@sanity/ui 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/_visual-editing.d.mts +2 -1126
- package/dist/_visual-editing.d.ts +2 -1126
- package/dist/_visual-editing.js +3 -31
- package/dist/_visual-editing.mjs +2 -31
- package/dist/index.d.mts +555 -2769
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +555 -2769
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2982 -1934
- package/dist/index.mjs +2950 -1903
- package/dist/index.mjs.map +1 -1
- package/dist/refractor.js +16 -0
- package/dist/refractor.mjs +21 -0
- package/dist/refractor.mjs.map +1 -0
- package/dist/tabList.js +3804 -0
- package/dist/tabList.mjs +3355 -0
- package/dist/tabList.mjs.map +1 -0
- package/dist/theme.d.mts +927 -1227
- package/dist/theme.d.mts.map +1 -0
- package/dist/theme.d.ts +927 -1227
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +3 -4127
- package/dist/theme.mjs +2 -4127
- package/dist/theme2.d.mts +2 -0
- package/dist/theme2.d.ts +2 -0
- package/dist/theme2.js +4104 -0
- package/dist/theme2.mjs +3851 -0
- package/dist/theme2.mjs.map +1 -0
- package/dist/useTheme.d.mts +1451 -0
- package/dist/useTheme.d.mts.map +1 -0
- package/dist/useTheme.d.ts +1451 -0
- package/dist/useTheme.d.ts.map +1 -0
- package/exports/_visual-editing.ts +1 -0
- package/package.json +52 -168
- package/src/core/_compat.ts +30 -0
- package/src/core/components/autocomplete/autocomplete.tsx +8 -0
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
- package/src/core/components/breadcrumbs/breadcrumbs.test.tsx +8 -5
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +3 -0
- package/src/core/components/dialog/dialog.tsx +5 -2
- package/src/core/components/hotkeys/hotkeys.test.tsx +10 -5
- package/src/core/components/hotkeys/hotkeys.tsx +2 -0
- package/src/core/components/menu/menu.spacing.test.tsx +12 -7
- package/src/core/components/menu/menu.test.tsx +9 -6
- package/src/core/components/menu/menu.tsx +4 -2
- package/src/core/components/menu/menuButton.tsx +8 -0
- package/src/core/components/menu/menuDivider.ts +1 -0
- package/src/core/components/menu/menuGroup.spacing.test.tsx +9 -6
- package/src/core/components/menu/menuGroup.tsx +6 -2
- package/src/core/components/menu/menuItem.spacing.test.tsx +8 -5
- package/src/core/components/menu/menuItem.tsx +4 -0
- package/src/core/components/menu/useMenuController.ts +2 -0
- package/src/core/components/skeleton/skeleton.tsx +1 -0
- package/src/core/components/tab/tab.tsx +1 -0
- package/src/core/components/tab/tabList.test.tsx +7 -5
- package/src/core/components/tab/tabList.tsx +1 -0
- package/src/core/components/toast/toast.test.tsx +9 -4
- package/src/core/components/toast/toast.tsx +1 -0
- package/src/core/components/toast/toastLayer.tsx +1 -0
- package/src/core/components/tree/tree.test.tsx +10 -5
- package/src/core/components/tree/tree.tsx +2 -0
- package/src/core/components/tree/treeGroup.tsx +1 -0
- package/src/core/components/tree/treeItem.test.tsx +10 -5
- package/src/core/components/tree/treeItem.tsx +1 -0
- package/src/core/hooks/index.ts +1 -0
- package/src/core/hooks/useClickOutside.test.tsx +43 -15
- package/src/core/hooks/useClickOutside.ts +1 -1
- package/src/core/hooks/useClickOutsideEvent.test.tsx +8 -4
- package/src/core/hooks/useDelayed.test.ts +9 -8
- package/src/core/hooks/useElementRect/useElementRect.ts +1 -0
- package/src/core/hooks/useForwardedRef.ts +1 -0
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +2 -1
- package/src/core/hooks/usePrefersDark.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersDark.test.tsx +3 -1
- package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +7 -5
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +3 -1
- package/src/core/lib/createGlobalScopedContext.ts +1 -0
- package/src/core/lib/globalScope.ts +1 -0
- package/src/core/observers/elementSizeObserver.ts +1 -0
- package/src/core/primitives/avatar/avatar.tsx +2 -2
- package/src/core/primitives/avatar/avatarStack.tsx +1 -0
- package/src/core/primitives/badge/badge.test.tsx +3 -2
- package/src/core/primitives/badge/badge.tsx +3 -1
- package/src/core/primitives/box/box.test.tsx +18 -5
- package/src/core/primitives/box/box.tsx +9 -1
- package/src/core/primitives/button/button.test.tsx +10 -6
- package/src/core/primitives/button/button.tsx +4 -0
- package/src/core/primitives/button/styles.ts +1 -0
- package/src/core/primitives/card/card.tsx +2 -5
- package/src/core/primitives/card/types.ts +1 -0
- package/src/core/primitives/code/code.tsx +1 -0
- package/src/core/primitives/code/refractor.tsx +2 -0
- package/src/core/primitives/container/container.tsx +1 -0
- package/src/core/primitives/flex/flex.tsx +2 -3
- package/src/core/primitives/grid/grid.test.tsx +11 -5
- package/src/core/primitives/grid/grid.tsx +3 -0
- package/src/core/primitives/heading/heading.tsx +1 -0
- package/src/core/primitives/inline/inline.test.tsx +9 -5
- package/src/core/primitives/inline/inline.tsx +3 -0
- package/src/core/primitives/kbd/kbd.tsx +5 -1
- package/src/core/primitives/label/label.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +5 -4
- package/src/core/primitives/popover/popoverCard.tsx +1 -0
- package/src/core/primitives/popover/types.ts +0 -1
- package/src/core/primitives/select/select.test.tsx +9 -5
- package/src/core/primitives/select/select.tsx +1 -0
- package/src/core/primitives/stack/stack.test.tsx +9 -5
- package/src/core/primitives/stack/stack.tsx +2 -0
- package/src/core/primitives/stack/styles.ts +1 -0
- package/src/core/primitives/text/text.tsx +1 -0
- package/src/core/primitives/textInput/textInput.test.tsx +9 -5
- package/src/core/primitives/textInput/textInput.tsx +3 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +82 -49
- package/src/core/primitives/tooltip/tooltip.tsx +3 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/types.ts +2 -0
- package/src/core/styles/flex/types.ts +0 -1
- package/src/core/styles/font/responsiveFont.ts +0 -3
- package/src/core/styles/font/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +1 -0
- package/src/core/styles/margin/marginStyle.ts +1 -0
- package/src/core/styles/margin/marginsStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.test.ts +2 -1
- package/src/core/styles/padding/paddingStyle.ts +1 -0
- package/src/core/theme/theme.test.tsx +7 -3
- package/src/core/theme/useRootTheme.ts +1 -0
- package/src/core/theme/useTheme.ts +2 -0
- package/src/core/utils/arrow/arrow.tsx +1 -0
- package/src/core/utils/boundaryElement/boundaryElement.test.tsx +9 -4
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +1 -0
- package/src/core/utils/getElementRef.ts +5 -0
- package/src/core/utils/layer/getLayerContext.test.ts +2 -0
- package/src/core/utils/layer/layer.test.tsx +9 -4
- package/src/core/utils/layer/layer.tsx +1 -0
- package/src/core/utils/layer/useLayer.ts +2 -0
- package/src/core/utils/portal/portal.test.tsx +9 -4
- package/src/core/utils/portal/portalProvider.tsx +1 -0
- package/src/core/utils/virtualList/virtualList.tsx +2 -1
- package/src/theme/build/_deprecated/color/_selectable/createSelectableTones.ts +10 -0
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +4 -0
- package/src/theme/build/_deprecated/color/button/createButtonModes.ts +5 -0
- package/src/theme/build/_deprecated/color/button/createButtonTones.ts +5 -0
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +6 -0
- package/src/theme/build/_deprecated/color/color.test.ts +5 -1
- package/src/theme/build/_deprecated/color/defaults.ts +1 -0
- package/src/theme/build/_deprecated/color/factory.ts +36 -0
- package/src/theme/build/_deprecated/color/input/createInputModes.ts +5 -0
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +4 -0
- package/src/theme/build/_deprecated/color/spot/createSpot.ts +3 -0
- package/src/theme/build/buildColorTheme.test.ts +2 -0
- package/src/theme/build/buildColorTheme.ts +8 -0
- package/src/theme/build/buildTheme.test.ts +2 -0
- package/src/theme/build/lib/color-fns/color-fns.test.ts +3 -1
- package/src/theme/build/merge.ts +5 -0
- package/src/theme/build/mixThemeColor.test.ts +2 -0
- package/src/theme/build/renderColorTheme.ts +6 -0
- package/src/theme/build/renderColorValue.ts +0 -2
- package/src/theme/build/resolveColorTokens.ts +6 -0
- package/src/theme/build/theme.test.ts +2 -0
- package/src/theme/config/helpers.ts +5 -0
- package/src/theme/config/system.ts +2 -0
- package/src/theme/config/tokens/color/types.ts +6 -4
- package/src/theme/config/tokens/parseTokenKey.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.test.ts +2 -0
- package/src/theme/config/tokens/parseTokenValue.ts +1 -0
- package/src/theme/getScopedTheme.ts +6 -1
- package/src/theme/system/color/_helpers.ts +4 -0
- package/src/theme/system/theme.ts +4 -0
- package/src/theme/system/v0/color/_system.ts +1 -0
- package/src/theme/system/v0/color/button.ts +14 -0
- package/src/theme/system/v0/color/card.ts +6 -0
- package/src/theme/system/v0/color/color.ts +11 -0
- package/src/theme/system/v0/color/input.ts +6 -0
- package/src/theme/system/v0/color/muted.ts +11 -0
- package/src/theme/system/v0/color/selectable.ts +11 -0
- package/src/theme/system/v0/color/solid.ts +11 -0
- package/src/theme/system/v0/color/spot.ts +1 -0
- package/src/theme/versioning/getTheme_v2.ts +15 -0
- package/src/theme/versioning/themeColor_v0_v2.ts +7 -0
- package/src/theme/versioning/themeColor_v2_v2_9.ts +1 -0
- package/src/theme/versioning/v0_v2.ts +13 -1
- package/src/theme/versioning/v2_v0.ts +18 -0
- package/dist/_chunks-cjs/_visual-editing.js +0 -5899
- package/dist/_chunks-cjs/_visual-editing.js.map +0 -1
- package/dist/_chunks-cjs/refractor.js +0 -23
- package/dist/_chunks-cjs/refractor.js.map +0 -1
- package/dist/_chunks-es/_visual-editing.mjs +0 -5905
- package/dist/_chunks-es/_visual-editing.mjs.map +0 -1
- package/dist/_chunks-es/refractor.mjs +0 -26
- package/dist/_chunks-es/refractor.mjs.map +0 -1
- package/dist/_visual-editing.js.map +0 -1
- package/dist/_visual-editing.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/theme.mjs.map +0 -1
- package/src/core/__workshop__/constants.ts +0 -293
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +0 -49
- package/src/core/components/autocomplete/__mocks__/countries.ts +0 -245
- package/src/core/components/autocomplete/__workshop__/async.tsx +0 -156
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -137
- package/src/core/components/autocomplete/__workshop__/custom.tsx +0 -89
- package/src/core/components/autocomplete/__workshop__/example.tsx +0 -79
- package/src/core/components/autocomplete/__workshop__/focusAndBlur.tsx +0 -36
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +0 -294
- package/src/core/components/autocomplete/__workshop__/index.ts +0 -39
- package/src/core/components/autocomplete/__workshop__/types.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +0 -62
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -14
- package/src/core/components/dialog/__workshop__/activate.tsx +0 -134
- package/src/core/components/dialog/__workshop__/autoFocus.tsx +0 -29
- package/src/core/components/dialog/__workshop__/index.ts +0 -19
- package/src/core/components/dialog/__workshop__/layering.tsx +0 -41
- package/src/core/components/dialog/__workshop__/nested.tsx +0 -72
- package/src/core/components/dialog/__workshop__/onScroll.tsx +0 -39
- package/src/core/components/dialog/__workshop__/panes.tsx +0 -82
- package/src/core/components/dialog/__workshop__/position.tsx +0 -30
- package/src/core/components/dialog/__workshop__/props.tsx +0 -75
- package/src/core/components/dialog/__workshop__/provider.tsx +0 -11
- package/src/core/components/dialog/__workshop__/wrapped.tsx +0 -76
- package/src/core/components/hotkeys/__workshop__/index.ts +0 -14
- package/src/core/components/hotkeys/__workshop__/plain.tsx +0 -9
- package/src/core/components/menu/__workshop__/asComponent.tsx +0 -45
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +0 -51
- package/src/core/components/menu/__workshop__/closableMenuButton.tsx +0 -46
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +0 -134
- package/src/core/components/menu/__workshop__/customMenuItem.tsx +0 -45
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +0 -39
- package/src/core/components/menu/__workshop__/disableFocusOnClose.tsx +0 -40
- package/src/core/components/menu/__workshop__/groups.tsx +0 -156
- package/src/core/components/menu/__workshop__/index.ts +0 -89
- package/src/core/components/menu/__workshop__/menuButton.tsx +0 -80
- package/src/core/components/menu/__workshop__/menuGroupRight.tsx +0 -65
- package/src/core/components/menu/__workshop__/nestedMenu.tsx +0 -22
- package/src/core/components/menu/__workshop__/onCloseMenuButton.tsx +0 -41
- package/src/core/components/menu/__workshop__/selectedItem.tsx +0 -69
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +0 -47
- package/src/core/components/menu/__workshop__/tones.tsx +0 -25
- package/src/core/components/menu/__workshop__/withoutArrow.tsx +0 -32
- package/src/core/components/skeleton/__workshop__/delay.tsx +0 -70
- package/src/core/components/skeleton/__workshop__/index.ts +0 -11
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +0 -64
- package/src/core/components/tab/__workshop__/example.tsx +0 -79
- package/src/core/components/tab/__workshop__/index.ts +0 -14
- package/src/core/components/toast/__workshop__/hook.tsx +0 -71
- package/src/core/components/toast/__workshop__/index.ts +0 -19
- package/src/core/components/toast/__workshop__/toast.tsx +0 -26
- package/src/core/components/tree/__workshop__/basic.perf.ts +0 -19
- package/src/core/components/tree/__workshop__/basic.tsx +0 -105
- package/src/core/components/tree/__workshop__/index.ts +0 -21
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +0 -84
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +0 -32
- package/src/core/hooks/useElementRect/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/index.ts +0 -14
- package/src/core/hooks/useMediaIndex/__workshop__/test.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +0 -14
- package/src/core/primitives/avatar/__workshop__/index.ts +0 -29
- package/src/core/primitives/avatar/__workshop__/stack.tsx +0 -25
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +0 -63
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +0 -70
- package/src/core/primitives/badge/__workshop__/index.ts +0 -19
- package/src/core/primitives/badge/__workshop__/props.tsx +0 -30
- package/src/core/primitives/badge/__workshop__/tones.tsx +0 -21
- package/src/core/primitives/box/__workshop__/asComponent.tsx +0 -31
- package/src/core/primitives/box/__workshop__/index.ts +0 -24
- package/src/core/primitives/box/__workshop__/props.tsx +0 -20
- package/src/core/primitives/box/__workshop__/responsive.tsx +0 -20
- package/src/core/primitives/button/__workshop__/custom.tsx +0 -51
- package/src/core/primitives/button/__workshop__/customIcons.tsx +0 -30
- package/src/core/primitives/button/__workshop__/disabled.tsx +0 -74
- package/src/core/primitives/button/__workshop__/index.ts +0 -59
- package/src/core/primitives/button/__workshop__/mixedChildren.tsx +0 -12
- package/src/core/primitives/button/__workshop__/props.tsx +0 -55
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +0 -36
- package/src/core/primitives/button/__workshop__/stacked.tsx +0 -58
- package/src/core/primitives/button/__workshop__/styled1.tsx +0 -17
- package/src/core/primitives/button/__workshop__/styled2.tsx +0 -19
- package/src/core/primitives/button/__workshop__/uploadButton.tsx +0 -28
- package/src/core/primitives/card/__workshop__/allTones.tsx +0 -25
- package/src/core/primitives/card/__workshop__/asButton.tsx +0 -107
- package/src/core/primitives/card/__workshop__/asComponent.tsx +0 -27
- package/src/core/primitives/card/__workshop__/checkered.tsx +0 -26
- package/src/core/primitives/card/__workshop__/index.ts +0 -18
- package/src/core/primitives/card/__workshop__/interactive.tsx +0 -30
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +0 -80
- package/src/core/primitives/card/__workshop__/props.tsx +0 -53
- package/src/core/primitives/card/__workshop__/selected.tsx +0 -94
- package/src/core/primitives/card/__workshop__/styled.tsx +0 -14
- package/src/core/primitives/checkbox/__workshop__/example.tsx +0 -25
- package/src/core/primitives/checkbox/__workshop__/index.ts +0 -13
- package/src/core/primitives/checkbox/__workshop__/props.tsx +0 -33
- package/src/core/primitives/checkbox/__workshop__/readOnly.tsx +0 -16
- package/src/core/primitives/checkbox/__workshop__/tones.tsx +0 -28
- package/src/core/primitives/code/__workshop__/index.ts +0 -19
- package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/code/__workshop__/props.tsx +0 -21
- package/src/core/primitives/container/__workshop__/example.tsx +0 -20
- package/src/core/primitives/container/__workshop__/index.ts +0 -8
- package/src/core/primitives/flex/__workshop__/example.tsx +0 -34
- package/src/core/primitives/flex/__workshop__/gap.tsx +0 -25
- package/src/core/primitives/flex/__workshop__/index.ts +0 -11
- package/src/core/primitives/grid/__workshop__/index.ts +0 -10
- package/src/core/primitives/grid/__workshop__/responsive.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/index.ts +0 -19
- package/src/core/primitives/heading/__workshop__/opticalAlignment.tsx +0 -54
- package/src/core/primitives/heading/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/inline/__workshop__/index.ts +0 -8
- package/src/core/primitives/inline/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/kbd/__workshop__/index.ts +0 -8
- package/src/core/primitives/kbd/__workshop__/plain.tsx +0 -9
- package/src/core/primitives/label/__workshop__/index.ts +0 -19
- package/src/core/primitives/label/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/label/__workshop__/plain.tsx +0 -24
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +0 -77
- package/src/core/primitives/popover/__workshop__/MarginsStory.tsx +0 -31
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +0 -32
- package/src/core/primitives/popover/__workshop__/OpenOnMountStory.tsx +0 -11
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -71
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +0 -89
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +0 -97
- package/src/core/primitives/popover/__workshop__/index.ts +0 -49
- package/src/core/primitives/radio/__workshop__/example.tsx +0 -63
- package/src/core/primitives/radio/__workshop__/index.ts +0 -11
- package/src/core/primitives/radio/__workshop__/plain.tsx +0 -28
- package/src/core/primitives/select/__workshop__/index.ts +0 -11
- package/src/core/primitives/select/__workshop__/plain.tsx +0 -27
- package/src/core/primitives/select/__workshop__/readOnly.tsx +0 -23
- package/src/core/primitives/spinner/__workshop__/Props.tsx +0 -15
- package/src/core/primitives/spinner/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/index.ts +0 -14
- package/src/core/primitives/stack/__workshop__/plain.tsx +0 -32
- package/src/core/primitives/switch/__workshop__/example.tsx +0 -23
- package/src/core/primitives/switch/__workshop__/index.ts +0 -11
- package/src/core/primitives/switch/__workshop__/props.tsx +0 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +0 -30
- package/src/core/primitives/text/__workshop__/example.tsx +0 -39
- package/src/core/primitives/text/__workshop__/index.ts +0 -24
- package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +0 -48
- package/src/core/primitives/textArea/__workshop__/index.ts +0 -14
- package/src/core/primitives/textArea/__workshop__/plain.tsx +0 -50
- package/src/core/primitives/textInput/__workshop__/clearButton.tsx +0 -30
- package/src/core/primitives/textInput/__workshop__/customValidity.tsx +0 -17
- package/src/core/primitives/textInput/__workshop__/index.ts +0 -44
- package/src/core/primitives/textInput/__workshop__/plain.tsx +0 -98
- package/src/core/primitives/textInput/__workshop__/readOnly.tsx +0 -9
- package/src/core/primitives/textInput/__workshop__/states.tsx +0 -53
- package/src/core/primitives/textInput/__workshop__/tones.tsx +0 -277
- package/src/core/primitives/textInput/__workshop__/typed.tsx +0 -23
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +0 -102
- package/src/core/primitives/tooltip/__workshop__/index.ts +0 -29
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +0 -74
- package/src/core/primitives/tooltip/__workshop__/props.tsx +0 -107
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +0 -86
- package/src/core/theme/__workshop__/build/Root.tsx +0 -367
- package/src/core/theme/__workshop__/build/helpers.ts +0 -46
- package/src/core/theme/__workshop__/build/story.tsx +0 -465
- package/src/core/theme/__workshop__/canvas.tsx +0 -352
- package/src/core/theme/__workshop__/color.tsx +0 -62
- package/src/core/theme/__workshop__/debug/story.tsx +0 -408
- package/src/core/theme/__workshop__/index.ts +0 -39
- package/src/core/theme/__workshop__/layer.tsx +0 -78
- package/src/core/theme/__workshop__/nestedProvider.tsx +0 -15
- package/src/core/utils/boundaryElement/__workshop__/index.ts +0 -14
- package/src/core/utils/boundaryElement/__workshop__/plain.tsx +0 -19
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +0 -30
- package/src/core/utils/elementQuery/__workshop__/index.ts +0 -14
- package/src/core/utils/layer/__workshop__/_debug.tsx +0 -17
- package/src/core/utils/layer/__workshop__/index.ts +0 -24
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +0 -49
- package/src/core/utils/layer/__workshop__/nested.tsx +0 -98
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +0 -13
- package/src/core/utils/portal/__workshop__/index.ts +0 -14
- package/src/core/utils/portal/__workshop__/named.tsx +0 -63
- package/src/core/utils/virtualList/__workshop__/changingProps.tsx +0 -36
- package/src/core/utils/virtualList/__workshop__/elementScroll.tsx +0 -24
- package/src/core/utils/virtualList/__workshop__/index.ts +0 -29
- package/src/core/utils/virtualList/__workshop__/infiniteList.tsx +0 -48
- package/src/core/utils/virtualList/__workshop__/windowScrolll.tsx +0 -22
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
2
|
|
|
3
3
|
import {type ComponentProps} from 'react'
|
|
4
|
+
import {beforeEach, describe, expect, it, vi} from 'vitest'
|
|
4
5
|
|
|
5
6
|
import {render} from '../../../../test'
|
|
6
7
|
import {responsiveGridItemStyle} from '../../styles/internal'
|
|
7
8
|
import {Box} from './box'
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
const actual =
|
|
10
|
+
vi.mock('../../styles/internal', async (importOriginal) => {
|
|
11
|
+
const actual = await importOriginal<typeof import('../../styles/internal')>()
|
|
11
12
|
|
|
12
13
|
return {
|
|
13
14
|
...actual,
|
|
14
|
-
responsiveGridItemStyle:
|
|
15
|
+
responsiveGridItemStyle: vi.fn(actual.responsiveGridItemStyle),
|
|
15
16
|
}
|
|
16
17
|
})
|
|
17
18
|
|
|
18
19
|
describe('<Box />', () => {
|
|
19
|
-
const mockedResponsiveGridItemStyle =
|
|
20
|
+
const mockedResponsiveGridItemStyle = vi.mocked(responsiveGridItemStyle)
|
|
20
21
|
|
|
21
22
|
beforeEach(() => {
|
|
22
23
|
mockedResponsiveGridItemStyle.mockClear()
|
|
23
24
|
})
|
|
24
25
|
|
|
25
26
|
it('uses column when gridColumn is not provided', () => {
|
|
27
|
+
// oxlint-disable-next-line no-deprecated
|
|
26
28
|
render(<Box column={3} />)
|
|
27
29
|
|
|
28
30
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
@@ -39,6 +41,7 @@ describe('<Box />', () => {
|
|
|
39
41
|
})
|
|
40
42
|
|
|
41
43
|
it('prefers gridColumn over column when both are provided', () => {
|
|
44
|
+
// oxlint-disable-next-line no-deprecated
|
|
42
45
|
render(<Box column={3} gridColumn={5} />)
|
|
43
46
|
|
|
44
47
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
@@ -60,6 +63,7 @@ describe('<Box />', () => {
|
|
|
60
63
|
})
|
|
61
64
|
|
|
62
65
|
it('uses columnStart when gridColumnStart is not provided', () => {
|
|
66
|
+
// oxlint-disable-next-line no-deprecated
|
|
63
67
|
render(<Box columnStart={2} />)
|
|
64
68
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
65
69
|
expect.objectContaining({$columnStart: [2]}),
|
|
@@ -67,6 +71,7 @@ describe('<Box />', () => {
|
|
|
67
71
|
})
|
|
68
72
|
|
|
69
73
|
it('prefers gridColumnStart over columnStart when both are provided', () => {
|
|
74
|
+
// oxlint-disable-next-line no-deprecated
|
|
70
75
|
render(<Box columnStart={2} gridColumnStart={4} />)
|
|
71
76
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
72
77
|
expect.objectContaining({$columnStart: [4]}),
|
|
@@ -77,6 +82,7 @@ describe('<Box />', () => {
|
|
|
77
82
|
})
|
|
78
83
|
|
|
79
84
|
it('uses columnEnd when gridColumnEnd is not provided', () => {
|
|
85
|
+
// oxlint-disable-next-line no-deprecated
|
|
80
86
|
render(<Box columnEnd={3} />)
|
|
81
87
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
82
88
|
expect.objectContaining({$columnEnd: [3]}),
|
|
@@ -84,6 +90,7 @@ describe('<Box />', () => {
|
|
|
84
90
|
})
|
|
85
91
|
|
|
86
92
|
it('prefers gridColumnEnd over columnEnd when both are provided', () => {
|
|
93
|
+
// oxlint-disable-next-line no-deprecated
|
|
87
94
|
render(<Box columnEnd={3} gridColumnEnd={5} />)
|
|
88
95
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
89
96
|
expect.objectContaining({$columnEnd: [5]}),
|
|
@@ -94,11 +101,13 @@ describe('<Box />', () => {
|
|
|
94
101
|
})
|
|
95
102
|
|
|
96
103
|
it('uses row when gridRow is not provided', () => {
|
|
104
|
+
// oxlint-disable-next-line no-deprecated
|
|
97
105
|
render(<Box row={1} />)
|
|
98
106
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(expect.objectContaining({$row: [1]}))
|
|
99
107
|
})
|
|
100
108
|
|
|
101
109
|
it('prefers gridRow over row when both are provided', () => {
|
|
110
|
+
// oxlint-disable-next-line no-deprecated
|
|
102
111
|
render(<Box row={1} gridRow={2} />)
|
|
103
112
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(expect.objectContaining({$row: [2]}))
|
|
104
113
|
expect(mockedResponsiveGridItemStyle).not.toHaveBeenCalledWith(
|
|
@@ -107,6 +116,7 @@ describe('<Box />', () => {
|
|
|
107
116
|
})
|
|
108
117
|
|
|
109
118
|
it('uses rowStart when gridRowStart is not provided', () => {
|
|
119
|
+
// oxlint-disable-next-line no-deprecated
|
|
110
120
|
render(<Box rowStart={2} />)
|
|
111
121
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
112
122
|
expect.objectContaining({$rowStart: [2]}),
|
|
@@ -114,6 +124,7 @@ describe('<Box />', () => {
|
|
|
114
124
|
})
|
|
115
125
|
|
|
116
126
|
it('prefers gridRowStart over rowStart when both are provided', () => {
|
|
127
|
+
// oxlint-disable-next-line no-deprecated
|
|
117
128
|
render(<Box rowStart={2} gridRowStart={4} />)
|
|
118
129
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
119
130
|
expect.objectContaining({$rowStart: [4]}),
|
|
@@ -124,6 +135,7 @@ describe('<Box />', () => {
|
|
|
124
135
|
})
|
|
125
136
|
|
|
126
137
|
it('uses rowEnd when gridRowEnd is not provided', () => {
|
|
138
|
+
// oxlint-disable-next-line no-deprecated
|
|
127
139
|
render(<Box rowEnd={3} />)
|
|
128
140
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
129
141
|
expect.objectContaining({$rowEnd: [3]}),
|
|
@@ -131,6 +143,7 @@ describe('<Box />', () => {
|
|
|
131
143
|
})
|
|
132
144
|
|
|
133
145
|
it('prefers gridRowEnd over rowEnd when both are provided', () => {
|
|
146
|
+
// oxlint-disable-next-line no-deprecated
|
|
134
147
|
render(<Box rowEnd={3} gridRowEnd={5} />)
|
|
135
148
|
expect(mockedResponsiveGridItemStyle).toHaveBeenCalledWith(
|
|
136
149
|
expect.objectContaining({$rowEnd: [5]}),
|
|
@@ -30,7 +30,8 @@ import {
|
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
32
|
export interface BoxOwnProps
|
|
33
|
-
extends
|
|
33
|
+
extends
|
|
34
|
+
ResponsiveFlexItemProps,
|
|
34
35
|
ResponsiveBoxProps,
|
|
35
36
|
ResponsiveGridItemProps,
|
|
36
37
|
ResponsiveMarginProps,
|
|
@@ -65,10 +66,13 @@ const BoxComponent = forwardRef(function Box(
|
|
|
65
66
|
const {
|
|
66
67
|
as: asProp = 'div',
|
|
67
68
|
gridColumn,
|
|
69
|
+
// oxlint-disable-next-line no-deprecated
|
|
68
70
|
column: deprecated_column,
|
|
69
71
|
gridColumnStart,
|
|
72
|
+
// oxlint-disable-next-line no-deprecated
|
|
70
73
|
columnStart: deprecated_columnStart,
|
|
71
74
|
gridColumnEnd,
|
|
75
|
+
// oxlint-disable-next-line no-deprecated
|
|
72
76
|
columnEnd: deprecated_columnEnd,
|
|
73
77
|
display = 'block',
|
|
74
78
|
flex,
|
|
@@ -89,10 +93,13 @@ const BoxComponent = forwardRef(function Box(
|
|
|
89
93
|
paddingBottom,
|
|
90
94
|
paddingLeft,
|
|
91
95
|
gridRow,
|
|
96
|
+
// oxlint-disable-next-line no-deprecated
|
|
92
97
|
row: deprecated_row,
|
|
93
98
|
gridRowStart,
|
|
99
|
+
// oxlint-disable-next-line no-deprecated
|
|
94
100
|
rowStart: deprecated_rowStart,
|
|
95
101
|
gridRowEnd,
|
|
102
|
+
// oxlint-disable-next-line no-deprecated
|
|
96
103
|
rowEnd: deprecated_rowEnd,
|
|
97
104
|
sizing,
|
|
98
105
|
...restProps
|
|
@@ -149,6 +156,7 @@ BoxComponent.displayName = 'ForwardRef(Box)'
|
|
|
149
156
|
*
|
|
150
157
|
* @public
|
|
151
158
|
*/
|
|
159
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
152
160
|
export const Box = BoxComponent as unknown as <E extends ElementType = 'div'>(
|
|
153
161
|
props: BoxProps<E>,
|
|
154
162
|
) => React.JSX.Element
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
2
|
|
|
3
3
|
import {AddIcon} from '@sanity/icons'
|
|
4
4
|
import {screen} from '@testing-library/react'
|
|
5
|
-
import {
|
|
5
|
+
import {beforeEach, describe, expect, it, vi} from 'vitest'
|
|
6
|
+
import {axe} from 'vitest-axe'
|
|
6
7
|
|
|
7
8
|
import {render} from '../../../../test'
|
|
8
9
|
import {Flex} from '../flex'
|
|
9
10
|
import {Button, ButtonOwnProps} from './button'
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
const actual =
|
|
12
|
+
vi.mock('../flex', async (importOriginal) => {
|
|
13
|
+
const actual = await importOriginal<typeof import('../flex')>()
|
|
13
14
|
|
|
14
15
|
return {
|
|
15
16
|
...actual,
|
|
16
|
-
|
|
17
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
18
|
+
Flex: vi.fn((props: Record<string, unknown>) => (actual.Flex as any).render(props, null)),
|
|
17
19
|
}
|
|
18
20
|
})
|
|
19
21
|
|
|
20
22
|
describe('atoms/button', () => {
|
|
21
|
-
const mockedFlex =
|
|
23
|
+
const mockedFlex = vi.mocked(Flex)
|
|
22
24
|
|
|
23
25
|
beforeEach(() => {
|
|
24
26
|
mockedFlex.mockClear()
|
|
@@ -59,6 +61,7 @@ describe('atoms/button', () => {
|
|
|
59
61
|
})
|
|
60
62
|
|
|
61
63
|
it('should support `space`', () => {
|
|
64
|
+
// oxlint-disable-next-line no-deprecated
|
|
62
65
|
render(<Button icon={AddIcon} space={17} text="Button text" />)
|
|
63
66
|
|
|
64
67
|
const propsList = mockedFlex.mock.calls.map(([props]) => props)
|
|
@@ -73,6 +76,7 @@ describe('atoms/button', () => {
|
|
|
73
76
|
})
|
|
74
77
|
|
|
75
78
|
it('should prefer `gap` over `space` when both are provided', () => {
|
|
79
|
+
// oxlint-disable-next-line no-deprecated
|
|
76
80
|
render(<Button gap={19} icon={AddIcon} space={20} text="Button text" />)
|
|
77
81
|
|
|
78
82
|
const propsList = mockedFlex.mock.calls.map(([props]) => props)
|
|
@@ -28,7 +28,9 @@ import {buttonBaseStyles, buttonColorStyles} from './styles'
|
|
|
28
28
|
export interface ButtonOwnProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
|
|
29
29
|
fontSize?: number | number[]
|
|
30
30
|
mode?: ButtonMode
|
|
31
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
31
32
|
icon?: React.ElementType | React.ReactNode
|
|
33
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
32
34
|
iconRight?: React.ElementType | React.ReactNode
|
|
33
35
|
justify?: FlexJustify | FlexJustify[]
|
|
34
36
|
/**
|
|
@@ -101,6 +103,7 @@ const ButtonComponent = forwardRef(function Button(
|
|
|
101
103
|
radius: radiusProp = 2,
|
|
102
104
|
selected,
|
|
103
105
|
gap,
|
|
106
|
+
// oxlint-disable-next-line no-deprecated
|
|
104
107
|
space: deprecated_space = 3,
|
|
105
108
|
text,
|
|
106
109
|
textAlign,
|
|
@@ -205,6 +208,7 @@ ButtonComponent.displayName = 'ForwardRef(Button)'
|
|
|
205
208
|
/**
|
|
206
209
|
* @public
|
|
207
210
|
*/
|
|
211
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
208
212
|
export const Button = ButtonComponent as unknown as <E extends ElementType = 'button'>(
|
|
209
213
|
props: ButtonProps<E>,
|
|
210
214
|
) => React.JSX.Element
|
|
@@ -79,6 +79,7 @@ export function buttonColorStyles(
|
|
|
79
79
|
// const defaultBoxShadow = `inset 0px -1.5px 0px ${buttonTheme.border.width}px color-mix(in srgb, var(--card-border-color) 25%, var(--card-bg-color))`
|
|
80
80
|
const defaultBoxShadow = undefined
|
|
81
81
|
|
|
82
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
82
83
|
return [
|
|
83
84
|
_cardColorStyle(baseColor, color.enabled),
|
|
84
85
|
{
|
|
@@ -23,10 +23,7 @@ import {CardStyleProps} from './types'
|
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
25
|
export interface CardOwnProps
|
|
26
|
-
extends BoxOwnProps,
|
|
27
|
-
ResponsiveBorderProps,
|
|
28
|
-
ResponsiveRadiusProps,
|
|
29
|
-
ResponsiveShadowProps {
|
|
26
|
+
extends BoxOwnProps, ResponsiveBorderProps, ResponsiveRadiusProps, ResponsiveShadowProps {
|
|
30
27
|
/**
|
|
31
28
|
* Do not use in production.
|
|
32
29
|
* @beta
|
|
@@ -84,7 +81,6 @@ const CardComponent = forwardRef(function Card(
|
|
|
84
81
|
const rootTheme = useRootTheme()
|
|
85
82
|
const tone = toneProp === 'inherit' ? rootTheme.tone : toneProp
|
|
86
83
|
|
|
87
|
-
// eslint-disable-next-line no-warning-comments
|
|
88
84
|
// todo: Consider adding the wrapper approach for nested cards in which the tones are not changing, avoid unnecessary ThemeColorProvider
|
|
89
85
|
return (
|
|
90
86
|
<ThemeColorProvider scheme={scheme} tone={tone}>
|
|
@@ -123,6 +119,7 @@ CardComponent.displayName = 'ForwardRef(Card)'
|
|
|
123
119
|
*
|
|
124
120
|
* @public
|
|
125
121
|
*/
|
|
122
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
126
123
|
export const Card = CardComponent as unknown as <E extends ElementType = 'div'>(
|
|
127
124
|
props: CardProps<E>,
|
|
128
125
|
) => React.JSX.Element
|
|
@@ -50,6 +50,7 @@ CodeComponent.displayName = 'ForwardRef(Code)'
|
|
|
50
50
|
/**
|
|
51
51
|
* @public
|
|
52
52
|
*/
|
|
53
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
53
54
|
export const Code = CodeComponent as unknown as <E extends ElementType = 'pre'>(
|
|
54
55
|
props: CodeProps<E>,
|
|
55
56
|
) => React.JSX.Element
|
|
@@ -7,11 +7,13 @@ export default function LazyRefractor(
|
|
|
7
7
|
) {
|
|
8
8
|
const {language: languageProp, value} = props
|
|
9
9
|
const language = typeof languageProp === 'string' ? languageProp : undefined
|
|
10
|
+
// oxlint-disable-next-line no-unnecessary-type-assertion, no-unsafe-type-assertion
|
|
10
11
|
const registered = language ? hasLanguage(language as any) : false
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
14
|
<>
|
|
14
15
|
{!(language && registered) && <code>{value}</code>}
|
|
16
|
+
{/* oxlint-disable-next-line no-base-to-string */}
|
|
15
17
|
{language && registered && <Refractor inline language={language} value={String(value)} />}
|
|
16
18
|
</>
|
|
17
19
|
)
|
|
@@ -49,6 +49,7 @@ ContainerComponent.displayName = 'ForwardRef(Container)'
|
|
|
49
49
|
*
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
52
53
|
export const Container = ContainerComponent as unknown as <E extends ElementType = 'div'>(
|
|
53
54
|
props: ContainerProps<E>,
|
|
54
55
|
) => React.JSX.Element
|
|
@@ -16,9 +16,7 @@ import {ResponsiveFlexItemProps, ResponsiveFlexProps} from '../types'
|
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
18
|
export interface FlexOwnProps
|
|
19
|
-
extends Omit<BoxOwnProps, 'display'>,
|
|
20
|
-
ResponsiveFlexProps,
|
|
21
|
-
ResponsiveFlexItemProps {
|
|
19
|
+
extends Omit<BoxOwnProps, 'display'>, ResponsiveFlexProps, ResponsiveFlexItemProps {
|
|
22
20
|
gap?: number | number[]
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -59,6 +57,7 @@ FlexComponent.displayName = 'ForwardRef(Flex)'
|
|
|
59
57
|
*
|
|
60
58
|
* @public
|
|
61
59
|
*/
|
|
60
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
62
61
|
export const Flex = FlexComponent as unknown as <E extends ElementType = 'div'>(
|
|
63
62
|
props: FlexProps<E>,
|
|
64
63
|
) => React.JSX.Element
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
|
+
|
|
3
|
+
import {beforeEach, describe, expect, it, vi} from 'vitest'
|
|
2
4
|
|
|
3
5
|
import {render} from '../../../../test'
|
|
4
6
|
import {responsiveGridStyle} from '../../styles/internal'
|
|
5
7
|
import {Grid} from './grid'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
const actual =
|
|
9
|
+
vi.mock('../../styles/internal', async (importOriginal) => {
|
|
10
|
+
const actual = await importOriginal<typeof import('../../styles/internal')>()
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
...actual,
|
|
12
|
-
responsiveGridStyle:
|
|
14
|
+
responsiveGridStyle: vi.fn(actual.responsiveGridStyle),
|
|
13
15
|
}
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
describe('primitives/grid', () => {
|
|
17
|
-
const mockedResponsiveGridStyle =
|
|
19
|
+
const mockedResponsiveGridStyle = vi.mocked(responsiveGridStyle)
|
|
18
20
|
|
|
19
21
|
beforeEach(() => {
|
|
20
22
|
mockedResponsiveGridStyle.mockClear()
|
|
@@ -22,6 +24,7 @@ describe('primitives/grid', () => {
|
|
|
22
24
|
|
|
23
25
|
it('should support `columns` and `gridTemplateColumns` with the same behavior', () => {
|
|
24
26
|
render(
|
|
27
|
+
// oxlint-disable-next-line no-deprecated
|
|
25
28
|
<Grid columns={2}>
|
|
26
29
|
<div>A</div>
|
|
27
30
|
</Grid>,
|
|
@@ -39,6 +42,7 @@ describe('primitives/grid', () => {
|
|
|
39
42
|
|
|
40
43
|
it('should prefer `gridTemplateColumns` over `columns` when both are provided', () => {
|
|
41
44
|
render(
|
|
45
|
+
// oxlint-disable-next-line no-deprecated
|
|
42
46
|
<Grid columns={1} gridTemplateColumns={3}>
|
|
43
47
|
<div>A</div>
|
|
44
48
|
</Grid>,
|
|
@@ -51,6 +55,7 @@ describe('primitives/grid', () => {
|
|
|
51
55
|
|
|
52
56
|
it('should support `rows` and `gridTemplateRows` with the same behavior', () => {
|
|
53
57
|
render(
|
|
58
|
+
// oxlint-disable-next-line no-deprecated
|
|
54
59
|
<Grid rows={2}>
|
|
55
60
|
<div>A</div>
|
|
56
61
|
</Grid>,
|
|
@@ -68,6 +73,7 @@ describe('primitives/grid', () => {
|
|
|
68
73
|
|
|
69
74
|
it('should prefer `gridTemplateRows` over `rows` when both are provided', () => {
|
|
70
75
|
render(
|
|
76
|
+
// oxlint-disable-next-line no-deprecated
|
|
71
77
|
<Grid gridTemplateRows={3} rows={1}>
|
|
72
78
|
<div>A</div>
|
|
73
79
|
</Grid>,
|
|
@@ -31,11 +31,13 @@ const GridComponent = forwardRef(function Grid(
|
|
|
31
31
|
autoRows,
|
|
32
32
|
autoCols,
|
|
33
33
|
autoFlow,
|
|
34
|
+
// oxlint-disable-next-line no-deprecated
|
|
34
35
|
columns,
|
|
35
36
|
gridTemplateColumns,
|
|
36
37
|
gap,
|
|
37
38
|
gapX,
|
|
38
39
|
gapY,
|
|
40
|
+
// oxlint-disable-next-line no-deprecated
|
|
39
41
|
rows,
|
|
40
42
|
gridTemplateRows,
|
|
41
43
|
children,
|
|
@@ -69,6 +71,7 @@ GridComponent.displayName = 'ForwardRef(Grid)'
|
|
|
69
71
|
*
|
|
70
72
|
* @public
|
|
71
73
|
*/
|
|
74
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
72
75
|
export const Grid = GridComponent as unknown as <E extends ElementType = 'div'>(
|
|
73
76
|
props: GridProps<E>,
|
|
74
77
|
) => React.JSX.Element
|
|
@@ -83,6 +83,7 @@ HeadingComponent.displayName = 'ForwardRef(Heading)'
|
|
|
83
83
|
*
|
|
84
84
|
* @public
|
|
85
85
|
*/
|
|
86
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
86
87
|
export const Heading = HeadingComponent as unknown as <E extends ElementType = 'div'>(
|
|
87
88
|
props: HeadingProps<E>,
|
|
88
89
|
) => React.JSX.Element
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
|
+
|
|
3
|
+
import {beforeEach, describe, expect, it, vi} from 'vitest'
|
|
2
4
|
|
|
3
5
|
import {render} from '../../../../test'
|
|
4
6
|
import {Inline} from './inline'
|
|
5
7
|
import {inlineSpaceStyle} from './styles'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
const actual =
|
|
9
|
+
vi.mock('./styles', async (importOriginal) => {
|
|
10
|
+
const actual = await importOriginal<typeof import('./styles')>()
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
...actual,
|
|
12
|
-
inlineSpaceStyle:
|
|
14
|
+
inlineSpaceStyle: vi.fn(actual.inlineSpaceStyle),
|
|
13
15
|
}
|
|
14
16
|
})
|
|
15
17
|
|
|
16
18
|
describe('primitives/inline', () => {
|
|
17
|
-
const mockedInlineSpaceStyle =
|
|
19
|
+
const mockedInlineSpaceStyle = vi.mocked(inlineSpaceStyle)
|
|
18
20
|
|
|
19
21
|
beforeEach(() => {
|
|
20
22
|
mockedInlineSpaceStyle.mockClear()
|
|
@@ -22,6 +24,7 @@ describe('primitives/inline', () => {
|
|
|
22
24
|
|
|
23
25
|
it('should support `space` and `gap` with the same behavior', () => {
|
|
24
26
|
render(
|
|
27
|
+
// oxlint-disable-next-line no-deprecated
|
|
25
28
|
<Inline space={2}>
|
|
26
29
|
<span>One</span>
|
|
27
30
|
<span>Two</span>
|
|
@@ -41,6 +44,7 @@ describe('primitives/inline', () => {
|
|
|
41
44
|
|
|
42
45
|
it('should prefer `gap` over `space` when both are provided', () => {
|
|
43
46
|
render(
|
|
47
|
+
// oxlint-disable-next-line no-deprecated
|
|
44
48
|
<Inline gap={3} space={1}>
|
|
45
49
|
<span>One</span>
|
|
46
50
|
<span>Two</span>
|
|
@@ -31,6 +31,7 @@ const InlineComponent = forwardRef(function Inline(
|
|
|
31
31
|
props: InlineOwnProps & {as?: ElementType} & React.HTMLProps<HTMLDivElement>,
|
|
32
32
|
ref,
|
|
33
33
|
) {
|
|
34
|
+
// oxlint-disable-next-line no-deprecated
|
|
34
35
|
const {as, children: childrenProp, gap, space: deprecated_space, ...restProps} = props
|
|
35
36
|
const spacing = gap === undefined ? deprecated_space : gap
|
|
36
37
|
|
|
@@ -45,6 +46,7 @@ const InlineComponent = forwardRef(function Inline(
|
|
|
45
46
|
{...restProps}
|
|
46
47
|
$space={_getArrayProp(spacing)}
|
|
47
48
|
forwardedAs={as}
|
|
49
|
+
// oxlint-disable-next-line no-unnecessary-type-assertion, no-unsafe-type-assertion
|
|
48
50
|
ref={ref as any}
|
|
49
51
|
>
|
|
50
52
|
{children}
|
|
@@ -58,6 +60,7 @@ InlineComponent.displayName = 'ForwardRef(Inline)'
|
|
|
58
60
|
*
|
|
59
61
|
* @public
|
|
60
62
|
*/
|
|
63
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
61
64
|
export const Inline = InlineComponent as unknown as <E extends ElementType = 'div'>(
|
|
62
65
|
props: InlineProps<E>,
|
|
63
66
|
) => React.JSX.Element
|
|
@@ -42,7 +42,10 @@ function kbdStyle() {
|
|
|
42
42
|
const StyledKBD = styled.kbd<ResponsiveRadiusStyleProps>(responsiveRadiusStyle, kbdStyle)
|
|
43
43
|
|
|
44
44
|
const KBDComponent = forwardRef(function KBD(
|
|
45
|
-
props: KBDOwnProps & {as?: ElementType} & Omit<
|
|
45
|
+
props: KBDOwnProps & {as?: ElementType} & Omit<
|
|
46
|
+
React.HTMLProps<HTMLElement>,
|
|
47
|
+
'as' | 'ref' | 'size'
|
|
48
|
+
>,
|
|
46
49
|
ref: React.ForwardedRef<HTMLDivElement>,
|
|
47
50
|
) {
|
|
48
51
|
const {children, fontSize = 0, padding = 1, radius = 2, ...restProps} = props
|
|
@@ -64,6 +67,7 @@ KBDComponent.displayName = 'ForwardRef(KBD)'
|
|
|
64
67
|
*
|
|
65
68
|
* @public
|
|
66
69
|
*/
|
|
70
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
67
71
|
export const KBD = KBDComponent as unknown as <E extends ElementType = 'kbd'>(
|
|
68
72
|
props: KBDProps<E>,
|
|
69
73
|
) => React.JSX.Element
|
|
@@ -82,6 +82,7 @@ LabelComponent.displayName = 'ForwardRef(Label)'
|
|
|
82
82
|
*
|
|
83
83
|
* @public
|
|
84
84
|
*/
|
|
85
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
85
86
|
export const Label = LabelComponent as unknown as <E extends ElementType = 'div'>(
|
|
86
87
|
props: LabelProps<E>,
|
|
87
88
|
) => React.JSX.Element
|
|
@@ -45,9 +45,7 @@ import {PopoverUpdateCallback, PopoverWidth} from './types'
|
|
|
45
45
|
|
|
46
46
|
/** @public */
|
|
47
47
|
export interface PopoverProps
|
|
48
|
-
extends Omit<LayerProps, 'as'>,
|
|
49
|
-
ResponsiveRadiusProps,
|
|
50
|
-
ResponsiveShadowProps {
|
|
48
|
+
extends Omit<LayerProps, 'as'>, ResponsiveRadiusProps, ResponsiveShadowProps {
|
|
51
49
|
/** @beta */
|
|
52
50
|
__unstable_margins?: PopoverMargins
|
|
53
51
|
/**
|
|
@@ -146,6 +144,7 @@ export const Popover = forwardRef(function Popover(
|
|
|
146
144
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
147
145
|
animate: _animate = false,
|
|
148
146
|
arrow: arrowProp = false,
|
|
147
|
+
// oxlint-disable-next-line no-deprecated
|
|
149
148
|
boundaryElement: _boundaryElement,
|
|
150
149
|
children: childProp,
|
|
151
150
|
constrainSize = false,
|
|
@@ -155,7 +154,7 @@ export const Popover = forwardRef(function Popover(
|
|
|
155
154
|
matchReferenceWidth,
|
|
156
155
|
floatingBoundary: _floatingBoundary,
|
|
157
156
|
modal,
|
|
158
|
-
//
|
|
157
|
+
// oxlint-disable-next-line no-unused-vars
|
|
159
158
|
onActivate,
|
|
160
159
|
open,
|
|
161
160
|
overflow = 'hidden',
|
|
@@ -179,8 +178,10 @@ export const Popover = forwardRef(function Popover(
|
|
|
179
178
|
const fallbackPlacements =
|
|
180
179
|
_fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']
|
|
181
180
|
const floatingBoundary =
|
|
181
|
+
// oxlint-disable-next-line no-deprecated
|
|
182
182
|
_floatingBoundary ?? props.boundaryElement ?? boundaryElementContext.element
|
|
183
183
|
const referenceBoundary =
|
|
184
|
+
// oxlint-disable-next-line no-deprecated
|
|
184
185
|
_referenceBoundary ?? props.boundaryElement ?? boundaryElementContext.element
|
|
185
186
|
const zOffsetProp = _zOffsetProp ?? layer.popover.zOffset
|
|
186
187
|
const prefersReducedMotion = usePrefersReducedMotion()
|
|
@@ -123,6 +123,7 @@ export const PopoverCard = forwardRef(function PopoverCard(
|
|
|
123
123
|
return (
|
|
124
124
|
<MotionCard
|
|
125
125
|
data-ui="Popover"
|
|
126
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
126
127
|
{...(restProps as CardProps & MotionProps)}
|
|
127
128
|
data-placement={placement}
|
|
128
129
|
radius={radius}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
|
+
|
|
3
|
+
import {beforeEach, describe, expect, it, vi} from 'vitest'
|
|
2
4
|
|
|
3
5
|
import {render} from '../../../../test'
|
|
4
6
|
import {Select} from './select'
|
|
5
7
|
import {selectStyle} from './styles'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
const actual =
|
|
9
|
+
vi.mock('./styles', async (importOriginal) => {
|
|
10
|
+
const actual = await importOriginal<typeof import('./styles')>()
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
...actual,
|
|
12
14
|
selectStyle: {
|
|
13
15
|
...actual.selectStyle,
|
|
14
|
-
input:
|
|
16
|
+
input: vi.fn(actual.selectStyle.input),
|
|
15
17
|
},
|
|
16
18
|
}
|
|
17
19
|
})
|
|
18
20
|
|
|
19
21
|
describe('primitives/select spacing', () => {
|
|
20
|
-
const mockedSelectInputStyle =
|
|
22
|
+
const mockedSelectInputStyle = vi.mocked(selectStyle.input)
|
|
21
23
|
|
|
22
24
|
beforeEach(() => {
|
|
23
25
|
mockedSelectInputStyle.mockClear()
|
|
@@ -25,6 +27,7 @@ describe('primitives/select spacing', () => {
|
|
|
25
27
|
|
|
26
28
|
it('should support `space` and `gap` with the same behavior', () => {
|
|
27
29
|
render(
|
|
30
|
+
// oxlint-disable-next-line no-deprecated
|
|
28
31
|
<Select space={2}>
|
|
29
32
|
<option>Option A</option>
|
|
30
33
|
</Select>,
|
|
@@ -42,6 +45,7 @@ describe('primitives/select spacing', () => {
|
|
|
42
45
|
|
|
43
46
|
it('should prefer `gap` over `space` when both are provided', () => {
|
|
44
47
|
render(
|
|
48
|
+
// oxlint-disable-next-line no-deprecated
|
|
45
49
|
<Select gap={3} space={1}>
|
|
46
50
|
<option>Option A</option>
|
|
47
51
|
</Select>,
|