@sanity/ui 3.0.0-static.33 → 3.0.0-static.34
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 +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +263 -375
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/refractor.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +263 -377
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -1
- package/dist/_visual-editing.cjs +0 -2
- package/dist/_visual-editing.cjs.map +1 -1
- package/dist/_visual-editing.d.cts +2 -904
- package/dist/_visual-editing.d.ts +2 -904
- package/dist/_visual-editing.js +2 -4
- package/dist/css/index.cjs +12 -12
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +805 -14697
- package/dist/css/index.d.ts +805 -14697
- package/dist/css/index.js +12 -12
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +241 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +990 -3095
- package/dist/index.d.ts +990 -3095
- package/dist/index.js +243 -360
- package/dist/index.js.map +1 -1
- package/dist/portalProvider-DgNIVviV.d.ts +575 -0
- package/dist/theme.cjs +367 -4288
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +272 -1806
- package/dist/theme.d.ts +272 -1806
- package/dist/theme.js +371 -4292
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +0 -2
- package/package.json +3 -4
- package/src/core/Root.tsx +4 -2
- package/src/core/RootProvider.tsx +4 -4
- package/src/core/__workshop__/boundary.tsx +1 -1
- package/src/core/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/async.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/example.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/__workshop__/index.ts +5 -3
- package/src/core/components/autocomplete/__workshop__/mock/apiStore.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/mock/countries.ts +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +2 -2
- package/src/core/components/autocomplete/autocompleteOption.tsx +2 -2
- package/src/core/components/autocomplete/constants.ts +2 -2
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/__workshop__/index.ts +5 -3
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +6 -11
- package/src/core/components/dialog/__workshop__/activate.tsx +1 -1
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +1 -1
- package/src/core/components/dialog/__workshop__/index.ts +5 -3
- package/src/core/components/dialog/__workshop__/layering.tsx +1 -1
- package/src/core/components/dialog/__workshop__/nested.tsx +2 -3
- package/src/core/components/dialog/__workshop__/onScroll.tsx +1 -1
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/__workshop__/position.tsx +1 -1
- package/src/core/components/dialog/__workshop__/props.tsx +1 -1
- package/src/core/components/dialog/__workshop__/provider.tsx +1 -1
- package/src/core/components/dialog/__workshop__/wrapped.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +5 -6
- package/src/core/components/dialog/dialogCard.tsx +2 -2
- package/src/core/components/dialog/dialogContext.ts +3 -4
- package/src/core/components/dialog/dialogProvider.tsx +2 -2
- package/src/core/components/hotkeys/__workshop__/index.ts +5 -3
- package/src/core/components/hotkeys/__workshop__/plain.tsx +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -15
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +3 -3
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -1
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +1 -1
- package/src/core/components/menu/__workshop__/index.ts +5 -3
- package/src/core/components/menu/__workshop__/menuButton.tsx +2 -2
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +1 -1
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +1 -1
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +1 -1
- package/src/core/components/menu/__workshop__/selectedItem.tsx +1 -1
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -1
- package/src/core/components/menu/__workshop__/tones.tsx +3 -3
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +2 -1
- package/src/core/components/menu/menu.tsx +7 -22
- package/src/core/components/menu/menuButton.tsx +4 -50
- package/src/core/components/menu/menuContext.ts +3 -15
- package/src/core/components/menu/menuDivider.tsx +2 -2
- package/src/core/components/menu/menuGroup.tsx +10 -15
- package/src/core/components/menu/menuItem.tsx +7 -18
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/__workshop__/index.ts +5 -3
- package/src/core/components/tab/tab.tsx +6 -4
- package/src/core/components/tab/tabList.tsx +3 -8
- package/src/core/components/tab/tabPanel.tsx +2 -2
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/__workshop__/index.ts +5 -3
- package/src/core/components/toast/__workshop__/toast.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +2 -1
- package/src/core/components/toast/toast.tsx +2 -2
- package/src/core/components/toast/toastContext.ts +4 -4
- package/src/core/components/toast/toastLayer.tsx +3 -3
- package/src/core/components/tree/__workshop__/basic.perf.ts +1 -1
- package/src/core/components/tree/__workshop__/basic.tsx +1 -1
- package/src/core/components/tree/__workshop__/index.ts +5 -3
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/tree.tsx +8 -9
- package/src/core/components/tree/treeContext.ts +4 -4
- package/src/core/components/tree/treeGroup.tsx +6 -8
- package/src/core/components/tree/treeItem.tsx +4 -4
- package/src/core/components/tree/types.ts +1 -1
- package/src/core/components/virtualList/__workshop__/changingProps.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/elementScroll.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/index.ts +5 -3
- package/src/core/components/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/components/virtualList/__workshop__/windowScrolll.tsx +1 -1
- package/src/core/components/virtualList/virtualList.tsx +2 -2
- package/src/core/constants.ts +0 -18
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +5 -3
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +6 -1
- package/src/core/index.ts +1 -24
- package/src/core/lib/createGlobalScopedContext.ts +1 -1
- package/src/core/lib/globalScope.ts +1 -1
- package/src/core/observers/elementSize.ts +1 -1
- package/src/core/primitives/arrow/arrow.tsx +2 -2
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/index.ts +5 -3
- package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +3 -10
- package/src/core/primitives/avatar/avatarCounter.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +2 -4
- package/src/core/primitives/avatar/types.ts +0 -32
- package/src/core/primitives/badge/__workshop__/index.ts +5 -3
- package/src/core/primitives/badge/__workshop__/props.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -1
- package/src/core/primitives/badge/badge.tsx +12 -11
- package/src/core/primitives/box/__workshop__/index.ts +5 -3
- package/src/core/primitives/box/__workshop__/props.tsx +1 -1
- package/src/core/primitives/box/__workshop__/responsive.tsx +1 -1
- package/src/core/primitives/box/box.tsx +28 -32
- package/src/core/primitives/button/__workshop__/custom.tsx +5 -5
- package/src/core/primitives/button/__workshop__/customIcons.tsx +1 -1
- package/src/core/primitives/button/__workshop__/disabled.tsx +3 -3
- package/src/core/primitives/button/__workshop__/index.ts +5 -3
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +1 -1
- package/src/core/primitives/button/__workshop__/props.tsx +1 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/__workshop__/textOverflow.tsx +1 -1
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +1 -1
- package/src/core/primitives/button/button.test.tsx +2 -1
- package/src/core/primitives/button/button.tsx +4 -7
- package/src/core/primitives/button/types.ts +0 -20
- package/src/core/primitives/card/__workshop__/asButton.tsx +2 -2
- package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
- package/src/core/primitives/card/__workshop__/checkered.tsx +3 -3
- package/src/core/primitives/card/__workshop__/index.ts +5 -3
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -1
- package/src/core/primitives/card/__workshop__/props.tsx +1 -1
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/card/card.tsx +4 -2
- package/src/core/primitives/card/cardContext.ts +1 -1
- package/src/core/primitives/card/cardProvider.tsx +4 -4
- package/src/core/primitives/card/types.ts +5 -19
- package/src/core/primitives/checkbox/__workshop__/example.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/index.ts +5 -3
- package/src/core/primitives/checkbox/__workshop__/props.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +3 -3
- package/src/core/primitives/checkbox/checkbox.tsx +2 -2
- package/src/core/primitives/code/__workshop__/index.ts +5 -3
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/__workshop__/props.tsx +1 -1
- package/src/core/primitives/code/code.tsx +4 -2
- package/src/core/primitives/code/refractor.tsx +1 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -1
- package/src/core/primitives/container/__workshop__/index.ts +5 -3
- package/src/core/primitives/container/container.tsx +2 -2
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/gap.tsx +1 -1
- package/src/core/primitives/flex/__workshop__/index.ts +5 -3
- package/src/core/primitives/flex/flex.tsx +4 -2
- package/src/core/primitives/grid/__workshop__/index.ts +5 -3
- package/src/core/primitives/grid/__workshop__/responsive.tsx +3 -3
- package/src/core/primitives/grid/grid.tsx +4 -2
- package/src/core/primitives/heading/__workshop__/index.ts +5 -3
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -4
- package/src/core/primitives/inline/__workshop__/index.ts +5 -3
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +4 -11
- package/src/core/primitives/kbd/__workshop__/index.ts +5 -3
- package/src/core/primitives/kbd/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/kbd/kbd.tsx +4 -2
- package/src/core/primitives/label/__workshop__/index.ts +5 -3
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/label/label.tsx +2 -4
- package/src/core/primitives/layer/__workshop__/_debug.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/index.ts +5 -3
- package/src/core/primitives/layer/__workshop__/multipleRoots.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/nested.tsx +1 -1
- package/src/core/primitives/layer/__workshop__/responsiveZOffset.tsx +1 -1
- package/src/core/primitives/layer/layer.test.tsx +2 -1
- package/src/core/primitives/layer/layer.tsx +2 -2
- package/src/core/primitives/layer/layerCard.tsx +2 -2
- package/src/core/primitives/layer/layerContext.ts +4 -4
- package/src/core/primitives/layer/layerProvider.tsx +2 -10
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +1 -1
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +3 -3
- package/src/core/primitives/popover/__workshop__/index.ts +5 -3
- package/src/core/primitives/popover/popover.tsx +4 -9
- package/src/core/primitives/popover/popoverLayer.tsx +2 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/__workshop__/index.ts +5 -3
- package/src/core/primitives/radio/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +2 -2
- package/src/core/primitives/select/__workshop__/index.ts +5 -3
- package/src/core/primitives/select/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +5 -15
- package/src/core/primitives/selectable/selectable.tsx +4 -4
- package/src/core/primitives/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/primitives/skeleton/__workshop__/index.ts +5 -3
- package/src/core/primitives/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/codeSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/headingSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/labelSkeleton.tsx +2 -2
- package/src/core/primitives/skeleton/skeleton.tsx +2 -2
- package/src/core/primitives/skeleton/textSkeleton.tsx +2 -2
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -1
- package/src/core/primitives/spinner/__workshop__/index.ts +5 -3
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +2 -2
- package/src/core/primitives/spinner/spinner.tsx +2 -2
- package/src/core/primitives/srOnly/srOnly.tsx +2 -2
- package/src/core/primitives/stack/__workshop__/index.ts +5 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -10
- package/src/core/primitives/switch/__workshop__/example.tsx +1 -1
- package/src/core/primitives/switch/__workshop__/index.ts +5 -3
- package/src/core/primitives/switch/__workshop__/props.tsx +1 -1
- package/src/core/primitives/switch/switch.tsx +2 -2
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/__workshop__/example.tsx +1 -1
- package/src/core/primitives/text/__workshop__/index.ts +5 -3
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +4 -4
- package/src/core/primitives/textArea/__workshop__/index.ts +5 -3
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textArea/textArea.tsx +5 -15
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/index.ts +5 -3
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/states.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/tones.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/typed.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +6 -9
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/index.ts +5 -3
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +2 -4
- package/src/core/primitives/tooltip/tooltip.tsx +5 -9
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +4 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +5 -3
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -2
- package/src/core/{types/props.ts → types.ts} +27 -0
- package/src/core/utils/boundaryElement/__workshop__/index.ts +5 -3
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +1 -1
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +2 -1
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +7 -4
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/index.ts +5 -3
- package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
- package/src/core/utils/getElementRef.ts +1 -1
- package/src/core/utils/portal/__workshop__/index.ts +5 -3
- package/src/core/utils/portal/__workshop__/named.tsx +1 -1
- package/src/core/utils/portal/portal.test.tsx +2 -1
- package/src/core/utils/portal/portalContext.ts +5 -2
- package/src/core/utils/portal/portalProvider.tsx +5 -9
- package/src/css/_responsiveClassName.ts +2 -2
- package/src/css/_style.css.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.css.ts +1 -1
- package/src/css/components/dialog/dialog.css.ts +9 -17
- package/src/css/components/menu/menu.css.ts +2 -2
- package/src/css/components/menu/menu.ts +2 -2
- package/src/css/components/skeleton/skeleton.css.ts +2 -6
- package/src/css/components/toast/toast.css.ts +2 -2
- package/src/css/components/toast/toast.ts +2 -2
- package/src/css/components/tree/tree.css.ts +1 -1
- package/src/css/components/tree/tree.ts +1 -1
- package/src/css/defaultTheme.css.ts +59 -60
- package/src/css/layers.css.ts +4 -1
- package/src/css/primitives/_arrow/_arrow.css.ts +5 -5
- package/src/css/primitives/_input/_input.css.ts +4 -4
- package/src/css/primitives/_selectable/_selectable.css.ts +4 -4
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.css.ts +10 -10
- package/src/css/primitives/badge/badge.css.ts +4 -4
- package/src/css/primitives/badge/types.ts +8 -2
- package/src/css/primitives/box/box.css.ts +2 -2
- package/src/css/primitives/button/button.css.ts +6 -6
- package/src/css/primitives/button/button.ts +2 -2
- package/src/css/primitives/button/types.ts +3 -3
- package/src/css/primitives/card/__workshop__/color.tsx +9 -9
- package/src/css/primitives/card/__workshop__/index.ts +5 -3
- package/src/css/primitives/card/card.css.ts +12 -18
- package/src/css/primitives/card/types.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.css.ts +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.css.ts +4 -3
- package/src/css/primitives/code/types.ts +3 -4
- package/src/css/primitives/container/container.css.ts +1 -1
- package/src/css/primitives/heading/heading.css.ts +5 -4
- package/src/css/primitives/heading/types.ts +3 -6
- package/src/css/primitives/kbd/kbd.css.ts +1 -1
- package/src/css/primitives/label/label.css.ts +5 -4
- package/src/css/primitives/label/types.ts +0 -8
- package/src/css/primitives/popover/popover.css.ts +2 -2
- package/src/css/primitives/popover/popover.ts +2 -2
- package/src/css/primitives/radio/radio.css.ts +3 -3
- package/src/css/primitives/radio/radio.ts +3 -3
- package/src/css/primitives/root/root.css.ts +1 -1
- package/src/css/primitives/root/root.ts +1 -1
- package/src/css/primitives/root/types.ts +3 -3
- package/src/css/primitives/select/select.css.ts +3 -3
- package/src/css/primitives/spinner/spinner.css.ts +2 -6
- package/src/css/primitives/spinner/spinner.ts +2 -2
- package/src/css/primitives/srOnly/srOnly.css.ts +1 -1
- package/src/css/primitives/srOnly/srOnly.ts +1 -1
- package/src/css/primitives/stack/stack.css.ts +1 -1
- package/src/css/primitives/stack/stack.ts +1 -1
- package/src/css/primitives/switch/switch.css.ts +5 -5
- package/src/css/primitives/text/text.css.ts +5 -4
- package/src/css/primitives/text/types.ts +3 -5
- package/src/css/primitives/textArea/textArea.css.ts +1 -1
- package/src/css/primitives/textInput/textInput.css.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.css.ts +1 -1
- package/src/css/props/alignItems/alignItems.ts +1 -1
- package/src/css/props/border/border.ts +1 -16
- package/src/css/props/boxSizing/boxSizing.css.ts +2 -1
- package/src/css/props/boxSizing/boxSizing.ts +0 -3
- package/src/css/props/display/display.ts +1 -10
- package/src/css/props/flex/flex.ts +1 -1
- package/src/css/props/flexDirection/flexDirection.ts +1 -1
- package/src/css/props/flexWrap/flexWrap.ts +1 -1
- package/src/css/props/font/font.css.ts +3 -2
- package/src/css/props/font/font.ts +1 -1
- package/src/css/props/gap/gap.ts +1 -1
- package/src/css/props/gridAutoColumns/gridAutoColumns.css.ts +2 -2
- package/src/css/props/gridAutoColumns/gridAutoColumns.ts +2 -2
- package/src/css/props/gridAutoColumns/types.ts +0 -10
- package/src/css/props/gridAutoFlow/gridAutoFlow.ts +2 -2
- package/src/css/props/gridAutoFlow/types.ts +0 -4
- package/src/css/props/gridAutoRows/gridAutoRows.ts +2 -2
- package/src/css/props/gridAutoRows/types.ts +0 -4
- package/src/css/props/gridColumn/gridColumn.ts +3 -3
- package/src/css/props/gridColumn/types.ts +0 -10
- package/src/css/props/gridColumnEnd/gridColumnEnd.ts +3 -3
- package/src/css/props/gridColumnEnd/types.ts +0 -10
- package/src/css/props/gridColumnStart/gridColumnStart.ts +3 -6
- package/src/css/props/gridColumnStart/types.ts +0 -10
- package/src/css/props/gridRow/gridRow.ts +3 -3
- package/src/css/props/gridRow/types.ts +0 -10
- package/src/css/props/gridRowEnd/gridRowEnd.ts +3 -3
- package/src/css/props/gridRowEnd/types.ts +0 -10
- package/src/css/props/gridRowStart/gridRowStart.ts +3 -3
- package/src/css/props/gridRowStart/types.ts +0 -10
- package/src/css/props/gridTemplateColumns/gridTemplateColumns.ts +2 -2
- package/src/css/props/gridTemplateColumns/types.ts +0 -10
- package/src/css/props/gridTemplateRows/gridTemplateRows.ts +2 -2
- package/src/css/props/gridTemplateRows/types.ts +0 -10
- package/src/css/props/height/height.ts +1 -1
- package/src/css/props/height/types.ts +0 -6
- package/src/css/props/inset/inset.ts +1 -1
- package/src/css/props/justifyContent/justifyContent.ts +1 -1
- package/src/css/props/margin/margin.ts +1 -1
- package/src/css/props/maxWidth/maxWidth.ts +1 -1
- package/src/css/props/minHeight/minHeight.ts +1 -1
- package/src/css/props/minWidth/minWidth.ts +1 -1
- package/src/css/props/outline/outline.ts +1 -1
- package/src/css/props/overflow/overflow.ts +1 -1
- package/src/css/props/overflow/types.ts +0 -6
- package/src/css/props/padding/padding.ts +1 -1
- package/src/css/props/pointerEvents/pointerEvents.ts +1 -1
- package/src/css/props/position/position.ts +1 -1
- package/src/css/props/radius/radius.ts +1 -1
- package/src/css/props/shadow/shadow.ts +1 -1
- package/src/css/props/textAlign/textAlign.ts +1 -1
- package/src/css/props/textOverflow/textOverflow.ts +1 -1
- package/src/css/props/width/width.ts +1 -1
- package/src/css/types.ts +225 -53
- package/src/css/util.ts +2 -2
- package/src/css/vars.css.ts +33 -36
- package/src/theme/{v3/_parseColorToken.ts → _parseColorToken.ts} +2 -2
- package/src/theme/buildTheme.ts +33 -0
- package/src/theme/constants.ts +90 -0
- package/src/theme/defaults/color.ts +197 -0
- package/src/theme/{v2/defaults/config.ts → defaults/common.ts} +3 -16
- package/src/theme/{v3/defaultFonts.ts → defaults/fonts.ts} +2 -2
- package/src/theme/index.ts +4 -5
- package/src/theme/{v3/resolveTokens.ts → resolveTokens.ts} +15 -15
- package/src/theme/types.ts +355 -15
- package/src/core/__DEV__.ts +0 -5
- package/src/core/_compat/helpers.ts +0 -72
- package/src/core/_compat/styles/_responsive.ts +0 -19
- package/src/core/_compat/theme/theme.test.tsx +0 -73
- package/src/core/_compat/theme/themeColorProvider.tsx +0 -24
- package/src/core/_compat/theme/themeContext.ts +0 -10
- package/src/core/_compat/theme/themeProvider.tsx +0 -68
- package/src/core/_compat/theme/types.ts +0 -10
- package/src/core/_compat/theme/useRootTheme.ts +0 -15
- package/src/core/_compat/theme/useTheme.ts +0 -12
- package/src/core/_compat/types.ts +0 -191
- package/src/core/hooks/useArrayProp.ts +0 -26
- package/src/core/hooks/useClickOutside.test.tsx +0 -481
- package/src/core/hooks/useClickOutside.ts +0 -113
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -30
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useElementRect/useElementRect.ts +0 -13
- package/src/core/hooks/useForwardedRef.ts +0 -19
- package/src/core/hooks/useIsomorphicEffect.ts +0 -7
- package/src/core/primitives/badge/types.ts +0 -18
- package/src/core/primitives/box/types.ts +0 -22
- package/src/core/primitives/flex/types.ts +0 -27
- package/src/core/primitives/grid/types.ts +0 -17
- package/src/core/primitives/selectable/types.ts +0 -7
- package/src/core/primitives/types.ts +0 -153
- package/src/core/types/gridItem.ts +0 -32
- package/src/core/types/placement.ts +0 -18
- package/src/core/types/radius.ts +0 -7
- package/src/core/types/textAlign.ts +0 -7
- package/src/core/utils/spanWithTextOverflow.tsx +0 -10
- package/src/theme/getScopedTheme.ts +0 -88
- package/src/theme/v0/avatar.ts +0 -10
- package/src/theme/v0/color/_generic.ts +0 -35
- package/src/theme/v0/color/_system.ts +0 -17
- package/src/theme/v0/color/base.ts +0 -21
- package/src/theme/v0/color/button.ts +0 -42
- package/src/theme/v0/color/card.ts +0 -19
- package/src/theme/v0/color/color.ts +0 -40
- package/src/theme/v0/color/index.ts +0 -11
- package/src/theme/v0/color/input.ts +0 -34
- package/src/theme/v0/color/muted.ts +0 -26
- package/src/theme/v0/color/selectable.ts +0 -31
- package/src/theme/v0/color/solid.ts +0 -26
- package/src/theme/v0/color/spot.ts +0 -13
- package/src/theme/v0/css.ts +0 -10
- package/src/theme/v0/focusRing.ts +0 -5
- package/src/theme/v0/font.ts +0 -40
- package/src/theme/v0/index.ts +0 -10
- package/src/theme/v0/input.ts +0 -23
- package/src/theme/v0/layer.ts +0 -6
- package/src/theme/v0/shadow.ts +0 -15
- package/src/theme/v0/styles.ts +0 -13
- package/src/theme/v0/theme.ts +0 -72
- package/src/theme/v2/avatar.ts +0 -12
- package/src/theme/v2/build/_deprecated/color/_selectable/createSelectableTones.ts +0 -76
- package/src/theme/v2/build/_deprecated/color/_solid/createSolidTones.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/button/createButtonModes.ts +0 -22
- package/src/theme/v2/build/_deprecated/color/button/createButtonTones.ts +0 -55
- package/src/theme/v2/build/_deprecated/color/card/createCardStates.ts +0 -60
- package/src/theme/v2/build/_deprecated/color/color.test.ts +0 -63
- package/src/theme/v2/build/_deprecated/color/defaults.ts +0 -390
- package/src/theme/v2/build/_deprecated/color/factory.ts +0 -141
- package/src/theme/v2/build/_deprecated/color/index.ts +0 -1
- package/src/theme/v2/build/_deprecated/color/input/createInputModes.ts +0 -86
- package/src/theme/v2/build/_deprecated/color/muted/createMuted.ts +0 -54
- package/src/theme/v2/build/_deprecated/color/spot/createSpot.ts +0 -20
- package/src/theme/v2/build/buildColorTheme.test.ts +0 -185
- package/src/theme/v2/build/buildColorTheme.ts +0 -494
- package/src/theme/v2/build/buildTheme.test.ts +0 -89
- package/src/theme/v2/build/buildTheme.ts +0 -37
- package/src/theme/v2/build/colorToken/colorToken.ts +0 -19
- package/src/theme/v2/build/colorToken/compileColorToken.ts +0 -21
- package/src/theme/v2/build/colorToken/index.ts +0 -2
- package/src/theme/v2/build/colorToken/types.ts +0 -6
- package/src/theme/v2/build/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/index.ts +0 -3
- package/src/theme/v2/build/lib/color-fns/blend/mix.ts +0 -21
- package/src/theme/v2/build/lib/color-fns/blend/multiply.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/blend/screen.ts +0 -18
- package/src/theme/v2/build/lib/color-fns/color-fns.test.ts +0 -68
- package/src/theme/v2/build/lib/color-fns/contrastRatio.ts +0 -34
- package/src/theme/v2/build/lib/color-fns/convert.ts +0 -150
- package/src/theme/v2/build/lib/color-fns/index.ts +0 -6
- package/src/theme/v2/build/lib/color-fns/parse.ts +0 -60
- package/src/theme/v2/build/lib/color-fns/rgba.ts +0 -14
- package/src/theme/v2/build/lib/color-fns/types.ts +0 -28
- package/src/theme/v2/build/lib/isRecord.ts +0 -3
- package/src/theme/v2/build/lib/utils.ts +0 -19
- package/src/theme/v2/build/merge.ts +0 -28
- package/src/theme/v2/build/mixThemeColor.test.ts +0 -23
- package/src/theme/v2/build/mixThemeColor.ts +0 -53
- package/src/theme/v2/build/renderColorTheme.ts +0 -532
- package/src/theme/v2/build/renderColorValue.ts +0 -85
- package/src/theme/v2/build/resolveColorTokens.ts +0 -268
- package/src/theme/v2/color/_constants.ts +0 -45
- package/src/theme/v2/color/_helpers.ts +0 -24
- package/src/theme/v2/color/_system.ts +0 -38
- package/src/theme/v2/color/avatar.ts +0 -11
- package/src/theme/v2/color/badge.ts +0 -12
- package/src/theme/v2/color/button.ts +0 -11
- package/src/theme/v2/color/color.ts +0 -28
- package/src/theme/v2/color/index.ts +0 -13
- package/src/theme/v2/color/input.ts +0 -23
- package/src/theme/v2/color/kbd.ts +0 -6
- package/src/theme/v2/color/selectable.ts +0 -8
- package/src/theme/v2/color/shadow.ts +0 -7
- package/src/theme/v2/color/state.ts +0 -41
- package/src/theme/v2/color/syntax.ts +0 -39
- package/src/theme/v2/config/helpers.ts +0 -48
- package/src/theme/v2/config/index.ts +0 -4
- package/src/theme/v2/config/system.ts +0 -114
- package/src/theme/v2/config/tokens/color/index.ts +0 -1
- package/src/theme/v2/config/tokens/color/types.ts +0 -137
- package/src/theme/v2/config/tokens/index.ts +0 -3
- package/src/theme/v2/config/tokens/parseTokenValue.test.ts +0 -44
- package/src/theme/v2/config/tokens/parseTokenValue.ts +0 -133
- package/src/theme/v2/config/tokens/types.ts +0 -53
- package/src/theme/v2/config/types.ts +0 -47
- package/src/theme/v2/defaults/colorPalette.ts +0 -5
- package/src/theme/v2/defaults/colorTokens.ts +0 -648
- package/src/theme/v2/defaults/fonts.ts +0 -227
- package/src/theme/v2/index.ts +0 -6
- package/src/theme/v2/input.ts +0 -31
- package/src/theme/v2/theme.ts +0 -45
- package/src/theme/v3/_constants.ts +0 -29
- package/src/theme/v3/buildTheme_v3.ts +0 -39
- package/src/theme/v3/color/_constants.ts +0 -15
- package/src/theme/v3/color/avatar.ts +0 -14
- package/src/theme/v3/color/card.ts +0 -79
- package/src/theme/v3/color/color.ts +0 -98
- package/src/theme/v3/color/element.ts +0 -19
- package/src/theme/v3/color/index.ts +0 -7
- package/src/theme/v3/color/token.ts +0 -32
- package/src/theme/v3/color/tokens.ts +0 -5
- package/src/theme/v3/defaultTokens.ts +0 -199
- package/src/theme/v3/index.ts +0 -9
- package/src/theme/v3/palette/constants.ts +0 -15
- package/src/theme/v3/palette/index.ts +0 -2
- package/src/theme/v3/palette/types.ts +0 -7
- package/src/theme/v3/tokens.ts +0 -16
- package/src/theme/v3/types.ts +0 -133
- package/src/theme/versioning/getTheme_v2.ts +0 -58
- package/src/theme/versioning/index.ts +0 -1
- package/src/theme/versioning/is_v0.ts +0 -7
- package/src/theme/versioning/is_v2.ts +0 -7
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -245
- package/src/theme/versioning/themeColor_v2_v2_9.ts +0 -49
- package/src/theme/versioning/themeColor_v3_v2.ts +0 -383
- package/src/theme/versioning/v0_v2.ts +0 -95
- package/src/theme/versioning/v2_v0.ts +0 -127
- package/src/theme/versioning/v3_v2.ts +0 -130
- /package/src/theme/{v3/merge.ts → merge.ts} +0 -0
|
@@ -29,8 +29,7 @@ import {Z_OFFSETS} from '../../constants'
|
|
|
29
29
|
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
30
30
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
31
31
|
import {origin} from '../../middleware/origin'
|
|
32
|
-
import type {Placement} from '../../types
|
|
33
|
-
import type {ComponentType, Props} from '../../types/props'
|
|
32
|
+
import type {ComponentType, Placement, Props} from '../../types'
|
|
34
33
|
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
35
34
|
import {getElementRef} from '../../utils/getElementRef'
|
|
36
35
|
import {Portal} from '../../utils/portal/portal'
|
|
@@ -63,8 +62,6 @@ export type PopoverOwnProps = Omit<LayerOwnProps, 'maxWidth'> & {
|
|
|
63
62
|
*/
|
|
64
63
|
animate?: boolean
|
|
65
64
|
arrow?: boolean
|
|
66
|
-
/** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
|
|
67
|
-
boundaryElement?: HTMLElement | null
|
|
68
65
|
children?: ReactElement<{ref: ForwardedRef<HTMLElement>}>
|
|
69
66
|
/**
|
|
70
67
|
* When `true`, prevent overflow within the current boundary:
|
|
@@ -156,7 +153,7 @@ function ViewportOverlay() {
|
|
|
156
153
|
*/
|
|
157
154
|
export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_ELEMENT>(
|
|
158
155
|
props: PopoverProps<E>,
|
|
159
|
-
) {
|
|
156
|
+
): React.JSX.Element {
|
|
160
157
|
const boundaryElementContext = useBoundaryElement()
|
|
161
158
|
|
|
162
159
|
const {
|
|
@@ -164,8 +161,6 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
164
161
|
animate: _animate = false,
|
|
165
162
|
arrow: arrowProp = false,
|
|
166
163
|
as: as = DEFAULT_POPOVER_ELEMENT,
|
|
167
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
168
|
-
boundaryElement = boundaryElementContext.element,
|
|
169
164
|
children: childProp,
|
|
170
165
|
className,
|
|
171
166
|
constrainSize = false,
|
|
@@ -174,7 +169,7 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
174
169
|
fallbackPlacements = props.fallbackPlacements ??
|
|
175
170
|
DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom'],
|
|
176
171
|
matchReferenceWidth,
|
|
177
|
-
floatingBoundary =
|
|
172
|
+
floatingBoundary = boundaryElementContext.element,
|
|
178
173
|
modal,
|
|
179
174
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
180
175
|
onActivate,
|
|
@@ -187,7 +182,7 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
187
182
|
preventOverflow = true,
|
|
188
183
|
radius = 3,
|
|
189
184
|
ref: forwardedRef,
|
|
190
|
-
referenceBoundary =
|
|
185
|
+
referenceBoundary = boundaryElementContext.element,
|
|
191
186
|
referenceElement,
|
|
192
187
|
scheme,
|
|
193
188
|
shadow = 3,
|
|
@@ -4,7 +4,7 @@ import {motion} from 'framer-motion'
|
|
|
4
4
|
import {type CSSProperties, type ForwardedRef, useMemo} from 'react'
|
|
5
5
|
|
|
6
6
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
|
-
import type {Placement} from '../../types
|
|
7
|
+
import type {Placement} from '../../types'
|
|
8
8
|
import {Arrow} from '../arrow/arrow'
|
|
9
9
|
import {Flex} from '../flex/flex'
|
|
10
10
|
import {Layer, type LayerOwnProps, type LayerProps} from '../layer/layer'
|
|
@@ -41,7 +41,7 @@ export type PopoverLayerOwnProps = LayerOwnProps & {
|
|
|
41
41
|
export type PopoverLayerProps = PopoverLayerOwnProps & LayerProps<'div'>
|
|
42
42
|
|
|
43
43
|
/** @internal */
|
|
44
|
-
export function PopoverLayer(props: PopoverLayerProps) {
|
|
44
|
+
export function PopoverLayer(props: PopoverLayerProps): React.JSX.Element {
|
|
45
45
|
const {
|
|
46
46
|
__unstable_margins: marginsProp,
|
|
47
47
|
animate,
|
|
@@ -2,7 +2,7 @@ import {Box, Container, Flex, Radio, Stack, Text} from '@sanity/ui'
|
|
|
2
2
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
import {useCallback, useState} from 'react'
|
|
4
4
|
|
|
5
|
-
export default function ExampleStory() {
|
|
5
|
+
export default function ExampleStory(): React.JSX.Element {
|
|
6
6
|
const [value, setValue] = useState('first-option')
|
|
7
7
|
const disabled = useBoolean('Disabled', false)
|
|
8
8
|
const readOnly = useBoolean('Read only', false)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/radio',
|
|
6
6
|
title: 'Radio',
|
|
7
7
|
stories: [
|
|
8
8
|
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
9
|
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
10
|
],
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default scope
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Flex, Radio} from '@sanity/ui'
|
|
2
2
|
import {useAction, useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
|
-
export default function PlainStory() {
|
|
4
|
+
export default function PlainStory(): React.JSX.Element {
|
|
5
5
|
const checked = useBoolean('Checked', false)
|
|
6
6
|
const disabled = useBoolean('Disabled', false)
|
|
7
7
|
const id = 'radioStory'
|
|
@@ -2,7 +2,7 @@ import {radio, radioInput, radioPresentation} from '@sanity/ui/css'
|
|
|
2
2
|
import {useImperativeHandle, useRef} from 'react'
|
|
3
3
|
|
|
4
4
|
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
5
|
-
import type {ComponentType, Props} from '../../types
|
|
5
|
+
import type {ComponentType, Props} from '../../types'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_RADIO_ELEMENT = 'input'
|
|
@@ -25,7 +25,7 @@ export type RadioProps<E extends RadioElementType = RadioElementType> = Props<Ra
|
|
|
25
25
|
*/
|
|
26
26
|
export function Radio<E extends RadioElementType = typeof DEFAULT_RADIO_ELEMENT>(
|
|
27
27
|
props: RadioProps<E>,
|
|
28
|
-
) {
|
|
28
|
+
): React.JSX.Element {
|
|
29
29
|
const {
|
|
30
30
|
as: Element = DEFAULT_RADIO_ELEMENT,
|
|
31
31
|
className,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/select',
|
|
6
6
|
title: 'Select',
|
|
7
7
|
stories: [
|
|
8
8
|
{name: 'plain', title: 'Plain', component: lazy(() => import('./plain'))},
|
|
9
9
|
{name: 'read-only', title: 'Read-only', component: lazy(() => import('./readOnly'))},
|
|
10
10
|
],
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default scope
|
|
@@ -3,7 +3,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
3
3
|
|
|
4
4
|
import {WORKSHOP_RADIUS_OPTIONS, WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
|
-
export default function PlainStory() {
|
|
6
|
+
export default function PlainStory(): React.JSX.Element {
|
|
7
7
|
const border = useBoolean('Border', true)
|
|
8
8
|
const disabled = useBoolean('Disabled', false)
|
|
9
9
|
const fontSize = useSelect('Font size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS)
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {
|
|
3
|
-
_inputElement,
|
|
4
|
-
type ResponsiveProp,
|
|
5
|
-
select,
|
|
6
|
-
selectPresentation,
|
|
7
|
-
type SelectStyleProps,
|
|
8
|
-
} from '@sanity/ui/css'
|
|
9
|
-
import type {Space} from '@sanity/ui/theme'
|
|
2
|
+
import {_inputElement, select, selectPresentation, type SelectStyleProps} from '@sanity/ui/css'
|
|
10
3
|
import {useImperativeHandle, useRef} from 'react'
|
|
11
4
|
|
|
12
5
|
import {useCustomValidity} from '../../hooks/useCustomValidity'
|
|
13
|
-
import type {ComponentType, Props} from '../../types
|
|
6
|
+
import type {ComponentType, Props} from '../../types'
|
|
14
7
|
import {Box} from '../box/box'
|
|
15
8
|
import {Text} from '../text/text'
|
|
16
9
|
|
|
@@ -21,8 +14,6 @@ export const DEFAULT_SELECT_ELEMENT = 'select'
|
|
|
21
14
|
export type SelectOwnProps = SelectStyleProps & {
|
|
22
15
|
customValidity?: string
|
|
23
16
|
readOnly?: boolean
|
|
24
|
-
/** @deprecated Use `gap` instead. */
|
|
25
|
-
space?: ResponsiveProp<Space>
|
|
26
17
|
}
|
|
27
18
|
|
|
28
19
|
/** @public */
|
|
@@ -38,7 +29,7 @@ export type SelectProps<E extends SelectElementType = SelectElementType> = Props
|
|
|
38
29
|
*/
|
|
39
30
|
export function Select<E extends SelectElementType = typeof DEFAULT_SELECT_ELEMENT>(
|
|
40
31
|
props: SelectProps<E>,
|
|
41
|
-
) {
|
|
32
|
+
): React.JSX.Element {
|
|
42
33
|
const {
|
|
43
34
|
as: Element = DEFAULT_SELECT_ELEMENT,
|
|
44
35
|
border = true,
|
|
@@ -46,12 +37,11 @@ export function Select<E extends SelectElementType = typeof DEFAULT_SELECT_ELEME
|
|
|
46
37
|
customValidity,
|
|
47
38
|
disabled,
|
|
48
39
|
fontSize = 2,
|
|
49
|
-
gap,
|
|
40
|
+
gap = 2,
|
|
50
41
|
padding = 3,
|
|
51
42
|
radius = 1,
|
|
52
43
|
readOnly,
|
|
53
44
|
ref: forwardedRef,
|
|
54
|
-
space = 2,
|
|
55
45
|
...rest
|
|
56
46
|
} = props as SelectProps<typeof DEFAULT_SELECT_ELEMENT>
|
|
57
47
|
|
|
@@ -67,7 +57,7 @@ export function Select<E extends SelectElementType = typeof DEFAULT_SELECT_ELEME
|
|
|
67
57
|
return (
|
|
68
58
|
<div
|
|
69
59
|
data-ui="Select"
|
|
70
|
-
className={select({border, fontSize, padding, radius
|
|
60
|
+
className={select({border, fontSize, gap, padding, radius})}
|
|
71
61
|
data-icon-right=""
|
|
72
62
|
>
|
|
73
63
|
<Element {...rest} className={_inputElement()} disabled={disabled || readOnly} ref={ref}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {_selectable, type SelectableStyleProps} from '@sanity/ui/css'
|
|
2
|
-
import type {
|
|
2
|
+
import type {ElementTone} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {ComponentType, Props} from '../../types
|
|
4
|
+
import type {ComponentType, Props} from '../../types'
|
|
5
5
|
import {Box, type BoxOwnProps} from '../box/box'
|
|
6
6
|
|
|
7
7
|
/** @internal */
|
|
@@ -13,7 +13,7 @@ export type SelectableOwnProps = BoxOwnProps &
|
|
|
13
13
|
disabled?: boolean
|
|
14
14
|
href?: string
|
|
15
15
|
selected?: boolean
|
|
16
|
-
tone?:
|
|
16
|
+
tone?: ElementTone
|
|
17
17
|
type?: 'button'
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ export type SelectableProps<E extends SelectableElementType = SelectableElementT
|
|
|
29
29
|
/** @internal */
|
|
30
30
|
export function Selectable<E extends SelectableElementType = typeof DEFAULT_SELECTABLE_ELEMENT>(
|
|
31
31
|
props: SelectableProps<E>,
|
|
32
|
-
) {
|
|
32
|
+
): React.JSX.Element {
|
|
33
33
|
const {
|
|
34
34
|
as = DEFAULT_SELECTABLE_ELEMENT,
|
|
35
35
|
className,
|
|
@@ -15,7 +15,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
15
15
|
|
|
16
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
17
17
|
|
|
18
|
-
export default function SkeletonDelayStory() {
|
|
18
|
+
export default function SkeletonDelayStory(): React.JSX.Element {
|
|
19
19
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
20
20
|
const animated = useBoolean('Animated', true)
|
|
21
21
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/skeleton',
|
|
6
6
|
title: 'Skeleton',
|
|
7
7
|
stories: [
|
|
8
8
|
{name: 'skeleton', title: 'Skeleton', component: lazy(() => import('./skeleton'))},
|
|
9
9
|
{name: 'skeleton-delay', title: 'Skeleton delay', component: lazy(() => import('./delay'))},
|
|
10
10
|
],
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default scope
|
|
@@ -15,7 +15,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
15
15
|
|
|
16
16
|
import {WORKSHOP_CARD_TONE_OPTIONS} from '$workshop'
|
|
17
17
|
|
|
18
|
-
export default function SkeletonStory() {
|
|
18
|
+
export default function SkeletonStory(): React.JSX.Element {
|
|
19
19
|
const tone = useSelect('Tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
20
20
|
const animated = useBoolean('Animated', true)
|
|
21
21
|
|
|
@@ -26,7 +26,7 @@ export default function SkeletonStory() {
|
|
|
26
26
|
{[1, 2, 3].map((item) => (
|
|
27
27
|
<Card key={item} tone={tone} padding={2} radius={2} border>
|
|
28
28
|
<Flex align="center">
|
|
29
|
-
<Grid gap={2}
|
|
29
|
+
<Grid gap={2} gridTemplateColumns={2} marginRight={3}>
|
|
30
30
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
31
31
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
32
32
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {codeSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontCodeSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -30,7 +30,7 @@ export type CodeSkeletonProps<E extends CodeSkeletonElementType = CodeSkeletonEl
|
|
|
30
30
|
*/
|
|
31
31
|
export function CodeSkeleton<
|
|
32
32
|
E extends CodeSkeletonElementType = typeof DEFAULT_CODE_SKELETON_ELEMENT,
|
|
33
|
-
>(props: CodeSkeletonProps<E>) {
|
|
33
|
+
>(props: CodeSkeletonProps<E>): React.JSX.Element {
|
|
34
34
|
const {
|
|
35
35
|
className,
|
|
36
36
|
size = 2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {headingSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontHeadingSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -29,7 +29,7 @@ export type HeadingSkeletonProps<
|
|
|
29
29
|
*/
|
|
30
30
|
export function HeadingSkeleton<
|
|
31
31
|
E extends HeadingSkeletonElementType = typeof DEFAULT_HEADING_SKELETON_ELEMENT,
|
|
32
|
-
>(props: HeadingSkeletonProps<E>) {
|
|
32
|
+
>(props: HeadingSkeletonProps<E>): React.JSX.Element {
|
|
33
33
|
const {
|
|
34
34
|
className,
|
|
35
35
|
size = 2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {labelSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {FontLabelSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -28,7 +28,7 @@ export type LabelSkeletonProps<E extends LabelSkeletonElementType = LabelSkeleto
|
|
|
28
28
|
*/
|
|
29
29
|
export function LabelSkeleton<
|
|
30
30
|
E extends LabelSkeletonElementType = typeof DEFAULT_LABEL_SKELETON_ELEMENT,
|
|
31
|
-
>(props: LabelSkeletonProps<E>) {
|
|
31
|
+
>(props: LabelSkeletonProps<E>): React.JSX.Element {
|
|
32
32
|
const {
|
|
33
33
|
className,
|
|
34
34
|
size = 2,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {skeleton, type SkeletonStyleProps} from '@sanity/ui/css'
|
|
2
2
|
import {useEffect, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
import type {ComponentType, Props} from '../../types
|
|
4
|
+
import type {ComponentType, Props} from '../../types'
|
|
5
5
|
|
|
6
6
|
/** @beta */
|
|
7
7
|
export const DEFAULT_SKELETON_ELEMENT = 'div'
|
|
@@ -30,7 +30,7 @@ export type SkeletonProps<E extends SkeletonElementType = SkeletonElementType> =
|
|
|
30
30
|
*/
|
|
31
31
|
export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON_ELEMENT>(
|
|
32
32
|
props: SkeletonProps<E>,
|
|
33
|
-
) {
|
|
33
|
+
): React.JSX.Element {
|
|
34
34
|
const {
|
|
35
35
|
as: As = DEFAULT_SKELETON_ELEMENT,
|
|
36
36
|
animated = false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type ResponsiveProp, textSkeleton} from '@sanity/ui/css'
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {Props} from '../../types
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
5
|
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
@@ -30,7 +30,7 @@ export type TextSkeletonProps<E extends TextSkeletonElementType = TextSkeletonEl
|
|
|
30
30
|
*/
|
|
31
31
|
export function TextSkeleton<
|
|
32
32
|
E extends TextSkeletonElementType = typeof DEFAULT_TEXT_SKELETON_ELEMENT,
|
|
33
|
-
>(props: TextSkeletonProps<E>) {
|
|
33
|
+
>(props: TextSkeletonProps<E>): React.JSX.Element {
|
|
34
34
|
const {
|
|
35
35
|
className,
|
|
36
36
|
size = 2,
|
|
@@ -3,7 +3,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
3
3
|
|
|
4
4
|
import {WORKSHOP_TEXT_FONT_SIZE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
|
-
export default function Props() {
|
|
6
|
+
export default function Props(): React.JSX.Element {
|
|
7
7
|
const muted = useBoolean('Muted', false)
|
|
8
8
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 2)
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/spinner',
|
|
6
6
|
title: 'Spinner',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./Props')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {SpinnerIcon} from '@sanity/icons'
|
|
2
2
|
import {animatedSpinnerIcon} from '@sanity/ui/css'
|
|
3
|
-
import type {
|
|
3
|
+
import type {SVGProps} from 'react'
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
6
|
export function AnimatedSpinnerIcon(
|
|
7
7
|
props: Omit<SVGProps<SVGSVGElement>, 'className'>,
|
|
8
|
-
):
|
|
8
|
+
): React.JSX.Element {
|
|
9
9
|
const {...rest} = props
|
|
10
10
|
|
|
11
11
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {type ResponsiveProp, spinner} from '@sanity/ui/css'
|
|
2
2
|
import type {FontTextSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import type {ComponentType, Props} from '../../types
|
|
4
|
+
import type {ComponentType, Props} from '../../types'
|
|
5
5
|
import {Text} from '../text/text'
|
|
6
6
|
import {AnimatedSpinnerIcon} from './animatedSpinnerIcon'
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ export type SpinnerProps<E extends SpinnerElementType = SpinnerElementType> = Pr
|
|
|
30
30
|
*/
|
|
31
31
|
export function Spinner<E extends SpinnerElementType = typeof DEFAULT_SPINNER_ELEMENT>(
|
|
32
32
|
props: SpinnerProps<E>,
|
|
33
|
-
) {
|
|
33
|
+
): React.JSX.Element {
|
|
34
34
|
const {
|
|
35
35
|
as = DEFAULT_SPINNER_ELEMENT,
|
|
36
36
|
className,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {srOnly} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import type {ComponentType, Props} from '../../types
|
|
3
|
+
import type {ComponentType, Props} from '../../types'
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
6
|
export const DEFAULT_SR_ONLY_ELEMENT = 'span'
|
|
@@ -17,7 +17,7 @@ export type SrOnlyProps<E extends SrOnlyElementType = SrOnlyElementType> = Props
|
|
|
17
17
|
/** @public */
|
|
18
18
|
export function SrOnly<E extends SrOnlyElementType = typeof DEFAULT_SR_ONLY_ELEMENT>(
|
|
19
19
|
props: SrOnlyProps<E>,
|
|
20
|
-
) {
|
|
20
|
+
): React.JSX.Element {
|
|
21
21
|
const {
|
|
22
22
|
as: Element = DEFAULT_SR_ONLY_ELEMENT,
|
|
23
23
|
children,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/stack',
|
|
6
6
|
title: 'Stack',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./plain')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -3,7 +3,7 @@ import {useSelect} from '@sanity/ui-workshop'
|
|
|
3
3
|
|
|
4
4
|
import {WORKSHOP_SPACE_OPTIONS} from '$workshop'
|
|
5
5
|
|
|
6
|
-
export default function PlainStory() {
|
|
6
|
+
export default function PlainStory(): React.JSX.Element {
|
|
7
7
|
return (
|
|
8
8
|
<Flex align="center" height="fill" justify="center" padding={[4, 5, 6]} sizing="border">
|
|
9
9
|
<Container width={0}>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {Space} from '@sanity/ui/theme'
|
|
1
|
+
import {stack} from '@sanity/ui/css'
|
|
3
2
|
|
|
4
|
-
import type {Props} from '../../types
|
|
3
|
+
import type {Props} from '../../types'
|
|
5
4
|
import {Box, type BoxElementType, type BoxOwnProps} from '../box/box'
|
|
6
5
|
|
|
7
6
|
/** @public */
|
|
@@ -24,10 +23,7 @@ export type StackOwnProps = Omit<
|
|
|
24
23
|
| 'justifyContent'
|
|
25
24
|
| 'rows'
|
|
26
25
|
| 'gridTemplateRows'
|
|
27
|
-
>
|
|
28
|
-
/** @deprecated Use `gap` instead. */
|
|
29
|
-
space?: ResponsiveProp<Space>
|
|
30
|
-
}
|
|
26
|
+
>
|
|
31
27
|
|
|
32
28
|
/** @public */
|
|
33
29
|
export type StackElementType = BoxElementType
|
|
@@ -42,12 +38,11 @@ export type StackProps<E extends StackElementType = StackElementType> = Props<St
|
|
|
42
38
|
*/
|
|
43
39
|
export function Stack<E extends StackElementType = typeof DEFAULT_STACK_ELEMENT>(
|
|
44
40
|
props: StackProps<E>,
|
|
45
|
-
) {
|
|
41
|
+
): React.JSX.Element {
|
|
46
42
|
const {
|
|
47
43
|
as = DEFAULT_STACK_ELEMENT,
|
|
48
44
|
className,
|
|
49
45
|
gap,
|
|
50
|
-
space,
|
|
51
46
|
...rest
|
|
52
47
|
} = props as StackProps<typeof DEFAULT_STACK_ELEMENT>
|
|
53
48
|
|
|
@@ -59,7 +54,7 @@ export function Stack<E extends StackElementType = typeof DEFAULT_STACK_ELEMENT>
|
|
|
59
54
|
gridAutoRows="min"
|
|
60
55
|
className={stack({className})}
|
|
61
56
|
display="grid"
|
|
62
|
-
gap={gap
|
|
57
|
+
gap={gap}
|
|
63
58
|
/>
|
|
64
59
|
)
|
|
65
60
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Flex, Switch, Text} from '@sanity/ui'
|
|
2
2
|
import {useCallback, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
export default function ExampleStory() {
|
|
4
|
+
export default function ExampleStory(): React.JSX.Element {
|
|
5
5
|
const [checked, setChecked] = useState<boolean | undefined>(undefined)
|
|
6
6
|
const indeterminate = checked === undefined
|
|
7
7
|
const handleChange = useCallback((event: React.FormEvent<HTMLInputElement>) => {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/switch',
|
|
6
6
|
title: 'Switch',
|
|
7
7
|
stories: [
|
|
8
8
|
{name: 'props', title: 'Props', component: lazy(() => import('./props'))},
|
|
9
9
|
{name: 'example', title: 'Example', component: lazy(() => import('./example'))},
|
|
10
10
|
],
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default scope
|
|
@@ -2,7 +2,7 @@ import {Flex, Switch} from '@sanity/ui'
|
|
|
2
2
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
import {useCallback} from 'react'
|
|
4
4
|
|
|
5
|
-
export default function PropsStory() {
|
|
5
|
+
export default function PropsStory(): React.JSX.Element {
|
|
6
6
|
const checked = useBoolean('Checked', false)
|
|
7
7
|
const indeterminate = useBoolean('Indeterminate', false)
|
|
8
8
|
const readOnly = useBoolean('Read only', false)
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
8
|
import {useEffect, useImperativeHandle, useRef} from 'react'
|
|
9
9
|
|
|
10
|
-
import type {ComponentType, Props} from '../../types
|
|
10
|
+
import type {ComponentType, Props} from '../../types'
|
|
11
11
|
import {Box} from '../box/box'
|
|
12
12
|
|
|
13
13
|
/** @public */
|
|
@@ -33,7 +33,7 @@ export type SwitchProps<E extends SwitchElementType = SwitchElementType> = Props
|
|
|
33
33
|
*/
|
|
34
34
|
export function Switch<E extends SwitchElementType = typeof DEFAULT_SWITCH_ELEMENT>(
|
|
35
35
|
props: SwitchProps<E>,
|
|
36
|
-
) {
|
|
36
|
+
): React.JSX.Element {
|
|
37
37
|
const {
|
|
38
38
|
as: Element = DEFAULT_SWITCH_ELEMENT,
|
|
39
39
|
className,
|
|
@@ -10,7 +10,7 @@ const ColoredText = styled(Text)<{$color: AvatarColor}>`
|
|
|
10
10
|
${vars.color.fg.slice(4, -1)}: ${({$color}) => vars.color.avatar[$color].bg};
|
|
11
11
|
`
|
|
12
12
|
|
|
13
|
-
export default function ColoredTextStory() {
|
|
13
|
+
export default function ColoredTextStory(): React.JSX.Element {
|
|
14
14
|
const color = useSelect('Color', WORKSHOP_AVATAR_COLOR_OPTIONS, 'gray') ?? 'gray'
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
WORKSHOP_TEXT_WEIGHT_OPTIONS,
|
|
9
9
|
} from '$workshop'
|
|
10
10
|
|
|
11
|
-
export default function TextStory() {
|
|
11
|
+
export default function TextStory(): React.JSX.Element {
|
|
12
12
|
const align = useSelect('Align', WORKSHOP_TEXT_ALIGN_OPTIONS)
|
|
13
13
|
const muted = useBoolean('Muted', false)
|
|
14
14
|
const size = useSelect('Size', WORKSHOP_TEXT_FONT_SIZE_OPTIONS, 1)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {WorkshopScope} from '@sanity/ui-workshop'
|
|
2
2
|
import {lazy} from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const scope: WorkshopScope = {
|
|
5
5
|
name: 'primitives/text',
|
|
6
6
|
title: 'Text',
|
|
7
7
|
stories: [
|
|
@@ -21,4 +21,6 @@ export default defineScope({
|
|
|
21
21
|
component: lazy(() => import('./opticalAlignment')),
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default scope
|