@sanity/ui 2.16.21 → 2.16.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/_visual-editing.js +121 -1046
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/refractor.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +116 -1041
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/refractor.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +411 -351
- package/dist/_visual-editing.d.ts +411 -351
- package/dist/index.d.mts +1107 -930
- package/dist/index.d.ts +1107 -930
- package/dist/index.js +67 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -156
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.mts +769 -681
- package/dist/theme.d.ts +769 -681
- package/dist/theme.js +47 -0
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +47 -0
- package/dist/theme.mjs.map +1 -1
- package/exports/_visual-editing.ts +1 -0
- package/package.json +50 -163
- package/src/core/_compat.ts +30 -0
- package/src/core/components/autocomplete/autocomplete.tsx +11 -4
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
- package/src/core/components/dialog/dialog.tsx +3 -0
- package/src/core/components/hotkeys/hotkeys.tsx +1 -0
- package/src/core/components/menu/menu.test.tsx +6 -4
- package/src/core/components/menu/menu.tsx +3 -2
- package/src/core/components/menu/menuButton.tsx +8 -0
- package/src/core/components/menu/menuGroup.tsx +5 -2
- package/src/core/components/menu/menuItem.tsx +4 -0
- package/src/core/components/menu/useMenuController.ts +6 -4
- package/src/core/components/skeleton/skeleton.tsx +2 -1
- package/src/core/components/tab/tab.tsx +1 -0
- 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 -1
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/components/tree/tree.tsx +1 -0
- package/src/core/components/tree/treeGroup.tsx +1 -0
- package/src/core/components/tree/treeItem.tsx +2 -2
- package/src/core/constants.ts +2 -2
- 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 +7 -6
- 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 +1 -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 +2 -1
- package/src/core/primitives/box/box.tsx +2 -1
- package/src/core/primitives/button/button.test.tsx +3 -2
- package/src/core/primitives/button/button.tsx +2 -0
- package/src/core/primitives/button/styles.ts +1 -0
- package/src/core/primitives/card/card.tsx +1 -5
- package/src/core/primitives/card/types.ts +1 -0
- package/src/core/primitives/code/refractor.tsx +2 -0
- package/src/core/primitives/flex/flex.tsx +1 -3
- package/src/core/primitives/inline/inline.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +13 -4
- package/src/core/primitives/popover/popoverCard.tsx +2 -1
- package/src/core/primitives/popover/types.ts +0 -1
- package/src/core/primitives/stack/styles.ts +1 -0
- package/src/core/primitives/textInput/textInput.tsx +2 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +82 -49
- package/src/core/primitives/tooltip/tooltip.tsx +6 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +2 -1
- 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 +4 -3
- 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 +7 -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 +5 -0
- 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 +15 -0
- 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__/index.ts +0 -19
- 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
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* These are internal exports for usage in `@sanity/visual-editing` and `@sanity/insert-menu`,
|
|
3
3
|
* which are used in environments where the regular `@sanity/ui` export is far too heavy due to imports from refractor and more.
|
|
4
4
|
*/
|
|
5
|
+
// oxlint-disable-next-line no-deprecated
|
|
5
6
|
export {studioTheme} from '../src/core/_compat'
|
|
6
7
|
export {Hotkeys} from '../src/core/components/hotkeys/hotkeys'
|
|
7
8
|
export {Menu} from '../src/core/components/menu/menu'
|
package/package.json
CHANGED
|
@@ -1,26 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.23",
|
|
4
4
|
"keywords": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"components",
|
|
6
|
+
"design-system",
|
|
7
7
|
"primitives",
|
|
8
8
|
"react",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"sanity",
|
|
10
|
+
"ui"
|
|
11
11
|
],
|
|
12
12
|
"homepage": "https://www.sanity.io/",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/sanity-io/ui/issues"
|
|
15
15
|
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
16
18
|
"repository": {
|
|
17
19
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/sanity-io/ui.git"
|
|
20
|
+
"url": "git+https://github.com/sanity-io/ui.git",
|
|
21
|
+
"directory": "packages/ui"
|
|
19
22
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"exports",
|
|
26
|
+
"src"
|
|
27
|
+
],
|
|
23
28
|
"type": "commonjs",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"typesVersions": {
|
|
34
|
+
"*": {
|
|
35
|
+
"_visual-editing": [
|
|
36
|
+
"./dist/_visual-editing.d.ts"
|
|
37
|
+
],
|
|
38
|
+
"theme": [
|
|
39
|
+
"./dist/theme.d.ts"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
24
43
|
"exports": {
|
|
25
44
|
".": {
|
|
26
45
|
"source": "./exports/index.ts",
|
|
@@ -42,166 +61,41 @@
|
|
|
42
61
|
},
|
|
43
62
|
"./package.json": "./package.json"
|
|
44
63
|
},
|
|
45
|
-
"main": "./dist/index.js",
|
|
46
|
-
"module": "./dist/index.mjs",
|
|
47
|
-
"types": "./dist/index.d.ts",
|
|
48
|
-
"typesVersions": {
|
|
49
|
-
"*": {
|
|
50
|
-
"_visual-editing": [
|
|
51
|
-
"./dist/_visual-editing.d.ts"
|
|
52
|
-
],
|
|
53
|
-
"theme": [
|
|
54
|
-
"./dist/theme.d.ts"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"files": [
|
|
59
|
-
"dist",
|
|
60
|
-
"exports",
|
|
61
|
-
"src"
|
|
62
|
-
],
|
|
63
|
-
"scripts": {
|
|
64
|
-
"build": "run-s clean pkg:build pkg:check figma:pkg:build",
|
|
65
|
-
"clean": "rimraf .workshop dist",
|
|
66
|
-
"commit": "cz",
|
|
67
|
-
"cypress:dev": "run-p dev cypress:open",
|
|
68
|
-
"cypress:open": "cypress open",
|
|
69
|
-
"cypress:run": "cypress run",
|
|
70
|
-
"dev": "run-p storybook:dev workshop:dev",
|
|
71
|
-
"figma:pkg:build": "cd figma && pnpm build",
|
|
72
|
-
"format": "prettier --write --cache --ignore-unknown .",
|
|
73
|
-
"lint": "eslint --cache .",
|
|
74
|
-
"prepack": "pnpm build",
|
|
75
|
-
"pkg:build": "pkg build --strict",
|
|
76
|
-
"pkg:check": "pkg --strict",
|
|
77
|
-
"prepare": "husky install",
|
|
78
|
-
"release": "semantic-release",
|
|
79
|
-
"storybook:build": "storybook build",
|
|
80
|
-
"storybook:dev": "storybook dev -p 6006",
|
|
81
|
-
"test": "jest",
|
|
82
|
-
"test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
|
|
83
|
-
"ts:check": "tsc",
|
|
84
|
-
"watch": "pkg watch --strict",
|
|
85
|
-
"workshop:build": "workshop build",
|
|
86
|
-
"workshop:dev": "workshop dev",
|
|
87
|
-
"workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
|
|
88
|
-
},
|
|
89
|
-
"commitlint": {
|
|
90
|
-
"extends": [
|
|
91
|
-
"@commitlint/config-conventional"
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
"lint-staged": {
|
|
95
|
-
"*": [
|
|
96
|
-
"prettier --write --cache --ignore-unknown"
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
"prettier": "@sanity/prettier-config",
|
|
100
|
-
"release": {
|
|
101
|
-
"branches": [
|
|
102
|
-
{
|
|
103
|
-
"name": "v2",
|
|
104
|
-
"range": "2.x",
|
|
105
|
-
"channel": "v2"
|
|
106
|
-
},
|
|
107
|
-
"main",
|
|
108
|
-
{
|
|
109
|
-
"name": "v4",
|
|
110
|
-
"channel": "static",
|
|
111
|
-
"prerelease": true
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
"extends": "@sanity/semantic-release-preset"
|
|
115
|
-
},
|
|
116
64
|
"dependencies": {
|
|
117
|
-
"@floating-ui/react-dom": "^2.1.
|
|
65
|
+
"@floating-ui/react-dom": "^2.1.8",
|
|
118
66
|
"@juggle/resize-observer": "^3.4.0",
|
|
119
67
|
"@sanity/color": "^3.0.6",
|
|
120
68
|
"@sanity/icons": "^3.7.4",
|
|
121
69
|
"csstype": "^3.1.3",
|
|
122
|
-
"
|
|
70
|
+
"motion": "^12.23.24",
|
|
123
71
|
"react-compiler-runtime": "1.0.0",
|
|
124
72
|
"react-refractor": "^2.2.0",
|
|
125
73
|
"use-effect-event": "^2.0.3"
|
|
126
74
|
},
|
|
127
75
|
"devDependencies": {
|
|
128
|
-
"@
|
|
129
|
-
"@babel/preset-env": "^7.28.3",
|
|
130
|
-
"@babel/preset-react": "^7.27.1",
|
|
131
|
-
"@babel/preset-typescript": "^7.27.1",
|
|
132
|
-
"@commitlint/cli": "^19.8.1",
|
|
133
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
134
|
-
"@eslint/js": "^9.37.0",
|
|
135
|
-
"@sanity/pkg-utils": "^8.1.19",
|
|
136
|
-
"@sanity/prettier-config": "^2.0.1",
|
|
137
|
-
"@sanity/semantic-release-preset": "^5.0.0",
|
|
138
|
-
"@sanity/ui-workshop": "^2.1.6",
|
|
139
|
-
"@storybook/addon-a11y": "^8.6.14",
|
|
140
|
-
"@storybook/addon-docs": "^8.6.14",
|
|
141
|
-
"@storybook/addon-essentials": "^8.6.14",
|
|
142
|
-
"@storybook/addon-interactions": "^8.6.14",
|
|
143
|
-
"@storybook/addon-links": "^8.6.14",
|
|
144
|
-
"@storybook/addon-mdx-gfm": "^8.6.14",
|
|
145
|
-
"@storybook/addon-storysource": "^8.6.14",
|
|
146
|
-
"@storybook/addon-themes": "^8.6.14",
|
|
147
|
-
"@storybook/blocks": "^8.6.14",
|
|
148
|
-
"@storybook/manager-api": "^8.6.14",
|
|
149
|
-
"@storybook/react": "^8.6.14",
|
|
150
|
-
"@storybook/react-vite": "^8.6.14",
|
|
151
|
-
"@storybook/test": "^8.6.14",
|
|
152
|
-
"@storybook/theming": "^8.6.14",
|
|
76
|
+
"@sanity/pkg-utils": "^8.1.29",
|
|
153
77
|
"@testing-library/dom": "^10.4.1",
|
|
154
78
|
"@testing-library/jest-dom": "^6.8.0",
|
|
155
79
|
"@testing-library/react": "^16.3.0",
|
|
156
80
|
"@testing-library/user-event": "^14.6.1",
|
|
157
|
-
"@types/jest": "^30.0.0",
|
|
158
|
-
"@types/jest-axe": "^3.5.9",
|
|
159
81
|
"@types/node": "^22.18.1",
|
|
160
|
-
"@types/react": "^19.2.
|
|
161
|
-
"@types/react-dom": "^19.2.
|
|
82
|
+
"@types/react": "^19.2.17",
|
|
83
|
+
"@types/react-dom": "^19.2.3",
|
|
162
84
|
"@types/react-is": "^19.2.0",
|
|
163
|
-
"@vitejs/plugin-react": "^5.0.4",
|
|
164
85
|
"babel-plugin-react-compiler": "1.0.0",
|
|
165
86
|
"babel-plugin-styled-components": "^2.1.4",
|
|
166
|
-
"
|
|
167
|
-
"cypress": "^13.17.0",
|
|
168
|
-
"cypress-real-events": "^1.14.0",
|
|
169
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
170
|
-
"eslint": "^9.37.0",
|
|
171
|
-
"eslint-config-prettier": "^10.1.8",
|
|
172
|
-
"eslint-formatter-gha": "^1.6.0",
|
|
173
|
-
"eslint-plugin-boundaries": "^5.0.2",
|
|
174
|
-
"eslint-plugin-import": "^2.32.0",
|
|
175
|
-
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
176
|
-
"eslint-plugin-react": "^7.37.5",
|
|
177
|
-
"eslint-plugin-react-hooks": "7.0.0",
|
|
178
|
-
"eslint-plugin-react-refresh": "^0.4.23",
|
|
179
|
-
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
180
|
-
"eslint-plugin-storybook": "^0.12.0",
|
|
181
|
-
"globals": "^16.3.0",
|
|
182
|
-
"http-server": "^14.1.1",
|
|
183
|
-
"husky": "^8.0.3",
|
|
184
|
-
"jest": "^30.1.3",
|
|
185
|
-
"jest-axe": "^10.0.0",
|
|
186
|
-
"jest-environment-jsdom": "^30.1.2",
|
|
187
|
-
"lint-staged": "^14.0.1",
|
|
188
|
-
"module-alias": "^2.2.3",
|
|
87
|
+
"jsdom": "^29.1.1",
|
|
189
88
|
"npm-run-all2": "^5.0.2",
|
|
190
|
-
"
|
|
191
|
-
"react": "^19.2.
|
|
192
|
-
"react-
|
|
193
|
-
"react-is": "^19.2.0",
|
|
89
|
+
"react": "^19.2.7",
|
|
90
|
+
"react-dom": "^19.2.7",
|
|
91
|
+
"react-is": "^19.2.7",
|
|
194
92
|
"refractor": "^4.9.0",
|
|
195
93
|
"rimraf": "^5.0.5",
|
|
196
|
-
"semantic-release": "^24.2.7",
|
|
197
|
-
"start-server-and-test": "^2.1.0",
|
|
198
|
-
"storybook": "^8.6.14",
|
|
199
94
|
"styled-components": "^6.1.19",
|
|
200
|
-
"tsconfig-paths": "^4.2.0",
|
|
201
95
|
"typescript": "5.9.3",
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
96
|
+
"vite": "^7.2.2",
|
|
97
|
+
"vitest": "4.1.9",
|
|
98
|
+
"vitest-axe": "^1.0.0-pre.5"
|
|
205
99
|
},
|
|
206
100
|
"peerDependencies": {
|
|
207
101
|
"react": "^18 || >=19.0.0-0",
|
|
@@ -209,26 +103,19 @@
|
|
|
209
103
|
"react-is": "^18 || >=19.0.0-0",
|
|
210
104
|
"styled-components": "^5.2 || ^6"
|
|
211
105
|
},
|
|
212
|
-
"packageManager": "pnpm@9.15.9",
|
|
213
106
|
"engines": {
|
|
214
107
|
"node": ">=14.0.0"
|
|
215
108
|
},
|
|
216
|
-
"publishConfig": {
|
|
217
|
-
"access": "public"
|
|
218
|
-
},
|
|
219
|
-
"pnpm": {
|
|
220
|
-
"overrides": {
|
|
221
|
-
"@types/react": "$@types/react",
|
|
222
|
-
"@types/react-dom": "$@types/react-dom",
|
|
223
|
-
"@types/react-is": "$@types/react-is",
|
|
224
|
-
"conventional-changelog-conventionalcommits": ">= 8.0.0",
|
|
225
|
-
"react": "$react",
|
|
226
|
-
"react-dom": "$react-dom",
|
|
227
|
-
"react-is": "$react-is",
|
|
228
|
-
"styled-components": "npm:@sanity/styled-components@6.1.23"
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
109
|
"esm.sh": {
|
|
232
110
|
"bundle": false
|
|
111
|
+
},
|
|
112
|
+
"scripts": {
|
|
113
|
+
"build": "run-s clean pkg:build pkg:check",
|
|
114
|
+
"clean": "rimraf dist",
|
|
115
|
+
"pkg:build": "pkg build --strict",
|
|
116
|
+
"pkg:check": "pkg --strict",
|
|
117
|
+
"test": "vitest run",
|
|
118
|
+
"test:watch": "vitest",
|
|
119
|
+
"watch": "pkg watch --strict"
|
|
233
120
|
}
|
|
234
|
-
}
|
|
121
|
+
}
|
package/src/core/_compat.ts
CHANGED
|
@@ -160,34 +160,63 @@ export type ThemeLayer = _ThemeLayer
|
|
|
160
160
|
export type ThemeShadow = _ThemeShadow
|
|
161
161
|
|
|
162
162
|
export {
|
|
163
|
+
// oxlint-disable-next-line no-deprecated
|
|
163
164
|
type PartialThemeColorBuilderOpts,
|
|
165
|
+
// oxlint-disable-next-line no-deprecated
|
|
164
166
|
type ThemeAvatar,
|
|
167
|
+
// oxlint-disable-next-line no-deprecated
|
|
165
168
|
type ThemeColor,
|
|
169
|
+
// oxlint-disable-next-line no-deprecated
|
|
166
170
|
type ThemeColorBase,
|
|
171
|
+
// oxlint-disable-next-line no-deprecated
|
|
167
172
|
type ThemeColorBuilderOpts,
|
|
173
|
+
// oxlint-disable-next-line no-deprecated
|
|
168
174
|
type ThemeColorButton,
|
|
175
|
+
// oxlint-disable-next-line no-deprecated
|
|
169
176
|
type ThemeColorButtonState,
|
|
177
|
+
// oxlint-disable-next-line no-deprecated
|
|
170
178
|
type ThemeColorButtonStates,
|
|
179
|
+
// oxlint-disable-next-line no-deprecated
|
|
171
180
|
type ThemeColorButtonTones,
|
|
181
|
+
// oxlint-disable-next-line no-deprecated
|
|
172
182
|
type ThemeColorCard,
|
|
183
|
+
// oxlint-disable-next-line no-deprecated
|
|
173
184
|
type ThemeColorCardState,
|
|
185
|
+
// oxlint-disable-next-line no-deprecated
|
|
174
186
|
type ThemeColorGenericState,
|
|
187
|
+
// oxlint-disable-next-line no-deprecated
|
|
175
188
|
type ThemeColorInput,
|
|
189
|
+
// oxlint-disable-next-line no-deprecated
|
|
176
190
|
type ThemeColorInputState,
|
|
191
|
+
// oxlint-disable-next-line no-deprecated
|
|
177
192
|
type ThemeColorInputStates,
|
|
193
|
+
// oxlint-disable-next-line no-deprecated
|
|
178
194
|
type ThemeColorMuted,
|
|
195
|
+
// oxlint-disable-next-line no-deprecated
|
|
179
196
|
type ThemeColorMutedTone,
|
|
197
|
+
// oxlint-disable-next-line no-deprecated
|
|
180
198
|
type ThemeColorName,
|
|
199
|
+
// oxlint-disable-next-line no-deprecated
|
|
181
200
|
type ThemeColorScheme,
|
|
201
|
+
// oxlint-disable-next-line no-deprecated
|
|
182
202
|
type ThemeColorSchemes,
|
|
203
|
+
// oxlint-disable-next-line no-deprecated
|
|
183
204
|
type ThemeColorSelectable,
|
|
205
|
+
// oxlint-disable-next-line no-deprecated
|
|
184
206
|
type ThemeColorSelectableState,
|
|
207
|
+
// oxlint-disable-next-line no-deprecated
|
|
185
208
|
type ThemeColorSelectableStates,
|
|
209
|
+
// oxlint-disable-next-line no-deprecated
|
|
186
210
|
type ThemeColorSolid,
|
|
211
|
+
// oxlint-disable-next-line no-deprecated
|
|
187
212
|
type ThemeColorSolidTone,
|
|
213
|
+
// oxlint-disable-next-line no-deprecated
|
|
188
214
|
type ThemeColorSpot,
|
|
215
|
+
// oxlint-disable-next-line no-deprecated
|
|
189
216
|
type ThemeColorSpotKey,
|
|
217
|
+
// oxlint-disable-next-line no-deprecated
|
|
190
218
|
type ThemeColorToneKey,
|
|
219
|
+
// oxlint-disable-next-line no-deprecated
|
|
191
220
|
type ThemeInput,
|
|
192
221
|
}
|
|
193
222
|
|
|
@@ -207,6 +236,7 @@ import {
|
|
|
207
236
|
* @public
|
|
208
237
|
* @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
|
|
209
238
|
*/
|
|
239
|
+
// oxlint-disable-next-line no-deprecated
|
|
210
240
|
export const createColorTheme = _createColorTheme
|
|
211
241
|
|
|
212
242
|
/**
|
|
@@ -51,6 +51,7 @@ export interface AutocompleteProps<Option extends BaseAutocompleteOption = BaseA
|
|
|
51
51
|
customValidity?: string
|
|
52
52
|
filterOption?: (query: string, option: Option) => boolean
|
|
53
53
|
fontSize?: number | number[]
|
|
54
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
54
55
|
icon?: ElementType | ReactNode
|
|
55
56
|
id: string
|
|
56
57
|
/** @beta */
|
|
@@ -243,6 +244,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
246
|
|
|
247
|
+
// oxlint-disable-next-line no-unnecessary-boolean-literal-compare
|
|
246
248
|
if (focusInside === false) {
|
|
247
249
|
dispatch({type: 'root/blur'})
|
|
248
250
|
popoverMouseWithinRef.current = false
|
|
@@ -332,6 +334,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
332
334
|
return
|
|
333
335
|
}
|
|
334
336
|
|
|
337
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
335
338
|
const target = event.target as Node
|
|
336
339
|
const listEl = listBoxElementRef.current
|
|
337
340
|
|
|
@@ -436,6 +439,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
436
439
|
|
|
437
440
|
if (activeOption) {
|
|
438
441
|
const activeIndex = filteredOptions.indexOf(activeOption)
|
|
442
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
439
443
|
const activeItemElement = listElement.childNodes[activeIndex] as HTMLLIElement | undefined
|
|
440
444
|
|
|
441
445
|
if (activeItemElement) {
|
|
@@ -556,6 +560,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
556
560
|
radius={radius}
|
|
557
561
|
readOnly={readOnly}
|
|
558
562
|
ref={inputElementRef}
|
|
563
|
+
// oxlint-disable-next-line prefer-tag-over-role, role-has-required-aria-props
|
|
559
564
|
role="combobox"
|
|
560
565
|
spellCheck={false}
|
|
561
566
|
suffix={suffix || openButtonNode}
|
|
@@ -590,6 +595,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
590
595
|
data-ui="AutoComplete__resultsList"
|
|
591
596
|
id={listBoxId}
|
|
592
597
|
ref={listBoxElementRef}
|
|
598
|
+
// oxlint-disable-next-line prefer-tag-over-role
|
|
593
599
|
role="listbox"
|
|
594
600
|
space={1}
|
|
595
601
|
>
|
|
@@ -633,16 +639,16 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
633
639
|
const results = useMemo(() => {
|
|
634
640
|
if (renderPopover) {
|
|
635
641
|
return renderPopover(
|
|
636
|
-
//
|
|
642
|
+
// oxlint-disable-next-line react-compiler
|
|
637
643
|
{
|
|
638
644
|
content,
|
|
639
645
|
hidden: !expanded,
|
|
640
|
-
//
|
|
646
|
+
// oxlint-disable-next-line react-compiler
|
|
641
647
|
inputElement: inputElementRef.current,
|
|
642
648
|
onMouseEnter: handlePopoverMouseEnter,
|
|
643
649
|
onMouseLeave: handlePopoverMouseLeave,
|
|
644
650
|
},
|
|
645
|
-
//
|
|
651
|
+
// oxlint-disable-next-line react-compiler
|
|
646
652
|
resultsPopoverElementRef,
|
|
647
653
|
)
|
|
648
654
|
}
|
|
@@ -666,7 +672,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete<
|
|
|
666
672
|
portal
|
|
667
673
|
radius={radius}
|
|
668
674
|
ref={resultsPopoverElementRef}
|
|
669
|
-
//
|
|
675
|
+
// oxlint-disable-next-line react-compiler
|
|
670
676
|
referenceElement={inputElementRef.current}
|
|
671
677
|
{...popover}
|
|
672
678
|
/>
|
|
@@ -704,6 +710,7 @@ InnerAutocomplete.displayName = 'ForwardRef(Autocomplete)'
|
|
|
704
710
|
*
|
|
705
711
|
* @public
|
|
706
712
|
*/
|
|
713
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
707
714
|
export const Autocomplete = InnerAutocomplete as <Option extends BaseAutocompleteOption>(
|
|
708
715
|
props: AutocompleteProps<Option> &
|
|
709
716
|
Omit<
|
|
@@ -35,6 +35,7 @@ export function AutocompleteOption(props: AutocompleteOptionProps): React.JSX.El
|
|
|
35
35
|
aria-selected={selected}
|
|
36
36
|
data-ui="AutocompleteOption"
|
|
37
37
|
id={id}
|
|
38
|
+
// oxlint-disable-next-line no-noninteractive-element-to-interactive-role, prefer-tag-over-role
|
|
38
39
|
role="option"
|
|
39
40
|
onClick={handleClick}
|
|
40
41
|
onKeyDown={handleKeyDown}
|
|
@@ -84,6 +84,7 @@ export const Breadcrumbs = forwardRef(function Breadcrumbs(
|
|
|
84
84
|
return (
|
|
85
85
|
<StyledBreadcrumbs data-ui="Breadcrumbs" {...restProps} ref={ref}>
|
|
86
86
|
{items.map((item, itemIndex) => (
|
|
87
|
+
// oxlint-disable-next-line no-array-index-key
|
|
87
88
|
<Fragment key={itemIndex}>
|
|
88
89
|
{itemIndex > 0 && (
|
|
89
90
|
<Box aria-hidden as="li" paddingX={space}>
|
|
@@ -180,6 +180,7 @@ const DialogCard = forwardRef(function DialogCard(
|
|
|
180
180
|
const layer = useLayer()
|
|
181
181
|
const {isTopLayer} = layer
|
|
182
182
|
const labelId = `${id}_label`
|
|
183
|
+
// oxlint-disable-next-line no-unnecessary-boolean-literal-compare
|
|
183
184
|
const showCloseButton = Boolean(onClose) && hideCloseButton === false
|
|
184
185
|
const showHeader = Boolean(header) || showCloseButton
|
|
185
186
|
|
|
@@ -224,6 +225,7 @@ const DialogCard = forwardRef(function DialogCard(
|
|
|
224
225
|
isTopLayer &&
|
|
225
226
|
onClickOutside &&
|
|
226
227
|
((event) => {
|
|
228
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
227
229
|
const target = event.target as Node | null
|
|
228
230
|
|
|
229
231
|
if (target && !isTargetWithinScope(boundaryElement, portalElement, target)) {
|
|
@@ -402,6 +404,7 @@ export const Dialog = forwardRef(function Dialog(
|
|
|
402
404
|
onClick={handleRootClick}
|
|
403
405
|
onFocus={handleFocus}
|
|
404
406
|
ref={ref}
|
|
407
|
+
// oxlint-disable-next-line prefer-tag-over-role
|
|
405
408
|
role="dialog"
|
|
406
409
|
zOffset={zOffset}
|
|
407
410
|
>
|
|
@@ -51,6 +51,7 @@ export const Hotkeys = forwardRef(function Hotkeys(
|
|
|
51
51
|
<StyledHotkeys data-ui="Hotkeys" {...restProps} ref={ref}>
|
|
52
52
|
<Inline as="span" space={space}>
|
|
53
53
|
{keys.map((key, i) => (
|
|
54
|
+
// oxlint-disable-next-line no-array-index-key
|
|
54
55
|
<Key fontSize={fontSize} key={i} padding={padding} radius={radius}>
|
|
55
56
|
{key}
|
|
56
57
|
</Key>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @vitest-environment jsdom */
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-console */
|
|
4
4
|
|
|
5
5
|
import React, {useCallback, useMemo} from 'react'
|
|
6
|
+
import {describe, expect, it, vi} from 'vitest'
|
|
6
7
|
|
|
7
8
|
import {render} from '../../../../test'
|
|
8
9
|
import {MenuContext, MenuContextValue} from './menuContext'
|
|
@@ -11,7 +12,7 @@ import {useMenu} from './useMenu'
|
|
|
11
12
|
describe('components/menu', () => {
|
|
12
13
|
describe('useMenu', () => {
|
|
13
14
|
it('should get context value', async () => {
|
|
14
|
-
const log =
|
|
15
|
+
const log = vi.fn()
|
|
15
16
|
|
|
16
17
|
function Debug() {
|
|
17
18
|
const rootMenu = useMenu()
|
|
@@ -67,7 +68,7 @@ describe('components/menu', () => {
|
|
|
67
68
|
})
|
|
68
69
|
|
|
69
70
|
it('should fail when no context value is provided', async () => {
|
|
70
|
-
const log =
|
|
71
|
+
const log = vi.fn()
|
|
71
72
|
|
|
72
73
|
function Debug() {
|
|
73
74
|
try {
|
|
@@ -95,7 +96,7 @@ describe('components/menu', () => {
|
|
|
95
96
|
})
|
|
96
97
|
|
|
97
98
|
it('should fail when context value is not compatible', async () => {
|
|
98
|
-
const log =
|
|
99
|
+
const log = vi.fn()
|
|
99
100
|
|
|
100
101
|
function Debug() {
|
|
101
102
|
try {
|
|
@@ -114,6 +115,7 @@ describe('components/menu', () => {
|
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
return (
|
|
118
|
+
// oxlint-disable-next-line jsx-no-constructed-context-values
|
|
117
119
|
<MenuContext.Provider value={value}>
|
|
118
120
|
<Debug />
|
|
119
121
|
</MenuContext.Provider>
|
|
@@ -48,9 +48,9 @@ export const Menu = forwardRef(function Menu(
|
|
|
48
48
|
) {
|
|
49
49
|
const {
|
|
50
50
|
children,
|
|
51
|
-
//
|
|
51
|
+
// oxlint-disable-next-line no-deprecated, no-unused-vars
|
|
52
52
|
focusFirst,
|
|
53
|
-
//
|
|
53
|
+
// oxlint-disable-next-line no-deprecated, no-unused-vars
|
|
54
54
|
focusLast,
|
|
55
55
|
onClickOutside,
|
|
56
56
|
onEscape,
|
|
@@ -65,6 +65,7 @@ export const Menu = forwardRef(function Menu(
|
|
|
65
65
|
...restProps
|
|
66
66
|
} = props
|
|
67
67
|
const shouldFocus =
|
|
68
|
+
// oxlint-disable-next-line no-deprecated
|
|
68
69
|
_shouldFocus ?? ((props.focusFirst && 'first') || (props.focusLast && 'last') || null)
|
|
69
70
|
|
|
70
71
|
const ref = useRef<HTMLDivElement | null>(null)
|
|
@@ -66,17 +66,23 @@ export const MenuButton = forwardRef(function MenuButton(
|
|
|
66
66
|
) {
|
|
67
67
|
const {
|
|
68
68
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,
|
|
69
|
+
// oxlint-disable-next-line no-deprecated
|
|
69
70
|
boundaryElement: deprecated_boundaryElement,
|
|
70
71
|
button: buttonProp,
|
|
71
72
|
id,
|
|
72
73
|
menu: menuProp,
|
|
73
74
|
onClose,
|
|
74
75
|
onOpen,
|
|
76
|
+
// oxlint-disable-next-line no-deprecated
|
|
75
77
|
placement: deprecated_placement,
|
|
78
|
+
// oxlint-disable-next-line no-deprecated
|
|
76
79
|
popoverScheme: deprecated_popoverScheme,
|
|
80
|
+
// oxlint-disable-next-line no-deprecated
|
|
77
81
|
portal: deprecated_portal = true,
|
|
78
82
|
popover,
|
|
83
|
+
// oxlint-disable-next-line no-deprecated
|
|
79
84
|
popoverRadius: deprecated_popoverRadius,
|
|
85
|
+
// oxlint-disable-next-line no-deprecated
|
|
80
86
|
preventOverflow: deprecated_preventOverflow,
|
|
81
87
|
} = props
|
|
82
88
|
const [open, setOpen] = useState(false)
|
|
@@ -239,6 +245,7 @@ export const MenuButton = forwardRef(function MenuButton(
|
|
|
239
245
|
|
|
240
246
|
const popoverProps: MenuButtonProps['popover'] = useMemo(
|
|
241
247
|
() => ({
|
|
248
|
+
// oxlint-disable-next-line no-deprecated
|
|
242
249
|
boundaryElement: deprecated_boundaryElement,
|
|
243
250
|
overflow: 'auto',
|
|
244
251
|
placement: deprecated_placement,
|
|
@@ -246,6 +253,7 @@ export const MenuButton = forwardRef(function MenuButton(
|
|
|
246
253
|
preventOverflow: deprecated_preventOverflow,
|
|
247
254
|
radius: deprecated_popoverRadius,
|
|
248
255
|
scheme: deprecated_popoverScheme,
|
|
256
|
+
// oxlint-disable-next-line no-useless-fallback-in-spread
|
|
249
257
|
...(popover || {}),
|
|
250
258
|
}),
|
|
251
259
|
[
|
|
@@ -16,6 +16,7 @@ import {useMenu} from './useMenu'
|
|
|
16
16
|
export interface MenuGroupProps {
|
|
17
17
|
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
18
18
|
fontSize?: number | number[]
|
|
19
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
19
20
|
icon?: React.ElementType | React.ReactNode
|
|
20
21
|
menu?: Omit<
|
|
21
22
|
MenuProps,
|
|
@@ -69,6 +70,7 @@ export function MenuGroup(
|
|
|
69
70
|
onItemMouseEnter: _onItemMouseEnter,
|
|
70
71
|
registerElement,
|
|
71
72
|
} = menu
|
|
73
|
+
// oxlint-disable-next-line no-deprecated
|
|
72
74
|
const onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter
|
|
73
75
|
const [rootElement, setRootElement] = useState<HTMLButtonElement | HTMLDivElement | null>(null)
|
|
74
76
|
const [open, setOpen] = useState(false)
|
|
@@ -122,13 +124,13 @@ export function MenuGroup(
|
|
|
122
124
|
|
|
123
125
|
// Close child menu when a sibling item becomes active
|
|
124
126
|
useEffect(() => {
|
|
125
|
-
//
|
|
127
|
+
// oxlint-disable-next-line react-compiler
|
|
126
128
|
if (!active) setOpen(false)
|
|
127
129
|
}, [active])
|
|
128
130
|
|
|
129
131
|
// Update state when child menu is no longer open
|
|
130
132
|
useEffect(() => {
|
|
131
|
-
//
|
|
133
|
+
// oxlint-disable-next-line react-compiler
|
|
132
134
|
if (!open) setWithinMenu(false)
|
|
133
135
|
}, [open])
|
|
134
136
|
|
|
@@ -139,6 +141,7 @@ export function MenuGroup(
|
|
|
139
141
|
// By doing the same here, we ensure that the reset is processed after the focus change.
|
|
140
142
|
const rafId = requestAnimationFrame(() => setShouldFocus(null))
|
|
141
143
|
|
|
144
|
+
// oxlint-disable-next-line consistent-return
|
|
142
145
|
return () => cancelAnimationFrame(rafId)
|
|
143
146
|
}, [shouldFocus])
|
|
144
147
|
|
|
@@ -26,7 +26,9 @@ export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusP
|
|
|
26
26
|
as?: React.ElementType | keyof React.JSX.IntrinsicElements
|
|
27
27
|
fontSize?: number | number[]
|
|
28
28
|
hotkeys?: string[]
|
|
29
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
29
30
|
icon?: React.ElementType | React.ReactNode
|
|
31
|
+
// oxlint-disable-next-line no-redundant-type-constituents
|
|
30
32
|
iconRight?: React.ElementType | React.ReactNode
|
|
31
33
|
pressed?: boolean
|
|
32
34
|
selected?: boolean
|
|
@@ -76,7 +78,9 @@ export const MenuItem = forwardRef(function MenuItem(
|
|
|
76
78
|
onItemMouseEnter: _onItemMouseEnter,
|
|
77
79
|
onItemMouseLeave: _onItemMouseLeave,
|
|
78
80
|
} = menu
|
|
81
|
+
// oxlint-disable-next-line no-deprecated
|
|
79
82
|
const onItemMouseEnter = _onItemMouseEnter ?? menu.onMouseEnter
|
|
83
|
+
// oxlint-disable-next-line no-deprecated
|
|
80
84
|
const onItemMouseLeave = _onItemMouseLeave ?? menu.onMouseLeave
|
|
81
85
|
const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)
|
|
82
86
|
const active = Boolean(activeElement) && activeElement === rootElement
|