@sanity/ui 3.0.0-static.17 → 3.0.0-static.19
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/dist/_chunks-cjs/_visual-editing.cjs +138 -137
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-cjs/buildCommand.cjs +21 -22
- package/dist/_chunks-cjs/buildCommand.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +139 -138
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +12 -22
- package/dist/_visual-editing.d.ts +12 -22
- package/dist/cli.cjs +1 -1
- package/dist/css.cjs +1589 -2016
- package/dist/css.cjs.map +1 -1
- package/dist/css.d.cts +9427 -874
- package/dist/css.d.ts +9427 -874
- package/dist/css.js +1591 -2018
- package/dist/css.js.map +1 -1
- package/dist/index.cjs +28 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -23
- package/dist/index.d.ts +26 -23
- package/dist/index.js +30 -42
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2749 -2756
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +242 -161
- package/dist/theme.d.ts +242 -161
- package/dist/theme.js +2750 -2757
- package/dist/theme.js.map +1 -1
- package/dist/ui-system.css +15719 -16097
- package/dist/ui-system.min.css +1 -1
- package/dist/ui-theme.css +850 -4568
- package/dist/ui-theme.min.css +1 -1
- package/dist/ui.css +16569 -20772
- package/dist/ui.min.css +1 -1
- package/package.json +10 -15
- package/src/cli/buildCommand.ts +13 -30
- package/src/core/StyleTags.tsx +4 -12
- package/src/core/_compat/styles/_responsive.ts +1 -1
- package/src/core/_compat/theme/theme.test.tsx +4 -5
- package/src/core/_compat/theme/themeColorProvider.tsx +2 -2
- package/src/core/_compat/theme/themeContext.ts +2 -2
- package/src/core/_compat/theme/themeProvider.tsx +2 -2
- package/src/core/_compat/theme/types.ts +1 -1
- package/src/core/_compat/theme/useRootTheme.ts +1 -1
- package/src/core/_compat/theme/useTheme.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/async.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/custom.tsx +11 -11
- package/src/core/components/autocomplete/__workshop__/example.tsx +6 -7
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +2 -2
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +5 -5
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
- package/src/core/components/autocomplete/autocompleteReducer.ts +1 -1
- package/src/core/components/autocomplete/constants.ts +1 -1
- package/src/core/components/autocomplete/types.ts +1 -1
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -1
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +7 -7
- package/src/core/components/dialog/__workshop__/activate.tsx +4 -4
- 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__/wrapped.tsx +2 -2
- package/src/core/components/dialog/dialog.tsx +15 -8
- package/src/core/components/dialog/dialogCard.tsx +18 -3
- package/src/core/components/dialog/dialogContext.ts +1 -1
- package/src/core/components/dialog/dialogProvider.tsx +3 -3
- package/src/core/components/dialog/useDialog.ts +1 -1
- package/src/core/components/hotkeys/hotkeys.tsx +4 -4
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +5 -4
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +2 -2
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +3 -3
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +1 -1
- package/src/core/components/menu/__workshop__/groups.tsx +2 -2
- package/src/core/components/menu/__workshop__/menuButton.tsx +1 -1
- 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 +13 -4
- package/src/core/components/menu/__workshop__/selectedItem.tsx +2 -2
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +1 -1
- package/src/core/components/menu/menu.test.tsx +6 -7
- package/src/core/components/menu/menu.tsx +2 -2
- package/src/core/components/menu/menuButton.tsx +9 -9
- package/src/core/components/menu/menuContext.ts +1 -1
- package/src/core/components/menu/menuDivider.tsx +3 -3
- package/src/core/components/menu/menuGroup.tsx +9 -9
- package/src/core/components/menu/menuItem.tsx +9 -6
- package/src/core/components/menu/useMenu.ts +1 -1
- package/src/core/components/menu/useMenuController.ts +4 -4
- package/src/core/components/skeleton/__workshop__/delay.tsx +1 -1
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +2 -2
- package/src/core/components/skeleton/codeSkeleton.tsx +5 -5
- package/src/core/components/skeleton/headingSkeleton.tsx +5 -5
- package/src/core/components/skeleton/labelSkeleton.tsx +5 -5
- package/src/core/components/skeleton/skeleton.tsx +4 -4
- package/src/core/components/skeleton/textSkeleton.tsx +5 -5
- package/src/core/components/tab/__workshop__/example.tsx +1 -1
- package/src/core/components/tab/tab.tsx +7 -7
- package/src/core/components/tab/tabList.tsx +14 -7
- package/src/core/components/tab/tabPanel.tsx +10 -7
- package/src/core/components/toast/__workshop__/hook.tsx +1 -1
- package/src/core/components/toast/toast.test.tsx +5 -5
- package/src/core/components/toast/toast.tsx +6 -7
- package/src/core/components/toast/toastContext.ts +1 -1
- package/src/core/components/toast/toastLayer.tsx +2 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/toast/types.ts +1 -1
- package/src/core/components/toast/useToast.ts +1 -1
- 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__/tabFromElement.tsx +1 -1
- package/src/core/components/tree/helpers.ts +1 -1
- package/src/core/components/tree/tree.tsx +6 -6
- package/src/core/components/tree/treeContext.ts +1 -1
- package/src/core/components/tree/treeGroup.tsx +2 -2
- package/src/core/components/tree/treeItem.tsx +15 -15
- package/src/core/components/tree/types.ts +2 -2
- package/src/core/components/tree/useTree.ts +1 -1
- package/src/core/hooks/useClickOutside.test.tsx +15 -16
- package/src/core/hooks/useClickOutsideEvent.test.tsx +4 -5
- package/src/core/hooks/useDelayed.test.ts +6 -7
- package/src/core/hooks/useDelayedState.ts +1 -1
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -1
- package/src/core/hooks/useElementSize.ts +1 -1
- package/src/core/hooks/useForwardedRef.ts +1 -1
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +1 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -18
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +10 -10
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersDark.test.tsx +1 -0
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +4 -4
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +1 -0
- package/src/core/middleware/origin.ts +1 -1
- package/src/core/primitives/_selectable/selectable.tsx +3 -3
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -1
- package/src/core/primitives/avatar/avatar.tsx +6 -6
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/core/primitives/avatar/avatarStack.tsx +7 -7
- package/src/core/primitives/avatar/types.ts +1 -3
- package/src/core/primitives/badge/badge.test.tsx +2 -3
- package/src/core/primitives/badge/badge.tsx +3 -3
- package/src/core/primitives/box/__workshop__/responsive.tsx +2 -1
- package/src/core/primitives/box/box.tsx +4 -2
- package/src/core/primitives/button/__workshop__/custom.tsx +2 -2
- package/src/core/primitives/button/__workshop__/customIcons.tsx +3 -3
- package/src/core/primitives/button/__workshop__/disabled.tsx +9 -9
- package/src/core/primitives/button/__workshop__/props.tsx +3 -4
- package/src/core/primitives/button/__workshop__/stacked.tsx +4 -5
- package/src/core/primitives/button/button.test.tsx +2 -3
- package/src/core/primitives/button/button.tsx +11 -6
- package/src/core/primitives/card/__workshop__/asButton.tsx +16 -7
- package/src/core/primitives/card/__workshop__/checkered.tsx +1 -1
- package/src/core/primitives/card/__workshop__/index.ts +1 -1
- package/src/core/primitives/card/__workshop__/interactive.tsx +1 -1
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +3 -3
- package/src/core/primitives/card/__workshop__/props.tsx +3 -3
- package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
- package/src/core/primitives/card/__workshop__/{allTones.tsx → tones.tsx} +3 -3
- package/src/core/primitives/card/card.tsx +4 -4
- package/src/core/primitives/card/cardContext.ts +2 -2
- package/src/core/primitives/card/cardProvider.tsx +3 -3
- package/src/core/primitives/card/types.ts +2 -2
- package/src/core/primitives/card/useCard.ts +2 -1
- package/src/core/primitives/checkbox/__workshop__/props.tsx +2 -0
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +11 -20
- package/src/core/primitives/checkbox/checkbox.tsx +5 -7
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/code/code.tsx +3 -3
- package/src/core/primitives/container/container.tsx +4 -4
- package/src/core/primitives/flex/flex.tsx +2 -2
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/heading/heading.tsx +2 -2
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/inline/inline.tsx +2 -2
- package/src/core/primitives/inline/types.ts +1 -0
- package/src/core/primitives/kbd/kbd.tsx +5 -5
- package/src/core/primitives/label/label.tsx +5 -5
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +2 -2
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +3 -4
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -4
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -3
- package/src/core/primitives/popover/constants.ts +1 -1
- package/src/core/primitives/popover/floating-ui/size.ts +2 -2
- package/src/core/primitives/popover/helpers.ts +1 -1
- package/src/core/primitives/popover/popover.tsx +1 -1
- package/src/core/primitives/popover/popoverLayer.tsx +4 -4
- package/src/core/primitives/popover/types.ts +3 -2
- package/src/core/primitives/radio/__workshop__/example.tsx +1 -1
- package/src/core/primitives/radio/radio.tsx +5 -5
- package/src/core/primitives/select/__workshop__/plain.tsx +15 -3
- package/src/core/primitives/select/__workshop__/readOnly.tsx +1 -1
- package/src/core/primitives/select/select.tsx +4 -10
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -2
- package/src/core/primitives/spinner/animatedSpinnerIcon.tsx +3 -3
- package/src/core/primitives/spinner/spinner.tsx +3 -3
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/stack/stack.tsx +5 -5
- package/src/core/primitives/switch/switch.tsx +3 -3
- package/src/core/primitives/text/__workshop__/colored.tsx +5 -5
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +1 -1
- package/src/core/primitives/text/text.tsx +6 -6
- package/src/core/primitives/textArea/__workshop__/plain.tsx +35 -23
- package/src/core/primitives/textArea/textArea.tsx +14 -5
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +9 -15
- package/src/core/primitives/textInput/__workshop__/states.tsx +4 -4
- package/src/core/primitives/textInput/__workshop__/tones.tsx +2 -2
- package/src/core/primitives/textInput/textInput.tsx +13 -11
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +2 -2
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -1
- package/src/core/primitives/tooltip/__workshop__/props.tsx +5 -4
- package/src/core/primitives/tooltip/constants.ts +1 -1
- package/src/core/primitives/tooltip/tooltip.test.tsx +61 -60
- package/src/core/primitives/tooltip/tooltip.tsx +11 -6
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +3 -3
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +4 -4
- package/src/core/primitives/types.ts +15 -24
- package/src/core/types/badge.ts +1 -1
- package/src/core/types/button.ts +1 -1
- package/src/core/types/card.ts +1 -1
- package/src/core/types/selectable.ts +1 -1
- package/src/core/utils/arrow/arrow.tsx +5 -14
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +5 -5
- package/src/core/utils/boundaryElement/boundaryElementContext.ts +1 -1
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -2
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +15 -8
- package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
- package/src/core/utils/errorBoundary.tsx +4 -4
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +5 -5
- package/src/core/utils/layer/__workshop__/nested.tsx +3 -3
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +9 -5
- package/src/core/utils/layer/getLayerContext.test.ts +3 -1
- package/src/core/utils/layer/getLayerContext.ts +1 -1
- package/src/core/utils/layer/layer.test.tsx +5 -5
- package/src/core/utils/layer/layer.tsx +2 -2
- package/src/core/utils/layer/layerCard.tsx +3 -3
- package/src/core/utils/layer/layerContext.ts +1 -1
- package/src/core/utils/layer/layerProvider.tsx +10 -2
- package/src/core/utils/layer/useLayer.ts +1 -1
- package/src/core/utils/portal/__workshop__/named.tsx +3 -3
- package/src/core/utils/portal/portal.test.tsx +5 -5
- package/src/core/utils/portal/portal.tsx +3 -2
- package/src/core/utils/portal/portalContext.ts +1 -1
- package/src/core/utils/portal/portalProvider.tsx +2 -2
- package/src/core/utils/portal/usePortal.ts +1 -1
- package/src/core/utils/srOnly/srOnly.tsx +3 -3
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +3 -3
- package/src/css/_assign.ts +3 -0
- package/src/css/_compileStyle.ts +12 -4
- package/src/css/_compileTheme.ts +10 -13
- package/src/css/_composeClassNames.ts +12 -0
- package/src/css/_fromEntries.ts +3 -0
- package/src/css/_getClassNames.ts +9 -0
- package/src/css/_hash.ts +9 -0
- package/src/css/_mergeStyles.ts +1 -1
- package/src/css/_resp.ts +6 -12
- package/src/css/_scopeClassName.ts +9 -0
- package/src/css/_scopeClassNames.ts +12 -0
- package/src/css/_system.style.ts +2 -0
- package/src/css/aspects/border/border.style.ts +2 -2
- package/src/css/aspects/border/border.ts +3 -3
- package/src/css/aspects/border/types.ts +1 -1
- package/src/css/aspects/boxSizing/boxSizing.style.ts +10 -0
- package/src/css/aspects/boxSizing/boxSizing.ts +8 -0
- package/src/css/aspects/boxSizing/index.ts +2 -0
- package/src/css/aspects/boxSizing/types.ts +9 -0
- package/src/css/aspects/display/display.style.ts +8 -8
- package/src/css/aspects/display/display.ts +3 -3
- package/src/css/aspects/display/types.ts +1 -1
- package/src/css/aspects/flex/flex.ts +3 -3
- package/src/css/aspects/flex/types.ts +1 -1
- package/src/css/aspects/flexItem/flex.style.ts +1 -1
- package/src/css/aspects/flexItem/flexItem.ts +3 -3
- package/src/css/aspects/flexItem/types.ts +1 -1
- package/src/css/aspects/font/font.style.ts +33 -22
- package/src/css/aspects/font/font.ts +3 -3
- package/src/css/aspects/font/types.ts +1 -1
- package/src/css/aspects/gap/gap.style.ts +2 -2
- package/src/css/aspects/gap/gap.ts +3 -3
- package/src/css/aspects/gap/types.ts +2 -2
- package/src/css/aspects/grid/grid.ts +3 -3
- package/src/css/aspects/grid/types.ts +1 -1
- package/src/css/aspects/gridItem/gridItem.ts +3 -3
- package/src/css/aspects/gridItem/types.ts +1 -1
- package/src/css/aspects/height/height.ts +3 -3
- package/src/css/aspects/index.ts +1 -0
- package/src/css/aspects/inset/inset.ts +3 -3
- package/src/css/aspects/inset/types.ts +1 -1
- package/src/css/aspects/margin/margin.style.ts +10 -10
- package/src/css/aspects/margin/margin.ts +3 -3
- package/src/css/aspects/margin/types.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.style.ts +1 -1
- package/src/css/aspects/maxWidth/maxWidth.ts +4 -3
- package/src/css/aspects/maxWidth/types.ts +2 -2
- package/src/css/aspects/minWidth/minWidth.ts +4 -3
- package/src/css/aspects/minWidth/types.ts +1 -1
- package/src/css/aspects/overflow/overflow.ts +3 -3
- package/src/css/aspects/overflow/types.ts +1 -1
- package/src/css/aspects/padding/padding.style.ts +2 -5
- package/src/css/aspects/padding/padding.ts +3 -3
- package/src/css/aspects/padding/types.ts +2 -2
- package/src/css/aspects/pointerEvents/pointerEvents.ts +3 -3
- package/src/css/aspects/position/position.ts +3 -3
- package/src/css/aspects/position/types.ts +1 -1
- package/src/css/aspects/radius/radius.style.ts +1 -1
- package/src/css/aspects/radius/radius.ts +3 -3
- package/src/css/aspects/radius/types.ts +2 -2
- package/src/css/aspects/shadow/shadow.style.ts +7 -7
- package/src/css/aspects/shadow/shadow.ts +3 -3
- package/src/css/aspects/shadow/types.ts +2 -2
- package/src/css/aspects/textAlign/textAlign.style.ts +1 -1
- package/src/css/aspects/textAlign/textAlign.ts +3 -3
- package/src/css/aspects/textOverflow/textOverflow.ts +3 -3
- package/src/css/aspects/width/types.ts +2 -2
- package/src/css/aspects/width/width.style.ts +1 -1
- package/src/css/aspects/width/width.ts +4 -3
- package/src/css/components/breadcrumbs/breadcrumbs.style.ts +1 -1
- package/src/css/components/breadcrumbs/breadcrumbs.ts +2 -2
- package/src/css/components/dialog/dialog.style.ts +14 -16
- package/src/css/components/dialog/dialog.ts +9 -8
- package/src/css/components/menu/menu.style.ts +2 -2
- package/src/css/components/menu/menu.ts +3 -3
- package/src/css/components/skeleton/skeleton.style.ts +24 -17
- package/src/css/components/skeleton/skeleton.ts +8 -7
- package/src/css/components/skeleton/types.ts +4 -6
- package/src/css/components/toast/toast.style.ts +1 -1
- package/src/css/components/toast/toast.ts +6 -6
- package/src/css/components/tree/tree.style.ts +7 -23
- package/src/css/components/tree/tree.ts +2 -2
- package/src/css/constants.ts +1 -3
- package/src/css/index.ts +3 -5
- package/src/css/prefix/constants.ts +6 -0
- package/src/css/prefix/types.ts +1 -0
- package/src/css/primitives/_arrow/_arrow.style.ts +11 -13
- package/src/css/primitives/_arrow/_arrow.ts +5 -5
- package/src/css/primitives/_input/_input.style.ts +171 -75
- package/src/css/primitives/_input/input.ts +13 -10
- package/src/css/primitives/_input/types.ts +3 -3
- package/src/css/primitives/_selectable/_selectable.style.ts +5 -6
- package/src/css/primitives/_selectable/selectable.ts +4 -3
- package/src/css/primitives/_selectable/types.ts +2 -2
- package/src/css/primitives/avatar/avatar.style.ts +38 -39
- package/src/css/primitives/avatar/avatar.ts +8 -8
- package/src/css/primitives/avatar/types.ts +3 -3
- package/src/css/primitives/badge/badge.style.ts +2 -3
- package/src/css/primitives/badge/badge.ts +7 -3
- package/src/css/primitives/badge/types.ts +2 -2
- package/src/css/primitives/box/box.style.ts +5 -15
- package/src/css/primitives/box/box.ts +7 -9
- package/src/css/primitives/box/types.ts +3 -6
- package/src/css/primitives/button/button.style.ts +189 -162
- package/src/css/primitives/button/button.ts +11 -4
- package/src/css/primitives/button/types.ts +1 -1
- package/src/css/primitives/card/card.style.ts +102 -68
- package/src/css/primitives/card/card.ts +5 -7
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.style.ts +125 -101
- package/src/css/primitives/checkbox/checkbox.ts +3 -3
- package/src/css/primitives/code/code.style.ts +24 -26
- package/src/css/primitives/code/code.ts +7 -3
- package/src/css/primitives/code/types.ts +2 -2
- package/src/css/primitives/container/container.style.ts +1 -1
- package/src/css/primitives/container/container.ts +4 -3
- package/src/css/primitives/container/types.ts +2 -2
- package/src/css/primitives/heading/heading.style.ts +31 -23
- package/src/css/primitives/heading/heading.ts +10 -8
- package/src/css/primitives/heading/types.ts +3 -2
- package/src/css/primitives/kbd/kbd.style.ts +7 -7
- package/src/css/primitives/kbd/kbd.ts +4 -3
- package/src/css/primitives/kbd/types.ts +1 -1
- package/src/css/primitives/label/label.style.ts +27 -24
- package/src/css/primitives/label/label.ts +5 -8
- package/src/css/primitives/label/types.ts +4 -3
- package/src/css/primitives/popover/popover.style.ts +6 -2
- package/src/css/primitives/popover/popover.ts +3 -3
- package/src/css/primitives/radio/radio.style.ts +37 -76
- package/src/css/primitives/radio/radio.ts +2 -2
- package/src/css/primitives/select/select.style.ts +3 -3
- package/src/css/primitives/select/select.ts +5 -5
- package/src/css/primitives/select/types.ts +1 -1
- package/src/css/primitives/spinner/spinner.style.ts +1 -1
- package/src/css/primitives/spinner/spinner.ts +3 -3
- package/src/css/primitives/stack/stack.style.ts +6 -2
- package/src/css/primitives/stack/stack.ts +2 -2
- package/src/css/primitives/switch/switch.style.ts +47 -39
- package/src/css/primitives/switch/switch.ts +6 -6
- package/src/css/primitives/text/text.style.ts +28 -23
- package/src/css/primitives/text/text.ts +5 -8
- package/src/css/primitives/text/types.ts +2 -2
- package/src/css/primitives/textArea/textArea.style.ts +6 -2
- package/src/css/primitives/textArea/textArea.ts +4 -4
- package/src/css/primitives/textArea/types.ts +1 -1
- package/src/css/primitives/textInput/textInput.style.ts +23 -17
- package/src/css/primitives/textInput/textInput.ts +4 -4
- package/src/css/primitives/textInput/types.ts +2 -8
- package/src/css/primitives/token/token.style.ts +4 -4
- package/src/css/primitives/tooltip/tooltip.style.ts +5 -4
- package/src/css/primitives/tooltip/tooltip.ts +3 -3
- package/src/css/renderColor.ts +31 -0
- package/src/css/theme/index.ts +14 -0
- package/src/css/theme/lib/contract/buildVarContract.ts +76 -0
- package/src/css/theme/lib/contract/index.ts +2 -0
- package/src/css/theme/lib/contract/types.ts +15 -0
- package/src/css/theme/resolveTheme.ts +852 -0
- package/src/css/types.ts +26 -910
- package/src/css/utils/srOnly/srOnly.style.ts +1 -1
- package/src/css/utils/srOnly/srOnly.ts +3 -3
- package/src/theme/getScopedTheme.ts +4 -4
- package/src/theme/index.ts +0 -5
- package/src/theme/types.ts +4 -4
- package/src/theme/v0/color/_generic.ts +1 -1
- package/src/theme/v0/color/button.ts +1 -1
- package/src/theme/v0/color/card.ts +1 -1
- package/src/theme/v0/color/color.ts +11 -11
- package/src/theme/v0/color/input.ts +1 -1
- package/src/theme/v0/color/muted.ts +1 -1
- package/src/theme/v0/color/selectable.ts +1 -1
- package/src/theme/v0/color/solid.ts +1 -1
- package/src/theme/v0/color/spot.ts +1 -1
- package/src/theme/v0/styles.ts +1 -1
- package/src/theme/v0/theme.ts +7 -7
- package/src/theme/v2/avatar.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/_selectable/createSelectableTones.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/_solid/createSolidTones.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/button/createButtonTones.ts +4 -4
- package/src/theme/{build → v2/build}/_deprecated/color/card/createCardStates.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/color.test.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/defaults.ts +1 -1
- package/src/theme/{build → v2/build}/_deprecated/color/factory.ts +3 -3
- package/src/theme/{build → v2/build}/_deprecated/color/input/createInputModes.ts +7 -2
- package/src/theme/{build → v2/build}/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/{build → v2/build}/_deprecated/color/spot/createSpot.ts +2 -2
- package/src/theme/{build → v2/build}/buildColorTheme.test.ts +3 -1
- package/src/theme/{build → v2/build}/buildColorTheme.ts +24 -24
- package/src/theme/{build → v2/build}/buildTheme.test.ts +10 -8
- package/src/theme/{build → v2/build}/buildTheme.ts +4 -4
- package/src/theme/{build → v2/build}/colorToken/colorToken.ts +2 -2
- package/src/theme/{build → v2/build}/colorToken/compileColorToken.ts +1 -1
- package/src/theme/{build → v2/build}/colorToken/types.ts +2 -2
- package/src/theme/{build → v2/build}/lib/color-fns/blend/mix.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/multiply.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/blend/screen.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/color-fns.test.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/contrastRatio.ts +5 -2
- package/src/theme/{build → v2/build}/lib/color-fns/convert.ts +1 -1
- package/src/theme/{build → v2/build}/lib/color-fns/parse.ts +1 -1
- package/src/theme/{build → v2/build}/mixThemeColor.test.ts +2 -0
- package/src/theme/{build → v2/build}/mixThemeColor.ts +1 -1
- package/src/theme/{build → v2/build}/renderColorTheme.ts +27 -27
- package/src/theme/{build → v2/build}/renderColorValue.ts +3 -3
- package/src/theme/{build → v2/build}/resolveColorTokens.ts +13 -13
- package/src/theme/v2/color/_helpers.ts +2 -2
- package/src/theme/v2/color/_system.ts +1 -1
- package/src/theme/v2/color/avatar.ts +1 -1
- package/src/theme/v2/color/badge.ts +1 -1
- package/src/theme/v2/color/button.ts +2 -2
- package/src/theme/v2/color/color.ts +7 -7
- package/src/theme/v2/color/input.ts +5 -1
- package/src/theme/v2/color/selectable.ts +2 -2
- package/src/theme/v2/color/state.ts +4 -4
- package/src/theme/{config → v2/config}/helpers.ts +6 -13
- package/src/theme/{config → v2/config}/system.ts +11 -12
- package/src/theme/{config → v2/config}/tokens/color/types.ts +14 -10
- package/src/theme/{config → v2/config}/tokens/index.ts +0 -1
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/{config → v2/config}/tokens/parseTokenValue.ts +2 -2
- package/src/theme/{config → v2/config}/tokens/types.ts +3 -3
- package/src/theme/{config → v2/config}/types.ts +8 -6
- package/src/theme/{defaults → v2/defaults}/colorPalette.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/colorTokens.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/config.ts +1 -1
- package/src/theme/{defaults → v2/defaults}/fonts.ts +1 -1
- package/src/theme/v2/index.ts +2 -0
- package/src/theme/v2/input.ts +1 -1
- package/src/theme/v2/theme.ts +8 -8
- package/src/theme/{_constants.ts → v3/_constants.ts} +6 -3
- package/src/theme/v3/_parseColorToken.ts +185 -0
- package/src/theme/v3/buildTheme_v3.ts +11 -7
- package/src/theme/v3/color/_constants.ts +15 -0
- package/src/theme/v3/color/avatar.ts +14 -0
- package/src/theme/v3/color/card.ts +53 -53
- package/src/theme/v3/color/color.ts +66 -68
- package/src/theme/v3/color/element.ts +8 -8
- package/src/theme/v3/color/index.ts +2 -2
- package/src/theme/v3/color/token.ts +18 -4
- package/src/theme/v3/color/tokens.ts +2 -2
- package/src/theme/v3/defaultTokens.ts +73 -85
- package/src/theme/v3/index.ts +3 -0
- package/src/theme/v3/palette/index.ts +2 -0
- package/src/theme/v3/resolveTokens.ts +65 -65
- package/src/theme/v3/tokens.ts +2 -2
- package/src/theme/v3/types.ts +61 -7
- package/src/theme/versioning/getTheme_v2.ts +3 -3
- package/src/theme/versioning/is_v0.ts +2 -2
- package/src/theme/versioning/is_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -1
- package/src/theme/versioning/themeColor_v3_v2.ts +229 -52
- package/src/theme/versioning/v0_v2.ts +3 -3
- package/src/theme/versioning/v2_v0.ts +4 -4
- package/src/theme/versioning/v3_v2.ts +38 -38
- package/dist/ui-palette.css +0 -105
- package/dist/ui-palette.min.css +0 -1
- package/src/css/_comp.test.ts +0 -7
- package/src/css/_comp.ts +0 -11
- package/src/css/_compilePalette.ts +0 -32
- package/src/css/_compileTheme_v3.ts +0 -440
- package/src/css/aspects/flex/flex.style.ts +0 -30
- package/src/css/composeClassNames.ts +0 -19
- package/src/css/primitives/_selectable/__style.ts +0 -117
- package/src/css/primitives/checkbox/__styles.ts +0 -129
- package/src/css/scopeClassName.ts +0 -7
- package/src/css/varNames.ts +0 -607
- package/src/css/vars.ts +0 -520
- package/src/theme/_types.ts +0 -41
- package/src/theme/build/theme.test.ts +0 -27
- package/src/theme/config/tokens/parseTokenKey.test.ts +0 -64
- package/src/theme/config/tokens/parseTokenKey.ts +0 -67
- package/src/theme/v3/buildTheme_v3.test.ts +0 -40
- package/src/theme/v3/color/buildColor_v3.ts +0 -226
- package/src/theme/v3/color/parseColor.test.ts +0 -79
- package/src/theme/v3/color/parseColor.ts +0 -167
- package/src/theme/v3/color/renderColor.test.ts +0 -20
- package/src/theme/v3/color/renderColor.ts +0 -43
- /package/src/{theme/palette → css/prefix}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/_deprecated/color/index.ts +0 -0
- /package/src/theme/{build → v2/build}/colorToken/index.ts +0 -0
- /package/src/theme/{build → v2/build}/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/blend/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/index.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/rgba.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/color-fns/types.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/isRecord.ts +0 -0
- /package/src/theme/{build → v2/build}/lib/utils.ts +0 -0
- /package/src/theme/{build → v2/build}/merge.ts +0 -0
- /package/src/theme/{config → v2/config}/index.ts +0 -0
- /package/src/theme/{config → v2/config}/tokens/color/index.ts +0 -0
- /package/src/theme/{palette → v3/palette}/constants.ts +0 -0
- /package/src/theme/{palette → v3/palette}/types.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Box, Button, Dialog, DialogProps, LayerProvider, useLayer} from '@sanity/ui'
|
|
2
|
-
import {ReactNode, useCallback, useEffect, useRef, useState} from 'react'
|
|
1
|
+
import {Box, Button, Dialog, type DialogProps, LayerProvider, useLayer} from '@sanity/ui'
|
|
2
|
+
import {type ReactNode, useCallback, useEffect, useRef, useState} from 'react'
|
|
3
3
|
|
|
4
4
|
export default function WrappedStory() {
|
|
5
5
|
return (
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
ContainerStyleProps,
|
|
2
|
+
_composeClassNames,
|
|
3
|
+
type ContainerStyleProps,
|
|
4
4
|
dialog,
|
|
5
5
|
dialogContainer,
|
|
6
|
-
ResponsiveProp,
|
|
6
|
+
type ResponsiveProp,
|
|
7
7
|
} from '@sanity/ui/css'
|
|
8
|
-
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
9
|
-
import {FocusEvent, ForwardedRef, ReactNode, useCallback, useRef} from 'react'
|
|
8
|
+
import type {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
9
|
+
import {type FocusEvent, type ForwardedRef, type ReactNode, useCallback, useRef} from 'react'
|
|
10
10
|
|
|
11
11
|
import {Z_OFFSETS} from '../../constants'
|
|
12
12
|
import {focusFirstDescendant, focusLastDescendant, isHTMLElement} from '../../helpers'
|
|
13
13
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
14
14
|
import {Container} from '../../primitives'
|
|
15
|
-
import {CardTone, ComponentType, DialogPosition, Props, Radius} from '../../types'
|
|
16
|
-
import {
|
|
15
|
+
import type {CardTone, ComponentType, DialogPosition, Props, Radius} from '../../types'
|
|
16
|
+
import {
|
|
17
|
+
Layer,
|
|
18
|
+
type LayerOwnProps,
|
|
19
|
+
type LayerProps,
|
|
20
|
+
Portal,
|
|
21
|
+
useBoundaryElement,
|
|
22
|
+
usePortal,
|
|
23
|
+
} from '../../utils'
|
|
17
24
|
import {DialogCard} from './dialogCard'
|
|
18
25
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
19
26
|
import {useDialog} from './useDialog'
|
|
@@ -176,7 +183,7 @@ export function Dialog<E extends DialogElementType = typeof DEFAULT_DIALOG_ELEME
|
|
|
176
183
|
{...rest}
|
|
177
184
|
aria-labelledby={labelId}
|
|
178
185
|
aria-modal
|
|
179
|
-
className={
|
|
186
|
+
className={_composeClassNames(className, dialog())}
|
|
180
187
|
data-animate={animate ? '' : undefined}
|
|
181
188
|
data-ui="Dialog"
|
|
182
189
|
display="flex"
|
|
@@ -6,12 +6,27 @@ import {
|
|
|
6
6
|
dialogHeader,
|
|
7
7
|
dialogLayout,
|
|
8
8
|
} from '@sanity/ui/css'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type ForwardedRef,
|
|
11
|
+
type ReactNode,
|
|
12
|
+
useCallback,
|
|
13
|
+
useEffect,
|
|
14
|
+
useImperativeHandle,
|
|
15
|
+
useRef,
|
|
16
|
+
} from 'react'
|
|
10
17
|
|
|
11
18
|
import {focusFirstDescendant} from '../../helpers'
|
|
12
19
|
import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
|
|
13
|
-
import {
|
|
14
|
-
|
|
20
|
+
import {
|
|
21
|
+
Box,
|
|
22
|
+
Button,
|
|
23
|
+
Card,
|
|
24
|
+
type CardElementType,
|
|
25
|
+
type CardOwnProps,
|
|
26
|
+
Flex,
|
|
27
|
+
Text,
|
|
28
|
+
} from '../../primitives'
|
|
29
|
+
import type {Props} from '../../types'
|
|
15
30
|
import {useBoundaryElement, useLayer, usePortal} from '../../utils'
|
|
16
31
|
import {isTargetWithinScope} from './isTargetWithinScope'
|
|
17
32
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {ReactElement, ReactNode, useMemo} from 'react'
|
|
1
|
+
import {type ReactElement, type ReactNode, useMemo} from 'react'
|
|
2
2
|
|
|
3
|
-
import {DialogPosition} from '../../types'
|
|
4
|
-
import {DialogContext, DialogContextValue} from './dialogContext'
|
|
3
|
+
import type {DialogPosition} from '../../types'
|
|
4
|
+
import {DialogContext, type DialogContextValue} from './dialogContext'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* This API might change. DO NOT USE IN PRODUCTION.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {GapStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
-
import {FontTextSize, Space} from '@sanity/ui/theme'
|
|
1
|
+
import type {GapStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {FontTextSize, Space} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
4
|
import {Box, KBD} from '../../primitives'
|
|
5
|
-
import {ComponentType, Props} from '../../types'
|
|
5
|
+
import type {ComponentType, Props} from '../../types'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_HOTKEYS_ELEMENT = 'kbd'
|
|
@@ -42,7 +42,7 @@ export function Hotkeys<E extends HotkeysElementType = typeof DEFAULT_HOTKEYS_EL
|
|
|
42
42
|
keys,
|
|
43
43
|
padding,
|
|
44
44
|
radius,
|
|
45
|
-
space =
|
|
45
|
+
space = 1,
|
|
46
46
|
...rest
|
|
47
47
|
} = props as HotkeysProps<typeof DEFAULT_HOTKEYS_ELEMENT>
|
|
48
48
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {AddIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Button, Menu, MenuButton, MenuButtonProps, MenuItem, Stack} from '@sanity/ui'
|
|
2
|
+
import {Box, Button, Menu, MenuButton, type MenuButtonProps, MenuItem, Stack} from '@sanity/ui'
|
|
3
|
+
import {vars} from '@sanity/ui/css'
|
|
3
4
|
import {useRef} from 'react'
|
|
4
5
|
|
|
5
6
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
@@ -16,14 +17,14 @@ export default function ClosableMenuButtonStory() {
|
|
|
16
17
|
button={<Button text="Open" />}
|
|
17
18
|
id="closable-example"
|
|
18
19
|
menu={
|
|
19
|
-
<Menu
|
|
20
|
-
<Stack
|
|
20
|
+
<Menu gap={0} padding={0}>
|
|
21
|
+
<Stack gap={1} padding={1}>
|
|
21
22
|
<MenuItem text="Item 1" />
|
|
22
23
|
<MenuItem text="Item 2" />
|
|
23
24
|
<MenuItem text="Item 3" />
|
|
24
25
|
<MenuItem text="Item 4" />
|
|
25
26
|
</Stack>
|
|
26
|
-
<Stack padding={1} style={{borderTop:
|
|
27
|
+
<Stack padding={1} style={{borderTop: `1px solid ${vars.color.border}`}}>
|
|
27
28
|
<Button
|
|
28
29
|
icon={AddIcon}
|
|
29
30
|
onClick={() => {
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
Menu,
|
|
9
9
|
MenuButton,
|
|
10
10
|
MenuItem,
|
|
11
|
-
SelectableTone,
|
|
11
|
+
type SelectableTone,
|
|
12
12
|
Text,
|
|
13
13
|
} from '@sanity/ui'
|
|
14
14
|
import {useState} from 'react'
|
|
15
15
|
|
|
16
|
-
import {MenuButtonProps} from '../menuButton'
|
|
16
|
+
import type {MenuButtonProps} from '../menuButton'
|
|
17
17
|
|
|
18
18
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
19
19
|
constrainSize: true,
|
|
@@ -7,7 +7,7 @@ export default function CustomMenuItemStory() {
|
|
|
7
7
|
<LayerProvider>
|
|
8
8
|
<Menu>
|
|
9
9
|
<MenuItem padding={3}>
|
|
10
|
-
<Stack
|
|
10
|
+
<Stack gap={3}>
|
|
11
11
|
<Text weight="medium" size={1}>
|
|
12
12
|
First option
|
|
13
13
|
</Text>
|
|
@@ -17,7 +17,7 @@ export default function CustomMenuItemStory() {
|
|
|
17
17
|
</Stack>
|
|
18
18
|
</MenuItem>
|
|
19
19
|
<MenuItem padding={3}>
|
|
20
|
-
<Stack
|
|
20
|
+
<Stack gap={3}>
|
|
21
21
|
<Text weight="medium" size={1}>
|
|
22
22
|
Second option
|
|
23
23
|
</Text>
|
|
@@ -28,7 +28,7 @@ export default function CustomMenuItemStory() {
|
|
|
28
28
|
</MenuItem>
|
|
29
29
|
<MenuDivider />
|
|
30
30
|
<MenuItem padding={3} tone="critical">
|
|
31
|
-
<Stack
|
|
31
|
+
<Stack gap={3}>
|
|
32
32
|
<Text weight="medium" size={1}>
|
|
33
33
|
Dangerous option
|
|
34
34
|
</Text>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {ChevronDownIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex, Menu, MenuButton, MenuButtonProps, MenuItem} from '@sanity/ui'
|
|
2
|
+
import {Button, Flex, Menu, MenuButton, type MenuButtonProps, MenuItem} from '@sanity/ui'
|
|
3
3
|
import {useBoolean} from '@sanity/ui-workshop'
|
|
4
4
|
|
|
5
5
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
LayerProvider,
|
|
7
7
|
Menu,
|
|
8
8
|
MenuButton,
|
|
9
|
-
MenuButtonProps,
|
|
9
|
+
type MenuButtonProps,
|
|
10
10
|
MenuDivider,
|
|
11
11
|
MenuGroup,
|
|
12
12
|
MenuItem,
|
|
@@ -29,7 +29,7 @@ export default function GroupsStory() {
|
|
|
29
29
|
return (
|
|
30
30
|
<Box padding={[4, 5, 6]}>
|
|
31
31
|
<Card padding={1} radius={3} shadow={1}>
|
|
32
|
-
<Inline
|
|
32
|
+
<Inline gap={1}>
|
|
33
33
|
<LayerProvider>
|
|
34
34
|
<MenuButton
|
|
35
35
|
button={<Button fontSize={1} mode="bleed" padding={2} text="File" />}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
4
|
+
Menu,
|
|
5
|
+
MenuButton,
|
|
6
|
+
type MenuButtonProps,
|
|
7
|
+
MenuItem,
|
|
8
|
+
Stack,
|
|
9
|
+
useToast,
|
|
10
|
+
} from '@sanity/ui'
|
|
2
11
|
import {useCallback} from 'react'
|
|
3
12
|
|
|
4
13
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
@@ -17,14 +26,14 @@ export default function OnCloseMenuButton() {
|
|
|
17
26
|
|
|
18
27
|
return (
|
|
19
28
|
<Box padding={[4, 5, 6]}>
|
|
20
|
-
<Stack
|
|
29
|
+
<Stack gap={2}>
|
|
21
30
|
<MenuButton
|
|
22
31
|
button={<Button text="With onClose callback" />}
|
|
23
32
|
id="closable-example"
|
|
24
33
|
onClose={handleClose}
|
|
25
34
|
menu={
|
|
26
|
-
<Menu
|
|
27
|
-
<Stack
|
|
35
|
+
<Menu gap={0} padding={0}>
|
|
36
|
+
<Stack gap={1} padding={1}>
|
|
28
37
|
<MenuItem text="Item 1" />
|
|
29
38
|
<MenuItem text="Item 2" />
|
|
30
39
|
<MenuItem text="Item 3" />
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Code,
|
|
6
6
|
Menu,
|
|
7
7
|
MenuButton,
|
|
8
|
-
MenuButtonProps,
|
|
8
|
+
type MenuButtonProps,
|
|
9
9
|
MenuDivider,
|
|
10
10
|
MenuItem,
|
|
11
11
|
Stack,
|
|
@@ -23,7 +23,7 @@ export default function SelectedItemStory() {
|
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<Box padding={[4, 5, 6]}>
|
|
26
|
-
<Stack
|
|
26
|
+
<Stack gap={4}>
|
|
27
27
|
<Code>selectedIndex={selectedIndex}</Code>
|
|
28
28
|
|
|
29
29
|
<MenuButton
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Box, Button, Menu, MenuButton, MenuButtonProps, MenuItem, Stack} from '@sanity/ui'
|
|
1
|
+
import {Box, Button, Menu, MenuButton, type MenuButtonProps, MenuItem, Stack} from '@sanity/ui'
|
|
2
2
|
|
|
3
3
|
const POPOVER_PROPS: MenuButtonProps['popover'] = {
|
|
4
4
|
__unstable_margins: [1, 1, 1, 1],
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
/** @jest-environment jsdom */
|
|
2
|
-
|
|
3
1
|
/* eslint-disable no-console */
|
|
4
2
|
|
|
5
|
-
import {MouseEvent, useCallback, useMemo} from 'react'
|
|
3
|
+
import {type MouseEvent, useCallback, useMemo} from 'react'
|
|
4
|
+
import {describe, expect, it, vi} from 'vitest'
|
|
6
5
|
|
|
7
6
|
import {render} from '../../../../test'
|
|
8
|
-
import {MenuContext, MenuContextValue} from './menuContext'
|
|
7
|
+
import {MenuContext, type MenuContextValue} from './menuContext'
|
|
9
8
|
import {useMenu} from './useMenu'
|
|
10
9
|
|
|
11
10
|
describe('components/menu', () => {
|
|
12
11
|
describe('useMenu', () => {
|
|
13
12
|
it('should get context value', async () => {
|
|
14
|
-
const log =
|
|
13
|
+
const log = vi.fn()
|
|
15
14
|
|
|
16
15
|
function Debug() {
|
|
17
16
|
const rootMenu = useMenu()
|
|
@@ -67,7 +66,7 @@ describe('components/menu', () => {
|
|
|
67
66
|
})
|
|
68
67
|
|
|
69
68
|
it('should fail when no context value is provided', async () => {
|
|
70
|
-
const log =
|
|
69
|
+
const log = vi.fn()
|
|
71
70
|
|
|
72
71
|
function Debug() {
|
|
73
72
|
try {
|
|
@@ -95,7 +94,7 @@ describe('components/menu', () => {
|
|
|
95
94
|
})
|
|
96
95
|
|
|
97
96
|
it('should fail when context value is not compatible', async () => {
|
|
98
|
-
const log =
|
|
97
|
+
const log = vi.fn()
|
|
99
98
|
|
|
100
99
|
function Debug() {
|
|
101
100
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_composeClassNames, menu, type PaddingStyleProps, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
2
|
import type {Space} from '@sanity/ui/theme'
|
|
3
3
|
import {useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'
|
|
4
4
|
|
|
@@ -176,7 +176,7 @@ export function Menu<E extends MenuElementType = typeof DEFAULT_MENU_ELEMENT>(pr
|
|
|
176
176
|
data-ui="Menu"
|
|
177
177
|
{...rest}
|
|
178
178
|
as={as}
|
|
179
|
-
className={
|
|
179
|
+
className={_composeClassNames(className, menu())}
|
|
180
180
|
onKeyDown={handleKeyDown}
|
|
181
181
|
overflow="auto"
|
|
182
182
|
outline="none"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
1
|
+
import type {ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
2
|
import {
|
|
3
3
|
cloneElement,
|
|
4
|
-
FocusEvent,
|
|
5
|
-
ForwardedRef,
|
|
6
|
-
KeyboardEvent,
|
|
7
|
-
MouseEvent as ReactMouseEvent,
|
|
8
|
-
ReactElement,
|
|
4
|
+
type FocusEvent,
|
|
5
|
+
type ForwardedRef,
|
|
6
|
+
type KeyboardEvent,
|
|
7
|
+
type MouseEvent as ReactMouseEvent,
|
|
8
|
+
type ReactElement,
|
|
9
9
|
useCallback,
|
|
10
10
|
useEffect,
|
|
11
11
|
useImperativeHandle,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
useState,
|
|
15
15
|
} from 'react'
|
|
16
16
|
|
|
17
|
-
import {ButtonProps, Popover, PopoverProps} from '../../primitives'
|
|
18
|
-
import {Placement, Props, Radius} from '../../types'
|
|
19
|
-
import {MenuProps} from './menu'
|
|
17
|
+
import {type ButtonProps, Popover, type PopoverProps} from '../../primitives'
|
|
18
|
+
import type {Placement, Props, Radius} from '../../types'
|
|
19
|
+
import type {MenuProps} from './menu'
|
|
20
20
|
|
|
21
21
|
/** @public */
|
|
22
22
|
export type MenuButtonProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_composeClassNames, menuDivider} from '@sanity/ui/css'
|
|
2
2
|
|
|
3
|
-
import {ComponentType, Props} from '../../types'
|
|
3
|
+
import type {ComponentType, Props} from '../../types'
|
|
4
4
|
|
|
5
5
|
/** @public */
|
|
6
6
|
export const DEFAULT_MENU_DIVIDER_ELEMENT = 'hr'
|
|
@@ -28,7 +28,7 @@ export function MenuDivider<E extends MenuDividerElementType = typeof DEFAULT_ME
|
|
|
28
28
|
...rest
|
|
29
29
|
} = props as MenuDividerProps<typeof DEFAULT_MENU_DIVIDER_ELEMENT>
|
|
30
30
|
|
|
31
|
-
return <Element {...rest} className={
|
|
31
|
+
return <Element {...rest} className={_composeClassNames(className, menuDivider())} />
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
MenuDivider.displayName = 'MenuDivider'
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {ChevronRightIcon} from '@sanity/icons'
|
|
2
|
-
import {RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
3
|
-
import {FontTextSize, Space, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
2
|
+
import type {RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
|
|
3
|
+
import type {FontTextSize, Space, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
4
4
|
import {
|
|
5
|
-
ElementType,
|
|
5
|
+
type ElementType,
|
|
6
6
|
isValidElement,
|
|
7
|
-
KeyboardEvent,
|
|
8
|
-
MouseEvent,
|
|
9
|
-
ReactNode,
|
|
7
|
+
type KeyboardEvent,
|
|
8
|
+
type MouseEvent,
|
|
9
|
+
type ReactNode,
|
|
10
10
|
useCallback,
|
|
11
11
|
useEffect,
|
|
12
12
|
useState,
|
|
13
13
|
} from 'react'
|
|
14
14
|
import {isValidElementType} from 'react-is'
|
|
15
15
|
|
|
16
|
-
import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
|
|
16
|
+
import {Box, Flex, Popover, type PopoverProps, Text} from '../../primitives'
|
|
17
17
|
import {Selectable} from '../../primitives/_selectable'
|
|
18
|
-
import {ComponentType, Props} from '../../types'
|
|
19
|
-
import {DEFAULT_MENU_ELEMENT, Menu, MenuProps} from './menu'
|
|
18
|
+
import type {ComponentType, Props} from '../../types'
|
|
19
|
+
import {DEFAULT_MENU_ELEMENT, Menu, type MenuProps} from './menu'
|
|
20
20
|
import {useMenu} from './useMenu'
|
|
21
21
|
|
|
22
22
|
/** @public */
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
GapStyleProps,
|
|
3
|
+
PaddingStyleProps,
|
|
4
|
+
RadiusStyleProps,
|
|
5
|
+
ResponsiveProp,
|
|
6
|
+
} from '@sanity/ui/css'
|
|
7
|
+
import type {Space, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
3
8
|
import {
|
|
4
|
-
ElementType,
|
|
9
|
+
type ElementType,
|
|
5
10
|
isValidElement,
|
|
6
11
|
type MouseEvent,
|
|
7
12
|
type ReactNode,
|
|
@@ -166,9 +171,7 @@ export function MenuItem<E extends MenuItemElementType = typeof DEFAULT_MENU_ITE
|
|
|
166
171
|
</Box>
|
|
167
172
|
)}
|
|
168
173
|
|
|
169
|
-
{hotkeys &&
|
|
170
|
-
<Hotkeys gap={0.5} keys={hotkeys} style={{marginTop: -4, marginBottom: -4}} />
|
|
171
|
-
)}
|
|
174
|
+
{hotkeys && <Hotkeys keys={hotkeys} style={{marginTop: -4, marginBottom: -4}} />}
|
|
172
175
|
|
|
173
176
|
{IconRightComponent && (
|
|
174
177
|
<Text muted size={fontSize}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useContext} from 'react'
|
|
2
2
|
|
|
3
3
|
import {isRecord} from '../../lib/isRecord'
|
|
4
|
-
import {MenuContext, MenuContextValue} from './menuContext'
|
|
4
|
+
import {MenuContext, type MenuContextValue} from './menuContext'
|
|
5
5
|
|
|
6
6
|
export function useMenu(): MenuContextValue {
|
|
7
7
|
const value = useContext(MenuContext)
|
|
@@ -22,7 +22,7 @@ export default function SkeletonStory() {
|
|
|
22
22
|
return (
|
|
23
23
|
<Box padding={[4, 5, 6]}>
|
|
24
24
|
<Container width={1}>
|
|
25
|
-
<Stack
|
|
25
|
+
<Stack gap={4}>
|
|
26
26
|
{[1, 2, 3].map((item) => (
|
|
27
27
|
<Card key={item} tone={tone} padding={2} radius={2} border>
|
|
28
28
|
<Flex align="center">
|
|
@@ -32,7 +32,7 @@ export default function SkeletonStory() {
|
|
|
32
32
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
33
33
|
<Skeleton style={{width: 40, height: 40}} radius={2} animated={animated} />
|
|
34
34
|
</Grid>
|
|
35
|
-
<Stack
|
|
35
|
+
<Stack gap={2} flex={1}>
|
|
36
36
|
<HeadingSkeleton style={{width: '100%'}} radius={1} animated={animated} />
|
|
37
37
|
<TextSkeleton style={{width: '100%'}} radius={1} animated={animated} />
|
|
38
38
|
<LabelSkeleton style={{width: '100%'}} radius={1} animated={animated} />
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {FontCodeSize} from '@sanity/ui/theme'
|
|
1
|
+
import {_composeClassNames, codeSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {FontCodeSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {Props} from '../../types'
|
|
5
|
-
import {Skeleton, SkeletonElementType, SkeletonOwnProps} from './skeleton'
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
|
+
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_CODE_SKELETON_ELEMENT = 'div'
|
|
@@ -40,7 +40,7 @@ export function CodeSkeleton<
|
|
|
40
40
|
return (
|
|
41
41
|
<Skeleton
|
|
42
42
|
{...rest}
|
|
43
|
-
className={
|
|
43
|
+
className={_composeClassNames(
|
|
44
44
|
className,
|
|
45
45
|
codeSkeleton({
|
|
46
46
|
size,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {FontHeadingSize} from '@sanity/ui/theme'
|
|
1
|
+
import {_composeClassNames, headingSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {FontHeadingSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {Props} from '../../types'
|
|
5
|
-
import {Skeleton, SkeletonElementType, SkeletonOwnProps} from './skeleton'
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
|
+
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_HEADING_SKELETON_ELEMENT = 'div'
|
|
@@ -39,7 +39,7 @@ export function HeadingSkeleton<
|
|
|
39
39
|
return (
|
|
40
40
|
<Skeleton
|
|
41
41
|
{...rest}
|
|
42
|
-
className={
|
|
42
|
+
className={_composeClassNames(
|
|
43
43
|
className,
|
|
44
44
|
headingSkeleton({
|
|
45
45
|
size,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {FontLabelSize} from '@sanity/ui/theme'
|
|
1
|
+
import {_composeClassNames, labelSkeleton, type ResponsiveProp} from '@sanity/ui/css'
|
|
2
|
+
import type {FontLabelSize} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {Props} from '../../types'
|
|
5
|
-
import {Skeleton, SkeletonElementType, SkeletonOwnProps} from './skeleton'
|
|
4
|
+
import type {Props} from '../../types'
|
|
5
|
+
import {Skeleton, type SkeletonElementType, type SkeletonOwnProps} from './skeleton'
|
|
6
6
|
|
|
7
7
|
/** @public */
|
|
8
8
|
export const DEFAULT_LABEL_SKELETON_ELEMENT = 'div'
|
|
@@ -38,7 +38,7 @@ export function LabelSkeleton<
|
|
|
38
38
|
return (
|
|
39
39
|
<Skeleton
|
|
40
40
|
{...rest}
|
|
41
|
-
className={
|
|
41
|
+
className={_composeClassNames(
|
|
42
42
|
className,
|
|
43
43
|
labelSkeleton({
|
|
44
44
|
size,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_composeClassNames, skeleton, type SkeletonStyleProps} from '@sanity/ui/css'
|
|
2
2
|
import {useEffect, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
import {Box, BoxOwnProps} from '../../primitives'
|
|
5
|
-
import {ComponentType, Props} from '../../types'
|
|
4
|
+
import {Box, type BoxOwnProps} from '../../primitives'
|
|
5
|
+
import type {ComponentType, Props} from '../../types'
|
|
6
6
|
|
|
7
7
|
/** @beta */
|
|
8
8
|
export const DEFAULT_SKELETON_ELEMENT = 'div'
|
|
@@ -61,7 +61,7 @@ export function Skeleton<E extends SkeletonElementType = typeof DEFAULT_SKELETON
|
|
|
61
61
|
<Box
|
|
62
62
|
data-ui="Skeleton"
|
|
63
63
|
{...rest}
|
|
64
|
-
className={
|
|
64
|
+
className={_composeClassNames(
|
|
65
65
|
className,
|
|
66
66
|
skeleton({
|
|
67
67
|
radius,
|