@sanity/ui 3.0.0-static.32 → 3.0.0-static.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +269 -378
- 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 +270 -381
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/refractor.js.map +1 -1
- package/dist/_visual-editing.cjs +0 -2
- package/dist/_visual-editing.cjs.map +1 -1
- package/dist/_visual-editing.d.cts +2 -894
- package/dist/_visual-editing.d.ts +2 -894
- package/dist/_visual-editing.js +2 -4
- package/dist/css/index.cjs +13 -13
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +805 -14697
- package/dist/css/index.d.ts +805 -14697
- package/dist/css/index.js +13 -13
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +242 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +990 -3085
- package/dist/index.d.ts +990 -3085
- package/dist/index.js +244 -361
- package/dist/index.js.map +1 -1
- package/dist/portalProvider-DgNIVviV.d.ts +575 -0
- package/dist/theme.cjs +367 -4288
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +272 -1806
- package/dist/theme.d.ts +272 -1806
- package/dist/theme.js +371 -4292
- package/dist/theme.js.map +1 -1
- package/exports/_visual-editing.ts +0 -2
- package/package.json +8 -9
- package/src/core/Root.tsx +6 -4
- 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 +34 -17
- 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 +2 -2
- package/src/css/primitives/root/root.ts +2 -2
- 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/dist/css/layers.css +0 -4
- package/dist/css/primitives/popover/popover.css +0 -4
- 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
|
@@ -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: 'utils/elementQuery',
|
|
6
6
|
title: 'ElementQuery',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./customMedia')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -2,7 +2,7 @@ import {BREAKPOINTS} from '@sanity/ui/css'
|
|
|
2
2
|
import {useImperativeHandle, useMemo, useState} from 'react'
|
|
3
3
|
|
|
4
4
|
import {useElementSize} from '../../hooks/useElementSize'
|
|
5
|
-
import type {ComponentType, Props} from '../../types
|
|
5
|
+
import type {ComponentType, Props} from '../../types'
|
|
6
6
|
import {findMaxBreakpoints, findMinBreakpoints} from './helpers'
|
|
7
7
|
|
|
8
8
|
/** @beta */
|
|
@@ -36,7 +36,7 @@ const DEFAULT_BREAKPOINTS = Object.values(BREAKPOINTS)
|
|
|
36
36
|
*/
|
|
37
37
|
export function ElementQuery<
|
|
38
38
|
E extends ElementQueryElementType = typeof DEFAULT_ELEMENT_QUERY_ELEMENT,
|
|
39
|
-
>(props: ElementQueryProps<E>) {
|
|
39
|
+
>(props: ElementQueryProps<E>): React.JSX.Element {
|
|
40
40
|
const {
|
|
41
41
|
as: Element = DEFAULT_ELEMENT_QUERY_ELEMENT,
|
|
42
42
|
children,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// https://github.com/facebook/react/pull/28348
|
|
8
8
|
//
|
|
9
9
|
// Access the ref using the method that doesn't yield a warning.
|
|
10
|
-
export function getElementRef(element: React.ReactElement) {
|
|
10
|
+
export function getElementRef(element: React.ReactElement): React.Ref<unknown> | undefined {
|
|
11
11
|
// React <=18 in DEV
|
|
12
12
|
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get
|
|
13
13
|
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning
|
|
@@ -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: 'utils/portal',
|
|
6
6
|
title: 'Portal',
|
|
7
7
|
stories: [
|
|
@@ -11,4 +11,6 @@ export default defineScope({
|
|
|
11
11
|
component: lazy(() => import('./named')),
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default scope
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Card, Container, Portal, PortalProvider, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {useMemo, useState} from 'react'
|
|
3
3
|
|
|
4
|
-
export default function NamedStory() {
|
|
4
|
+
export default function NamedStory(): React.JSX.Element {
|
|
5
5
|
const [portal1Element, setPortal1Element] = useState<HTMLDivElement | null>(null)
|
|
6
6
|
const [portal2Element, setPortal2Element] = useState<HTMLDivElement | null>(null)
|
|
7
7
|
const [portal3Element, setPortal3Element] = useState<HTMLDivElement | null>(null)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {describe, expect, it, vi} from 'vitest'
|
|
2
2
|
|
|
3
|
-
import {render} from '
|
|
3
|
+
import {render} from '$test/utils'
|
|
4
|
+
|
|
4
5
|
import {PortalContext} from './portalContext'
|
|
5
6
|
import type {PortalContextValue} from './types'
|
|
6
7
|
import {usePortal} from './usePortal'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type {Context} from 'react'
|
|
2
|
+
|
|
1
3
|
import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
|
|
2
4
|
import {globalScope} from '../../lib/globalScope'
|
|
3
5
|
import type {PortalContextValue} from './types'
|
|
4
6
|
|
|
5
|
-
const key = '@sanity/ui/
|
|
7
|
+
const key = '@sanity/ui/v3/portal'
|
|
6
8
|
const elementKey = Symbol.for(`${key}/element`)
|
|
7
9
|
|
|
8
10
|
// Use the global scope as a map of symbols to elements
|
|
@@ -31,4 +33,5 @@ export const defaultContextValue: PortalContextValue = {
|
|
|
31
33
|
},
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
export const PortalContext
|
|
36
|
+
export const PortalContext: Context<PortalContextValue> =
|
|
37
|
+
createGlobalScopedContext<PortalContextValue>(key, defaultContextValue)
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {type
|
|
1
|
+
import {type ReactNode, useMemo, useRef, useSyncExternalStore} from 'react'
|
|
2
2
|
|
|
3
3
|
import {PortalContext} from './portalContext'
|
|
4
4
|
import type {PortalContextValue} from './types'
|
|
5
5
|
|
|
6
6
|
/** @public */
|
|
7
7
|
export interface PortalProviderProps {
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `<BoundaryElementProvider element={...} />` instead
|
|
10
|
-
*/
|
|
11
|
-
boundaryElement?: HTMLElement | null
|
|
12
8
|
children: ReactNode
|
|
13
9
|
element?: HTMLElement | null
|
|
14
10
|
/**
|
|
@@ -18,8 +14,8 @@ export interface PortalProviderProps {
|
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
/** @public */
|
|
21
|
-
export function PortalProvider(props: PortalProviderProps):
|
|
22
|
-
const {
|
|
17
|
+
export function PortalProvider(props: PortalProviderProps): React.JSX.Element {
|
|
18
|
+
const {children, element, __unstable_elements: elementsProp} = props
|
|
23
19
|
const elements = useUnique(elementsProp)
|
|
24
20
|
const fallbackElement = useSyncExternalStore(
|
|
25
21
|
emptySubscribe,
|
|
@@ -30,11 +26,11 @@ export function PortalProvider(props: PortalProviderProps): ReactElement {
|
|
|
30
26
|
const value: PortalContextValue = useMemo(() => {
|
|
31
27
|
return {
|
|
32
28
|
version: 0.0,
|
|
33
|
-
boundaryElement:
|
|
29
|
+
boundaryElement: null,
|
|
34
30
|
element: element || fallbackElement,
|
|
35
31
|
elements,
|
|
36
32
|
}
|
|
37
|
-
}, [
|
|
33
|
+
}, [element, elements, fallbackElement])
|
|
38
34
|
|
|
39
35
|
return <PortalContext.Provider value={value}>{children}</PortalContext.Provider>
|
|
40
36
|
}
|
|
@@ -4,11 +4,11 @@ import type {ResponsiveProp, ResponsiveRuleOptions} from './types'
|
|
|
4
4
|
|
|
5
5
|
export function _responsiveClassName<T extends string | number>(
|
|
6
6
|
rules: ResponsiveRuleOptions<T>,
|
|
7
|
-
_value: ResponsiveProp<T | boolean> | undefined,
|
|
7
|
+
_value: ResponsiveProp<T | boolean> | T | undefined,
|
|
8
8
|
options?: {
|
|
9
9
|
valueWhenTrue: T
|
|
10
10
|
},
|
|
11
|
-
) {
|
|
11
|
+
): string | undefined {
|
|
12
12
|
let value = _value
|
|
13
13
|
|
|
14
14
|
if (value === undefined) {
|
package/src/css/_style.css.ts
CHANGED
|
@@ -5,8 +5,6 @@ import {layers} from '../../layers.css'
|
|
|
5
5
|
import {vars} from '../../vars.css'
|
|
6
6
|
|
|
7
7
|
const zoomIn = keyframes({
|
|
8
|
-
// '@layer': {
|
|
9
|
-
// [layers.components]: {
|
|
10
8
|
from: {
|
|
11
9
|
opacity: 0,
|
|
12
10
|
transform: 'scale(0.95)',
|
|
@@ -15,24 +13,18 @@ const zoomIn = keyframes({
|
|
|
15
13
|
opacity: 1,
|
|
16
14
|
transform: 'scale(1)',
|
|
17
15
|
},
|
|
18
|
-
// },
|
|
19
|
-
// },
|
|
20
16
|
})
|
|
21
17
|
|
|
22
18
|
const fadeIn = keyframes({
|
|
23
|
-
// '@layer': {
|
|
24
|
-
// [layers.components]: {
|
|
25
19
|
from: {
|
|
26
20
|
opacity: 0,
|
|
27
21
|
},
|
|
28
22
|
to: {
|
|
29
23
|
opacity: 1,
|
|
30
24
|
},
|
|
31
|
-
// },
|
|
32
|
-
// },
|
|
33
25
|
})
|
|
34
26
|
|
|
35
|
-
export const root = _style(layers.components, {
|
|
27
|
+
export const root: string = _style(layers.components, {
|
|
36
28
|
alignItems: 'center',
|
|
37
29
|
justifyContent: 'center',
|
|
38
30
|
outline: 'none',
|
|
@@ -46,7 +38,7 @@ export const root = _style(layers.components, {
|
|
|
46
38
|
},
|
|
47
39
|
})
|
|
48
40
|
|
|
49
|
-
export const card = _style(layers.components, {
|
|
41
|
+
export const card: string = _style(layers.components, {
|
|
50
42
|
width: '100%',
|
|
51
43
|
maxHeight: '100%',
|
|
52
44
|
overflow: ['hidden', 'clip'],
|
|
@@ -58,19 +50,19 @@ export const card = _style(layers.components, {
|
|
|
58
50
|
},
|
|
59
51
|
})
|
|
60
52
|
|
|
61
|
-
export const container = _style(layers.components, {
|
|
53
|
+
export const container: string = _style(layers.components, {
|
|
62
54
|
width: '100%',
|
|
63
55
|
height: '100%',
|
|
64
56
|
})
|
|
65
57
|
|
|
66
|
-
export const scroller = _style(layers.components, {
|
|
58
|
+
export const scroller: string = _style(layers.components, {
|
|
67
59
|
width: '100%',
|
|
68
60
|
height: '100%',
|
|
69
61
|
// overflow: 'auto',
|
|
70
62
|
outline: 'none',
|
|
71
63
|
})
|
|
72
64
|
|
|
73
|
-
export const scrollerShadowTop = _style(layers.components, {
|
|
65
|
+
export const scrollerShadowTop: string = _style(layers.components, {
|
|
74
66
|
position: 'absolute',
|
|
75
67
|
top: 0,
|
|
76
68
|
left: 0,
|
|
@@ -81,7 +73,7 @@ export const scrollerShadowTop = _style(layers.components, {
|
|
|
81
73
|
pointerEvents: 'none',
|
|
82
74
|
})
|
|
83
75
|
|
|
84
|
-
export const scrollerShadowBottom = _style(layers.components, {
|
|
76
|
+
export const scrollerShadowBottom: string = _style(layers.components, {
|
|
85
77
|
position: 'absolute',
|
|
86
78
|
bottom: 0,
|
|
87
79
|
left: 0,
|
|
@@ -92,15 +84,15 @@ export const scrollerShadowBottom = _style(layers.components, {
|
|
|
92
84
|
pointerEvents: 'none',
|
|
93
85
|
})
|
|
94
86
|
|
|
95
|
-
export const header = _style(layers.components, {
|
|
87
|
+
export const header: string = _style(layers.components, {
|
|
96
88
|
zIndex: 2,
|
|
97
89
|
})
|
|
98
90
|
|
|
99
|
-
export const content = _style(layers.components, {
|
|
91
|
+
export const content: string = _style(layers.components, {
|
|
100
92
|
zIndex: 1,
|
|
101
93
|
outline: 'none',
|
|
102
94
|
})
|
|
103
95
|
|
|
104
|
-
export const footer = _style(layers.components, {
|
|
96
|
+
export const footer: string = _style(layers.components, {
|
|
105
97
|
zIndex: 3,
|
|
106
98
|
})
|
|
@@ -2,11 +2,11 @@ import {_style} from '../../_style.css'
|
|
|
2
2
|
import {layers} from '../../layers.css'
|
|
3
3
|
import {vars} from '../../vars.css'
|
|
4
4
|
|
|
5
|
-
export const root = _style(layers.components, {
|
|
5
|
+
export const root: string = _style(layers.components, {
|
|
6
6
|
outline: 'none',
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
export const divider = _style(layers.components, {
|
|
9
|
+
export const divider: string = _style(layers.components, {
|
|
10
10
|
height: `1px`,
|
|
11
11
|
border: 0,
|
|
12
12
|
backgroundColor: vars.color.border,
|
|
@@ -2,11 +2,11 @@ import {_composeClassNames} from '../../_composeClassNames'
|
|
|
2
2
|
import {divider, root} from './menu.css'
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
|
-
export function menu(props: {className?: string}) {
|
|
5
|
+
export function menu(props: {className?: string}): string | undefined {
|
|
6
6
|
return _composeClassNames(props.className, root)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
|
-
export function menuDivider(props: {className?: string}) {
|
|
10
|
+
export function menuDivider(props: {className?: string}): string | undefined {
|
|
11
11
|
return _composeClassNames(props.className, divider)
|
|
12
12
|
}
|
|
@@ -18,19 +18,15 @@ import type {ResponsiveRuleOptions} from '../../types'
|
|
|
18
18
|
import {vars} from '../../vars.css'
|
|
19
19
|
|
|
20
20
|
const pulse = keyframes({
|
|
21
|
-
// '@layer': {
|
|
22
|
-
// [layers.components]: {
|
|
23
21
|
'0%': {
|
|
24
22
|
backgroundPosition: '100%',
|
|
25
23
|
},
|
|
26
24
|
'100%': {
|
|
27
25
|
backgroundPosition: '-100%',
|
|
28
26
|
},
|
|
29
|
-
// },
|
|
30
|
-
// },
|
|
31
27
|
})
|
|
32
28
|
|
|
33
|
-
export const root = _style(layers.components, {
|
|
29
|
+
export const root: string = _style(layers.components, {
|
|
34
30
|
'backgroundColor': vars.color.skeleton.from,
|
|
35
31
|
'backgroundPosition': '100%',
|
|
36
32
|
'backgroundSize': '200% 100%',
|
|
@@ -67,7 +63,7 @@ export const root = _style(layers.components, {
|
|
|
67
63
|
},
|
|
68
64
|
})
|
|
69
65
|
|
|
70
|
-
export const font = _style(layers.components, {
|
|
66
|
+
export const font: string = _style(layers.components, {
|
|
71
67
|
height: `calc(${vars.font.skeleton.lineHeight} - ${vars.font.skeleton.ascenderHeight} - ${vars.font.skeleton.descenderHeight})`,
|
|
72
68
|
})
|
|
73
69
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {_style} from '../../_style.css'
|
|
2
2
|
import {layers} from '../../layers.css'
|
|
3
3
|
|
|
4
|
-
export const layer = _style(layers.components, {
|
|
4
|
+
export const layer: string = _style(layers.components, {
|
|
5
5
|
position: 'absolute',
|
|
6
6
|
right: 0,
|
|
7
7
|
bottom: 0,
|
|
@@ -11,7 +11,7 @@ export const layer = _style(layers.components, {
|
|
|
11
11
|
width: '100%',
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
export const root = _style(layers.components, {
|
|
14
|
+
export const root: string = _style(layers.components, {
|
|
15
15
|
pointerEvents: 'all',
|
|
16
16
|
overflow: ['hidden', 'clip'],
|
|
17
17
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {layer, root} from './toast.css'
|
|
2
2
|
|
|
3
3
|
/** @public */
|
|
4
|
-
export function toastLayer() {
|
|
4
|
+
export function toastLayer(): string {
|
|
5
5
|
return layer
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** @public */
|
|
9
|
-
export function toast() {
|
|
9
|
+
export function toast(): string {
|
|
10
10
|
return root
|
|
11
11
|
}
|
|
@@ -4,7 +4,7 @@ import {_style} from '../../_style.css'
|
|
|
4
4
|
import {layers} from '../../layers.css'
|
|
5
5
|
import {vars} from '../../vars.css'
|
|
6
6
|
|
|
7
|
-
export const item = _style(layers.components, {
|
|
7
|
+
export const item: string = _style(layers.components, {
|
|
8
8
|
selectors: {
|
|
9
9
|
'&[role="treeitem"]': {
|
|
10
10
|
outline: 'none',
|
|
@@ -2,6 +2,6 @@ import {_composeClassNames} from '../../_composeClassNames'
|
|
|
2
2
|
import {item} from './tree.css'
|
|
3
3
|
|
|
4
4
|
/** @beta */
|
|
5
|
-
export function treeItem(props: {className?: string}) {
|
|
5
|
+
export function treeItem(props: {className?: string}): string | undefined {
|
|
6
6
|
return _composeClassNames(props.className, item)
|
|
7
7
|
}
|
|
@@ -3,10 +3,17 @@ import {
|
|
|
3
3
|
_parseColorToken,
|
|
4
4
|
AVATAR_COLORS,
|
|
5
5
|
AVATAR_SIZE,
|
|
6
|
-
|
|
6
|
+
buildTheme,
|
|
7
|
+
CARD_TONES,
|
|
8
|
+
type CardColorTokens,
|
|
9
|
+
type CardTone,
|
|
7
10
|
COLOR_VARIANTS,
|
|
11
|
+
type ColorScheme,
|
|
8
12
|
type ColorValue,
|
|
13
|
+
type ColorVariant,
|
|
9
14
|
CONTAINER_SCALE,
|
|
15
|
+
ELEMENT_TONES,
|
|
16
|
+
type ElementTone,
|
|
10
17
|
FONT_CODE_SIZE,
|
|
11
18
|
FONT_HEADING_SIZE,
|
|
12
19
|
FONT_LABEL_SIZE,
|
|
@@ -16,20 +23,19 @@ import {
|
|
|
16
23
|
RADIUS,
|
|
17
24
|
SHADOW,
|
|
18
25
|
SPACE,
|
|
19
|
-
THEME_COLOR_CARD_TONES,
|
|
20
|
-
THEME_COLOR_STATE_TONES,
|
|
21
|
-
type ThemeColorCard_v3,
|
|
22
|
-
type ThemeColorCardToneKey,
|
|
23
|
-
type ThemeColorSchemeKey,
|
|
24
|
-
type ThemeColorStateToneKey,
|
|
25
|
-
type ThemeColorVariantKey,
|
|
26
26
|
TINTS,
|
|
27
27
|
} from '@sanity/ui/theme'
|
|
28
28
|
import {createTheme, globalFontFace} from '@vanilla-extract/css'
|
|
29
29
|
|
|
30
30
|
import {_fromEntries} from './_fromEntries'
|
|
31
31
|
import {layers} from './layers.css'
|
|
32
|
-
import type {
|
|
32
|
+
import type {
|
|
33
|
+
CSSCardColorTokens,
|
|
34
|
+
ElementColorTokens,
|
|
35
|
+
RootThemeTokens,
|
|
36
|
+
SchemeColorTokens,
|
|
37
|
+
VariantColorTokens,
|
|
38
|
+
} from './types'
|
|
33
39
|
import {px, toBoxShadow} from './util'
|
|
34
40
|
import {paletteVars, themeVars} from './vars.css'
|
|
35
41
|
|
|
@@ -86,11 +92,10 @@ globalFontFace('Inter', [
|
|
|
86
92
|
},
|
|
87
93
|
])
|
|
88
94
|
|
|
89
|
-
const theme =
|
|
95
|
+
const theme = buildTheme()
|
|
90
96
|
|
|
91
|
-
const themeValue:
|
|
92
|
-
|
|
93
|
-
'avatar': {
|
|
97
|
+
const themeValue: RootThemeTokens = {
|
|
98
|
+
avatar: {
|
|
94
99
|
focusRing: {
|
|
95
100
|
offset: px(theme.avatar.focusRing.offset),
|
|
96
101
|
width: px(theme.avatar.focusRing.width),
|
|
@@ -107,7 +112,7 @@ const themeValue: CSSTheme = {
|
|
|
107
112
|
),
|
|
108
113
|
},
|
|
109
114
|
},
|
|
110
|
-
|
|
115
|
+
button: {
|
|
111
116
|
border: {
|
|
112
117
|
width: px(theme.button.border.width),
|
|
113
118
|
},
|
|
@@ -116,15 +121,15 @@ const themeValue: CSSTheme = {
|
|
|
116
121
|
width: px(theme.button.focusRing.width),
|
|
117
122
|
},
|
|
118
123
|
},
|
|
119
|
-
|
|
124
|
+
card: {
|
|
120
125
|
shadow: {
|
|
121
126
|
outline: px(theme.card.shadow.outline),
|
|
122
127
|
},
|
|
123
128
|
},
|
|
124
|
-
|
|
129
|
+
container: {
|
|
125
130
|
..._fromEntries(CONTAINER_SCALE.map((s) => [s, rem(theme.container[s])])),
|
|
126
131
|
},
|
|
127
|
-
|
|
132
|
+
color: {
|
|
128
133
|
palette: {
|
|
129
134
|
black: black.hex,
|
|
130
135
|
white: white.hex,
|
|
@@ -136,7 +141,7 @@ const themeValue: CSSTheme = {
|
|
|
136
141
|
light: renderColorScheme({scheme: 'light'}),
|
|
137
142
|
dark: renderColorScheme({scheme: 'dark'}),
|
|
138
143
|
},
|
|
139
|
-
|
|
144
|
+
font: {
|
|
140
145
|
code: {
|
|
141
146
|
family: theme.font.code.family,
|
|
142
147
|
featureSettings: theme.font.code.featureSettings || 'normal',
|
|
@@ -245,7 +250,7 @@ const themeValue: CSSTheme = {
|
|
|
245
250
|
},
|
|
246
251
|
},
|
|
247
252
|
},
|
|
248
|
-
|
|
253
|
+
input: {
|
|
249
254
|
border: {
|
|
250
255
|
width: px(theme.input.border.width),
|
|
251
256
|
},
|
|
@@ -288,10 +293,8 @@ const themeValue: CSSTheme = {
|
|
|
288
293
|
},
|
|
289
294
|
},
|
|
290
295
|
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
'shadow': _fromEntries(
|
|
296
|
+
radius: _fromEntries(RADIUS.map((key) => [key, `${theme.radius[key]}px`])),
|
|
297
|
+
shadow: _fromEntries(
|
|
295
298
|
SHADOW.map((s) => [
|
|
296
299
|
s,
|
|
297
300
|
{
|
|
@@ -301,14 +304,16 @@ const themeValue: CSSTheme = {
|
|
|
301
304
|
},
|
|
302
305
|
]),
|
|
303
306
|
),
|
|
304
|
-
|
|
305
|
-
'space': _fromEntries(SPACE.map((key) => [key, `${theme.space[key]}px`])),
|
|
307
|
+
space: _fromEntries(SPACE.map((key) => [key, `${theme.space[key]}px`])),
|
|
306
308
|
} as const
|
|
307
309
|
|
|
308
310
|
/** @public */
|
|
309
|
-
export const themeClassName = createTheme(themeVars,
|
|
311
|
+
export const themeClassName: string = createTheme(themeVars, {
|
|
312
|
+
'@layer': layers.theme,
|
|
313
|
+
...themeValue,
|
|
314
|
+
})
|
|
310
315
|
|
|
311
|
-
function renderColorScheme(options: {scheme:
|
|
316
|
+
function renderColorScheme(options: {scheme: ColorScheme}): SchemeColorTokens {
|
|
312
317
|
const {scheme} = options
|
|
313
318
|
|
|
314
319
|
const defaultCardColor = renderCardColor({
|
|
@@ -318,7 +323,7 @@ function renderColorScheme(options: {scheme: ThemeColorSchemeKey}) {
|
|
|
318
323
|
|
|
319
324
|
return {
|
|
320
325
|
..._fromEntries(
|
|
321
|
-
|
|
326
|
+
CARD_TONES.map((key) => {
|
|
322
327
|
if (key === 'default') {
|
|
323
328
|
return [key, defaultCardColor]
|
|
324
329
|
}
|
|
@@ -338,14 +343,14 @@ function renderColorScheme(options: {scheme: ThemeColorSchemeKey}) {
|
|
|
338
343
|
|
|
339
344
|
function renderCardColor(options: {
|
|
340
345
|
bgValue?: string
|
|
341
|
-
tone:
|
|
346
|
+
tone: CardTone
|
|
342
347
|
scheme: 'light' | 'dark'
|
|
343
|
-
}):
|
|
348
|
+
}): CSSCardColorTokens {
|
|
344
349
|
const {bgValue, tone: t, scheme} = options
|
|
345
350
|
|
|
346
351
|
const tokens = theme.color[t]
|
|
347
352
|
|
|
348
|
-
const tintedDefaultVariant =
|
|
353
|
+
const tintedDefaultVariant = renderColorElement(tokens, {
|
|
349
354
|
bgValue,
|
|
350
355
|
variant: 'tinted',
|
|
351
356
|
scheme,
|
|
@@ -358,25 +363,6 @@ function renderCardColor(options: {
|
|
|
358
363
|
scheme,
|
|
359
364
|
} as const
|
|
360
365
|
|
|
361
|
-
const variants = {
|
|
362
|
-
..._fromEntries(
|
|
363
|
-
COLOR_VARIANTS.map((v) => [
|
|
364
|
-
v,
|
|
365
|
-
{
|
|
366
|
-
..._fromEntries(
|
|
367
|
-
THEME_COLOR_STATE_TONES.map((t) => {
|
|
368
|
-
if (v === 'tinted' && t === 'default') {
|
|
369
|
-
return [t, tintedDefaultVariant]
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return [t, renderColorVariant(tokens, {scheme, variant: v, tone: t})]
|
|
373
|
-
}),
|
|
374
|
-
),
|
|
375
|
-
},
|
|
376
|
-
]),
|
|
377
|
-
),
|
|
378
|
-
}
|
|
379
|
-
|
|
380
366
|
return {
|
|
381
367
|
avatar: {
|
|
382
368
|
..._fromEntries(
|
|
@@ -433,7 +419,6 @@ function renderCardColor(options: {
|
|
|
433
419
|
variable: renderColor(tokens.code.token.variable, colorOptions),
|
|
434
420
|
},
|
|
435
421
|
},
|
|
436
|
-
|
|
437
422
|
focusRing: renderColor(tokens.focusRing, colorOptions),
|
|
438
423
|
link: {
|
|
439
424
|
fg: renderColor(tokens.link.fg, colorOptions),
|
|
@@ -444,25 +429,39 @@ function renderCardColor(options: {
|
|
|
444
429
|
penumbra: renderColor(tokens.shadow.penumbra, colorOptions),
|
|
445
430
|
ambient: renderColor(tokens.shadow.ambient, colorOptions),
|
|
446
431
|
},
|
|
447
|
-
|
|
448
432
|
skeleton: {
|
|
449
433
|
from: renderColor(tokens.skeleton.from, colorOptions),
|
|
450
434
|
to: renderColor(tokens.skeleton.to, colorOptions),
|
|
451
435
|
},
|
|
436
|
+
// variants
|
|
437
|
+
..._fromEntries(
|
|
438
|
+
COLOR_VARIANTS.map((v) => [
|
|
439
|
+
v,
|
|
440
|
+
{
|
|
441
|
+
..._fromEntries(
|
|
442
|
+
ELEMENT_TONES.map((t) => {
|
|
443
|
+
if (v === 'tinted' && t === 'default') {
|
|
444
|
+
return [t, tintedDefaultVariant]
|
|
445
|
+
}
|
|
452
446
|
|
|
453
|
-
|
|
447
|
+
return [t, renderColorElement(tokens, {scheme, variant: v, tone: t})]
|
|
448
|
+
}),
|
|
449
|
+
),
|
|
450
|
+
} satisfies VariantColorTokens,
|
|
451
|
+
]),
|
|
452
|
+
),
|
|
454
453
|
}
|
|
455
454
|
}
|
|
456
455
|
|
|
457
|
-
function
|
|
458
|
-
tokens:
|
|
456
|
+
function renderColorElement(
|
|
457
|
+
tokens: CardColorTokens,
|
|
459
458
|
options: {
|
|
460
459
|
bgValue?: string
|
|
461
|
-
scheme:
|
|
462
|
-
variant:
|
|
463
|
-
tone:
|
|
460
|
+
scheme: ColorScheme
|
|
461
|
+
variant: ColorVariant
|
|
462
|
+
tone: ElementTone
|
|
464
463
|
},
|
|
465
|
-
) {
|
|
464
|
+
): ElementColorTokens {
|
|
466
465
|
const {bgValue, scheme, variant: v, tone: t} = options
|
|
467
466
|
|
|
468
467
|
const elementColorOptions = {bgValue, defaultHue: tokens.variant[v][t]._hue, scheme}
|
|
@@ -486,7 +485,7 @@ function renderColorVariant(
|
|
|
486
485
|
function renderColor(
|
|
487
486
|
value: ColorValue,
|
|
488
487
|
context: {bgValue?: string; defaultHue: Hue; scheme: 'light' | 'dark'},
|
|
489
|
-
) {
|
|
488
|
+
): string {
|
|
490
489
|
const {bgValue = 'transparent', defaultHue, scheme} = context
|
|
491
490
|
|
|
492
491
|
const expr = _parseColorToken(value[scheme === 'light' ? 0 : 1], {defaultHue})
|
package/src/css/layers.css.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {layer} from '@vanilla-extract/css'
|
|
2
2
|
|
|
3
3
|
/** @public */
|
|
4
|
-
export
|
|
4
|
+
export type CSSLayer = 'theme' | 'props' | 'primitives' | 'components'
|
|
5
|
+
|
|
6
|
+
/** @public */
|
|
7
|
+
export const layers: Record<CSSLayer, string> = {
|
|
5
8
|
theme: layer('theme'),
|
|
6
9
|
props: layer('props'),
|
|
7
10
|
primitives: layer('primitives'),
|