@sanity/ui 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/_visual-editing.d.mts +2 -1126
- package/dist/_visual-editing.d.ts +2 -1126
- package/dist/_visual-editing.js +3 -31
- package/dist/_visual-editing.mjs +2 -31
- package/dist/index.d.mts +555 -2769
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +555 -2769
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2982 -1934
- package/dist/index.mjs +2950 -1903
- package/dist/index.mjs.map +1 -1
- package/dist/refractor.js +16 -0
- package/dist/refractor.mjs +21 -0
- package/dist/refractor.mjs.map +1 -0
- package/dist/tabList.js +3804 -0
- package/dist/tabList.mjs +3355 -0
- package/dist/tabList.mjs.map +1 -0
- package/dist/theme.d.mts +927 -1227
- package/dist/theme.d.mts.map +1 -0
- package/dist/theme.d.ts +927 -1227
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +3 -4127
- package/dist/theme.mjs +2 -4127
- package/dist/theme2.d.mts +2 -0
- package/dist/theme2.d.ts +2 -0
- package/dist/theme2.js +4104 -0
- package/dist/theme2.mjs +3851 -0
- package/dist/theme2.mjs.map +1 -0
- package/dist/useTheme.d.mts +1451 -0
- package/dist/useTheme.d.mts.map +1 -0
- package/dist/useTheme.d.ts +1451 -0
- package/dist/useTheme.d.ts.map +1 -0
- package/exports/_visual-editing.ts +1 -0
- package/package.json +52 -168
- package/src/core/_compat.ts +30 -0
- package/src/core/components/autocomplete/autocomplete.tsx +8 -0
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
- package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +8 -5
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -0
- package/src/core/components/dialog/dialog.tsx +5 -2
- package/src/core/components/hotkeys/hotkeys.test.tsx +10 -5
- package/src/core/components/hotkeys/hotkeys.tsx +2 -0
- package/src/core/components/menu/menu.spacing.test.tsx +12 -7
- package/src/core/components/menu/menu.test.tsx +9 -6
- package/src/core/components/menu/menu.tsx +4 -2
- package/src/core/components/menu/menuButton.tsx +8 -0
- package/src/core/components/menu/menuDivider.ts +1 -0
- package/src/core/components/menu/menuGroup.spacing.test.tsx +9 -6
- package/src/core/components/menu/menuGroup.tsx +6 -2
- package/src/core/components/menu/menuItem.spacing.test.tsx +8 -5
- package/src/core/components/menu/menuItem.tsx +4 -0
- package/src/core/components/menu/useMenuController.ts +2 -0
- package/src/core/components/skeleton/skeleton.tsx +1 -0
- package/src/core/components/tab/tab.tsx +1 -0
- package/src/core/components/tab/tabList.test.tsx +7 -5
- package/src/core/components/tab/tabList.tsx +1 -0
- package/src/core/components/toast/toast.test.tsx +9 -4
- package/src/core/components/toast/toast.tsx +1 -0
- package/src/core/components/toast/toastLayer.tsx +1 -0
- package/src/core/components/tree/tree.test.tsx +10 -5
- package/src/core/components/tree/tree.tsx +2 -0
- package/src/core/components/tree/treeGroup.tsx +1 -0
- package/src/core/components/tree/treeItem.test.tsx +10 -5
- package/src/core/components/tree/treeItem.tsx +1 -0
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/useClickOutside.test.tsx +43 -15
- package/src/core/hooks/useClickOutside.ts +1 -1
- package/src/core/hooks/useClickOutsideEvent.test.tsx +8 -4
- package/src/core/hooks/useDelayed.test.ts +9 -8
- package/src/core/hooks/useElementRect/useElementRect.ts +1 -0
- package/src/core/hooks/useForwardedRef.ts +1 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +2 -1
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersDark.test.tsx +3 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +3 -1
- package/src/core/lib/createGlobalScopedContext.ts +1 -0
- package/src/core/lib/globalScope.ts +1 -0
- package/src/core/observers/elementSizeObserver.ts +1 -0
- package/src/core/primitives/avatar/avatar.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +1 -0
- package/src/core/primitives/badge/badge.test.tsx +3 -2
- package/src/core/primitives/badge/badge.tsx +3 -1
- package/src/core/primitives/box/box.test.tsx +18 -5
- package/src/core/primitives/box/box.tsx +9 -1
- package/src/core/primitives/button/button.test.tsx +10 -6
- package/src/core/primitives/button/button.tsx +4 -0
- package/src/core/primitives/button/styles.ts +1 -0
- package/src/core/primitives/card/card.tsx +2 -5
- package/src/core/primitives/card/types.ts +1 -0
- package/src/core/primitives/code/code.tsx +1 -0
- package/src/core/primitives/code/refractor.tsx +2 -0
- package/src/core/primitives/container/container.tsx +1 -0
- package/src/core/primitives/flex/flex.tsx +2 -3
- package/src/core/primitives/grid/grid.test.tsx +11 -5
- package/src/core/primitives/grid/grid.tsx +3 -0
- package/src/core/primitives/heading/heading.tsx +1 -0
- package/src/core/primitives/inline/inline.test.tsx +9 -5
- package/src/core/primitives/inline/inline.tsx +3 -0
- package/src/core/primitives/kbd/kbd.tsx +5 -1
- package/src/core/primitives/label/label.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +5 -4
- package/src/core/primitives/popover/popoverCard.tsx +1 -0
- package/src/core/primitives/popover/types.ts +0 -1
- package/src/core/primitives/select/select.test.tsx +9 -5
- package/src/core/primitives/select/select.tsx +1 -0
- package/src/core/primitives/stack/stack.test.tsx +9 -5
- package/src/core/primitives/stack/stack.tsx +2 -0
- package/src/core/primitives/stack/styles.ts +1 -0
- package/src/core/primitives/text/text.tsx +1 -0
- package/src/core/primitives/textInput/textInput.test.tsx +9 -5
- package/src/core/primitives/textInput/textInput.tsx +3 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +82 -49
- package/src/core/primitives/tooltip/tooltip.tsx +3 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +2 -0
- package/src/core/styles/flex/types.ts +0 -1
- package/src/core/styles/font/responsiveFont.ts +0 -3
- package/src/core/styles/font/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +1 -0
- package/src/core/styles/margin/marginStyle.ts +1 -0
- package/src/core/styles/margin/marginsStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.ts +1 -0
- package/src/core/theme/theme.test.tsx +7 -3
- package/src/core/theme/useRootTheme.ts +1 -0
- package/src/core/theme/useTheme.ts +2 -0
- package/src/core/utils/arrow/arrow.tsx +1 -0
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +9 -4
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +1 -0
- package/src/core/utils/getElementRef.ts +5 -0
- package/src/core/utils/layer/getLayerContext.test.ts +2 -0
- package/src/core/utils/layer/layer.test.tsx +9 -4
- package/src/core/utils/layer/layer.tsx +1 -0
- package/src/core/utils/layer/useLayer.ts +2 -0
- package/src/core/utils/portal/portal.test.tsx +9 -4
- package/src/core/utils/portal/portalProvider.tsx +1 -0
- package/src/core/utils/virtualList/virtualList.tsx +2 -1
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +10 -0
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +4 -0
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +5 -0
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +5 -0
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +6 -0
- package/src/theme/build/_deprecated/color/color.test.ts +5 -1
- package/src/theme/build/_deprecated/color/defaults.ts +1 -0
- package/src/theme/build/_deprecated/color/factory.ts +36 -0
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +5 -0
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +4 -0
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +3 -0
- package/src/theme/build/buildColorTheme.test.ts +2 -0
- package/src/theme/build/buildColorTheme.ts +8 -0
- package/src/theme/build/buildTheme.test.ts +2 -0
- package/src/theme/build/lib/color-fns/color-fns.test.ts +3 -1
- package/src/theme/build/merge.ts +5 -0
- package/src/theme/build/mixThemeColor.test.ts +2 -0
- package/src/theme/build/renderColorTheme.ts +6 -0
- package/src/theme/build/renderColorValue.ts +0 -2
- package/src/theme/build/resolveColorTokens.ts +6 -0
- package/src/theme/build/theme.test.ts +2 -0
- package/src/theme/config/helpers.ts +5 -0
- package/src/theme/config/system.ts +2 -0
- package/src/theme/config/tokens/color/types.ts +6 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.ts +1 -0
- package/src/theme/getScopedTheme.ts +6 -1
- package/src/theme/system/color/_helpers.ts +4 -0
- package/src/theme/system/theme.ts +4 -0
- package/src/theme/system/v0/color/_system.ts +1 -0
- package/src/theme/system/v0/color/button.ts +14 -0
- package/src/theme/system/v0/color/card.ts +6 -0
- package/src/theme/system/v0/color/color.ts +11 -0
- package/src/theme/system/v0/color/input.ts +6 -0
- package/src/theme/system/v0/color/muted.ts +11 -0
- package/src/theme/system/v0/color/selectable.ts +11 -0
- package/src/theme/system/v0/color/solid.ts +11 -0
- package/src/theme/system/v0/color/spot.ts +1 -0
- package/src/theme/versioning/getTheme_v2.ts +15 -0
- package/src/theme/versioning/themeColor_v0_v2.ts +7 -0
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -0
- package/src/theme/versioning/v0_v2.ts +13 -1
- package/src/theme/versioning/v2_v0.ts +18 -0
- package/dist/_chunks-cjs/_visual-editing.js +0 -5899
- package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
- package/dist/_chunks-cjs/refractor.js +0 -23
- package/dist/_chunks-cjs/refractor.js.map +0 -1
- package/dist/_chunks-es/_visual-editing.mjs +0 -5905
- package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
- package/dist/_chunks-es/refractor.mjs +0 -26
- package/dist/_chunks-es/refractor.mjs.map +0 -1
- package/dist/_visual-editing.js.map +0 -1
- package/dist/_visual-editing.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/theme.mjs.map +0 -1
- package/src/core/__workshop__/constants.ts +0 -293
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
- package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/core/components/dialog/__workshop__/index.ts +0 -19
- package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/core/components/dialog/__workshop__/position.tsx +0 -30
- package/src/core/components/dialog/__workshop__/props.tsx +0 -75
- package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/core/components/menu/__workshop__/groups.tsx +0 -156
- package/src/core/components/menu/__workshop__/index.ts +0 -89
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -65
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/core/components/skeleton/__workshop__/index.ts +0 -11
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/core/components/tab/__workshop__/example.tsx +0 -79
- package/src/core/components/tab/__workshop__/index.ts +0 -14
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/index.ts +0 -19
- package/src/core/components/toast/__workshop__/toast.tsx +0 -26
- package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/core/components/tree/__workshop__/basic.tsx +0 -105
- package/src/core/components/tree/__workshop__/index.ts +0 -21
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
- package/src/core/primitives/badge/__workshop__/index.ts +0 -19
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
- package/src/core/primitives/box/__workshop__/index.ts +0 -24
- package/src/core/primitives/box/__workshop__/props.tsx +0 -20
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
- package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/core/primitives/button/__workshop__/index.ts +0 -59
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/core/primitives/button/__workshop__/props.tsx +0 -55
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/core/primitives/card/__workshop__/index.ts +0 -18
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/core/primitives/card/__workshop__/props.tsx +0 -53
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/core/primitives/code/__workshop__/index.ts +0 -19
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/code/__workshop__/props.tsx +0 -21
- package/src/core/primitives/container/__workshop__/example.tsx +0 -20
- package/src/core/primitives/container/__workshop__/index.ts +0 -8
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/__workshop__/index.ts +0 -11
- package/src/core/primitives/grid/__workshop__/index.ts +0 -10
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/index.ts +0 -19
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/inline/__workshop__/index.ts +0 -8
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/core/primitives/label/__workshop__/index.ts +0 -19
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
- package/src/core/primitives/popover/__workshop__/index.ts +0 -49
- package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/core/primitives/radio/__workshop__/index.ts +0 -11
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/select/__workshop__/index.ts +0 -11
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
- package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/core/primitives/switch/__workshop__/index.ts +0 -11
- package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
- package/src/core/primitives/text/__workshop__/example.tsx +0 -39
- package/src/core/primitives/text/__workshop__/index.ts +0 -24
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -465
- package/src/core/theme/__workshop__/canvas.tsx +0 -352
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -408
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/core/utils/layer/__workshop__/index.ts +0 -24
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/core/utils/portal/__workshop__/index.ts +0 -14
- package/src/core/utils/portal/__workshop__/named.tsx +0 -63
- package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {Box, Text} from '@sanity/ui'
|
|
2
|
-
|
|
3
|
-
export default function ResponsiveStory() {
|
|
4
|
-
return (
|
|
5
|
-
<Box padding={[4, 5, 6]}>
|
|
6
|
-
<Box
|
|
7
|
-
id="responsive-box"
|
|
8
|
-
display={['none', 'block', 'none', 'block', 'none', 'block', 'none']}
|
|
9
|
-
flex={[1, 2, 3, 4, 5, 6, 7]}
|
|
10
|
-
padding={3}
|
|
11
|
-
sizing={['content', 'border', 'content', 'border', 'content', 'border', 'content']}
|
|
12
|
-
style={{outline: '1px solid var(--card-border-color)'}}
|
|
13
|
-
>
|
|
14
|
-
<Text align="center" muted>
|
|
15
|
-
This is a box with responsive props
|
|
16
|
-
</Text>
|
|
17
|
-
</Box>
|
|
18
|
-
</Box>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
2
|
-
|
|
3
|
-
import {Button, Flex, Grid, Stack, Text} from '@sanity/ui'
|
|
4
|
-
|
|
5
|
-
import {WORKSHOP_BUTTON_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
6
|
-
|
|
7
|
-
export default function CustomStory() {
|
|
8
|
-
const tones = Object.entries(WORKSHOP_BUTTON_TONE_OPTIONS)
|
|
9
|
-
const len = tones.length
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
13
|
-
<Stack space={2}>
|
|
14
|
-
<Grid columns={len} gap={1}>
|
|
15
|
-
{tones.map(([title, tone]) => (
|
|
16
|
-
<Button key={tone} mode="ghost" padding={3} tone={tone}>
|
|
17
|
-
<Stack space={2}>
|
|
18
|
-
<Text>{title}</Text>
|
|
19
|
-
<Text muted>Muted</Text>
|
|
20
|
-
<Text muted>
|
|
21
|
-
<a href="#">Link</a>
|
|
22
|
-
</Text>
|
|
23
|
-
<Text>
|
|
24
|
-
<code>Code</code>
|
|
25
|
-
</Text>
|
|
26
|
-
<Text accent>Accent</Text>
|
|
27
|
-
</Stack>
|
|
28
|
-
</Button>
|
|
29
|
-
))}
|
|
30
|
-
</Grid>
|
|
31
|
-
<Grid columns={len} gap={1}>
|
|
32
|
-
{tones.map(([title, tone]) => (
|
|
33
|
-
<Button key={tone} mode="default" padding={3} tone={tone}>
|
|
34
|
-
<Stack space={2}>
|
|
35
|
-
<Text>{title}</Text>
|
|
36
|
-
<Text muted>Muted</Text>
|
|
37
|
-
<Text muted>
|
|
38
|
-
<a href="#">Link</a>
|
|
39
|
-
</Text>
|
|
40
|
-
<Text>
|
|
41
|
-
<code>Code</code>
|
|
42
|
-
</Text>
|
|
43
|
-
<Text accent>Accent</Text>
|
|
44
|
-
</Stack>
|
|
45
|
-
</Button>
|
|
46
|
-
))}
|
|
47
|
-
</Grid>
|
|
48
|
-
</Stack>
|
|
49
|
-
</Flex>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {RocketIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex, Inline} from '@sanity/ui'
|
|
3
|
-
|
|
4
|
-
export default function CustomIconsStory() {
|
|
5
|
-
return (
|
|
6
|
-
<Flex align="center" height="fill" justify="center">
|
|
7
|
-
<Inline space={1}>
|
|
8
|
-
<Button fontSize={1} icon={RocketIcon} padding={2} space={2} text="Rocket" />
|
|
9
|
-
<Button fontSize={1} icon={CustomIcon} padding={2} space={2} text="Heart" />
|
|
10
|
-
</Inline>
|
|
11
|
-
</Flex>
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function CustomIcon() {
|
|
16
|
-
return (
|
|
17
|
-
<svg
|
|
18
|
-
stroke="currentColor"
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
strokeWidth="0"
|
|
21
|
-
viewBox="0 0 24 24"
|
|
22
|
-
height="1em"
|
|
23
|
-
width="1em"
|
|
24
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
-
>
|
|
26
|
-
<path fill="none" d="M0 0h24v24H0z"></path>
|
|
27
|
-
<path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path>
|
|
28
|
-
</svg>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import {SquareIcon} from '@sanity/icons'
|
|
2
|
-
|
|
3
|
-
import {Card} from '../../card/card'
|
|
4
|
-
import {Container} from '../../container/container'
|
|
5
|
-
import {Grid} from '../../grid/grid'
|
|
6
|
-
import {Stack} from '../../stack/stack'
|
|
7
|
-
import {Text} from '../../text/text'
|
|
8
|
-
import {Button, ButtonOwnProps} from '../button'
|
|
9
|
-
|
|
10
|
-
const GAP = 4
|
|
11
|
-
const COLUMNS = 3
|
|
12
|
-
|
|
13
|
-
const DEFAULT_PROPS: ButtonOwnProps = {
|
|
14
|
-
icon: SquareIcon,
|
|
15
|
-
iconRight: SquareIcon,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function Layout() {
|
|
19
|
-
return (
|
|
20
|
-
<Container width={2}>
|
|
21
|
-
<Stack space={4}>
|
|
22
|
-
<Grid columns={COLUMNS} gap={GAP}>
|
|
23
|
-
<Text size={1} weight="semibold">
|
|
24
|
-
Default
|
|
25
|
-
</Text>
|
|
26
|
-
<Text size={1} weight="semibold">
|
|
27
|
-
Ghost
|
|
28
|
-
</Text>
|
|
29
|
-
<Text size={1} weight="semibold">
|
|
30
|
-
Bleed
|
|
31
|
-
</Text>
|
|
32
|
-
</Grid>
|
|
33
|
-
|
|
34
|
-
<Stack space={2}>
|
|
35
|
-
<Grid columns={COLUMNS} gap={GAP}>
|
|
36
|
-
<Stack space={2}>
|
|
37
|
-
<Button {...DEFAULT_PROPS} mode="default" text="Enabled" />
|
|
38
|
-
<Button {...DEFAULT_PROPS} disabled mode="default" text="Disabled" />
|
|
39
|
-
<Button {...DEFAULT_PROPS} disabled mode="default" muted text="Disabled (muted)" />
|
|
40
|
-
</Stack>
|
|
41
|
-
|
|
42
|
-
<Stack space={2}>
|
|
43
|
-
<Button {...DEFAULT_PROPS} mode="ghost" text="Enabled" />
|
|
44
|
-
<Button {...DEFAULT_PROPS} disabled mode="ghost" text="Disabled" />
|
|
45
|
-
<Button {...DEFAULT_PROPS} disabled mode="ghost" muted text="Disabled (muted)" />
|
|
46
|
-
</Stack>
|
|
47
|
-
|
|
48
|
-
<Stack space={2}>
|
|
49
|
-
<Button {...DEFAULT_PROPS} mode="bleed" text="Enabled" />
|
|
50
|
-
<Button {...DEFAULT_PROPS} mode="bleed" disabled text="Disabled" />
|
|
51
|
-
<Button {...DEFAULT_PROPS} disabled mode="bleed" muted text="Disabled (muted)" />
|
|
52
|
-
</Stack>
|
|
53
|
-
</Grid>
|
|
54
|
-
</Stack>
|
|
55
|
-
</Stack>
|
|
56
|
-
</Container>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default function DisabledButtonStory() {
|
|
61
|
-
return (
|
|
62
|
-
<Stack>
|
|
63
|
-
<Stack space={4}>
|
|
64
|
-
<Card padding={5} scheme="light">
|
|
65
|
-
<Layout />
|
|
66
|
-
</Card>
|
|
67
|
-
|
|
68
|
-
<Card padding={5} scheme="dark">
|
|
69
|
-
<Layout />
|
|
70
|
-
</Card>
|
|
71
|
-
</Stack>
|
|
72
|
-
</Stack>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/button',
|
|
6
|
-
title: 'Button',
|
|
7
|
-
stories: [
|
|
8
|
-
{
|
|
9
|
-
name: 'props',
|
|
10
|
-
title: 'Props',
|
|
11
|
-
component: lazy(() => import('./props')),
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
name: 'styled-1',
|
|
15
|
-
title: 'Styled #1',
|
|
16
|
-
component: lazy(() => import('./styled1')),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'styled-2',
|
|
20
|
-
title: 'Styled #2',
|
|
21
|
-
component: lazy(() => import('./styled2')),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'stacked',
|
|
25
|
-
title: 'Stacked',
|
|
26
|
-
component: lazy(() => import('./stacked')),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'custom',
|
|
30
|
-
title: 'Custom',
|
|
31
|
-
component: lazy(() => import('./custom')),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'mixed-children',
|
|
35
|
-
title: 'Mixed children',
|
|
36
|
-
component: lazy(() => import('./mixedChildren')),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'upload-button',
|
|
40
|
-
title: 'Upload button',
|
|
41
|
-
component: lazy(() => import('./uploadButton')),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'sanity-upload-button-workaround',
|
|
45
|
-
title: 'SanityUploadButtonWorkaroundStory',
|
|
46
|
-
component: lazy(() => import('./sanityUploadButton')),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'custom-icons',
|
|
50
|
-
title: 'Custom icons',
|
|
51
|
-
component: lazy(() => import('./customIcons')),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: 'disabled',
|
|
55
|
-
title: 'Disabled',
|
|
56
|
-
component: lazy(() => import('./disabled')),
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {AddIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex} from '@sanity/ui'
|
|
3
|
-
|
|
4
|
-
export default function MixedChildrenStory() {
|
|
5
|
-
return (
|
|
6
|
-
<Flex align="center" height="fill" justify="center">
|
|
7
|
-
<Button fontSize={[2, 2, 3]} icon={AddIcon} mode="ghost" padding={[3, 3, 4]} text="Create">
|
|
8
|
-
<span style={{display: 'none'}}>test</span>
|
|
9
|
-
</Button>
|
|
10
|
-
</Flex>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {icons} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex} from '@sanity/ui'
|
|
3
|
-
import {useAction, useBoolean, useSelect, useText} from '@sanity/ui-workshop'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
WORKSHOP_BUTTON_MODE_OPTIONS,
|
|
7
|
-
WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS,
|
|
8
|
-
WORKSHOP_BUTTON_TONE_OPTIONS,
|
|
9
|
-
WORKSHOP_FLEX_JUSTIFY_OPTIONS,
|
|
10
|
-
WORKSHOP_ICON_SYMBOL_OPTIONS,
|
|
11
|
-
WORKSHOP_SPACE_OPTIONS,
|
|
12
|
-
WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
13
|
-
WORKSHOP_TEXT_WEIGHT_OPTIONS,
|
|
14
|
-
} from '../../../__workshop__/constants'
|
|
15
|
-
|
|
16
|
-
export default function ButtonStory() {
|
|
17
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
18
|
-
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
|
|
19
|
-
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props')
|
|
20
|
-
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props')
|
|
21
|
-
const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props')
|
|
22
|
-
const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default', 'Props')
|
|
23
|
-
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
24
|
-
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
25
|
-
const selected = useBoolean('Selected', false, 'Props')
|
|
26
|
-
const space = useSelect('Space', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
27
|
-
const tone = useSelect('Tone', WORKSHOP_BUTTON_TONE_OPTIONS, 'default', 'Props')
|
|
28
|
-
const textAlign =
|
|
29
|
-
useSelect('Text align', WORKSHOP_BUTTON_TEXT_ALIGN_OPTIONS, undefined, 'Props') || undefined
|
|
30
|
-
const textProp = useText('Text', 'Label', 'Props')
|
|
31
|
-
const textWeight =
|
|
32
|
-
useSelect('Text weight', WORKSHOP_TEXT_WEIGHT_OPTIONS, '', 'Props') || undefined
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Flex align="center" height="fill" justify="center">
|
|
36
|
-
<Button
|
|
37
|
-
disabled={disabled}
|
|
38
|
-
fontSize={fontSize}
|
|
39
|
-
icon={icon && icons[icon]}
|
|
40
|
-
iconRight={iconRight && icons[iconRight]}
|
|
41
|
-
justify={justify}
|
|
42
|
-
mode={mode}
|
|
43
|
-
onClick={useAction('onClick')}
|
|
44
|
-
paddingX={paddingX}
|
|
45
|
-
paddingY={paddingY}
|
|
46
|
-
selected={selected}
|
|
47
|
-
space={space}
|
|
48
|
-
textAlign={textAlign}
|
|
49
|
-
text={textProp}
|
|
50
|
-
textWeight={textWeight}
|
|
51
|
-
tone={tone}
|
|
52
|
-
/>
|
|
53
|
-
</Flex>
|
|
54
|
-
)
|
|
55
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {UploadIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex} from '@sanity/ui'
|
|
3
|
-
import {styled} from 'styled-components'
|
|
4
|
-
|
|
5
|
-
const SanityUploadButton = styled(Button).attrs({forwardedAs: 'label'})`
|
|
6
|
-
& input {
|
|
7
|
-
appearance: none;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
overflow: clip;
|
|
10
|
-
top: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
|
-
opacity: 0;
|
|
15
|
-
position: absolute;
|
|
16
|
-
max-width: 0;
|
|
17
|
-
width: -webkit-fill-available;
|
|
18
|
-
width: stretch;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
& span:nth-child(2) {
|
|
22
|
-
width: 0;
|
|
23
|
-
flex: none;
|
|
24
|
-
padding: 0;
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
export default function SanityUploadButtonWorkaroundStory() {
|
|
29
|
-
return (
|
|
30
|
-
<Flex align="center" height="fill" justify="center">
|
|
31
|
-
<SanityUploadButton icon={UploadIcon} tabIndex={0} text="Upload">
|
|
32
|
-
<input type="file" />
|
|
33
|
-
</SanityUploadButton>
|
|
34
|
-
</Flex>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {icons} from '@sanity/icons'
|
|
2
|
-
import {Box, Button, Card, Container, Flex, Stack} from '@sanity/ui'
|
|
3
|
-
import {useAction, useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
WORKSHOP_BUTTON_MODE_OPTIONS,
|
|
7
|
-
WORKSHOP_BUTTON_TONE_OPTIONS,
|
|
8
|
-
WORKSHOP_FLEX_JUSTIFY_OPTIONS,
|
|
9
|
-
WORKSHOP_ICON_SYMBOL_OPTIONS,
|
|
10
|
-
WORKSHOP_SPACE_OPTIONS,
|
|
11
|
-
WORKSHOP_TEXT_SIZE_OPTIONS,
|
|
12
|
-
} from '../../../__workshop__/constants'
|
|
13
|
-
|
|
14
|
-
export default function StackedStory() {
|
|
15
|
-
const tones = Object.entries(WORKSHOP_BUTTON_TONE_OPTIONS)
|
|
16
|
-
const disabled = useBoolean('Disabled', false, 'Props')
|
|
17
|
-
const fontSize = useSelect('Font size', WORKSHOP_TEXT_SIZE_OPTIONS, 2, 'Props')
|
|
18
|
-
const icon = useSelect('Icon', WORKSHOP_ICON_SYMBOL_OPTIONS, 'add-circle', 'Props')
|
|
19
|
-
const iconRight = useSelect('Icon (right)', WORKSHOP_ICON_SYMBOL_OPTIONS, '', 'Props')
|
|
20
|
-
const justify = useSelect('Justify', WORKSHOP_FLEX_JUSTIFY_OPTIONS, 'center', 'Props')
|
|
21
|
-
const mode = useSelect('Mode', WORKSHOP_BUTTON_MODE_OPTIONS, 'default', 'Props')
|
|
22
|
-
const onClick = useAction('onClick')
|
|
23
|
-
const paddingX = useSelect('Padding X', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
24
|
-
const paddingY = useSelect('Padding Y', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
25
|
-
const selected = useBoolean('Selected', false, 'Props')
|
|
26
|
-
const space = useSelect('Space', WORKSHOP_SPACE_OPTIONS, 3, 'Props')
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Card height="fill">
|
|
30
|
-
<Flex align="center" height="fill" justify="center">
|
|
31
|
-
<Container width={0} style={{textAlign: 'center'}}>
|
|
32
|
-
<Box padding={4}>
|
|
33
|
-
<Stack space={1}>
|
|
34
|
-
{tones.map(([title, tone]) => (
|
|
35
|
-
<Button
|
|
36
|
-
disabled={disabled}
|
|
37
|
-
fontSize={fontSize}
|
|
38
|
-
icon={icon && icons[icon]}
|
|
39
|
-
iconRight={iconRight && icons[iconRight]}
|
|
40
|
-
justify={justify}
|
|
41
|
-
key={tone}
|
|
42
|
-
mode={mode}
|
|
43
|
-
onClick={onClick}
|
|
44
|
-
paddingX={paddingX}
|
|
45
|
-
paddingY={paddingY}
|
|
46
|
-
selected={selected}
|
|
47
|
-
space={space}
|
|
48
|
-
text={title}
|
|
49
|
-
tone={tone}
|
|
50
|
-
/>
|
|
51
|
-
))}
|
|
52
|
-
</Stack>
|
|
53
|
-
</Box>
|
|
54
|
-
</Container>
|
|
55
|
-
</Flex>
|
|
56
|
-
</Card>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {Button, Flex} from '@sanity/ui'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
|
|
4
|
-
const StyledButton1 = styled.a`
|
|
5
|
-
&:hover {
|
|
6
|
-
background-color: red;
|
|
7
|
-
box-shadow: none;
|
|
8
|
-
}
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export default function StyledButton1Story() {
|
|
12
|
-
return (
|
|
13
|
-
<Flex align="center" height="fill" justify="center">
|
|
14
|
-
<Button as={StyledButton1} href="#" text="Test" />
|
|
15
|
-
</Flex>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {Button, Flex} from '@sanity/ui'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
|
|
4
|
-
const StyledButton2 = styled(Button)<{$color?: boolean}>`
|
|
5
|
-
&:hover {
|
|
6
|
-
background-color: red;
|
|
7
|
-
box-shadow: none;
|
|
8
|
-
}
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export default function StyledButton2Story() {
|
|
12
|
-
const props = {href: '#', text: 'Test'}
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<Flex align="center" height="fill" justify="center">
|
|
16
|
-
<StyledButton2 $color forwardedAs="a" {...props} />
|
|
17
|
-
</Flex>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {Button, Flex} from '@sanity/ui'
|
|
2
|
-
import {useCallback, useRef} from 'react'
|
|
3
|
-
|
|
4
|
-
export default function UploadButtonStory() {
|
|
5
|
-
const inputRef = useRef<HTMLInputElement | null>(null)
|
|
6
|
-
|
|
7
|
-
const handleKeyDown = useCallback((event: React.KeyboardEvent) => {
|
|
8
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
9
|
-
inputRef.current?.click()
|
|
10
|
-
}
|
|
11
|
-
}, [])
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Flex align="center" height="fill" justify="center">
|
|
15
|
-
<Button
|
|
16
|
-
as="label"
|
|
17
|
-
onKeyDown={handleKeyDown}
|
|
18
|
-
tabIndex={0}
|
|
19
|
-
text={
|
|
20
|
-
<>
|
|
21
|
-
Upload
|
|
22
|
-
<input id="file" ref={inputRef} type="file" style={{display: 'none'}} />
|
|
23
|
-
</>
|
|
24
|
-
}
|
|
25
|
-
/>
|
|
26
|
-
</Flex>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {Card, Container, Flex, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
3
|
-
|
|
4
|
-
export default function AllTonesStory() {
|
|
5
|
-
return (
|
|
6
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
7
|
-
<Container width={0}>
|
|
8
|
-
<Stack space={3}>
|
|
9
|
-
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
10
|
-
<Card
|
|
11
|
-
key={tone}
|
|
12
|
-
padding={3}
|
|
13
|
-
radius={2}
|
|
14
|
-
shadow={2}
|
|
15
|
-
style={{textAlign: 'center'}}
|
|
16
|
-
tone={tone}
|
|
17
|
-
>
|
|
18
|
-
<Text size={1}>{tone}</Text>
|
|
19
|
-
</Card>
|
|
20
|
-
))}
|
|
21
|
-
</Stack>
|
|
22
|
-
</Container>
|
|
23
|
-
</Flex>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {Box, Card, Container, Flex, Grid, Stack, Text} from '@sanity/ui'
|
|
2
|
-
|
|
3
|
-
import {WORKSHOP_CARD_TONE_OPTIONS} from '../../../__workshop__/constants'
|
|
4
|
-
|
|
5
|
-
export default function AsButtonStory() {
|
|
6
|
-
const tones = Object.entries(WORKSHOP_CARD_TONE_OPTIONS)
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<Flex align="center" height="fill" justify="center" padding={4} sizing="border">
|
|
10
|
-
<Container>
|
|
11
|
-
<Grid columns={3} gap={2}>
|
|
12
|
-
<Box>
|
|
13
|
-
<Text align="center" size={1} weight="medium">
|
|
14
|
-
Enabled
|
|
15
|
-
</Text>
|
|
16
|
-
<Stack marginTop={3} space={2}>
|
|
17
|
-
{tones.map(([title, tone]) => (
|
|
18
|
-
<Card
|
|
19
|
-
__unstable_focusRing
|
|
20
|
-
as="button"
|
|
21
|
-
key={tone}
|
|
22
|
-
padding={3}
|
|
23
|
-
style={{textAlign: 'center'}}
|
|
24
|
-
tone={tone}
|
|
25
|
-
>
|
|
26
|
-
<Stack space={2}>
|
|
27
|
-
<Text size={1} weight="medium">
|
|
28
|
-
{title}
|
|
29
|
-
</Text>
|
|
30
|
-
<Text muted size={1}>
|
|
31
|
-
Muted
|
|
32
|
-
</Text>
|
|
33
|
-
<Text accent size={1}>
|
|
34
|
-
Accent
|
|
35
|
-
</Text>
|
|
36
|
-
</Stack>
|
|
37
|
-
</Card>
|
|
38
|
-
))}
|
|
39
|
-
</Stack>
|
|
40
|
-
</Box>
|
|
41
|
-
|
|
42
|
-
<Box>
|
|
43
|
-
<Text align="center" size={1} weight="medium">
|
|
44
|
-
Disabled
|
|
45
|
-
</Text>
|
|
46
|
-
<Stack marginTop={3} space={2}>
|
|
47
|
-
{tones.map(([title, tone]) => (
|
|
48
|
-
<Card
|
|
49
|
-
__unstable_focusRing
|
|
50
|
-
as="button"
|
|
51
|
-
disabled
|
|
52
|
-
key={tone}
|
|
53
|
-
padding={3}
|
|
54
|
-
style={{textAlign: 'center'}}
|
|
55
|
-
tone={tone}
|
|
56
|
-
>
|
|
57
|
-
<Stack space={2}>
|
|
58
|
-
<Text size={1} weight="medium">
|
|
59
|
-
{title}
|
|
60
|
-
</Text>
|
|
61
|
-
<Text size={1} muted>
|
|
62
|
-
Muted
|
|
63
|
-
</Text>
|
|
64
|
-
<Text accent size={1}>
|
|
65
|
-
Accent
|
|
66
|
-
</Text>
|
|
67
|
-
</Stack>
|
|
68
|
-
</Card>
|
|
69
|
-
))}
|
|
70
|
-
</Stack>
|
|
71
|
-
</Box>
|
|
72
|
-
|
|
73
|
-
<Box>
|
|
74
|
-
<Text align="center" size={1} weight="medium">
|
|
75
|
-
Selected
|
|
76
|
-
</Text>
|
|
77
|
-
<Stack marginTop={3} space={2}>
|
|
78
|
-
{tones.map(([title, tone]) => (
|
|
79
|
-
<Card
|
|
80
|
-
__unstable_focusRing
|
|
81
|
-
as="button"
|
|
82
|
-
key={tone}
|
|
83
|
-
padding={3}
|
|
84
|
-
selected
|
|
85
|
-
style={{textAlign: 'center'}}
|
|
86
|
-
tone={tone}
|
|
87
|
-
>
|
|
88
|
-
<Stack space={2}>
|
|
89
|
-
<Text size={1} weight="medium">
|
|
90
|
-
{title}
|
|
91
|
-
</Text>
|
|
92
|
-
<Text size={1} muted>
|
|
93
|
-
Muted
|
|
94
|
-
</Text>
|
|
95
|
-
<Text accent size={1}>
|
|
96
|
-
Accent
|
|
97
|
-
</Text>
|
|
98
|
-
</Stack>
|
|
99
|
-
</Card>
|
|
100
|
-
))}
|
|
101
|
-
</Stack>
|
|
102
|
-
</Box>
|
|
103
|
-
</Grid>
|
|
104
|
-
</Container>
|
|
105
|
-
</Flex>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {Card, Flex, Text} from '@sanity/ui'
|
|
2
|
-
import {forwardRef} from 'react'
|
|
3
|
-
|
|
4
|
-
const CustomLink = forwardRef(function CustomLink(
|
|
5
|
-
props: {req: string} & Omit<React.HTMLProps<HTMLAnchorElement>, 'as' | 'href'>,
|
|
6
|
-
ref: React.ForwardedRef<HTMLAnchorElement>,
|
|
7
|
-
): React.JSX.Element {
|
|
8
|
-
const {children, req, ...restProps} = props
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<a data-required={req} {...restProps} ref={ref}>
|
|
12
|
-
{children}
|
|
13
|
-
</a>
|
|
14
|
-
)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export default function AsComponentStory() {
|
|
18
|
-
const props = {href: '#'}
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Flex align="center" height="fill" justify="center">
|
|
22
|
-
<Card as={CustomLink} data-as="a" {...props} padding={3} req="example">
|
|
23
|
-
<Text size={1}>As component</Text>
|
|
24
|
-
</Card>
|
|
25
|
-
</Flex>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import {Card, Flex, Stack, Text} from '@sanity/ui'
|
|
2
|
-
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
3
|
-
|
|
4
|
-
export default function CheckeredStory() {
|
|
5
|
-
return (
|
|
6
|
-
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
7
|
-
<Stack space={1}>
|
|
8
|
-
{THEME_COLOR_CARD_TONES.map((tone) => (
|
|
9
|
-
<Card
|
|
10
|
-
__unstable_checkered
|
|
11
|
-
border
|
|
12
|
-
key={tone}
|
|
13
|
-
padding={3}
|
|
14
|
-
sizing="border"
|
|
15
|
-
style={{width: 120, height: 60}}
|
|
16
|
-
tone={tone}
|
|
17
|
-
>
|
|
18
|
-
<Text muted size={1}>
|
|
19
|
-
{tone}
|
|
20
|
-
</Text>
|
|
21
|
-
</Card>
|
|
22
|
-
))}
|
|
23
|
-
</Stack>
|
|
24
|
-
</Flex>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {defineScope} from '@sanity/ui-workshop'
|
|
2
|
-
import {lazy} from 'react'
|
|
3
|
-
|
|
4
|
-
export default defineScope({
|
|
5
|
-
name: 'primitives/card',
|
|
6
|
-
title: 'Card',
|
|
7
|
-
stories: [
|
|
8
|
-
{name: 'props', title: 'Props', component: lazy(() => import('./props'))},
|
|
9
|
-
{name: 'styled', title: 'Styled', component: lazy(() => import('./styled'))},
|
|
10
|
-
{name: 'interactive', title: 'Interactive', component: lazy(() => import('./interactive'))},
|
|
11
|
-
{name: 'tones', title: 'Tones', component: lazy(() => import('./allTones'))},
|
|
12
|
-
{name: 'as-button', title: 'As button', component: lazy(() => import('./asButton'))},
|
|
13
|
-
{name: 'list-nav', title: 'List navigation', component: lazy(() => import('./listNavigation'))},
|
|
14
|
-
{name: 'checkered', title: 'Checkered', component: lazy(() => import('./checkered'))},
|
|
15
|
-
{name: 'as-component', title: 'As component', component: lazy(() => import('./asComponent'))},
|
|
16
|
-
{name: 'selected', title: 'Selected', component: lazy(() => import('./selected'))},
|
|
17
|
-
],
|
|
18
|
-
})
|