@sanity/ui 3.0.0-static.33 → 3.0.0-static.35
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 +34 -85
- package/dist/_visual-editing.d.ts +34 -85
- 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 +383 -13934
- package/dist/css/index.d.ts +383 -13934
- 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 +107 -817
- package/dist/index.d.ts +107 -817
- package/dist/index.js +243 -360
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +367 -4288
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +180 -1582
- package/dist/theme.d.ts +180 -1582
- 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
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* These are internal exports for usage in `@sanity/visual-editing` and `@sanity/insert-menu`,
|
|
3
3
|
* which are used in environments where the regular `@sanity/ui` export is far too heavy due to imports from refractor and more.
|
|
4
4
|
*/
|
|
5
|
-
export {ThemeProvider, type ThemeProviderProps} from '../src/core/_compat/theme/themeProvider'
|
|
6
|
-
export {useTheme_v2} from '../src/core/_compat/theme/useTheme'
|
|
7
5
|
export {Hotkeys, type HotkeysProps} from '../src/core/components/hotkeys/hotkeys'
|
|
8
6
|
export {Menu, type MenuProps} from '../src/core/components/menu/menu'
|
|
9
7
|
export {MenuDivider} from '../src/core/components/menu/menuDivider'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.35",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@commitlint/config-conventional": "^19.8.0",
|
|
122
122
|
"@eslint/js": "^9.29.0",
|
|
123
123
|
"@sanity/browserslist-config": "^1.0.5",
|
|
124
|
-
"@sanity/pkg-utils": "^7.
|
|
124
|
+
"@sanity/pkg-utils": "^7.6.1",
|
|
125
125
|
"@sanity/prettier-config": "^1.0.4",
|
|
126
126
|
"@sanity/semantic-release-preset": "^5.0.0",
|
|
127
127
|
"@sanity/ui-workshop": "^3.0.0",
|
|
@@ -187,8 +187,7 @@
|
|
|
187
187
|
"peerDependencies": {
|
|
188
188
|
"react": "^19",
|
|
189
189
|
"react-dom": "^19",
|
|
190
|
-
"react-is": "^19"
|
|
191
|
-
"styled-components": "^6"
|
|
190
|
+
"react-is": "^19"
|
|
192
191
|
},
|
|
193
192
|
"engines": {
|
|
194
193
|
"node": ">=14.0.0"
|
package/src/core/Root.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import {useCallback, useImperativeHandle, useRef, useState} from 'react'
|
|
|
3
3
|
|
|
4
4
|
import {Box, type BoxOwnProps} from './primitives/box/box'
|
|
5
5
|
import {RootProvider} from './RootProvider'
|
|
6
|
-
import type {Props} from './types
|
|
6
|
+
import type {Props} from './types'
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
9
|
export const DEFAULT_ROOT_ELEMENT = 'html'
|
|
@@ -22,7 +22,9 @@ export type RootProps<E extends RootElementType = RootElementType> = Props<RootO
|
|
|
22
22
|
*
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(
|
|
25
|
+
export function Root<E extends RootElementType = typeof DEFAULT_ROOT_ELEMENT>(
|
|
26
|
+
props: RootProps<E>,
|
|
27
|
+
): React.JSX.Element {
|
|
26
28
|
const {
|
|
27
29
|
as: as = DEFAULT_ROOT_ELEMENT,
|
|
28
30
|
children,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {CardTone, ColorScheme} from '@sanity/ui/theme'
|
|
2
2
|
import type {ReactNode} from 'react'
|
|
3
3
|
|
|
4
4
|
import {ToastProvider} from './components/toast/toastProvider'
|
|
@@ -12,12 +12,12 @@ export interface RootProviderProps {
|
|
|
12
12
|
boundaryElement?: HTMLElement | null
|
|
13
13
|
children?: ReactNode
|
|
14
14
|
portalElement?: HTMLElement | null
|
|
15
|
-
scheme?:
|
|
16
|
-
tone?:
|
|
15
|
+
scheme?: ColorScheme
|
|
16
|
+
tone?: CardTone
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/** @public */
|
|
20
|
-
export function RootProvider(props: RootProviderProps) {
|
|
20
|
+
export function RootProvider(props: RootProviderProps): React.JSX.Element {
|
|
21
21
|
const {
|
|
22
22
|
boundaryElement = null,
|
|
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: 'root',
|
|
6
6
|
title: 'Root',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./boundary')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -14,7 +14,7 @@ import {useCallback, useEffect, useRef, useState} from 'react'
|
|
|
14
14
|
|
|
15
15
|
import {countriesStore} from './mock/apiStore'
|
|
16
16
|
|
|
17
|
-
export default function AsyncStory() {
|
|
17
|
+
export default function AsyncStory(): React.JSX.Element {
|
|
18
18
|
const [options, setOptions] = useState<BaseAutocompleteOption[]>([])
|
|
19
19
|
const [loading, setLoading] = useState(false)
|
|
20
20
|
const searchRef = useRef<{cancel: () => void} | null>(null)
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
} from '@sanity/ui'
|
|
13
13
|
import {useCallback, useState} from 'react'
|
|
14
14
|
|
|
15
|
-
import countries from './mock/countries'
|
|
15
|
+
import {countries} from './mock/countries'
|
|
16
16
|
import type {ExampleOption} from './types'
|
|
17
17
|
|
|
18
|
-
export default function ConstrainedHeightStory() {
|
|
18
|
+
export default function ConstrainedHeightStory(): React.JSX.Element {
|
|
19
19
|
const [boundaryElement, setBoundaryElement] = useState<HTMLDivElement | null>(null)
|
|
20
20
|
|
|
21
21
|
return (
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
10
10
|
} from '$workshop'
|
|
11
11
|
|
|
12
|
-
import countries from './mock/countries'
|
|
12
|
+
import {countries} from './mock/countries'
|
|
13
13
|
import type {ExampleOption} from './types'
|
|
14
14
|
|
|
15
|
-
export default function CustomStory() {
|
|
15
|
+
export default function CustomStory(): React.JSX.Element {
|
|
16
16
|
const data: ExampleOption[] = countries.map((d) => ({value: d.code, title: d.name}))
|
|
17
17
|
const border = useBoolean('Border', true)
|
|
18
18
|
const disabled = useBoolean('Disabled', false)
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
WORKSHOP_TEXT_FONT_SIZE_OPTIONS,
|
|
12
12
|
} from '$workshop'
|
|
13
13
|
|
|
14
|
-
import countries from './mock/countries'
|
|
14
|
+
import {countries} from './mock/countries'
|
|
15
15
|
|
|
16
16
|
const typingPerfTest: PerfTestProps<HTMLInputElement> = {
|
|
17
17
|
name: 'typing',
|
|
@@ -29,7 +29,7 @@ const typingPerfTest: PerfTestProps<HTMLInputElement> = {
|
|
|
29
29
|
},
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export default function ExampleStory() {
|
|
32
|
+
export default function ExampleStory(): React.JSX.Element {
|
|
33
33
|
const {ref, Wrapper} = usePerfTest(typingPerfTest)
|
|
34
34
|
|
|
35
35
|
const layoutTone = useSelect('Layout tone', WORKSHOP_CARD_TONE_OPTIONS)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Autocomplete, Box, Button, Code, Stack} from '@sanity/ui'
|
|
2
2
|
import {useCallback, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
export default function FocusAndBlurStory() {
|
|
4
|
+
export default function FocusAndBlurStory(): React.JSX.Element {
|
|
5
5
|
const [value, setValue] = useState('')
|
|
6
6
|
const [log, setLog] = useState<string[]>([])
|
|
7
7
|
const handleBlur = useCallback(() => setLog((v) => v.concat(['blur'])), [])
|
|
@@ -21,7 +21,7 @@ import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
|
|
21
21
|
|
|
22
22
|
import {countriesStore} from './mock/apiStore'
|
|
23
23
|
|
|
24
|
-
export default function
|
|
24
|
+
export default function FullscreenStory(): React.JSX.Element {
|
|
25
25
|
const error = useBoolean('Error', false)
|
|
26
26
|
|
|
27
27
|
const {push: pushToast} = useToast()
|
|
@@ -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: 'components/autocomplete',
|
|
6
6
|
title: 'Autocomplete',
|
|
7
7
|
stories: [
|
|
@@ -36,4 +36,6 @@ export default defineScope({
|
|
|
36
36
|
component: lazy(() => import('./fullscreen')),
|
|
37
37
|
},
|
|
38
38
|
],
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default scope
|
|
@@ -30,7 +30,7 @@ import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
|
|
|
30
30
|
import {Stack} from '../../primitives/stack/stack'
|
|
31
31
|
import {Text} from '../../primitives/text/text'
|
|
32
32
|
import {TextInput, type TextInputOwnProps} from '../../primitives/textInput/textInput'
|
|
33
|
-
import type {ComponentType, Props} from '../../types
|
|
33
|
+
import type {ComponentType, Props} from '../../types'
|
|
34
34
|
import {AutocompleteOption} from './autocompleteOption'
|
|
35
35
|
import {autocompleteReducer} from './autocompleteReducer'
|
|
36
36
|
import {
|
|
@@ -110,7 +110,7 @@ const DEFAULT_FILTER_OPTION = (query: string, option: BaseAutocompleteOption) =>
|
|
|
110
110
|
export function Autocomplete<
|
|
111
111
|
E extends AutocompleteElementType = typeof DEFAULT_AUTOCOMPLETE_ELEMENT,
|
|
112
112
|
O extends BaseAutocompleteOption = BaseAutocompleteOption,
|
|
113
|
-
>(props: AutocompleteProps<E, O>) {
|
|
113
|
+
>(props: AutocompleteProps<E, O>): React.JSX.Element {
|
|
114
114
|
const {
|
|
115
115
|
as = DEFAULT_AUTOCOMPLETE_ELEMENT,
|
|
116
116
|
border = true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type KeyboardEvent, type
|
|
1
|
+
import {type KeyboardEvent, type ReactNode, useCallback} from 'react'
|
|
2
2
|
|
|
3
3
|
import {_isEnterToClickElement} from '../../helpers/element'
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ export interface AutocompleteOptionProps {
|
|
|
10
10
|
value: string
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function AutocompleteOption(props: AutocompleteOptionProps):
|
|
13
|
+
export function AutocompleteOption(props: AutocompleteOptionProps): React.JSX.Element {
|
|
14
14
|
const {children, id, onSelect, selected, value} = props
|
|
15
15
|
|
|
16
16
|
const handleClick = useCallback(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {Placement} from '../../types
|
|
1
|
+
import type {Placement} from '../../types'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
6
|
+
export const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS: string[] = [
|
|
7
7
|
'Control',
|
|
8
8
|
'Shift',
|
|
9
9
|
'Alt',
|
|
@@ -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: 'components/breadcrumbs',
|
|
6
6
|
title: 'Breadcrumbs',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./example')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {breadcrumbs, type GapStyleProps} from '@sanity/ui/css'
|
|
2
|
-
import type {Space} from '@sanity/ui/theme'
|
|
3
2
|
import {
|
|
4
3
|
Children,
|
|
5
4
|
Fragment,
|
|
@@ -18,7 +17,7 @@ import {Flex} from '../../primitives/flex/flex'
|
|
|
18
17
|
import {Popover} from '../../primitives/popover/popover'
|
|
19
18
|
import {Stack} from '../../primitives/stack/stack'
|
|
20
19
|
import {Text} from '../../primitives/text/text'
|
|
21
|
-
import type {ComponentType, Props} from '../../types
|
|
20
|
+
import type {ComponentType, Props} from '../../types'
|
|
22
21
|
|
|
23
22
|
/** @beta */
|
|
24
23
|
export const DEFAULT_BREADCRUMBS_ELEMENT = 'nav'
|
|
@@ -28,8 +27,6 @@ export type BreadcrumbsOwnProps = GapStyleProps & {
|
|
|
28
27
|
expandButton?: Omit<ButtonProps<'button'>, 'as' | 'onClick' | 'selected'>
|
|
29
28
|
maxLength?: number
|
|
30
29
|
separator?: ReactNode
|
|
31
|
-
/** @deprecated - Use `gap`, `gapX`, `gapY` instead */
|
|
32
|
-
space?: number | number[]
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
/** @beta */
|
|
@@ -44,20 +41,17 @@ export type BreadcrumbsProps<E extends BreadcrumbsElementType = BreadcrumbsEleme
|
|
|
44
41
|
/** @beta */
|
|
45
42
|
export function Breadcrumbs<E extends BreadcrumbsElementType = typeof DEFAULT_BREADCRUMBS_ELEMENT>(
|
|
46
43
|
props: BreadcrumbsProps<E>,
|
|
47
|
-
) {
|
|
44
|
+
): React.JSX.Element {
|
|
48
45
|
const {
|
|
49
46
|
as = DEFAULT_BREADCRUMBS_ELEMENT,
|
|
50
47
|
children,
|
|
51
48
|
className,
|
|
52
49
|
expandButton: expandButtonProps,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
gapY = props.gap ?? (props.space as Space | undefined) ?? 2,
|
|
50
|
+
gap = 2,
|
|
51
|
+
gapX,
|
|
52
|
+
gapY,
|
|
57
53
|
maxLength,
|
|
58
54
|
separator,
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
60
|
-
space: _spaceProp,
|
|
61
55
|
...rest
|
|
62
56
|
} = props as BreadcrumbsProps<typeof DEFAULT_BREADCRUMBS_ELEMENT>
|
|
63
57
|
|
|
@@ -118,6 +112,7 @@ export function Breadcrumbs<E extends BreadcrumbsElementType = typeof DEFAULT_BR
|
|
|
118
112
|
data-ui="Breadcrumbs"
|
|
119
113
|
{...rest}
|
|
120
114
|
className={breadcrumbs({className})}
|
|
115
|
+
gap={gap}
|
|
121
116
|
gapX={gapX}
|
|
122
117
|
gapY={gapY}
|
|
123
118
|
>
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@sanity/ui'
|
|
13
13
|
import {useState} from 'react'
|
|
14
14
|
|
|
15
|
-
export default function LayeringFocusStory() {
|
|
15
|
+
export default function LayeringFocusStory(): React.JSX.Element {
|
|
16
16
|
const [firstDialogOpen, setFirstDialogOpen] = useState<boolean>(false)
|
|
17
17
|
const [secondDialogOpen, setSecondDialogOpen] = useState<boolean>(false)
|
|
18
18
|
const [thirdDialogOpen, setThirdDialogOpen] = useState<boolean>(false)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Button, Dialog, Text} from '@sanity/ui'
|
|
2
2
|
import {useAction, useBoolean} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
|
-
export default function AutoFocusStory() {
|
|
4
|
+
export default function AutoFocusStory(): React.JSX.Element {
|
|
5
5
|
const autoFocus = useBoolean('Auto-focus', true)
|
|
6
6
|
const open = useBoolean('Open', false)
|
|
7
7
|
const handleClose = useAction('onClose')
|
|
@@ -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: 'components/dialog',
|
|
6
6
|
title: 'Dialog',
|
|
7
7
|
stories: [
|
|
@@ -16,4 +16,6 @@ export default defineScope({
|
|
|
16
16
|
{name: 'activate', title: 'Activate', component: lazy(() => import('./activate'))},
|
|
17
17
|
{name: 'wrapped', title: 'Wrapped', component: lazy(() => import('./wrapped'))},
|
|
18
18
|
],
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default scope
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Card, Code, Dialog, Layer, LayerProvider, useLayer} from '@sanity/ui'
|
|
2
2
|
import {useAction} from '@sanity/ui-workshop'
|
|
3
3
|
|
|
4
|
-
export default function LayeringStory() {
|
|
4
|
+
export default function LayeringStory(): React.JSX.Element {
|
|
5
5
|
return (
|
|
6
6
|
<Box padding={[4, 5, 6]}>
|
|
7
7
|
<LayerProvider>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Button, Dialog, LayerProvider, Menu, MenuButton, MenuItem} from '@sanity/ui'
|
|
2
2
|
import {useEffect, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
export default function NestedStory() {
|
|
4
|
+
export default function NestedStory(): React.JSX.Element {
|
|
5
5
|
const [open1] = useState(true)
|
|
6
6
|
const [open2, setOpen2] = useState(false)
|
|
7
7
|
const [open3, setOpen3] = useState(false)
|
|
@@ -51,14 +51,13 @@ export default function NestedStory() {
|
|
|
51
51
|
<MenuButton
|
|
52
52
|
button={<Button text="Test" />}
|
|
53
53
|
id="menu3"
|
|
54
|
-
popover={{animate: true}}
|
|
54
|
+
popover={{animate: true, portal: true}}
|
|
55
55
|
menu={
|
|
56
56
|
<Menu>
|
|
57
57
|
<MenuItem text="Test" />
|
|
58
58
|
<MenuItem text="Test" />
|
|
59
59
|
</Menu>
|
|
60
60
|
}
|
|
61
|
-
portal
|
|
62
61
|
/>
|
|
63
62
|
</Box>
|
|
64
63
|
</Dialog>
|
|
@@ -2,7 +2,7 @@ import {Dialog, LayerProvider, Stack, Text} from '@sanity/ui'
|
|
|
2
2
|
import {useAction} from '@sanity/ui-workshop'
|
|
3
3
|
import {useEffect, useRef} from 'react'
|
|
4
4
|
|
|
5
|
-
export default function OnScrollStory() {
|
|
5
|
+
export default function OnScrollStory(): React.JSX.Element {
|
|
6
6
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
7
7
|
const handleScroll = useAction('scroll')
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {useCallback, useState} from 'react'
|
|
14
14
|
import {styled} from 'styled-components'
|
|
15
15
|
|
|
16
|
-
export default function PanesStory() {
|
|
16
|
+
export default function PanesStory(): React.JSX.Element {
|
|
17
17
|
return (
|
|
18
18
|
<Flex height="fill">
|
|
19
19
|
<Pane id="A" />
|
|
@@ -4,7 +4,7 @@ import {useBoolean, useSelect} from '@sanity/ui-workshop'
|
|
|
4
4
|
|
|
5
5
|
import {WORKSHOP_DIALOG_POSITION_OPTIONS} from '$workshop'
|
|
6
6
|
|
|
7
|
-
export default function PositionStory() {
|
|
7
|
+
export default function PositionStory(): React.JSX.Element {
|
|
8
8
|
const open = useBoolean('Open', true)
|
|
9
9
|
const position = useSelect('Position', WORKSHOP_DIALOG_POSITION_OPTIONS)
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ import {useCallback, useRef, useState} from 'react'
|
|
|
4
4
|
|
|
5
5
|
import {WORKSHOP_CONTAINER_WIDTH_OPTIONS} from '$workshop'
|
|
6
6
|
|
|
7
|
-
export default function PropsStory() {
|
|
7
|
+
export default function PropsStory(): React.JSX.Element {
|
|
8
8
|
const animate = useBoolean('Animate', false)
|
|
9
9
|
const header = useText('Header', 'Props example')
|
|
10
10
|
const onClickOutside = useBoolean('Close when click outside', false)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Dialog, DialogProvider} from '@sanity/ui'
|
|
2
2
|
|
|
3
|
-
export default function ProviderStory() {
|
|
3
|
+
export default function ProviderStory(): React.JSX.Element {
|
|
4
4
|
return (
|
|
5
5
|
<DialogProvider position="absolute" zOffset={1000}>
|
|
6
6
|
<Dialog header="Outer" id="provider-example">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Button, Dialog, type DialogProps, LayerProvider, useLayer} from '@sanity/ui'
|
|
2
2
|
import {type ReactNode, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
export default function WrappedStory() {
|
|
4
|
+
export default function WrappedStory(): React.JSX.Element {
|
|
5
5
|
return (
|
|
6
6
|
<LayerProvider zOffset={100}>
|
|
7
7
|
<Box padding={4}>
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
dialogContainer,
|
|
5
5
|
type ResponsiveProp,
|
|
6
6
|
} from '@sanity/ui/css'
|
|
7
|
-
import type {
|
|
7
|
+
import type {CardTone, ColorScheme, Radius} from '@sanity/ui/theme'
|
|
8
8
|
import {type FocusEvent, type ForwardedRef, type ReactNode, useCallback, useRef} from 'react'
|
|
9
9
|
|
|
10
10
|
import {Z_OFFSETS} from '../../constants'
|
|
@@ -12,10 +12,9 @@ import {isHTMLElement} from '../../helpers/element'
|
|
|
12
12
|
import {focusFirstDescendant, focusLastDescendant} from '../../helpers/focus'
|
|
13
13
|
import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
|
|
14
14
|
import {useResponsiveProp} from '../../hooks/useResponsiveProp'
|
|
15
|
-
import type {CardTone} from '../../primitives/card/types'
|
|
16
15
|
import {Container} from '../../primitives/container/container'
|
|
17
16
|
import {Layer, type LayerOwnProps, type LayerProps} from '../../primitives/layer/layer'
|
|
18
|
-
import type {ComponentType, Props} from '../../types
|
|
17
|
+
import type {ComponentType, Props} from '../../types'
|
|
19
18
|
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
20
19
|
import {Portal} from '../../utils/portal/portal'
|
|
21
20
|
import {usePortal} from '../../utils/portal/usePortal'
|
|
@@ -57,8 +56,8 @@ export type DialogOwnProps = ContainerStyleProps &
|
|
|
57
56
|
open?: boolean
|
|
58
57
|
portal?: string
|
|
59
58
|
position?: ResponsiveProp<DialogPosition>
|
|
60
|
-
scheme?:
|
|
61
|
-
tone?: CardTone
|
|
59
|
+
scheme?: ColorScheme
|
|
60
|
+
tone?: CardTone | 'inherit'
|
|
62
61
|
zOffset?: number | number[]
|
|
63
62
|
}
|
|
64
63
|
|
|
@@ -75,7 +74,7 @@ export type DialogProps<E extends DialogElementType = DialogElementType> = Props
|
|
|
75
74
|
*/
|
|
76
75
|
export function Dialog<E extends DialogElementType = typeof DEFAULT_DIALOG_ELEMENT>(
|
|
77
76
|
props: DialogProps<E>,
|
|
78
|
-
) {
|
|
77
|
+
): React.JSX.Element {
|
|
79
78
|
const context = useDialog()
|
|
80
79
|
const {
|
|
81
80
|
__unstable_autoFocus: autoFocus = true,
|
|
@@ -27,7 +27,7 @@ import {Card, type CardElementType, type CardOwnProps} from '../../primitives/ca
|
|
|
27
27
|
import {Flex} from '../../primitives/flex/flex'
|
|
28
28
|
import {useLayer} from '../../primitives/layer/useLayer'
|
|
29
29
|
import {Text} from '../../primitives/text/text'
|
|
30
|
-
import type {Props} from '../../types
|
|
30
|
+
import type {Props} from '../../types'
|
|
31
31
|
import {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'
|
|
32
32
|
import {usePortal} from '../../utils/portal/usePortal'
|
|
33
33
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
@@ -68,7 +68,7 @@ export type DialogCardProps<E extends DialogCardElementType = DialogCardElementT
|
|
|
68
68
|
|
|
69
69
|
export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIALOG_CARD_ELEMENT>(
|
|
70
70
|
props: DialogCardProps<E>,
|
|
71
|
-
) {
|
|
71
|
+
): React.JSX.Element {
|
|
72
72
|
const {
|
|
73
73
|
__unstable_autoFocus: autoFocus,
|
|
74
74
|
__unstable_hideCloseButton: hideCloseButton,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {Context} from 'react'
|
|
2
3
|
|
|
3
4
|
import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
|
|
4
5
|
import type {DialogPosition} from './types'
|
|
@@ -16,7 +17,5 @@ export interface DialogContextValue {
|
|
|
16
17
|
/**
|
|
17
18
|
* @internal
|
|
18
19
|
*/
|
|
19
|
-
export const DialogContext
|
|
20
|
-
'@sanity/ui/
|
|
21
|
-
{version: 0.0},
|
|
22
|
-
)
|
|
20
|
+
export const DialogContext: Context<DialogContextValue> =
|
|
21
|
+
createGlobalScopedContext<DialogContextValue>('@sanity/ui/v3/dialog', {version: 0.0})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
-
import {type
|
|
2
|
+
import {type ReactNode, useMemo} from 'react'
|
|
3
3
|
|
|
4
4
|
import {DialogContext, type DialogContextValue} from './dialogContext'
|
|
5
5
|
import type {DialogPosition} from './types'
|
|
@@ -18,7 +18,7 @@ export interface DialogProviderProps {
|
|
|
18
18
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
19
19
|
* @beta
|
|
20
20
|
*/
|
|
21
|
-
export function DialogProvider(props: DialogProviderProps):
|
|
21
|
+
export function DialogProvider(props: DialogProviderProps): React.JSX.Element {
|
|
22
22
|
const {children, position, zOffset} = props
|
|
23
23
|
|
|
24
24
|
const contextValue: DialogContextValue = useMemo(
|
|
@@ -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: 'components/hotkeys',
|
|
6
6
|
title: 'Hotkeys',
|
|
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
|