From f88694cb37d531dc463f0d597da35f414137dfd8 Mon Sep 17 00:00:00 2001 From: Vojtech Miksu Date: Thu, 29 Feb 2024 21:37:15 -0700 Subject: [PATCH] Doc fixes (#5328) * Fix pre/code styling * Add StackBlitz buttons to each code example * Delete old .prettierrc * Reformat examples --- documentation-site/components/code.jsx | 11 +- documentation-site/components/example.jsx | 110 +++++++- documentation-site/components/exports.jsx | 2 +- documentation-site/components/json.jsx | 4 +- .../components/markdown-elements.jsx | 90 +++---- documentation-site/examples/.prettierrc | 14 - .../examples/accordion/basic.tsx | 6 +- .../examples/accordion/custom.tsx | 6 +- .../examples/accordion/renderpanelcontent.tsx | 6 +- .../examples/accordion/stateful-panel.tsx | 10 +- .../examples/accordion/stateless.tsx | 11 +- .../examples/accordion/title.tsx | 22 +- .../examples/app-nav-bar/basic.tsx | 62 +++-- .../examples/app-nav-bar/map-item-to-node.tsx | 22 +- .../app-nav-bar/unique-identifier.tsx | 20 +- .../examples/aspect-ratio-box/basic.tsx | 39 ++- .../examples/aspect-ratio-box/calendar.tsx | 17 +- .../examples/aspect-ratio-box/image.tsx | 7 +- documentation-site/examples/avatar/error.tsx | 28 +- .../examples/avatar/initials.tsx | 12 +- .../examples/avatar/override.tsx | 24 +- documentation-site/examples/avatar/sizes.tsx | 28 +- documentation-site/examples/badge/offset.tsx | 20 +- .../examples/badge/primary-inline.tsx | 4 +- .../examples/badge/secondary-inline.tsx | 11 +- documentation-site/examples/banner/action.tsx | 18 +- .../examples/banner/artwork.tsx | 12 +- .../examples/banner/variants.tsx | 8 +- documentation-site/examples/block/basic.tsx | 8 +- .../examples/block/override.tsx | 6 +- .../examples/block/responsive.tsx | 6 +- .../examples/bottom-navigation/overflow.tsx | 81 +++--- .../examples/breadcrumbs/basic.tsx | 6 +- .../examples/breadcrumbs/pseudo.tsx | 10 +- .../examples/button-dock/basic.tsx | 60 +++-- .../examples/button-group/basic.tsx | 6 +- .../examples/button-group/checkbox-mode.tsx | 6 +- .../examples/button-group/disabled-button.tsx | 6 +- .../examples/button-group/disabled.tsx | 6 +- .../examples/button-group/dropdown.tsx | 34 +-- .../examples/button-group/enhancer.tsx | 20 +- .../examples/button-group/icon.tsx | 8 +- .../examples/button-group/radio-mode.tsx | 6 +- .../button-group/stateful-checkbox.tsx | 8 +- .../examples/button-group/stateful-radio.tsx | 11 +- .../examples/button-group/wrappable.tsx | 8 +- .../examples/button-timed/paused.tsx | 29 +-- .../examples/button/as-an-anchor.tsx | 4 +- documentation-site/examples/button/basic.tsx | 8 +- .../examples/button/dropdown.tsx | 42 ++- documentation-site/examples/button/kinds.tsx | 6 +- documentation-site/examples/button/shapes.tsx | 6 +- documentation-site/examples/button/sizes.tsx | 8 +- documentation-site/examples/button/states.tsx | 8 +- .../examples/button/with-enhancers.tsx | 10 +- documentation-site/examples/card/basic.tsx | 10 +- .../examples/card/image-cta.tsx | 18 +- .../examples/card/thumbnail-cta.tsx | 21 +- .../examples/checkbox/alignment.tsx | 10 +- .../examples/checkbox/basic-controlled.tsx | 9 +- .../examples/checkbox/basic-uncontrolled.tsx | 10 +- .../examples/checkbox/component-overrides.tsx | 12 +- .../examples/checkbox/disabled.tsx | 4 +- .../examples/checkbox/error.tsx | 10 +- .../examples/checkbox/focus.tsx | 6 +- .../examples/checkbox/multiline.tsx | 22 +- .../examples/checkbox/overrides.tsx | 16 +- .../examples/checkbox/toggle.tsx | 9 +- .../examples/data-table/access-table-data.tsx | 58 ++--- .../examples/data-table/basic.tsx | 64 ++--- .../examples/data-table/batch-action.tsx | 140 ++++------ .../data-table/customized-column-sort.tsx | 83 +++--- .../data-table/customized-empty-state.tsx | 40 +-- .../data-table/row-height-line-clamp.tsx | 124 +++++---- .../examples/datepicker/basic.tsx | 6 +- .../calendar-multiple-months-with-label.tsx | 6 +- .../datepicker/calendar-multiple-months.tsx | 6 +- .../datepicker/calendar-time-select.tsx | 6 +- .../datepicker/composed-range-pickers.tsx | 38 +-- .../datepicker/composed-single-pickers.tsx | 22 +- .../datepicker/datepicker-with-timezone.tsx | 18 +- .../datepicker/datepickers-color-states.tsx | 36 +-- .../range-picker-with-separate-inputs.tsx | 8 +- .../datepicker/with-callback-overrides.tsx | 28 +- documentation-site/examples/divider/basic.tsx | 36 +-- .../examples/dnd-list/basic.tsx | 13 +- .../examples/dnd-list/customDragHandle.tsx | 25 +- .../examples/dnd-list/overrideLabel.tsx | 19 +- .../examples/dnd-list/overrides_short.tsx | 6 +- .../dnd-list/overrides_state_props.tsx | 12 +- .../examples/dnd-list/overrides_style.tsx | 10 +- .../examples/dnd-list/removable.tsx | 15 +- .../examples/dnd-list/varyingHeights.tsx | 14 +- .../examples/drawer/anchors.tsx | 27 +- documentation-site/examples/drawer/sizes.tsx | 25 +- .../examples/drawer/ssr-render-all.tsx | 17 +- .../examples/empty-state/empty-state.tsx | 14 +- .../examples/empty-state/loading.tsx | 12 +- .../examples/file-uploader/basic.tsx | 8 +- .../examples/file-uploader/disabled.tsx | 4 +- .../examples/file-uploader/error.tsx | 36 +-- .../file-uploader/indeterminate-progress.tsx | 8 +- .../examples/file-uploader/overrides.tsx | 8 +- .../badge-and-label-enhancers.tsx | 14 +- .../fixed-marker/badge-enhancer-text.tsx | 10 +- .../examples/fixed-marker/basic.tsx | 4 +- .../examples/fixed-marker/dragging.tsx | 10 +- .../fixed-marker/end-enhancer-color.tsx | 10 +- .../fixed-marker/react-map-gl-dragging.tsx | 10 +- .../examples/fixed-marker/react-map-gl.tsx | 10 +- .../fixed-marker/start-enhancer-large.tsx | 10 +- .../examples/fixed-marker/start-enhancer.tsx | 10 +- .../examples/fixed-marker/x-small.tsx | 4 +- .../examples/flex-grid/basic.tsx | 16 +- .../examples/flex-grid/missing.tsx | 16 +- .../examples/flex-grid/responsive.tsx | 16 +- .../examples/flex-grid/unequal-narrow.tsx | 20 +- .../examples/flex-grid/unequal-wide.tsx | 18 +- .../examples/floating-marker/basic.tsx | 4 +- .../large-square-anchor-start-enhancer.tsx | 10 +- .../floating-marker/large-top-right.tsx | 4 +- .../examples/floating-marker/react-map-gl.tsx | 10 +- .../floating-marker/secondary-label-color.tsx | 9 +- .../floating-marker/secondary-label.tsx | 7 +- .../floating-marker/small-no-anchor.tsx | 4 +- .../floating-marker/start-enhancer.tsx | 10 +- .../examples/floating-route-marker/basic.tsx | 4 +- .../changing-pointer-positions.tsx | 22 +- .../custom-color-overrides.tsx | 32 +-- .../floating-route-marker/react-map-gl.tsx | 30 +-- .../floating-route-marker/secondary-label.tsx | 11 +- .../start-end-enhancer.tsx | 12 +- .../examples/form-control/checkbox.tsx | 11 +- .../examples/form-control/input.tsx | 8 +- .../examples/form-control/kinds.tsx | 6 +- .../examples/form-control/radio-group.tsx | 13 +- .../examples/form-control/select.tsx | 20 +- .../examples/form-control/textarea.tsx | 8 +- .../examples/form-control/validation.tsx | 28 +- .../examples/getting-started/usage.tsx | 14 +- .../examples/header-navigation/basic.tsx | 8 +- .../header-navigation/with-search.tsx | 38 ++- .../examples/hint-dot/offset.tsx | 6 +- documentation-site/examples/icon/basic.tsx | 13 +- documentation-site/examples/icon/button.tsx | 12 +- documentation-site/examples/icon/list.tsx | 12 +- .../examples/input/available-states.tsx | 4 +- .../examples/input/basic-controlled.tsx | 6 +- .../examples/input/basic-uncontrolled.tsx | 6 +- .../examples/input/clearable.tsx | 6 +- .../examples/input/enhancers.tsx | 16 +- documentation-site/examples/input/focus.tsx | 16 +- documentation-site/examples/input/mask.tsx | 8 +- .../examples/input/overrides.tsx | 14 +- .../examples/input/password.tsx | 6 +- documentation-site/examples/input/sizes.tsx | 4 +- .../examples/input/with-select.tsx | 47 ++-- .../examples/input/with-tags.tsx | 32 ++- .../examples/internationalization/example.tsx | 12 +- documentation-site/examples/layer/basic.tsx | 44 ++-- .../examples/layout-grid/align.tsx | 20 +- .../examples/layout-grid/basic.tsx | 18 +- .../examples/layout-grid/behavior.tsx | 18 +- .../examples/layout-grid/compact.tsx | 18 +- .../examples/layout-grid/custom.tsx | 18 +- .../examples/layout-grid/hide.tsx | 18 +- .../examples/layout-grid/order.tsx | 18 +- .../examples/layout-grid/overrides.tsx | 38 +-- .../examples/layout-grid/responsive.tsx | 18 +- .../examples/layout-grid/skip-shrink.tsx | 18 +- .../examples/layout-grid/skip.tsx | 18 +- .../examples/layout-grid/span.tsx | 18 +- .../examples/layout-grid/unit.tsx | 24 +- .../examples/list/artwork-sizes.tsx | 30 +-- documentation-site/examples/list/basic.tsx | 16 +- .../examples/list/enhancers.tsx | 18 +- .../examples/list/menu-adapter.tsx | 28 +- documentation-site/examples/list/sublist.tsx | 28 +- .../examples/list/tap-target.tsx | 14 +- .../location-puck/consumer-confidence.tsx | 9 +- .../location-puck/consumer-no-heading.tsx | 9 +- .../examples/location-puck/consumer.tsx | 4 +- .../examples/location-puck/earner.tsx | 4 +- .../examples/location-puck/react-map-gl.tsx | 10 +- documentation-site/examples/menu/basic.tsx | 34 +-- .../examples/menu/child-render-all.tsx | 56 ++-- documentation-site/examples/menu/child.tsx | 66 ++--- documentation-site/examples/menu/compact.tsx | 34 +-- documentation-site/examples/menu/dividers.tsx | 30 +-- documentation-site/examples/menu/grouped.tsx | 22 +- documentation-site/examples/menu/href.tsx | 10 +- documentation-site/examples/menu/profile.tsx | 22 +- .../examples/menu/stateless.tsx | 32 +-- .../examples/menu/virtual-list.tsx | 22 +- .../examples/message-card/color.tsx | 37 ++- .../examples/message-card/custom-color.tsx | 11 +- .../examples/message-card/layout.tsx | 20 +- .../examples/message-card/positioning.tsx | 42 ++- .../examples/mobile-header/floating.tsx | 56 ++-- .../examples/mobile-header/text-content.tsx | 100 ++++---- .../examples/modal/autofocus.tsx | 18 +- documentation-site/examples/modal/basic.tsx | 11 +- .../modal/buried-interactive-element.tsx | 124 ++++----- documentation-site/examples/modal/nested.tsx | 30 +-- documentation-site/examples/modal/sized.tsx | 21 +- .../examples/notification-circle/inline.tsx | 7 +- .../examples/notification-circle/offset.tsx | 6 +- .../examples/notification/basic.tsx | 4 +- .../examples/notification/closeable.tsx | 8 +- .../examples/notification/custom-dismiss.tsx | 8 +- .../examples/notification/full-width.tsx | 6 +- .../examples/notification/kinds.tsx | 16 +- .../examples/notification/overrides.tsx | 12 +- .../examples/overrides/component.tsx | 4 +- .../examples/overrides/props.tsx | 6 +- .../examples/overrides/style-with-theme.tsx | 6 +- .../examples/overrides/style.tsx | 6 +- .../examples/page-control/overflow.tsx | 28 +- .../examples/pagination/controlled.tsx | 6 +- .../examples/pagination/labels.tsx | 10 +- .../examples/pagination/overrides.tsx | 42 +-- .../examples/pagination/uncontrolled.tsx | 4 +- .../examples/payment-card/controlled.tsx | 6 +- .../examples/payment-card/defaultvalue.tsx | 10 +- .../examples/payment-card/form.tsx | 40 ++- .../examples/payment-card/uncontrolled.tsx | 4 +- .../examples/phone-input/basic.tsx | 6 +- .../examples/phone-input/flag-overrides.tsx | 12 +- .../examples/phone-input/localized.tsx | 6 +- .../examples/phone-input/nested-overrides.tsx | 8 +- .../examples/phone-input/uncontrolled.tsx | 4 +- .../examples/pin-code/autofocus.tsx | 20 +- .../examples/pin-code/basic.tsx | 8 +- .../examples/pin-code/completion.tsx | 16 +- .../examples/pin-code/event.tsx | 8 +- .../examples/pin-code/id-and-name.tsx | 8 +- .../examples/pin-code/length.tsx | 8 +- documentation-site/examples/pin-code/mask.tsx | 12 +- .../examples/pin-code/no-tab.tsx | 8 +- .../examples/pin-code/override.tsx | 18 +- .../examples/pin-code/placeholder.tsx | 8 +- documentation-site/examples/pin-code/size.tsx | 18 +- .../examples/pin-code/stateful.tsx | 6 +- .../examples/pin-code/states.tsx | 16 +- .../examples/popover/clipping.tsx | 24 +- .../examples/popover/dismiss.tsx | 21 +- documentation-site/examples/popover/link.tsx | 16 +- .../examples/popover/overrides.tsx | 22 +- .../examples/popover/placements.tsx | 28 +- .../examples/popover/ref-handling.tsx | 39 ++- .../examples/popover/ssr-render-all.tsx | 14 +- .../examples/popover/stateful-click.tsx | 16 +- .../examples/popover/stateful-hover.tsx | 20 +- .../examples/popover/stateless.tsx | 18 +- .../examples/popover/with-arrow.tsx | 16 +- .../examples/progress-bar/basic.tsx | 4 +- .../examples/progress-bar/custom-label.tsx | 8 +- .../examples/progress-bar/negative.tsx | 6 +- .../examples/progress-bar/overrides.tsx | 18 +- .../examples/progress-bar/rounded.tsx | 8 +- .../examples/progress-bar/steps.tsx | 22 +- .../examples/progress-bar/with-label.tsx | 4 +- documentation-site/examples/radio/basic.tsx | 6 +- .../examples/radio/disabled.tsx | 4 +- documentation-site/examples/radio/error.tsx | 6 +- .../examples/radio/horizontal-align.tsx | 6 +- .../examples/radio/overrides.tsx | 18 +- .../examples/radio/stateful.tsx | 6 +- .../examples/rating/emoticon.tsx | 9 +- documentation-site/examples/rating/star.tsx | 11 +- .../examples/rating/starReadOnly.tsx | 6 +- .../examples/segmented-control/badge-hint.tsx | 8 +- .../examples/segmented-control/badge.tsx | 10 +- .../examples/segmented-control/basic.tsx | 8 +- .../examples/segmented-control/disabled.tsx | 8 +- .../examples/select/async-options.tsx | 122 +++++---- .../examples/select/control-ref-dropdown.tsx | 30 +-- .../select/control-ref-input-value.tsx | 23 +- .../examples/select/controlled.tsx | 18 +- .../examples/select/creatable-multi.tsx | 18 +- .../examples/select/creatable.tsx | 18 +- documentation-site/examples/select/focus.tsx | 28 +- .../examples/select/grouped.tsx | 20 +- .../examples/select/in-modal.tsx | 20 +- .../examples/select/overridden-dropdown.tsx | 20 +- .../examples/select/overridden-tag.tsx | 34 +-- .../examples/select/overridden.tsx | 18 +- .../examples/select/search-multi-pick.tsx | 18 +- .../examples/select/search-single-pick.tsx | 18 +- documentation-site/examples/select/sizes.tsx | 42 +-- .../examples/select/uncontrolled.tsx | 16 +- .../examples/select/with-many-options.tsx | 47 ++-- .../examples/side-navigation/basic.tsx | 36 +-- .../side-navigation/nav-overrides.tsx | 42 +-- .../examples/skeleton/animation.tsx | 4 +- .../examples/skeleton/auto-size-rows.tsx | 8 +- .../examples/skeleton/basic.tsx | 4 +- .../examples/skeleton/circle.tsx | 6 +- .../examples/skeleton/subElements.tsx | 8 +- documentation-site/examples/slider/basic.tsx | 8 +- .../examples/slider/disabled.tsx | 10 +- documentation-site/examples/slider/marks.tsx | 6 +- .../examples/slider/overrides.tsx | 44 ++-- documentation-site/examples/slider/range.tsx | 8 +- .../examples/slider/stateful.tsx | 4 +- .../examples/slider/step-min-max.tsx | 6 +- documentation-site/examples/spinner/basic.tsx | 4 +- documentation-site/examples/spinner/size.tsx | 4 +- documentation-site/examples/spinner/span.tsx | 4 +- documentation-site/examples/styled/basic.tsx | 21 +- .../examples/table-grid/basic.tsx | 20 +- .../examples/table-grid/cell-navigation.tsx | 121 ++++----- .../examples/table-grid/cell-span.tsx | 71 +++--- .../examples/table-grid/nested.tsx | 192 +++++++------- .../examples/table-semantic/alternating.tsx | 25 +- .../examples/table-semantic/basic.tsx | 12 +- .../examples/table-semantic/builder.tsx | 23 +- .../examples/table-semantic/cells.tsx | 79 +++--- .../examples/table-semantic/empty-message.tsx | 14 +- .../examples/table-semantic/scroll.tsx | 10 +- .../examples/table-semantic/sortable.tsx | 36 +-- .../examples/table-semantic/span.tsx | 28 +- .../examples/table-semantic/toggleable.tsx | 31 +-- documentation-site/examples/table/basic.tsx | 12 +- documentation-site/examples/table/cells.tsx | 240 +++++++++--------- documentation-site/examples/table/filter.tsx | 33 +-- .../examples/table/fixed-width-column.tsx | 86 ++----- .../examples/table/horizontal-scroll.tsx | 88 ++----- .../examples/table/pagination.tsx | 44 ++-- .../examples/table/vertical-scroll.tsx | 34 +-- .../table/virtual-horizontal-scroll.tsx | 50 ++-- documentation-site/examples/table/virtual.tsx | 50 ++-- .../examples/tabs-motion/alignment.tsx | 13 +- .../examples/tabs-motion/artwork.tsx | 8 +- .../examples/tabs-motion/basic.tsx | 6 +- .../examples/tabs-motion/disabled.tsx | 6 +- .../examples/tabs-motion/enhancer.tsx | 8 +- .../examples/tabs-motion/fixed.tsx | 6 +- .../tabs-motion/keyboard-activation.tsx | 6 +- .../examples/tabs-motion/keys.tsx | 9 +- .../examples/tabs-motion/refs.tsx | 10 +- .../examples/tabs-motion/renderAll.tsx | 6 +- .../examples/tabs-motion/stateful.tsx | 4 +- .../tabs-motion/vertical-orientation.tsx | 6 +- .../examples/tabs/custom-keys.tsx | 8 +- .../examples/tabs/overrides.tsx | 50 ++-- .../examples/tabs/renderall.tsx | 6 +- .../examples/tabs/uncontrolled.tsx | 6 +- documentation-site/examples/tabs/vertical.tsx | 6 +- documentation-site/examples/tag/basic.tsx | 4 +- .../examples/tag/clickable-non-closeable.tsx | 16 +- documentation-site/examples/tag/clickable.tsx | 16 +- .../examples/tag/custom-color.tsx | 4 +- documentation-site/examples/tag/disabled.tsx | 16 +- .../examples/tag/non-clickable.tsx | 4 +- .../examples/tag/non-closeable.tsx | 4 +- documentation-site/examples/tag/size.tsx | 4 +- documentation-site/examples/tag/variants.tsx | 4 +- .../examples/textarea/basic.tsx | 11 +- documentation-site/examples/textarea/ref.tsx | 8 +- .../examples/textarea/resizable.tsx | 6 +- .../examples/textarea/sizes.tsx | 12 +- .../examples/textarea/stateful.tsx | 6 +- .../examples/textarea/states.tsx | 8 +- .../examples/theme/icon-overrides.tsx | 10 +- documentation-site/examples/tile/action.tsx | 8 +- .../examples/tile/alignment.tsx | 6 +- .../examples/tile/multi-select-batch.tsx | 9 +- .../examples/tile/multi-select-live.tsx | 9 +- .../tile/selection-no-trailing-content.tsx | 9 +- .../examples/tile/single-select.tsx | 9 +- .../examples/timepicker/timepicker-minmax.tsx | 20 +- .../examples/timepicker/timepicker.tsx | 24 +- .../timezonepicker/timezone-picker.tsx | 10 +- .../toast/toast-close-from-outside.tsx | 12 +- .../examples/toast/toast-notification.tsx | 4 +- .../toast/toast-same-key-notification.tsx | 28 +- documentation-site/examples/tokens/basic.tsx | 8 +- .../tooltip/stateful-complex-content.tsx | 26 +- .../examples/tooltip/stateful.tsx | 18 +- .../examples/typography/display.tsx | 19 +- .../examples/typography/heading.tsx | 7 +- .../examples/typography/text.tsx | 9 +- .../examples/unstable-a11y/wrapper.tsx | 23 +- .../examples/use-styletron/overrides.tsx | 6 +- documentation-site/pages/components/menu.mdx | 6 +- package.json | 3 +- pnpm-lock.yaml | 82 +++--- 388 files changed, 3488 insertions(+), 4224 deletions(-) delete mode 100644 documentation-site/examples/.prettierrc diff --git a/documentation-site/components/code.jsx b/documentation-site/components/code.jsx index a067f23cf9..d54042306b 100644 --- a/documentation-site/components/code.jsx +++ b/documentation-site/components/code.jsx @@ -12,14 +12,15 @@ import { lightTheme } from "react-view"; import darkTheme from "./yard/dark-theme"; import CodeBox from "./code-box"; -const Code = ({ children, language }) => { +const Code = ({ children, language, content }) => { const [, theme] = useStyletron(); + const code = content || children.props.children; return ( {({ style, tokens, getLineProps, getTokenProps }) => ( @@ -38,8 +39,4 @@ const Code = ({ children, language }) => { ); }; -Code.defaultProps = { - language: "jsx", -}; - export default Code; diff --git a/documentation-site/components/example.jsx b/documentation-site/components/example.jsx index 224bbb817d..0f085e9665 100644 --- a/documentation-site/components/example.jsx +++ b/documentation-site/components/example.jsx @@ -12,6 +12,7 @@ import { Button, KIND, SIZE } from "baseui/button"; import { ButtonGroup } from "baseui/button-group"; import { Card } from "baseui/card"; import { Block } from "baseui/block"; +import sdk from "@stackblitz/sdk"; import Code from "./code"; import CodeIcon from "./code-icon"; @@ -20,7 +21,7 @@ import { H3 } from "./markdown-elements"; function Source(props) { if (!props.children || typeof props.children !== "string") return null; - return {props.children}; + return ; } function Example(props) { @@ -69,16 +70,103 @@ function Example(props) { {children} - + + + + {isOpen && ( diff --git a/documentation-site/components/exports.jsx b/documentation-site/components/exports.jsx index 4002b150e7..e211639c61 100644 --- a/documentation-site/components/exports.jsx +++ b/documentation-site/components/exports.jsx @@ -26,7 +26,7 @@ const Exports = (props) => {

{title}

You can import this module like so: - {code} + It exports the following components or utility functions: diff --git a/documentation-site/components/json.jsx b/documentation-site/components/json.jsx index 199b38e5cc..daf555ded8 100644 --- a/documentation-site/components/json.jsx +++ b/documentation-site/components/json.jsx @@ -8,6 +8,8 @@ LICENSE file in the root directory of this source tree. import * as React from "react"; import Code from "./code.jsx"; -const JSONViewer = (props) => {JSON.stringify(props.src, null, 2)}; +const JSONViewer = (props) => ( + +); export default JSONViewer; diff --git a/documentation-site/components/markdown-elements.jsx b/documentation-site/components/markdown-elements.jsx index 96902ecca8..5171b8a267 100644 --- a/documentation-site/components/markdown-elements.jsx +++ b/documentation-site/components/markdown-elements.jsx @@ -33,14 +33,9 @@ const getText = (children) => { return label; }; -export const cleanAnchor = (anchor) => - slugify(getText(anchor)); - -export const Heading = ({ - element, - fontType, - children, -}) => { +export const cleanAnchor = (anchor) => slugify(getText(anchor)); + +export const Heading = ({ element, fontType, children }) => { const [hoverRef, isHovered] = useHover(); const slug = cleanAnchor(children); return ( @@ -54,11 +49,7 @@ export const Heading = ({ > {children}{" "} - + ); @@ -76,29 +67,24 @@ export const Paragraph = (props) => ( ); -export const UnorderedList = (props) => ( -
    {props.children}
-); - -export const InlineCode = themedStyled( - "code", - ({ $theme }) => { - return { - ...$theme.typography.MonoParagraphMedium, - backgroundColor: "rgba(27, 31, 35, 0.05)", - borderTopLeftRadius: "3px", - borderTopRightRadius: "3px", - borderBottomRightRadius: "3px", - borderBottomLeftRadius: "3px", - fontSize: "85%", - marginLeft: 0, - marginRight: 0, - marginTop: 0, - marginBottom: 0, - padding: "0.2em 0.4em", - }; - } -); +export const UnorderedList = (props) =>
    {props.children}
; + +export const InlineCode = themedStyled("code", ({ $theme }) => { + return { + ...$theme.typography.MonoParagraphMedium, + backgroundColor: "rgba(27, 31, 35, 0.05)", + borderTopLeftRadius: "3px", + borderTopRightRadius: "3px", + borderBottomRightRadius: "3px", + borderBottomLeftRadius: "3px", + fontSize: "85%", + marginLeft: 0, + marginRight: 0, + marginTop: 0, + marginBottom: 0, + padding: "0.2em 0.4em", + }; +}); const Blockquote = themedStyled("blockquote", { backgroundColor: "rgba(27, 31, 35, 0.03)", @@ -116,8 +102,7 @@ const Blockquote = themedStyled("blockquote", { export const DocLink = ({ children, href }) => { const parts = href.split("#"); const internal = - (parts[0] === "" && parts[1] !== "") || - !href.includes("http"); + (parts[0] === "" && parts[1] !== "") || !href.includes("http"); if (internal) { return ( @@ -136,9 +121,7 @@ export const H1 = ({ children }) => ( - {process.env.NODE_ENV !== "production" - ? "[DEV] " - : ""} + {process.env.NODE_ENV !== "production" ? "[DEV] " : ""} Base Web - {children} @@ -149,11 +132,7 @@ export const H1 = ({ children }) => ( ); export const H2 = ({ children }) => ( - + {children} ); @@ -184,21 +163,14 @@ export const H6 = ({ children }) => ( export const Image = ({ alt, src, height, width }) => { if (height || width) { - return ( - {alt} - ); + return {alt}; } else { return {alt}; } }; export default { - code: Code, + pre: Code, h1: H1, h2: H2, h3: H3, @@ -209,11 +181,7 @@ export default { li: ListItem, p: Paragraph, ul: UnorderedList, - inlineCode: ({ children }) => ( - {children} - ), - blockquote: ({ children }) => ( -
{children}
- ), + code: InlineCode, + blockquote: ({ children }) =>
{children}
, a: DocLink, }; diff --git a/documentation-site/examples/.prettierrc b/documentation-site/examples/.prettierrc deleted file mode 100644 index ece7d6aaed..0000000000 --- a/documentation-site/examples/.prettierrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "singleQuote": true, - "bracketSpacing": false, - "trailingComma": "all", - "printWidth": 68, - "overrides": [ - { - "files": "*.js", - "options": { - "parser": "flow" - } - } - ] -} diff --git a/documentation-site/examples/accordion/basic.tsx b/documentation-site/examples/accordion/basic.tsx index 9febcf6cfd..434f46969b 100644 --- a/documentation-site/examples/accordion/basic.tsx +++ b/documentation-site/examples/accordion/basic.tsx @@ -1,8 +1,8 @@ -import * as React from 'react'; -import {Accordion, Panel} from 'baseui/accordion'; +import * as React from "react"; +import { Accordion, Panel } from "baseui/accordion"; const content = - 'Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris.'; + "Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris."; export default function Example() { return ( diff --git a/documentation-site/examples/accordion/custom.tsx b/documentation-site/examples/accordion/custom.tsx index b2b585a582..728567445b 100644 --- a/documentation-site/examples/accordion/custom.tsx +++ b/documentation-site/examples/accordion/custom.tsx @@ -1,9 +1,9 @@ -import * as React from 'react'; -import {Accordion, Panel} from 'baseui/accordion'; +import * as React from "react"; +import { Accordion, Panel } from "baseui/accordion"; export default function Example() { return ( - console.log(expanded)}> + console.log(expanded)}> Panel 1 opens correctly This is a custom panel component diff --git a/documentation-site/examples/accordion/renderpanelcontent.tsx b/documentation-site/examples/accordion/renderpanelcontent.tsx index 5794855786..76f137bfea 100644 --- a/documentation-site/examples/accordion/renderpanelcontent.tsx +++ b/documentation-site/examples/accordion/renderpanelcontent.tsx @@ -1,8 +1,8 @@ -import * as React from 'react'; -import {Accordion, Panel} from 'baseui/accordion'; +import * as React from "react"; +import { Accordion, Panel } from "baseui/accordion"; const content = - 'Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris.'; + "Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris."; export default function Example() { return ( diff --git a/documentation-site/examples/accordion/stateful-panel.tsx b/documentation-site/examples/accordion/stateful-panel.tsx index 2bbb085b9d..1de0005fea 100644 --- a/documentation-site/examples/accordion/stateful-panel.tsx +++ b/documentation-site/examples/accordion/stateful-panel.tsx @@ -1,15 +1,13 @@ -import * as React from 'react'; -import {StatefulPanel} from 'baseui/accordion'; +import * as React from "react"; +import { StatefulPanel } from "baseui/accordion"; const content = - 'Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris.'; + "Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris."; export default function Example() { return (
    - - {content} - + {content}
); } diff --git a/documentation-site/examples/accordion/stateless.tsx b/documentation-site/examples/accordion/stateless.tsx index 7d1aeee620..78ef2d23a8 100644 --- a/documentation-site/examples/accordion/stateless.tsx +++ b/documentation-site/examples/accordion/stateless.tsx @@ -1,15 +1,12 @@ -import * as React from 'react'; -import {StatelessAccordion, Panel} from 'baseui/accordion'; +import * as React from "react"; +import { StatelessAccordion, Panel } from "baseui/accordion"; export default function Example() { - const [expanded, setExpanded] = React.useState([ - 'P1', - 'P2', - ]); + const [expanded, setExpanded] = React.useState(["P1", "P2"]); return ( { + onChange={({ key, expanded }) => { console.log(key); setExpanded(expanded); }} diff --git a/documentation-site/examples/accordion/title.tsx b/documentation-site/examples/accordion/title.tsx index 01ee4f3d81..7d8a753297 100644 --- a/documentation-site/examples/accordion/title.tsx +++ b/documentation-site/examples/accordion/title.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; -import {useStyletron} from 'baseui'; -import {Accordion, Panel} from 'baseui/accordion'; -import {ArrowUp} from 'baseui/icon'; +import * as React from "react"; +import { useStyletron } from "baseui"; +import { Accordion, Panel } from "baseui/accordion"; +import { ArrowUp } from "baseui/icon"; const content = - 'Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris.'; + "Praesent condimentum ante ac ipsum aliquam, ac scelerisque velit sagittis. Ut sit amet libero scelerisque, accumsan ante vitae, hendrerit tellus. Nullam metus est, vehicula a aliquet id, lobortis in mauris."; export default function Example() { const [css] = useStyletron(); @@ -12,9 +12,7 @@ export default function Example() { +
Custom Title 1
@@ -25,9 +23,7 @@ export default function Example() { +
Custom Title 2
@@ -38,9 +34,7 @@ export default function Example() { +
Custom Title 2
diff --git a/documentation-site/examples/app-nav-bar/basic.tsx b/documentation-site/examples/app-nav-bar/basic.tsx index 1e64e425f1..28ac46c3d1 100644 --- a/documentation-site/examples/app-nav-bar/basic.tsx +++ b/documentation-site/examples/app-nav-bar/basic.tsx @@ -1,53 +1,49 @@ -import * as React from 'react'; -import {useStyletron} from 'baseui'; -import {Button} from 'baseui/button'; -import {Layer} from 'baseui/layer'; -import {ChevronDown, Delete, Overflow, Upload} from 'baseui/icon'; -import { - AppNavBar, - setItemActive, - NavItem, -} from 'baseui/app-nav-bar'; +import * as React from "react"; +import { useStyletron } from "baseui"; +import { Button } from "baseui/button"; +import { Layer } from "baseui/layer"; +import { ChevronDown, Delete, Overflow, Upload } from "baseui/icon"; +import { AppNavBar, setItemActive, NavItem } from "baseui/app-nav-bar"; export default function Example() { const [css] = useStyletron(); const [mainItems, setMainItems] = React.useState([ - {icon: Upload, label: 'Primary A'}, - {icon: Upload, label: 'Primary B'}, + { icon: Upload, label: "Primary A" }, + { icon: Upload, label: "Primary B" }, { icon: ChevronDown, - label: 'Primary C', + label: "Primary C", navExitIcon: Delete, children: [ - {icon: Upload, label: 'Secondary A'}, - {icon: Upload, label: 'Secondary B'}, - {icon: Upload, label: 'Secondary C'}, - {icon: Upload, label: 'Secondary D'}, + { icon: Upload, label: "Secondary A" }, + { icon: Upload, label: "Secondary B" }, + { icon: Upload, label: "Secondary C" }, + { icon: Upload, label: "Secondary D" }, ], }, { icon: ChevronDown, - label: 'Primary D', + label: "Primary D", navExitIcon: Delete, children: [ { icon: ChevronDown, - label: 'Secondary E', + label: "Secondary E", children: [ - {icon: Upload, label: 'Tertiary A'}, - {icon: Upload, label: 'Tertiary B'}, + { icon: Upload, label: "Tertiary A" }, + { icon: Upload, label: "Tertiary B" }, ], }, - {icon: Upload, label: 'Secondary F'}, + { icon: Upload, label: "Secondary F" }, ], }, ]); const userItems = [ - {icon: Overflow, label: 'Account item1'}, - {icon: Overflow, label: 'Account item2'}, - {icon: Overflow, label: 'Account item3'}, - {icon: Overflow, label: 'Account item4'}, + { icon: Overflow, label: "Account item1" }, + { icon: Overflow, label: "Account item2" }, + { icon: Overflow, label: "Account item3" }, + { icon: Overflow, label: "Account item4" }, ]; const [isNavVisible, setIsNavVisible] = React.useState(false); @@ -59,17 +55,17 @@ export default function Example() { return ( {isNavVisible && (
console.log('user', item)} + onUserItemSelect={(item) => console.log("user", item)} username="Umka Marshmallow" usernameSubtitle="5.0" userImgUrl="" diff --git a/documentation-site/examples/app-nav-bar/map-item-to-node.tsx b/documentation-site/examples/app-nav-bar/map-item-to-node.tsx index 806dcc51f8..7f6fcc36b3 100644 --- a/documentation-site/examples/app-nav-bar/map-item-to-node.tsx +++ b/documentation-site/examples/app-nav-bar/map-item-to-node.tsx @@ -1,23 +1,19 @@ -import * as React from 'react'; +import * as React from "react"; -import {useStyletron} from 'baseui'; -import { - AppNavBar, - setItemActive, - NavItem, -} from 'baseui/app-nav-bar'; +import { useStyletron } from "baseui"; +import { AppNavBar, setItemActive, NavItem } from "baseui/app-nav-bar"; export default function Example() { const [css] = useStyletron(); const [mainItems, setMainItems] = React.useState([ - {label: 'main one', info: {color: 'blue'}}, - {label: 'main two', info: {color: 'red'}}, + { label: "main one", info: { color: "blue" } }, + { label: "main two", info: { color: "red" } }, ]); const userItems = [ - {label: 'user one', info: {color: 'green'}}, - {label: 'user two', info: {color: 'yellow'}}, + { label: "user one", info: { color: "green" } }, + { label: "user two", info: { color: "yellow" } }, ]; function handleMainItemSelect(item: NavItem) { @@ -32,9 +28,7 @@ export default function Example() { mapItemToNode={(item) => (
{item.info ? `color: ${item.info.color}` : item.label} diff --git a/documentation-site/examples/app-nav-bar/unique-identifier.tsx b/documentation-site/examples/app-nav-bar/unique-identifier.tsx index 45cebf18d0..d6b45801e6 100644 --- a/documentation-site/examples/app-nav-bar/unique-identifier.tsx +++ b/documentation-site/examples/app-nav-bar/unique-identifier.tsx @@ -1,17 +1,13 @@ -import * as React from 'react'; +import * as React from "react"; -import { - AppNavBar, - setItemActive, - NavItem, -} from 'baseui/app-nav-bar'; +import { AppNavBar, setItemActive, NavItem } from "baseui/app-nav-bar"; export default function Example() { const [mainItems, setMainItems] = React.useState([ - {label: 'label', info: {id: 1}}, - {label: 'label', info: {id: 2}}, - {label: 'label', info: {id: 3}}, - {label: 'label', info: {id: 4}}, + { label: "label", info: { id: 1 } }, + { label: "label", info: { id: 2 } }, + { label: "label", info: { id: 3 } }, + { label: "label", info: { id: 4 } }, ]); function getUniqueIdentifier(item: NavItem) { @@ -22,9 +18,7 @@ export default function Example() { } function handleMainItemSelect(item: NavItem) { - setMainItems((prev) => - setItemActive(prev, item, getUniqueIdentifier), - ); + setMainItems((prev) => setItemActive(prev, item, getUniqueIdentifier)); } return ( diff --git a/documentation-site/examples/aspect-ratio-box/basic.tsx b/documentation-site/examples/aspect-ratio-box/basic.tsx index fe483a312b..137d7413a3 100644 --- a/documentation-site/examples/aspect-ratio-box/basic.tsx +++ b/documentation-site/examples/aspect-ratio-box/basic.tsx @@ -1,8 +1,5 @@ -import * as React from 'react'; -import { - AspectRatioBox, - AspectRatioBoxBody, -} from 'baseui/aspect-ratio-box'; +import * as React from "react"; +import { AspectRatioBox, AspectRatioBoxBody } from "baseui/aspect-ratio-box"; export default function Example() { return ( @@ -15,14 +12,14 @@ export default function Example() { overrides={{ Block: { style: { - borderLeftStyle: 'solid', - borderRightStyle: 'solid', - borderTopStyle: 'solid', - borderBottomStyle: 'solid', - borderLeftWidth: '2px', - borderTopWidth: '2px', - borderRightWidth: '2px', - borderBottomWidth: '2px', + borderLeftStyle: "solid", + borderRightStyle: "solid", + borderTopStyle: "solid", + borderBottomStyle: "solid", + borderLeftWidth: "2px", + borderTopWidth: "2px", + borderRightWidth: "2px", + borderBottomWidth: "2px", borderLeftColor: `grey`, borderTopColor: `grey`, borderRightColor: `grey`, @@ -42,14 +39,14 @@ export default function Example() { overrides={{ Block: { style: { - borderLeftStyle: 'solid', - borderRightStyle: 'solid', - borderTopStyle: 'solid', - borderBottomStyle: 'solid', - borderLeftWidth: '2px', - borderTopWidth: '2px', - borderRightWidth: '2px', - borderBottomWidth: '2px', + borderLeftStyle: "solid", + borderRightStyle: "solid", + borderTopStyle: "solid", + borderBottomStyle: "solid", + borderLeftWidth: "2px", + borderTopWidth: "2px", + borderRightWidth: "2px", + borderBottomWidth: "2px", borderLeftColor: `grey`, borderTopColor: `grey`, borderRightColor: `grey`, diff --git a/documentation-site/examples/aspect-ratio-box/calendar.tsx b/documentation-site/examples/aspect-ratio-box/calendar.tsx index 5871f6ddc2..e7273eeaff 100644 --- a/documentation-site/examples/aspect-ratio-box/calendar.tsx +++ b/documentation-site/examples/aspect-ratio-box/calendar.tsx @@ -1,12 +1,9 @@ -import * as React from 'react'; -import { - AspectRatioBox, - AspectRatioBoxBody, -} from 'baseui/aspect-ratio-box'; -import {Button, KIND} from 'baseui/button'; -import {useStyletron} from 'baseui'; +import * as React from "react"; +import { AspectRatioBox, AspectRatioBoxBody } from "baseui/aspect-ratio-box"; +import { Button, KIND } from "baseui/button"; +import { useStyletron } from "baseui"; -const CalendarButton = (props: {children: React.ReactNode}) => ( +const CalendarButton = (props: { children: React.ReactNode }) => ( } - dismissiveAction={ - - } + dismissiveAction={} secondaryActions={[ diff --git a/documentation-site/examples/button-group/enhancer.tsx b/documentation-site/examples/button-group/enhancer.tsx index cca03f2cb9..54393c9c66 100644 --- a/documentation-site/examples/button-group/enhancer.tsx +++ b/documentation-site/examples/button-group/enhancer.tsx @@ -1,20 +1,14 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {ButtonGroup} from 'baseui/button-group'; -import {Upload} from 'baseui/icon'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { ButtonGroup } from "baseui/button-group"; +import { Upload } from "baseui/icon"; export default function Example() { return ( - - - + + + ); } diff --git a/documentation-site/examples/button-group/icon.tsx b/documentation-site/examples/button-group/icon.tsx index 66bcd2ea62..db487f7c73 100644 --- a/documentation-site/examples/button-group/icon.tsx +++ b/documentation-site/examples/button-group/icon.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {ButtonGroup} from 'baseui/button-group'; -import {Upload} from 'baseui/icon'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { ButtonGroup } from "baseui/button-group"; +import { Upload } from "baseui/icon"; export default function Example() { return ( diff --git a/documentation-site/examples/button-group/radio-mode.tsx b/documentation-site/examples/button-group/radio-mode.tsx index 741a771572..05a08b2645 100644 --- a/documentation-site/examples/button-group/radio-mode.tsx +++ b/documentation-site/examples/button-group/radio-mode.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {ButtonGroup, MODE} from 'baseui/button-group'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { ButtonGroup, MODE } from "baseui/button-group"; export default function Example() { const [selected, setSelected] = React.useState(-1); diff --git a/documentation-site/examples/button-group/stateful-checkbox.tsx b/documentation-site/examples/button-group/stateful-checkbox.tsx index 0e20e477c1..7ccb0ac13c 100644 --- a/documentation-site/examples/button-group/stateful-checkbox.tsx +++ b/documentation-site/examples/button-group/stateful-checkbox.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {StatefulButtonGroup, MODE} from 'baseui/button-group'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { StatefulButtonGroup, MODE } from "baseui/button-group"; export default function Example() { return ( diff --git a/documentation-site/examples/button-group/stateful-radio.tsx b/documentation-site/examples/button-group/stateful-radio.tsx index 51c5ee3f8a..5780f9042f 100644 --- a/documentation-site/examples/button-group/stateful-radio.tsx +++ b/documentation-site/examples/button-group/stateful-radio.tsx @@ -1,13 +1,10 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {StatefulButtonGroup, MODE} from 'baseui/button-group'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { StatefulButtonGroup, MODE } from "baseui/button-group"; export default function Example() { return ( - + diff --git a/documentation-site/examples/button-group/wrappable.tsx b/documentation-site/examples/button-group/wrappable.tsx index 3ca6262695..c3d8f754cb 100644 --- a/documentation-site/examples/button-group/wrappable.tsx +++ b/documentation-site/examples/button-group/wrappable.tsx @@ -1,13 +1,13 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {ButtonGroup} from 'baseui/button-group'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { ButtonGroup } from "baseui/button-group"; export default function Example() { return ( diff --git a/documentation-site/examples/button-timed/paused.tsx b/documentation-site/examples/button-timed/paused.tsx index c2a16a8eb4..0cb179fffe 100644 --- a/documentation-site/examples/button-timed/paused.tsx +++ b/documentation-site/examples/button-timed/paused.tsx @@ -4,10 +4,10 @@ Copyright (c) Uber Technologies, Inc. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ -import * as React from 'react'; +import * as React from "react"; -import {ButtonTimed} from 'baseui/button-timed'; -import {Button, KIND} from 'baseui/button'; +import { ButtonTimed } from "baseui/button-timed"; +import { Button, KIND } from "baseui/button"; export default function Example() { const [finished1, setFinished1] = React.useState(false); @@ -19,11 +19,8 @@ export default function Example() { return (
-
@@ -35,9 +32,7 @@ export default function Example() { Countdown {finished1 && ( - - Time! - + Time! )}
@@ -50,9 +45,7 @@ export default function Example() { Countdown {finished2 && ( - - Time! - + Time! )}
@@ -65,9 +58,7 @@ export default function Example() { Countdown {finished3 && ( - - Time! - + Time! )}
@@ -80,9 +71,7 @@ export default function Example() { Countdown {finished4 && ( - - Time! - + Time! )}
diff --git a/documentation-site/examples/button/as-an-anchor.tsx b/documentation-site/examples/button/as-an-anchor.tsx index c9c8d98a36..22ec13dd30 100644 --- a/documentation-site/examples/button/as-an-anchor.tsx +++ b/documentation-site/examples/button/as-an-anchor.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; +import * as React from "react"; +import { Button } from "baseui/button"; export default function Example() { return ( diff --git a/documentation-site/examples/button/basic.tsx b/documentation-site/examples/button/basic.tsx index 0f4cf00739..2812532c72 100644 --- a/documentation-site/examples/button/basic.tsx +++ b/documentation-site/examples/button/basic.tsx @@ -1,8 +1,6 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; +import * as React from "react"; +import { Button } from "baseui/button"; export default function Example() { - return ( - - ); + return ; } diff --git a/documentation-site/examples/button/dropdown.tsx b/documentation-site/examples/button/dropdown.tsx index 8bd9a96559..94c46b6b8c 100644 --- a/documentation-site/examples/button/dropdown.tsx +++ b/documentation-site/examples/button/dropdown.tsx @@ -1,22 +1,22 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {ChevronDown} from 'baseui/icon'; -import {StatefulPopover, PLACEMENT} from 'baseui/popover'; -import {StatefulMenu} from 'baseui/menu'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { ChevronDown } from "baseui/icon"; +import { StatefulPopover, PLACEMENT } from "baseui/popover"; +import { StatefulMenu } from "baseui/menu"; const ITEMS = [ - {label: 'Item One'}, - {label: 'Item Two'}, - {label: 'Item Three'}, - {label: 'Item Four'}, - {label: 'Item Five'}, - {label: 'Item Six'}, - {label: 'Item Seven'}, - {label: 'Item Eight'}, - {label: 'Item Nine'}, - {label: 'Item Ten'}, - {label: 'Item Eleven'}, - {label: 'Item Twelve'}, + { label: "Item One" }, + { label: "Item Two" }, + { label: "Item Three" }, + { label: "Item Four" }, + { label: "Item Five" }, + { label: "Item Six" }, + { label: "Item Seven" }, + { label: "Item Eight" }, + { label: "Item Nine" }, + { label: "Item Ten" }, + { label: "Item Eleven" }, + { label: "Item Twelve" }, ]; export default function Example() { @@ -24,19 +24,17 @@ export default function Example() { ( + content={({ close }) => ( close()} overrides={{ - List: {style: {height: '150px', width: '138px'}}, + List: { style: { height: "150px", width: "138px" } }, }} /> )} > - + ); } diff --git a/documentation-site/examples/button/kinds.tsx b/documentation-site/examples/button/kinds.tsx index 1ab3186966..7c4612685a 100644 --- a/documentation-site/examples/button/kinds.tsx +++ b/documentation-site/examples/button/kinds.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Block} from 'baseui/block'; -import {Button, KIND} from 'baseui/button'; +import * as React from "react"; +import { Block } from "baseui/block"; +import { Button, KIND } from "baseui/button"; export default function Example() { return ( diff --git a/documentation-site/examples/button/shapes.tsx b/documentation-site/examples/button/shapes.tsx index 9ca31d16ef..7a40bd381d 100644 --- a/documentation-site/examples/button/shapes.tsx +++ b/documentation-site/examples/button/shapes.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Button, SHAPE} from 'baseui/button'; -import {Upload} from 'baseui/icon'; +import * as React from "react"; +import { Button, SHAPE } from "baseui/button"; +import { Upload } from "baseui/icon"; export default function Example() { return ( diff --git a/documentation-site/examples/button/sizes.tsx b/documentation-site/examples/button/sizes.tsx index 98b5f6774d..5b8ef72a37 100644 --- a/documentation-site/examples/button/sizes.tsx +++ b/documentation-site/examples/button/sizes.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; -import {useStyletron} from 'baseui'; -import {Button, SIZE} from 'baseui/button'; +import * as React from "react"; +import { useStyletron } from "baseui"; +import { Button, SIZE } from "baseui/button"; export default function Example() { const [css, theme] = useStyletron(); - const space = css({marginBottom: theme.sizing.scale300}); + const space = css({ marginBottom: theme.sizing.scale300 }); return ( diff --git a/documentation-site/examples/button/states.tsx b/documentation-site/examples/button/states.tsx index dae1e66ebf..a4ac06bfdf 100644 --- a/documentation-site/examples/button/states.tsx +++ b/documentation-site/examples/button/states.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {useStyletron} from 'baseui'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { useStyletron } from "baseui"; export default function Example() { const [css, theme] = useStyletron(); - const space = css({marginLeft: theme.sizing.scale300}); + const space = css({ marginLeft: theme.sizing.scale300 }); return ( diff --git a/documentation-site/examples/button/with-enhancers.tsx b/documentation-site/examples/button/with-enhancers.tsx index 5c1a612d45..c309c18377 100644 --- a/documentation-site/examples/button/with-enhancers.tsx +++ b/documentation-site/examples/button/with-enhancers.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Button} from 'baseui/button'; -import {Upload, ArrowRight} from 'baseui/icon'; +import * as React from "react"; +import { Button } from "baseui/button"; +import { Upload, ArrowRight } from "baseui/icon"; export default function Example() { return ( @@ -11,9 +11,7 @@ export default function Example() {

- +

); diff --git a/documentation-site/examples/card/basic.tsx b/documentation-site/examples/card/basic.tsx index be9c9ae3ee..9c403f44b8 100644 --- a/documentation-site/examples/card/basic.tsx +++ b/documentation-site/examples/card/basic.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; -import {Card, StyledBody} from 'baseui/card'; +import * as React from "react"; +import { Card, StyledBody } from "baseui/card"; export default function Example() { return ( - + - Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla - ornare faucibus ex, non facilisis nisl. + Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla ornare + faucibus ex, non facilisis nisl. ); diff --git a/documentation-site/examples/card/image-cta.tsx b/documentation-site/examples/card/image-cta.tsx index e7697db78a..3ccdc15aad 100644 --- a/documentation-site/examples/card/image-cta.tsx +++ b/documentation-site/examples/card/image-cta.tsx @@ -1,22 +1,20 @@ -import * as React from 'react'; -import {Card, StyledBody, StyledAction} from 'baseui/card'; -import {Button} from 'baseui/button'; +import * as React from "react"; +import { Card, StyledBody, StyledAction } from "baseui/card"; +import { Button } from "baseui/button"; export default function Example() { return ( - Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla - ornare faucibus ex, non facilisis nisl. + Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla ornare + faucibus ex, non facilisis nisl. - diff --git a/documentation-site/examples/card/thumbnail-cta.tsx b/documentation-site/examples/card/thumbnail-cta.tsx index 36f108e1cc..9a787999eb 100644 --- a/documentation-site/examples/card/thumbnail-cta.tsx +++ b/documentation-site/examples/card/thumbnail-cta.tsx @@ -1,27 +1,22 @@ -import * as React from 'react'; -import { - Card, - StyledBody, - StyledAction, - StyledThumbnail, -} from 'baseui/card'; -import {Button} from 'baseui/button'; +import * as React from "react"; +import { Card, StyledBody, StyledAction, StyledThumbnail } from "baseui/card"; +import { Button } from "baseui/button"; export default function Example() { return ( - Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla - ornare faucibus ex, non facilisis nisl. + Proin ut dui sed metus pharetra hend rerit vel non mi. Nulla ornare + faucibus ex, non facilisis nisl. - diff --git a/documentation-site/examples/checkbox/alignment.tsx b/documentation-site/examples/checkbox/alignment.tsx index e4246b20c4..4b0d00ef0d 100644 --- a/documentation-site/examples/checkbox/alignment.tsx +++ b/documentation-site/examples/checkbox/alignment.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; -import {Checkbox} from 'baseui/checkbox'; +import * as React from "react"; +import { Checkbox } from "baseui/checkbox"; export default function Example() { const [checkboxes, setCheckboxes] = React.useState([ @@ -23,9 +23,9 @@ export default function Example() {
setChecked(!checked)} - > + setChecked(!checked)}> click me ); diff --git a/documentation-site/examples/checkbox/basic-uncontrolled.tsx b/documentation-site/examples/checkbox/basic-uncontrolled.tsx index 71162439be..bab7e65685 100644 --- a/documentation-site/examples/checkbox/basic-uncontrolled.tsx +++ b/documentation-site/examples/checkbox/basic-uncontrolled.tsx @@ -1,10 +1,6 @@ -import * as React from 'react'; -import {StatefulCheckbox} from 'baseui/checkbox'; +import * as React from "react"; +import { StatefulCheckbox } from "baseui/checkbox"; export default function Example() { - return ( - - click me - - ); + return click me; } diff --git a/documentation-site/examples/checkbox/component-overrides.tsx b/documentation-site/examples/checkbox/component-overrides.tsx index 0b15876c32..ac8ee0f9bb 100644 --- a/documentation-site/examples/checkbox/component-overrides.tsx +++ b/documentation-site/examples/checkbox/component-overrides.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {useStyletron} from 'baseui'; -import {StatefulCheckbox} from 'baseui/checkbox'; -import {Alert} from 'baseui/icon'; +import * as React from "react"; +import { useStyletron } from "baseui"; +import { StatefulCheckbox } from "baseui/checkbox"; +import { Alert } from "baseui/icon"; export default function Example() { const [css, theme] = useStyletron(); @@ -15,8 +15,8 @@ export default function Example() { color: props.checked ? theme.colors.primary : theme.colors.mono700, - marginTop: '3px', - marginRight: '3px', + marginTop: "3px", + marginRight: "3px", })} > diff --git a/documentation-site/examples/checkbox/disabled.tsx b/documentation-site/examples/checkbox/disabled.tsx index 834ae1852a..c71d6ab77f 100644 --- a/documentation-site/examples/checkbox/disabled.tsx +++ b/documentation-site/examples/checkbox/disabled.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; -import {Checkbox} from 'baseui/checkbox'; +import * as React from "react"; +import { Checkbox } from "baseui/checkbox"; export default function Example() { return ( diff --git a/documentation-site/examples/checkbox/error.tsx b/documentation-site/examples/checkbox/error.tsx index 14f108c34b..ff53ab5cb9 100644 --- a/documentation-site/examples/checkbox/error.tsx +++ b/documentation-site/examples/checkbox/error.tsx @@ -1,14 +1,10 @@ -import * as React from 'react'; -import {Checkbox} from 'baseui/checkbox'; +import * as React from "react"; +import { Checkbox } from "baseui/checkbox"; export default function Example() { const [checked, setChecked] = React.useState(true); return ( - setChecked(!checked)} - error - > + setChecked(!checked)} error> Checkbox with an error ); diff --git a/documentation-site/examples/checkbox/focus.tsx b/documentation-site/examples/checkbox/focus.tsx index 85fe1c1d3a..bc5c57a433 100644 --- a/documentation-site/examples/checkbox/focus.tsx +++ b/documentation-site/examples/checkbox/focus.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Button, SIZE} from 'baseui/button'; -import {Checkbox} from 'baseui/checkbox'; +import * as React from "react"; +import { Button, SIZE } from "baseui/button"; +import { Checkbox } from "baseui/checkbox"; export default function Example() { const [checked, setChecked] = React.useState(true); diff --git a/documentation-site/examples/checkbox/multiline.tsx b/documentation-site/examples/checkbox/multiline.tsx index 9db7e6f1b2..6af22a2d0f 100644 --- a/documentation-site/examples/checkbox/multiline.tsx +++ b/documentation-site/examples/checkbox/multiline.tsx @@ -1,20 +1,16 @@ -import * as React from 'react'; -import {Checkbox} from 'baseui/checkbox'; +import * as React from "react"; +import { Checkbox } from "baseui/checkbox"; export default function Example() { const [checked, setChecked] = React.useState(true); return ( - setChecked(!checked)} - > - It started as a simple idea: What if you could request a ride - from your phone? More than 5 billion trips later, we’re - working to make transportation safer and more accessible, - helping people order food quickly and affordably, reducing - congestion in cities by getting more people into fewer cars, - and creating opportunities for people to work on their own - terms. + setChecked(!checked)}> + It started as a simple idea: What if you could request a ride from your + phone? More than 5 billion trips later, we’re working to make + transportation safer and more accessible, helping people order food + quickly and affordably, reducing congestion in cities by getting more + people into fewer cars, and creating opportunities for people to work on + their own terms. ); } diff --git a/documentation-site/examples/checkbox/overrides.tsx b/documentation-site/examples/checkbox/overrides.tsx index 5052f28192..11ebde9cb9 100644 --- a/documentation-site/examples/checkbox/overrides.tsx +++ b/documentation-site/examples/checkbox/overrides.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {Checkbox} from 'baseui/checkbox'; -import {expandBorderStyles} from 'baseui/styles'; +import * as React from "react"; +import { Checkbox } from "baseui/checkbox"; +import { expandBorderStyles } from "baseui/styles"; export default function Example() { const [checked, setChecked] = React.useState(true); @@ -10,24 +10,22 @@ export default function Example() { onChange={() => setChecked(!checked)} overrides={{ Root: { - style: ({$theme}) => ({ + style: ({ $theme }) => ({ ...expandBorderStyles($theme.borders.border300), }), }, Label: { - style: ({$theme}) => ({ + style: ({ $theme }) => ({ color: $theme.colors.warning, }), }, Checkmark: { - style: ({$checked, $theme}) => ({ + style: ({ $checked, $theme }) => ({ borderLeftColor: $theme.colors.warning, borderRightColor: $theme.colors.warning, borderTopColor: $theme.colors.warning, borderBottomColor: $theme.colors.warning, - backgroundColor: $checked - ? $theme.colors.warning - : null, + backgroundColor: $checked ? $theme.colors.warning : null, }), }, }} diff --git a/documentation-site/examples/checkbox/toggle.tsx b/documentation-site/examples/checkbox/toggle.tsx index c8678f5807..279b2828cd 100644 --- a/documentation-site/examples/checkbox/toggle.tsx +++ b/documentation-site/examples/checkbox/toggle.tsx @@ -1,11 +1,8 @@ -import * as React from 'react'; -import {Checkbox, STYLE_TYPE} from 'baseui/checkbox'; +import * as React from "react"; +import { Checkbox, STYLE_TYPE } from "baseui/checkbox"; export default function Example() { - const [checkboxes, setCheckboxes] = React.useState([ - false, - false, - ]); + const [checkboxes, setCheckboxes] = React.useState([false, false]); return ( data[0], }), CategoricalColumn({ - title: 'color', + title: "color", mapDataToValue: (data: RowData) => data[1], }), NumericalColumn({ - title: 'number', + title: "number", mapDataToValue: (data: RowData) => data[2], }), StringColumn({ - title: 'description', + title: "description", mapDataToValue: (data: RowData) => data[3], }), ]; const rows = [ - {id: 1, data: [true, 'green', 2, 'bright']}, - {id: 2, data: [false, 'blue', 1, 'glossy']}, - {id: 3, data: [true, 'black', 4, 'dry']}, - {id: 4, data: [false, 'pink', 3, 'brittle']}, - {id: 5, data: [false, 'blue', 5, 'big']}, - {id: 6, data: [true, 'pink', 6, 'spicey']}, - {id: 7, data: [false, 'blue', 3, 'mild']}, - {id: 8, data: [false, 'blue', 3, 'pointy']}, - {id: 9, data: [true, 'blue', 3, 'soft']}, - {id: 10, data: [false, 'pink', 1, 'worn']}, - {id: 11, data: [true, 'blue', 1, 'brittle']}, - {id: 12, data: [true, 'blue', 3, 'glossy']}, - {id: 13, data: [false, 'purple', 3, 'big']}, - {id: 14, data: [false, 'blue', 1, 'worn']}, - {id: 15, data: [false, 'blue', 3, 'dry']}, - {id: 16, data: [false, 'orange', 5, 'spicey']}, - {id: 17, data: [false, 'orange', 7, 'big']}, - {id: 18, data: [false, 'blue', 8, 'glossy']}, - {id: 19, data: [false, 'magenta', 4, 'brittle']}, - {id: 20, data: [true, 'blue', 3, 'dry']}, + { id: 1, data: [true, "green", 2, "bright"] }, + { id: 2, data: [false, "blue", 1, "glossy"] }, + { id: 3, data: [true, "black", 4, "dry"] }, + { id: 4, data: [false, "pink", 3, "brittle"] }, + { id: 5, data: [false, "blue", 5, "big"] }, + { id: 6, data: [true, "pink", 6, "spicey"] }, + { id: 7, data: [false, "blue", 3, "mild"] }, + { id: 8, data: [false, "blue", 3, "pointy"] }, + { id: 9, data: [true, "blue", 3, "soft"] }, + { id: 10, data: [false, "pink", 1, "worn"] }, + { id: 11, data: [true, "blue", 1, "brittle"] }, + { id: 12, data: [true, "blue", 3, "glossy"] }, + { id: 13, data: [false, "purple", 3, "big"] }, + { id: 14, data: [false, "blue", 1, "worn"] }, + { id: 15, data: [false, "blue", 3, "dry"] }, + { id: 16, data: [false, "orange", 5, "spicey"] }, + { id: 17, data: [false, "orange", 7, "big"] }, + { id: 18, data: [false, "blue", 8, "glossy"] }, + { id: 19, data: [false, "magenta", 4, "brittle"] }, + { id: 20, data: [true, "blue", 3, "dry"] }, ]; export default function Example() { @@ -71,7 +71,7 @@ export default function Example() { -
+
diff --git a/documentation-site/examples/data-table/basic.tsx b/documentation-site/examples/data-table/basic.tsx index 65cf4633a1..5308e77cde 100644 --- a/documentation-site/examples/data-table/basic.tsx +++ b/documentation-site/examples/data-table/basic.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import {useStyletron} from 'baseui'; +import React from "react"; +import { useStyletron } from "baseui"; import { StatefulDataTable, BooleanColumn, @@ -9,13 +9,13 @@ import { StringColumn, COLUMNS, NUMERICAL_FORMATS, -} from 'baseui/data-table'; +} from "baseui/data-table"; // https://gist.github.com/6174/6062387 function pseudoRandomString(rowIdx: any, columnIdx: any) { return ( - (0.88 * rowIdx).toString(36).replace('.', '').substring(2) + - (0.99 * columnIdx).toString(36).replace('.', '') + (0.88 * rowIdx).toString(36).replace(".", "").substring(2) + + (0.99 * columnIdx).toString(36).replace(".", "") ).slice(0, 10); } @@ -29,16 +29,16 @@ function makeRowsFromColumns(columns: any, rowCount: number) { case COLUMNS.CATEGORICAL: switch (i % 5) { case 4: - return 'A'; + return "A"; case 3: - return 'B'; + return "B"; case 2: - return 'C'; + return "C"; case 1: - return 'D'; + return "D"; case 0: default: - return 'F'; + return "F"; } case COLUMNS.NUMERICAL: return i % 2 ? i - 1 : i + 3; @@ -49,19 +49,19 @@ function makeRowsFromColumns(columns: any, rowCount: number) { case COLUMNS.CUSTOM: switch (i % 5) { case 4: - return {color: 'red'}; + return { color: "red" }; case 3: - return {color: 'green'}; + return { color: "green" }; case 2: - return {color: 'blue'}; + return { color: "blue" }; case 1: - return {color: 'purple'}; + return { color: "purple" }; case 0: default: - return {color: 'yellow'}; + return { color: "yellow" }; } default: - return 'default' + pseudoRandomString(i, j); + return "default" + pseudoRandomString(i, j); } }), }); @@ -75,53 +75,53 @@ type RowDataT = [ number, number, number, - {color: string}, + { color: string }, boolean, string, ]; const columns = [ CategoricalColumn({ - title: 'categorical', + title: "categorical", mapDataToValue: (data: RowDataT) => data[0], }), StringColumn({ - title: 'string', + title: "string", mapDataToValue: (data: RowDataT) => data[1], }), NumericalColumn({ - title: 'three', + title: "three", mapDataToValue: (data: RowDataT) => data[2], }), NumericalColumn({ - title: 'neg std', + title: "neg std", highlight: (n: number) => n < 0, mapDataToValue: (data: RowDataT) => data[3], }), NumericalColumn({ - title: 'accounting', + title: "accounting", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data[4], }), - CustomColumn<{color: string}, {}>({ - title: 'custom color', + CustomColumn<{ color: string }, {}>({ + title: "custom color", mapDataToValue: (data: RowDataT) => data[5], renderCell: function Cell(props: any) { const [css] = useStyletron(); return (
{props.value.color}
@@ -130,11 +130,11 @@ const columns = [ }, }), BooleanColumn({ - title: 'boolean', + title: "boolean", mapDataToValue: (data: RowDataT) => data[6], }), CategoricalColumn({ - title: 'second category', + title: "second category", mapDataToValue: (data: RowDataT) => data[7], }), ]; @@ -144,7 +144,7 @@ const rows = makeRowsFromColumns(columns, 2000); export default function Example() { const [css] = useStyletron(); return ( -
+
); diff --git a/documentation-site/examples/data-table/batch-action.tsx b/documentation-site/examples/data-table/batch-action.tsx index 31659998e3..7f3487e709 100644 --- a/documentation-site/examples/data-table/batch-action.tsx +++ b/documentation-site/examples/data-table/batch-action.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import {Alert, Check} from 'baseui/icon'; +import React from "react"; +import { Alert, Check } from "baseui/icon"; import { StatefulDataTable, @@ -10,128 +10,88 @@ import { NUMERICAL_FORMATS, BatchAction, RowAction, -} from 'baseui/data-table'; +} from "baseui/data-table"; -type RowDataT = [ - string, - boolean, - string, - number, - number, - number, - number, -]; +type RowDataT = [string, boolean, string, number, number, number, number]; const columns = [ StringColumn({ - title: 'Movie', + title: "Movie", mapDataToValue: (data: RowDataT) => data[0], }), BooleanColumn({ - title: 'is it good?', + title: "is it good?", mapDataToValue: (data: RowDataT) => data[1], }), CategoricalColumn({ - title: 'Genre', + title: "Genre", mapDataToValue: (data: RowDataT) => data[2], }), NumericalColumn({ - title: 'Production Budget (millions)', + title: "Production Budget (millions)", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data[3], }), NumericalColumn({ - title: 'Box Office (millions)', + title: "Box Office (millions)", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data[4], }), NumericalColumn({ - title: 'ROI', + title: "ROI", precision: 2, mapDataToValue: (data: RowDataT) => data[5], }), NumericalColumn({ - title: 'Rating IMDB', + title: "Rating IMDB", precision: 2, mapDataToValue: (data: RowDataT) => data[6], }), ]; const initialRows = [ - ['Avatar', false, 'Action', 237, 2784, 11.7, 8.0], - ['The Blind Side', false, 'Drama', 29, 309, 10.7, 7.6], - ['The Dark Knight', false, 'Action', 185, 1005, 5.4, 9.0], - ['ET: The Extra-Terrestrial', false, 'Drama', 11, 793, 75.5, 7.9], - ['Finding Nemo', false, 'Adventure', 94, 940, 10.0, 8.1], - ['Ghostbusters', false, 'Comedy', 144, 229, 1.6, 7.8], - [ - 'The Hunger Games', - false, - 'Thriller/Suspense', - 78, - 649, - 8.3, - 7.2, - ], - ['Iron Man 3', false, 'Action', 178, 1215, 6.8, 7.6], - ['Jurassic Park', false, 'Action', 53, 1030, 19.4, 8.0], - ['King Kong', false, 'Adventure', 207, 551, 2.7, 7.3], - ['The Lion King', false, 'Adventure', 115, 577, 5.0, 8.0], - ['Monsters, Inc.', false, 'Adventure', 115, 577, 5.0, 8.0], - [ - 'The Twilight Saga: New Moon', - false, - 'Drama', - 50, - 710, - 14.2, - 4.5, - ], - [ - 'Oz the Great and Powerful', - false, - 'Adventure', - 160, - 493, - 3.1, - 6.6, - ], + ["Avatar", false, "Action", 237, 2784, 11.7, 8.0], + ["The Blind Side", false, "Drama", 29, 309, 10.7, 7.6], + ["The Dark Knight", false, "Action", 185, 1005, 5.4, 9.0], + ["ET: The Extra-Terrestrial", false, "Drama", 11, 793, 75.5, 7.9], + ["Finding Nemo", false, "Adventure", 94, 940, 10.0, 8.1], + ["Ghostbusters", false, "Comedy", 144, 229, 1.6, 7.8], + ["The Hunger Games", false, "Thriller/Suspense", 78, 649, 8.3, 7.2], + ["Iron Man 3", false, "Action", 178, 1215, 6.8, 7.6], + ["Jurassic Park", false, "Action", 53, 1030, 19.4, 8.0], + ["King Kong", false, "Adventure", 207, 551, 2.7, 7.3], + ["The Lion King", false, "Adventure", 115, 577, 5.0, 8.0], + ["Monsters, Inc.", false, "Adventure", 115, 577, 5.0, 8.0], + ["The Twilight Saga: New Moon", false, "Drama", 50, 710, 14.2, 4.5], + ["Oz the Great and Powerful", false, "Adventure", 160, 493, 3.1, 6.6], [ `Pirates of the Caribbean: Dead Man's Chest`, false, - 'Adventure', + "Adventure", 225, 1066, 4.7, 7.3, ], - ['Quantum of Solace', false, 'Action', 200, 586, 2.9, 6.7], - [ - 'Raiders of the Lost Ark', - false, - 'Adventure', - 18, - 390, - 21.7, - 8.7, - ], + ["Quantum of Solace", false, "Action", 200, 586, 2.9, 6.7], + ["Raiders of the Lost Ark", false, "Adventure", 18, 390, 21.7, 8.7], [ - 'Star Wars Ep. I: The Phantom Menace', + "Star Wars Ep. I: The Phantom Menace", false, - 'Adventure', + "Adventure", 115, 1027, 8.9, 6.5, ], - ['Titanic', false, 'Thriller/Suspense', 200, 2187, 10.9, 7.6], - ['Up', false, 'Adventure', 175, 735, 4.2, 8.3], - ['The Vow', false, 'Drama', 30, 196, 6.5, 6.7], - ['The War of the Worlds', false, 'Action', 132, 704, 5.3, 6.5], - ['X-Men: The Last Stand', false, 'Action', 210, 459, 2.2, 6.8], - [`You've Got Mail`, false, 'Drama', 65, 251, 3.9, 6.3], - ['Zookeeper', false, 'Romantic Comedy', 80, 170, 2.1, 5.0], -].map((r) => ({id: String(r[0]), data: r})); + ["Titanic", false, "Thriller/Suspense", 200, 2187, 10.9, 7.6], + ["Up", false, "Adventure", 175, 735, 4.2, 8.3], + ["The Vow", false, "Drama", 30, 196, 6.5, 6.7], + ["The War of the Worlds", false, "Action", 132, 704, 5.3, 6.5], + ["X-Men: The Last Stand", false, "Action", 210, 459, 2.2, 6.8], + [`You've Got Mail`, false, "Drama", 65, 251, 3.9, 6.3], + ["Zookeeper", false, "Romantic Comedy", 80, 170, 2.1, 5.0], +].map((r) => ({ id: String(r[0]), data: r })); export default function Example() { const [rows, setRows] = React.useState(initialRows); @@ -141,7 +101,7 @@ export default function Example() { if (ids.includes(row.id)) { const nextData = [...row.data]; nextData[1] = !nextData[1]; - return {...row, data: nextData}; + return { ...row, data: nextData }; } return row; @@ -162,42 +122,42 @@ export default function Example() { const batchActions: BatchAction[] = [ { - label: 'Check', - onClick: ({selection, clearSelection}) => { + label: "Check", + onClick: ({ selection, clearSelection }) => { flagRows(selection.map((r) => r.id)); clearSelection(); }, renderIcon: Check, }, { - label: 'Remove', - onClick: ({selection, clearSelection}) => { + label: "Remove", + onClick: ({ selection, clearSelection }) => { removeRows(selection.map((r) => r.id)); clearSelection(); }, renderIcon: Alert, }, { - label: 'Download', - onClick: ({clearSelection}) => clearSelection(), + label: "Download", + onClick: ({ clearSelection }) => clearSelection(), }, ]; const rowActions: RowAction[] = [ { - label: 'Check', - onClick: ({row}) => flagRow(row.id), + label: "Check", + onClick: ({ row }) => flagRow(row.id), renderIcon: Check, }, { - label: 'Remove', - onClick: ({row}) => removeRow(row.id), + label: "Remove", + onClick: ({ row }) => removeRow(row.id), renderIcon: Alert, }, ]; return ( -
+
data[0], }), CustomColumn< - {color: string}, - {selection: Set; exclude: boolean; description: string} + { color: string }, + { selection: Set; exclude: boolean; description: string } >({ - title: 'custom color (sortable)', + title: "custom color (sortable)", filterable: true, sortable: true, minWidth: 120, @@ -101,17 +101,17 @@ const columns = [ return (
{props.value.color}
@@ -133,10 +133,7 @@ const columns = [
    {Array.from(colors).map((color: any) => { return ( -
  • +
  • { @@ -148,9 +145,7 @@ const columns = [ setSelection(selection); }} /> - - {color} - + {color}
  • ); })} @@ -159,7 +154,7 @@ const columns = [ onClick={() => { props.setFilter({ selection, - description: Array.from(selection).join(', '), + description: Array.from(selection).join(", "), exclude: false, }); props.close(); @@ -180,11 +175,11 @@ const columns = [ }, }), StringColumn({ - title: 'string', + title: "string", mapDataToValue: (data: RowDataT) => data[2], }), NumericalColumn({ - title: 'accounting', + title: "accounting", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data[3], }), @@ -195,7 +190,7 @@ const rows = makeRowsFromColumns(columns, 100); export default function Example() { const [css] = useStyletron(); return ( -
    +
    ); diff --git a/documentation-site/examples/data-table/customized-empty-state.tsx b/documentation-site/examples/data-table/customized-empty-state.tsx index 85269ffacb..495d77981e 100644 --- a/documentation-site/examples/data-table/customized-empty-state.tsx +++ b/documentation-site/examples/data-table/customized-empty-state.tsx @@ -1,5 +1,5 @@ -import React from 'react'; -import {useStyletron} from 'baseui'; +import React from "react"; +import { useStyletron } from "baseui"; import { StatefulDataTable, BooleanColumn, @@ -8,7 +8,7 @@ import { NumericalColumn, StringColumn, NUMERICAL_FORMATS, -} from 'baseui/data-table'; +} from "baseui/data-table"; type RowDataT = [ string, @@ -16,53 +16,53 @@ type RowDataT = [ number, number, number, - {color: string}, + { color: string }, boolean, string, ]; const columns = [ CategoricalColumn({ - title: 'categorical', + title: "categorical", mapDataToValue: (data: RowDataT) => data[0], }), StringColumn({ - title: 'string', + title: "string", mapDataToValue: (data: RowDataT) => data[1], }), NumericalColumn({ - title: 'three', + title: "three", mapDataToValue: (data: RowDataT) => data[2], }), NumericalColumn({ - title: 'neg std', + title: "neg std", highlight: (n: number) => n < 0, mapDataToValue: (data: RowDataT) => data[3], }), NumericalColumn({ - title: 'accounting', + title: "accounting", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data[4], }), - CustomColumn<{color: string}, {}>({ - title: 'custom color', + CustomColumn<{ color: string }, {}>({ + title: "custom color", mapDataToValue: (data: RowDataT) => data[5], renderCell: function Cell(props: any) { const [css] = useStyletron(); return (
    {props.value.color}
    @@ -71,11 +71,11 @@ const columns = [ }, }), BooleanColumn({ - title: 'boolean', + title: "boolean", mapDataToValue: (data: RowDataT) => data[6], }), CategoricalColumn({ - title: 'second category', + title: "second category", mapDataToValue: (data: RowDataT) => data[7], }), ]; @@ -84,14 +84,14 @@ export default function Example() { const [css] = useStyletron(); return ( -
    +
    -
    +
    data.title, }), StringColumn({ - title: 'Lorem Ipsum Description', + title: "Lorem Ipsum Description", maxWidth: 300, lineClamp: 3, mapDataToValue: (data: RowDataT) => data.loremIpsum, }), CategoricalColumn({ - title: 'Genre', + title: "Genre", mapDataToValue: (data: RowDataT) => data.genre, }), NumericalColumn({ - title: 'Production Budget (millions)', + title: "Production Budget (millions)", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data.budget, }), NumericalColumn({ - title: 'Box Office (millions)', + title: "Box Office (millions)", format: NUMERICAL_FORMATS.ACCOUNTING, mapDataToValue: (data: RowDataT) => data.boxOffice, }), NumericalColumn({ - title: 'ROI', + title: "ROI", precision: 2, mapDataToValue: (data: RowDataT) => data.roi, }), NumericalColumn({ - title: 'Rating IMDB', + title: "Rating IMDB", precision: 2, mapDataToValue: (data: RowDataT) => data.imdb, }), @@ -60,126 +60,126 @@ const columns = [ const rows = [ { - title: 'Avatar', + title: "Avatar", loremIpsum, - genre: 'Action', + genre: "Action", budget: 237, boxOffice: 2784, roi: 11.7, imdb: 8.0, }, { - title: 'The Blind Side', + title: "The Blind Side", loremIpsum, - genre: 'Drama', + genre: "Drama", budget: 29, boxOffice: 309, roi: 10.7, imdb: 7.6, }, { - title: 'The Dark Knight', + title: "The Dark Knight", loremIpsum, - genre: 'Action', + genre: "Action", budget: 185, boxOffice: 1005, roi: 5.4, imdb: 9.0, }, { - title: 'ET: The Extra-Terrestrial', + title: "ET: The Extra-Terrestrial", loremIpsum, - genre: 'Drama', + genre: "Drama", budget: 11, boxOffice: 793, roi: 75.5, imdb: 7.9, }, { - title: 'Finding Nemo', + title: "Finding Nemo", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 94, boxOffice: 940, roi: 10.0, imdb: 8.1, }, { - title: 'Ghostbusters', + title: "Ghostbusters", loremIpsum, - genre: 'Comedy', + genre: "Comedy", budget: 144, boxOffice: 229, roi: 1.6, imdb: 7.8, }, { - title: 'The Hunger Games', + title: "The Hunger Games", loremIpsum, - genre: 'Thriller/Suspense', + genre: "Thriller/Suspense", budget: 78, boxOffice: 649, roi: 8.3, imdb: 7.2, }, { - title: 'Iron Man 3', + title: "Iron Man 3", loremIpsum, - genre: 'Action', + genre: "Action", budget: 178, boxOffice: 1215, roi: 6.8, imdb: 7.6, }, { - title: 'Jurassic Park', + title: "Jurassic Park", loremIpsum, - genre: 'Action', + genre: "Action", budget: 53, boxOffice: 1030, roi: 19.4, imdb: 8.0, }, { - title: 'King Kong', + title: "King Kong", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 207, boxOffice: 551, roi: 2.7, imdb: 7.3, }, { - title: 'The Lion King', + title: "The Lion King", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 115, boxOffice: 577, roi: 5.0, imdb: 8.0, }, { - title: 'Monsters, Inc.', + title: "Monsters, Inc.", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 115, boxOffice: 577, roi: 5.0, imdb: 8.0, }, { - title: 'The Twilight Saga: New Moon', + title: "The Twilight Saga: New Moon", loremIpsum, - genre: 'Drama', + genre: "Drama", budget: 50, boxOffice: 710, roi: 14.2, imdb: 4.5, }, { - title: 'Oz the Great and Powerful', + title: "Oz the Great and Powerful", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 160, boxOffice: 493, roi: 3.1, @@ -188,79 +188,79 @@ const rows = [ { title: `Pirates of the Caribbean: Dead Man's Chest`, loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 225, boxOffice: 1066, roi: 4.7, imdb: 7.3, }, { - title: 'Quantum of Solace', + title: "Quantum of Solace", loremIpsum, - genre: 'Action', + genre: "Action", budget: 200, boxOffice: 586, roi: 2.9, imdb: 6.7, }, { - title: 'Raiders of the Lost Ark', + title: "Raiders of the Lost Ark", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 18, boxOffice: 390, roi: 21.7, imdb: 8.7, }, { - title: 'Star Wars Ep. I: The Phantom Menace', + title: "Star Wars Ep. I: The Phantom Menace", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 115, boxOffice: 1027, roi: 8.9, imdb: 6.5, }, { - title: 'Titanic', + title: "Titanic", loremIpsum, - genre: 'Thriller/Suspense', + genre: "Thriller/Suspense", budget: 200, boxOffice: 2187, roi: 10.9, imdb: 7.6, }, { - title: 'Up', + title: "Up", loremIpsum, - genre: 'Adventure', + genre: "Adventure", budget: 175, boxOffice: 735, roi: 4.2, imdb: 8.3, }, { - title: 'The Vow', + title: "The Vow", loremIpsum, - genre: 'Drama', + genre: "Drama", budget: 30, boxOffice: 196, roi: 6.5, imdb: 6.7, }, { - title: 'The War of the Worlds', + title: "The War of the Worlds", loremIpsum, - genre: 'Action', + genre: "Action", budget: 132, boxOffice: 704, roi: 5.3, imdb: 6.5, }, { - title: 'X-Men: The Last Stand', + title: "X-Men: The Last Stand", loremIpsum, - genre: 'Action', + genre: "Action", budget: 210, boxOffice: 459, roi: 2.2, @@ -269,31 +269,27 @@ const rows = [ { title: `You've Got Mail`, loremIpsum, - genre: 'Drama', + genre: "Drama", budget: 65, boxOffice: 251, roi: 3.9, imdb: 6.3, }, { - title: 'Zookeeper', + title: "Zookeeper", loremIpsum, - genre: 'Romantic Comedy', + genre: "Romantic Comedy", budget: 80, boxOffice: 170, roi: 2.1, imdb: 5.0, }, -].map((r) => ({id: r.title, data: r})); +].map((r) => ({ id: r.title, data: r })); export default function Example() { return ( -
    - +
    +
    ); } diff --git a/documentation-site/examples/datepicker/basic.tsx b/documentation-site/examples/datepicker/basic.tsx index c85cc2a7a4..c95ebfc3b1 100644 --- a/documentation-site/examples/datepicker/basic.tsx +++ b/documentation-site/examples/datepicker/basic.tsx @@ -1,11 +1,11 @@ -import * as React from 'react'; -import {StatefulCalendar} from 'baseui/datepicker'; +import * as React from "react"; +import { StatefulCalendar } from "baseui/datepicker"; export default function Example() { return ( console.log(date)} + onChange={({ date }) => console.log(date)} /> ); } diff --git a/documentation-site/examples/datepicker/calendar-multiple-months-with-label.tsx b/documentation-site/examples/datepicker/calendar-multiple-months-with-label.tsx index d1c386233c..6da2a86502 100644 --- a/documentation-site/examples/datepicker/calendar-multiple-months-with-label.tsx +++ b/documentation-site/examples/datepicker/calendar-multiple-months-with-label.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import {ORIENTATION, StatefulCalendar} from 'baseui/datepicker'; +import React from "react"; +import { ORIENTATION, StatefulCalendar } from "baseui/datepicker"; export default function Example() { return ( console.log(date)} + onChange={({ date }) => console.log(date)} orientation={ORIENTATION.horizontal} monthsShown={2} range diff --git a/documentation-site/examples/datepicker/calendar-multiple-months.tsx b/documentation-site/examples/datepicker/calendar-multiple-months.tsx index 8aaa02ed9e..2d8c6056b3 100644 --- a/documentation-site/examples/datepicker/calendar-multiple-months.tsx +++ b/documentation-site/examples/datepicker/calendar-multiple-months.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import {ORIENTATION, StatefulCalendar} from 'baseui/datepicker'; +import React from "react"; +import { ORIENTATION, StatefulCalendar } from "baseui/datepicker"; export default function Example() { return ( console.log(date)} + onChange={({ date }) => console.log(date)} orientation={ORIENTATION.horizontal} monthsShown={2} range diff --git a/documentation-site/examples/datepicker/calendar-time-select.tsx b/documentation-site/examples/datepicker/calendar-time-select.tsx index 0c199cc456..b33ef8cc93 100644 --- a/documentation-site/examples/datepicker/calendar-time-select.tsx +++ b/documentation-site/examples/datepicker/calendar-time-select.tsx @@ -1,10 +1,10 @@ -import React from 'react'; -import {StatefulCalendar} from 'baseui/datepicker'; +import React from "react"; +import { StatefulCalendar } from "baseui/datepicker"; export default function Example() { return ( console.log(date)} + onChange={({ date }) => console.log(date)} timeSelectStart /> ); diff --git a/documentation-site/examples/datepicker/composed-range-pickers.tsx b/documentation-site/examples/datepicker/composed-range-pickers.tsx index d8c5eb1e40..03317f4a9f 100644 --- a/documentation-site/examples/datepicker/composed-range-pickers.tsx +++ b/documentation-site/examples/datepicker/composed-range-pickers.tsx @@ -1,11 +1,11 @@ -import React, {useState} from 'react'; -import {isAfter, isBefore} from 'date-fns'; +import React, { useState } from "react"; +import { isAfter, isBefore } from "date-fns"; -import {useStyletron} from 'baseui'; -import {FormControl} from 'baseui/form-control'; -import {ArrowRight} from 'baseui/icon'; -import {DatePicker} from 'baseui/datepicker'; -import {TimePicker} from 'baseui/timepicker'; +import { useStyletron } from "baseui"; +import { FormControl } from "baseui/form-control"; +import { ArrowRight } from "baseui/icon"; +import { DatePicker } from "baseui/datepicker"; +import { TimePicker } from "baseui/timepicker"; const START_DATE = new Date(2019, 3, 1, 12, 0, 0); const END_DATE = new Date(2019, 3, 10, 16, 0, 0); @@ -18,22 +18,22 @@ export default function Example() {
    -
    +
    setDates(date as Array)} + onChange={({ date }) => setDates(date as Array)} timeSelectStart range mask="9999/99/99" @@ -45,7 +45,7 @@ export default function Example() {
    @@ -68,27 +68,27 @@ export default function Example() {
    -
    +
    setDates(date as Array)} + onChange={({ date }) => setDates(date as Array)} timeSelectEnd range mask="9999/99/99" @@ -100,7 +100,7 @@ export default function Example() {
    diff --git a/documentation-site/examples/datepicker/composed-single-pickers.tsx b/documentation-site/examples/datepicker/composed-single-pickers.tsx index 1bd0d0427c..23531a60da 100644 --- a/documentation-site/examples/datepicker/composed-single-pickers.tsx +++ b/documentation-site/examples/datepicker/composed-single-pickers.tsx @@ -1,10 +1,10 @@ -import React, {useState} from 'react'; +import React, { useState } from "react"; -import {useStyletron} from 'baseui'; -import {FormControl} from 'baseui/form-control'; -import {DatePicker} from 'baseui/datepicker'; -import {TimezonePicker} from 'baseui/timezonepicker'; -import {TimePicker} from 'baseui/timepicker'; +import { useStyletron } from "baseui"; +import { FormControl } from "baseui/form-control"; +import { DatePicker } from "baseui/datepicker"; +import { TimezonePicker } from "baseui/timezonepicker"; +import { TimePicker } from "baseui/timepicker"; const DATE = new Date(2019, 3, 1, 12, 0, 0); @@ -14,17 +14,17 @@ export default function Example() { const [zone, setZone] = useState(null); return ( -
    +
    setDate(date as Date)} + onChange={({ date }) => setDate(date as Date)} timeSelectStart /> @@ -32,7 +32,7 @@ export default function Example() {
    @@ -43,7 +43,7 @@ export default function Example() {
    diff --git a/documentation-site/examples/datepicker/datepicker-with-timezone.tsx b/documentation-site/examples/datepicker/datepicker-with-timezone.tsx index ab59c57ca8..09d89b695e 100644 --- a/documentation-site/examples/datepicker/datepicker-with-timezone.tsx +++ b/documentation-site/examples/datepicker/datepicker-with-timezone.tsx @@ -1,13 +1,13 @@ -import React, {useState} from 'react'; -import {DatePicker} from 'baseui/datepicker'; -import {TimezonePicker} from 'baseui/timezonepicker'; -import {FormControl} from 'baseui/form-control'; +import React, { useState } from "react"; +import { DatePicker } from "baseui/datepicker"; +import { TimezonePicker } from "baseui/timezonepicker"; +import { FormControl } from "baseui/form-control"; export default function Example() { const [date, setDate] = useState(new Date()); const [tz, setZone] = useState({ - id: 'America/Fort_Nelson', - label: 'MST - America/Fort Nelson (GMT -07:00)', + id: "America/Fort_Nelson", + label: "MST - America/Fort Nelson (GMT -07:00)", offset: 420, }); @@ -15,11 +15,9 @@ export default function Example() { setDate(date as Date)} + onChange={({ date }) => setDate(date as Date)} value={ - date - ? new Date(date.getTime() + tz.offset * 60000) - : undefined + date ? new Date(date.getTime() + tz.offset * 60000) : undefined } /> diff --git a/documentation-site/examples/datepicker/datepickers-color-states.tsx b/documentation-site/examples/datepicker/datepickers-color-states.tsx index df9bf7a73c..bb1dafa3ac 100644 --- a/documentation-site/examples/datepicker/datepickers-color-states.tsx +++ b/documentation-site/examples/datepicker/datepickers-color-states.tsx @@ -1,10 +1,10 @@ -import React from 'react'; +import React from "react"; -import {useStyletron} from 'baseui'; -import {FormControl} from 'baseui/form-control'; -import {StatefulDatePicker} from 'baseui/datepicker'; -import {TimezonePicker} from 'baseui/timezonepicker'; -import {TimePicker} from 'baseui/timepicker'; +import { useStyletron } from "baseui"; +import { FormControl } from "baseui/form-control"; +import { StatefulDatePicker } from "baseui/datepicker"; +import { TimezonePicker } from "baseui/timezonepicker"; +import { TimePicker } from "baseui/timepicker"; export default function Example() { const [css, theme] = useStyletron(); @@ -13,12 +13,12 @@ export default function Example() { Disabled state
    @@ -28,7 +28,7 @@ export default function Example() {
    @@ -36,7 +36,7 @@ export default function Example() {
    -
    +
    @@ -45,12 +45,12 @@ export default function Example() { Positive state
    @@ -60,7 +60,7 @@ export default function Example() {
    @@ -68,7 +68,7 @@ export default function Example() {
    -
    +
    @@ -77,12 +77,12 @@ export default function Example() { Error state
    @@ -92,7 +92,7 @@ export default function Example() {
    @@ -100,7 +100,7 @@ export default function Example() {
    -
    +
    diff --git a/documentation-site/examples/datepicker/range-picker-with-separate-inputs.tsx b/documentation-site/examples/datepicker/range-picker-with-separate-inputs.tsx index 234ec91e3b..53ee7c6cb8 100644 --- a/documentation-site/examples/datepicker/range-picker-with-separate-inputs.tsx +++ b/documentation-site/examples/datepicker/range-picker-with-separate-inputs.tsx @@ -1,13 +1,13 @@ -import React from 'react'; -import {StatefulDatepicker} from 'baseui/datepicker'; +import React from "react"; +import { StatefulDatepicker } from "baseui/datepicker"; export default function Example() { return ( diff --git a/documentation-site/examples/datepicker/with-callback-overrides.tsx b/documentation-site/examples/datepicker/with-callback-overrides.tsx index b2cddccdbe..c101fe3bba 100644 --- a/documentation-site/examples/datepicker/with-callback-overrides.tsx +++ b/documentation-site/examples/datepicker/with-callback-overrides.tsx @@ -1,28 +1,26 @@ -import * as React from 'react'; -import {DatePicker} from 'baseui/datepicker'; -import {LabelSmall} from 'baseui/typography'; -import {Select} from 'baseui/select'; +import * as React from "react"; +import { DatePicker } from "baseui/datepicker"; +import { LabelSmall } from "baseui/typography"; +import { Select } from "baseui/select"; export default function Example() { - const [date, setDate] = React.useState(new Date('2020/01/01')); - const [quickSelected, setQuickSelected] = React.useState(''); + const [date, setDate] = React.useState(new Date("2020/01/01")); + const [quickSelected, setQuickSelected] = React.useState(""); return (
    - - Quick Selected: {quickSelected || 'nothing'} - + Quick Selected: {quickSelected || "nothing"} setDate(date as Date)} + onChange={({ date }) => setDate(date as Date)} quickSelect quickSelectOptions={[ { - id: 'suggested-time', + id: "suggested-time", beginDate: new Date(), }, { - id: 'other-time', + id: "other-time", beginDate: new Date(), }, ]} @@ -30,15 +28,15 @@ export default function Example() { QuickSelectFormControl: { props: { overrides: { - Label: () => {'Pick me!'}, + Label: () => {"Pick me!"}, }, }, }, // @ts-ignore - QuickSelect: ({onChange, ...rest}) => ( + QuickSelect: ({ onChange, ...rest }) => ( + setValue(event.currentTarget.value)} diff --git a/documentation-site/examples/form-control/select.tsx b/documentation-site/examples/form-control/select.tsx index e860225143..e2f899c075 100644 --- a/documentation-site/examples/form-control/select.tsx +++ b/documentation-site/examples/form-control/select.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {FormControl} from 'baseui/form-control'; -import {Select} from 'baseui/select'; +import * as React from "react"; +import { FormControl } from "baseui/form-control"; +import { Select } from "baseui/select"; export default function Example() { const [value, setValue] = React.useState([]); @@ -9,14 +9,14 @@ export default function Example() {