@sanity/ui 2.15.7 → 2.15.9
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 +134 -134
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +134 -134
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +1 -1
- package/dist/_visual-editing.d.ts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +77 -80
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -81
- package/dist/index.mjs.map +1 -1
- package/dist/theme.js +431 -40
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +393 -4
- package/dist/theme.mjs.map +1 -1
- package/exports/_visual-editing.ts +15 -15
- package/package.json +34 -30
- package/src/core/_compat.ts +11 -11
- package/src/core/components/autocomplete/__mocks__/apiStore.ts +1 -1
- package/src/core/components/autocomplete/__workshop__/async.tsx +1 -0
- package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -1
- package/src/core/components/autocomplete/__workshop__/custom.tsx +2 -1
- package/src/core/components/autocomplete/__workshop__/example.tsx +2 -1
- package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -0
- package/src/core/components/autocomplete/autocomplete.styles.tsx +2 -1
- package/src/core/components/autocomplete/autocomplete.tsx +3 -2
- package/src/core/components/autocomplete/autocompleteOption.tsx +1 -0
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +7 -0
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
- package/src/core/components/dialog/__workshop__/activate.tsx +2 -1
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -0
- package/src/core/components/dialog/__workshop__/position.tsx +1 -0
- package/src/core/components/dialog/__workshop__/props.tsx +1 -0
- package/src/core/components/dialog/__workshop__/wrapped.tsx +1 -3
- package/src/core/components/dialog/dialog.tsx +3 -0
- package/src/core/components/dialog/dialogProvider.tsx +1 -0
- package/src/core/components/dialog/styles.ts +1 -0
- package/src/core/components/dialog/useDialog.ts +1 -0
- package/src/core/components/hotkeys/hotkeys.tsx +1 -0
- package/src/core/components/menu/__workshop__/asComponent.tsx +1 -0
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +1 -0
- package/src/core/components/menu/__workshop__/constrainedInBoundary.tsx +1 -0
- package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -0
- package/src/core/components/menu/__workshop__/menuButton.tsx +1 -0
- package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -0
- package/src/core/components/menu/__workshop__/tones.tsx +1 -0
- package/src/core/components/menu/menu.test.tsx +1 -0
- package/src/core/components/menu/menu.tsx +1 -0
- package/src/core/components/menu/menuButton.tsx +4 -3
- package/src/core/components/menu/menuGroup.tsx +1 -0
- package/src/core/components/menu/menuItem.tsx +1 -1
- package/src/core/components/menu/useMenu.ts +1 -0
- package/src/core/components/menu/useMenuController.ts +1 -0
- package/src/core/components/skeleton/__workshop__/delay.tsx +1 -0
- package/src/core/components/skeleton/__workshop__/skeleton.tsx +1 -0
- package/src/core/components/skeleton/skeleton.tsx +2 -2
- package/src/core/components/skeleton/textSkeleton.tsx +3 -2
- package/src/core/components/tab/tab.tsx +1 -0
- package/src/core/components/tab/tabList.tsx +2 -1
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/__workshop__/toast.tsx +1 -0
- package/src/core/components/toast/styles.ts +2 -1
- package/src/core/components/toast/toast.tsx +4 -4
- package/src/core/components/toast/toastLayer.tsx +1 -0
- package/src/core/components/toast/toastProvider.tsx +1 -0
- package/src/core/components/toast/useToast.ts +1 -0
- package/src/core/components/tree/__workshop__/basic.tsx +1 -0
- package/src/core/components/tree/__workshop__/tabFromElement.tsx +2 -1
- package/src/core/components/tree/style.ts +1 -0
- 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 +3 -2
- package/src/core/components/tree/useTree.ts +1 -0
- package/src/core/helpers/focus.ts +2 -2
- package/src/core/hooks/useArrayProp.ts +1 -0
- package/src/core/hooks/useClickOutside.test.tsx +0 -1
- package/src/core/hooks/useClickOutside.ts +1 -0
- package/src/core/hooks/useClickOutsideEvent.test.tsx +0 -1
- package/src/core/hooks/useClickOutsideEvent.ts +1 -0
- package/src/core/hooks/useDelayed.test.ts +2 -1
- package/src/core/hooks/useDelayedState.ts +1 -2
- package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -0
- package/src/core/hooks/useElementSize.ts +2 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +2 -1
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +1 -0
- package/src/core/hooks/usePrefersDark.test.tsx +2 -1
- package/src/core/hooks/usePrefersReducedMotion.test.tsx +2 -1
- package/src/core/index.ts +1 -2
- package/src/core/lib/createGlobalScopedContext.ts +2 -1
- package/src/core/primitives/_selectable/selectable.tsx +1 -0
- package/src/core/primitives/_selectable/style.ts +1 -0
- package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -0
- package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -0
- package/src/core/primitives/avatar/__workshop__/withinButton.tsx +1 -0
- package/src/core/primitives/avatar/__workshop__/withinMenuItem.tsx +1 -0
- package/src/core/primitives/avatar/avatar.tsx +2 -7
- package/src/core/primitives/avatar/avatarCounter.tsx +3 -2
- package/src/core/primitives/avatar/avatarStack.tsx +3 -2
- package/src/core/primitives/avatar/styles.ts +2 -1
- package/src/core/primitives/avatar/types.ts +1 -0
- package/src/core/primitives/badge/__workshop__/props.tsx +1 -0
- package/src/core/primitives/badge/__workshop__/tones.tsx +1 -0
- package/src/core/primitives/badge/badge.test.tsx +1 -0
- package/src/core/primitives/badge/badge.tsx +1 -0
- package/src/core/primitives/badge/styles.ts +1 -0
- package/src/core/primitives/box/__workshop__/props.tsx +1 -0
- package/src/core/primitives/box/box.tsx +3 -2
- package/src/core/primitives/button/__workshop__/custom.tsx +3 -0
- package/src/core/primitives/button/__workshop__/disabled.tsx +1 -0
- package/src/core/primitives/button/__workshop__/props.tsx +2 -1
- package/src/core/primitives/button/__workshop__/stacked.tsx +1 -0
- package/src/core/primitives/button/button.test.tsx +1 -0
- package/src/core/primitives/button/button.tsx +1 -0
- package/src/core/primitives/button/styles.ts +1 -0
- package/src/core/primitives/card/__workshop__/asButton.tsx +1 -0
- package/src/core/primitives/card/__workshop__/listNavigation.tsx +1 -0
- package/src/core/primitives/card/__workshop__/props.tsx +3 -1
- package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
- package/src/core/primitives/card/card.tsx +1 -0
- package/src/core/primitives/card/styles.ts +1 -0
- package/src/core/primitives/checkbox/checkbox.tsx +1 -0
- package/src/core/primitives/checkbox/styles.ts +1 -0
- package/src/core/primitives/code/__workshop__/props.tsx +1 -0
- package/src/core/primitives/code/code.tsx +2 -1
- package/src/core/primitives/container/__workshop__/example.tsx +1 -0
- package/src/core/primitives/container/container.tsx +1 -0
- package/src/core/primitives/container/styles.ts +2 -1
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -0
- package/src/core/primitives/flex/flex.tsx +2 -1
- package/src/core/primitives/grid/grid.tsx +1 -0
- package/src/core/primitives/heading/__workshop__/plain.tsx +2 -1
- package/src/core/primitives/heading/heading.tsx +1 -0
- package/src/core/primitives/heading/styles.ts +1 -0
- package/src/core/primitives/inline/__workshop__/plain.tsx +1 -0
- package/src/core/primitives/inline/inline.tsx +2 -1
- package/src/core/primitives/inline/styles.ts +2 -1
- package/src/core/primitives/kbd/kbd.tsx +2 -1
- package/src/core/primitives/label/__workshop__/plain.tsx +2 -1
- package/src/core/primitives/label/label.tsx +1 -0
- package/src/core/primitives/label/styles.ts +1 -0
- package/src/core/primitives/popover/__workshop__/AlignedStory.tsx +1 -0
- package/src/core/primitives/popover/__workshop__/MatchReferenceWidthStory.tsx +1 -0
- package/src/core/primitives/popover/__workshop__/PlainStory.tsx +1 -0
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +4 -1
- package/src/core/primitives/popover/__workshop__/TestStory.tsx +1 -0
- package/src/core/primitives/popover/floating-ui/size.ts +2 -1
- package/src/core/primitives/popover/popover.tsx +6 -7
- package/src/core/primitives/popover/popoverCard.tsx +2 -1
- package/src/core/primitives/radio/radio.tsx +2 -1
- package/src/core/primitives/radio/styles.ts +1 -0
- package/src/core/primitives/select/select.tsx +2 -1
- package/src/core/primitives/select/styles.ts +3 -3
- package/src/core/primitives/spinner/__workshop__/Props.tsx +1 -0
- package/src/core/primitives/spinner/spinner.tsx +2 -1
- package/src/core/primitives/stack/__workshop__/plain.tsx +1 -0
- package/src/core/primitives/stack/stack.tsx +2 -1
- package/src/core/primitives/stack/styles.ts +2 -1
- package/src/core/primitives/switch/styles.ts +1 -0
- package/src/core/primitives/switch/switch.tsx +2 -1
- package/src/core/primitives/text/__workshop__/colored.tsx +3 -2
- package/src/core/primitives/text/__workshop__/example.tsx +1 -0
- package/src/core/primitives/text/styles.ts +1 -0
- package/src/core/primitives/text/text.tsx +1 -0
- package/src/core/primitives/textArea/__workshop__/plain.tsx +1 -0
- package/src/core/primitives/textArea/textArea.tsx +6 -5
- package/src/core/primitives/textInput/__workshop__/plain.tsx +2 -1
- package/src/core/primitives/textInput/__workshop__/typed.tsx +1 -0
- package/src/core/primitives/textInput/textInput.tsx +1 -0
- package/src/core/primitives/tooltip/__workshop__/customPortal.tsx +1 -0
- package/src/core/primitives/tooltip/__workshop__/overflowingBoundary.tsx +1 -0
- package/src/core/primitives/tooltip/__workshop__/props.tsx +3 -2
- package/src/core/primitives/tooltip/__workshop__/resizableBoundary.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.test.tsx +4 -2
- package/src/core/primitives/tooltip/tooltip.tsx +6 -5
- package/src/core/primitives/tooltip/tooltipCard.tsx +2 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/index.ts +1 -1
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -0
- package/src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts +1 -0
- package/src/core/styles/border/borderStyle.ts +1 -0
- package/src/core/styles/box/boxStyle.ts +1 -0
- package/src/core/styles/card/_cardColorStyle.ts +1 -2
- package/src/core/styles/flex/flexItemStyle.ts +1 -0
- package/src/core/styles/flex/flexStyle.ts +2 -1
- package/src/core/styles/flex/index.ts +1 -1
- package/src/core/styles/flex/types.ts +1 -0
- package/src/core/styles/font/codeFontStyle.ts +1 -0
- package/src/core/styles/font/headingFontStyle.ts +1 -0
- package/src/core/styles/font/labelFontStyle.ts +1 -0
- package/src/core/styles/font/responsiveFont.ts +3 -3
- package/src/core/styles/font/textAlignStyle.ts +1 -0
- package/src/core/styles/font/textFontStyle.ts +1 -0
- package/src/core/styles/font/types.ts +1 -0
- package/src/core/styles/grid/gridItemStyle.ts +1 -0
- package/src/core/styles/grid/gridStyle.ts +2 -1
- package/src/core/styles/grid/index.ts +1 -1
- package/src/core/styles/helpers.ts +2 -2
- package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -1
- package/src/core/styles/input/textInputStyle.ts +3 -3
- package/src/core/styles/margin/marginStyle.ts +1 -0
- package/src/core/styles/margin/marginsStyle.test.ts +1 -0
- package/src/core/styles/padding/paddingStyle.test.ts +1 -0
- package/src/core/styles/padding/paddingStyle.ts +1 -0
- package/src/core/styles/radius/radiusStyle.ts +1 -0
- package/src/core/styles/shadow/shadowStyle.ts +3 -3
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/__workshop__/build/story.tsx +18 -9
- package/src/core/theme/__workshop__/canvas.tsx +7 -6
- package/src/core/theme/__workshop__/debug/story.tsx +5 -3
- package/src/core/theme/index.ts +1 -1
- package/src/core/theme/theme.test.tsx +1 -0
- package/src/core/theme/themeColorProvider.tsx +1 -0
- package/src/core/theme/themeProvider.tsx +3 -2
- package/src/core/theme/useRootTheme.ts +1 -0
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/utils/arrow/arrow.tsx +4 -3
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +1 -0
- package/src/core/utils/boundaryElement/index.ts +1 -1
- package/src/core/utils/boundaryElement/useBoundaryElement.ts +1 -0
- package/src/core/utils/elementQuery/elementQuery.tsx +1 -0
- package/src/core/utils/errorBoundary.tsx +1 -0
- package/src/core/utils/layer/__workshop__/multipleRoots.tsx +1 -0
- package/src/core/utils/layer/__workshop__/nested.tsx +1 -0
- package/src/core/utils/layer/__workshop__/responsiveZOffset.tsx +1 -0
- package/src/core/utils/layer/index.ts +1 -1
- package/src/core/utils/layer/layer.tsx +1 -0
- package/src/core/utils/layer/layerProvider.tsx +2 -1
- package/src/core/utils/layer/useLayer.ts +1 -0
- package/src/core/utils/portal/portal.ts +1 -0
- package/src/core/utils/portal/portalProvider.tsx +1 -0
- package/src/core/utils/portal/usePortal.ts +1 -0
- package/src/core/utils/virtualList/virtualList.tsx +1 -0
- package/src/theme/build/_deprecated/color/_solid/createSolidTones.ts +1 -1
- package/src/theme/build/_deprecated/color/card/createCardStates.ts +1 -1
- package/src/theme/build/_deprecated/color/factory.ts +6 -6
- package/src/theme/build/buildColorTheme.ts +15 -15
- package/src/theme/build/colorToken/colorToken.ts +1 -1
- package/src/theme/build/mixThemeColor.ts +1 -1
- package/src/theme/build/renderColorTheme.ts +7 -6
- package/src/theme/build/renderColorValue.ts +3 -2
- package/src/theme/build/resolveColorTokens.ts +5 -4
- package/src/theme/config/helpers.ts +2 -2
- package/src/theme/config/system.ts +2 -1
- package/src/theme/config/tokens/color/types.ts +2 -1
- package/src/theme/config/tokens/types.ts +2 -1
- package/src/theme/config/types.ts +2 -1
- package/src/theme/system/color/_helpers.ts +1 -0
- package/src/theme/system/color/_system.ts +1 -1
- package/src/theme/system/color/color.ts +1 -1
- package/src/theme/system/index.ts +1 -2
- package/src/theme/system/theme.ts +2 -2
- package/src/theme/system/v0/color/index.ts +1 -1
- package/src/theme/system/v0/index.ts +1 -1
- package/src/theme/versioning/themeColor_v0_v2.ts +5 -5
- package/dist/_chunks-cjs/getTheme_v2.js +0 -397
- package/dist/_chunks-cjs/getTheme_v2.js.map +0 -1
- package/dist/_chunks-es/getTheme_v2.mjs +0 -398
- package/dist/_chunks-es/getTheme_v2.mjs.map +0 -1
- package/src/core/__workshop__/fontsPlugin.tsx +0 -76
- /package/src/core/components/autocomplete/{__fixtures__ → __mocks__}/countries.ts +0 -0
- /package/src/core/primitives/kbd/{index.tsx → index.ts} +0 -0
|
@@ -835,7 +835,7 @@ declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
|
|
|
835
835
|
* @public
|
|
836
836
|
*/
|
|
837
837
|
export declare const TextInput: ForwardRefExoticComponent<
|
|
838
|
-
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | '
|
|
838
|
+
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
|
|
839
839
|
RefAttributes<HTMLInputElement>
|
|
840
840
|
>
|
|
841
841
|
|
|
@@ -835,7 +835,7 @@ declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
|
|
|
835
835
|
* @public
|
|
836
836
|
*/
|
|
837
837
|
export declare const TextInput: ForwardRefExoticComponent<
|
|
838
|
-
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | '
|
|
838
|
+
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
|
|
839
839
|
RefAttributes<HTMLInputElement>
|
|
840
840
|
>
|
|
841
841
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2200,7 +2200,7 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
|
|
|
2200
2200
|
* @public
|
|
2201
2201
|
*/
|
|
2202
2202
|
export declare const TextInput: ForwardRefExoticComponent<
|
|
2203
|
-
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | '
|
|
2203
|
+
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
|
|
2204
2204
|
RefAttributes<HTMLInputElement>
|
|
2205
2205
|
>
|
|
2206
2206
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2200,7 +2200,7 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
|
|
|
2200
2200
|
* @public
|
|
2201
2201
|
*/
|
|
2202
2202
|
export declare const TextInput: ForwardRefExoticComponent<
|
|
2203
|
-
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | '
|
|
2203
|
+
Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
|
|
2204
2204
|
RefAttributes<HTMLInputElement>
|
|
2205
2205
|
>
|
|
2206
2206
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), framerMotion = require("framer-motion")
|
|
3
|
+
var _visualEditing = require("./_chunks-cjs/_visual-editing.js"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), react = require("react"), styledComponents = require("styled-components"), reactCompilerRuntime = require("react-compiler-runtime"), theme = require("@sanity/ui/theme"), framerMotion = require("framer-motion");
|
|
4
|
+
function _raf(fn) {
|
|
5
|
+
const frameId = requestAnimationFrame(fn);
|
|
6
|
+
return () => {
|
|
7
|
+
cancelAnimationFrame(frameId);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function _raf2(fn) {
|
|
11
|
+
let innerDispose = null;
|
|
12
|
+
const outerDispose = _raf(() => {
|
|
13
|
+
innerDispose = _raf(fn);
|
|
14
|
+
});
|
|
15
|
+
return () => {
|
|
16
|
+
innerDispose && innerDispose(), outerDispose();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function _hasFocus(element) {
|
|
20
|
+
return !!document.activeElement && element.contains(document.activeElement);
|
|
21
|
+
}
|
|
22
|
+
function isFocusable(element) {
|
|
23
|
+
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : _visualEditing.isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : _visualEditing.isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : _visualEditing.isHTMLButtonElement(element) || _visualEditing.isHTMLSelectElement(element) || _visualEditing.isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
24
|
+
}
|
|
25
|
+
function attemptFocus(element) {
|
|
26
|
+
if (!isFocusable(element))
|
|
27
|
+
return !1;
|
|
28
|
+
try {
|
|
29
|
+
element.focus();
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
return document.activeElement === element;
|
|
33
|
+
}
|
|
34
|
+
function focusFirstDescendant(element) {
|
|
35
|
+
for (let i = 0; i < element.childNodes.length; i++) {
|
|
36
|
+
const child = element.childNodes[i];
|
|
37
|
+
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
|
|
38
|
+
return !0;
|
|
39
|
+
}
|
|
40
|
+
return !1;
|
|
41
|
+
}
|
|
42
|
+
function focusLastDescendant(element) {
|
|
43
|
+
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
44
|
+
const child = element.childNodes[i];
|
|
45
|
+
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
|
|
46
|
+
return !0;
|
|
47
|
+
}
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
4
50
|
function _getElements(element, elementsArg) {
|
|
5
51
|
const ret = [element];
|
|
6
52
|
for (const el of elementsArg)
|
|
@@ -82,52 +128,6 @@ class ErrorBoundary extends react.Component {
|
|
|
82
128
|
return this.props.children;
|
|
83
129
|
}
|
|
84
130
|
}
|
|
85
|
-
function _raf(fn) {
|
|
86
|
-
const frameId = requestAnimationFrame(fn);
|
|
87
|
-
return () => {
|
|
88
|
-
cancelAnimationFrame(frameId);
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function _raf2(fn) {
|
|
92
|
-
let innerDispose = null;
|
|
93
|
-
const outerDispose = _raf(() => {
|
|
94
|
-
innerDispose = _raf(fn);
|
|
95
|
-
});
|
|
96
|
-
return () => {
|
|
97
|
-
innerDispose && innerDispose(), outerDispose();
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function _hasFocus(element) {
|
|
101
|
-
return !!document.activeElement && element.contains(document.activeElement);
|
|
102
|
-
}
|
|
103
|
-
function isFocusable(element) {
|
|
104
|
-
return element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null ? !0 : _visualEditing.isHTMLAnchorElement(element) ? !!element.href && element.rel !== "ignore" : _visualEditing.isHTMLInputElement(element) ? element.type !== "hidden" && element.type !== "file" && !element.disabled : _visualEditing.isHTMLButtonElement(element) || _visualEditing.isHTMLSelectElement(element) || _visualEditing.isHTMLTextAreaElement(element) ? !element.disabled : !1;
|
|
105
|
-
}
|
|
106
|
-
function attemptFocus(element) {
|
|
107
|
-
if (!isFocusable(element))
|
|
108
|
-
return !1;
|
|
109
|
-
try {
|
|
110
|
-
element.focus();
|
|
111
|
-
} catch {
|
|
112
|
-
}
|
|
113
|
-
return document.activeElement === element;
|
|
114
|
-
}
|
|
115
|
-
function focusFirstDescendant(element) {
|
|
116
|
-
for (let i = 0; i < element.childNodes.length; i++) {
|
|
117
|
-
const child = element.childNodes[i];
|
|
118
|
-
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusFirstDescendant(child)))
|
|
119
|
-
return !0;
|
|
120
|
-
}
|
|
121
|
-
return !1;
|
|
122
|
-
}
|
|
123
|
-
function focusLastDescendant(element) {
|
|
124
|
-
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
125
|
-
const child = element.childNodes[i];
|
|
126
|
-
if (_visualEditing.isHTMLElement(child) && (attemptFocus(child) || focusLastDescendant(child)))
|
|
127
|
-
return !0;
|
|
128
|
-
}
|
|
129
|
-
return !1;
|
|
130
|
-
}
|
|
131
131
|
const StyledAutocomplete = styledComponents.styled.div.withConfig({
|
|
132
132
|
displayName: "StyledAutocomplete",
|
|
133
133
|
componentId: "sc-1igauft-0"
|
|
@@ -987,7 +987,7 @@ const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
|
|
|
987
987
|
})`display:block;height:100%;width:100%;transform-origin:0% 50%;background-color:${(props) => {
|
|
988
988
|
const {
|
|
989
989
|
color
|
|
990
|
-
} =
|
|
990
|
+
} = theme.getTheme_v2(props.theme);
|
|
991
991
|
return color.button.default[props.tone].enabled.bg;
|
|
992
992
|
}};`, ROLES = {
|
|
993
993
|
error: "alert",
|
|
@@ -996,7 +996,7 @@ const LOADING_BAR_HEIGHT = 2, STATUS_CARD_TONE = {
|
|
|
996
996
|
info: "alert"
|
|
997
997
|
}, LONG_ENOUGH_BUT_NOT_TOO_LONG = 1e3 * 60 * 60 * 24 * 24;
|
|
998
998
|
function Toast(props) {
|
|
999
|
-
const $ = reactCompilerRuntime.c(
|
|
999
|
+
const $ = reactCompilerRuntime.c(50);
|
|
1000
1000
|
let closable, description, duration, onClose, restProps, status, t0, title, updatedAt;
|
|
1001
1001
|
$[0] !== props ? ({
|
|
1002
1002
|
closable,
|
|
@@ -1018,39 +1018,36 @@ function Toast(props) {
|
|
|
1018
1018
|
} : {
|
|
1019
1019
|
duration: 0
|
|
1020
1020
|
}, $[10] = visualDuration, $[11] = t1) : t1 = $[11];
|
|
1021
|
-
const transition = t1;
|
|
1021
|
+
const transition = t1, hasDuration = duration && isFinite(duration) && duration < LONG_ENOUGH_BUT_NOT_TOO_LONG;
|
|
1022
1022
|
let t2;
|
|
1023
|
-
$[12]
|
|
1024
|
-
const
|
|
1023
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = ["hidden", "initial"], $[12] = t2) : t2 = $[12];
|
|
1024
|
+
const initial = t2;
|
|
1025
1025
|
let t3;
|
|
1026
|
-
$[
|
|
1027
|
-
const
|
|
1026
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t3 = ["visible", "slideIn"], $[13] = t3) : t3 = $[13];
|
|
1027
|
+
const animate = t3;
|
|
1028
1028
|
let t4;
|
|
1029
|
-
$[
|
|
1030
|
-
const
|
|
1031
|
-
let
|
|
1032
|
-
$[
|
|
1033
|
-
const exit = t5, t6 = hasDuration ? "" : void 0;
|
|
1029
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t4 = ["hidden", "slideOut"], $[14] = t4) : t4 = $[14];
|
|
1030
|
+
const exit = t4, t5 = hasDuration ? "" : void 0;
|
|
1031
|
+
let t6;
|
|
1032
|
+
$[15] !== title ? (t6 = title && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: 1, weight: "medium", children: title }), $[15] = title, $[16] = t6) : t6 = $[16];
|
|
1034
1033
|
let t7;
|
|
1035
|
-
$[17] !==
|
|
1034
|
+
$[17] !== description || $[18] !== transition ? (t7 = description && /* @__PURE__ */ jsxRuntime.jsx(MotionText, { muted: !0, size: 1, variants: content, transition, children: description }), $[17] = description, $[18] = transition, $[19] = t7) : t7 = $[19];
|
|
1036
1035
|
let t8;
|
|
1037
|
-
$[
|
|
1036
|
+
$[20] !== t6 || $[21] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(_visualEditing.Stack, { space: 3, children: [
|
|
1037
|
+
t6,
|
|
1038
|
+
t7
|
|
1039
|
+
] }) }), $[20] = t6, $[21] = t7, $[22] = t8) : t8 = $[22];
|
|
1038
1040
|
let t9;
|
|
1039
|
-
$[
|
|
1040
|
-
t7,
|
|
1041
|
-
t8
|
|
1042
|
-
] }) }), $[22] = t7, $[23] = t8, $[24] = t9) : t9 = $[24];
|
|
1043
|
-
let t10;
|
|
1044
|
-
$[25] !== buttonTone || $[26] !== closable || $[27] !== onClose ? (t10 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
|
|
1041
|
+
$[23] !== buttonTone || $[24] !== closable || $[25] !== onClose ? (t9 = closable && /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Box, { padding: 1, children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Button, { as: "button", icon: icons.CloseIcon, mode: "bleed", padding: 2, tone: buttonTone, onClick: onClose, style: {
|
|
1045
1042
|
verticalAlign: "top"
|
|
1046
|
-
} }) }), $[
|
|
1043
|
+
} }) }), $[23] = buttonTone, $[24] = closable, $[25] = onClose, $[26] = t9) : t9 = $[26];
|
|
1044
|
+
let t10;
|
|
1045
|
+
$[27] !== t8 || $[28] !== t9 || $[29] !== transition ? (t10 = /* @__PURE__ */ jsxRuntime.jsxs(MotionFlex, { align: "flex-start", variants: content, transition, children: [
|
|
1046
|
+
t8,
|
|
1047
|
+
t9
|
|
1048
|
+
] }), $[27] = t8, $[28] = t9, $[29] = transition, $[30] = t10) : t10 = $[30];
|
|
1047
1049
|
let t11;
|
|
1048
|
-
$[
|
|
1049
|
-
t9,
|
|
1050
|
-
t10
|
|
1051
|
-
] }), $[29] = t10, $[30] = t9, $[31] = transition, $[32] = t11) : t11 = $[32];
|
|
1052
|
-
let t12;
|
|
1053
|
-
$[33] !== cardTone || $[34] !== duration || $[35] !== hasDuration || $[36] !== onClose || $[37] !== radius || $[38] !== transition || $[39] !== updatedAt || $[40] !== visualDuration ? (t12 = hasDuration && /* @__PURE__ */ jsxRuntime.jsxs(MotionLoadingBar, { variants: content, transition, children: [
|
|
1050
|
+
$[31] !== cardTone || $[32] !== duration || $[33] !== hasDuration || $[34] !== onClose || $[35] !== radius || $[36] !== transition || $[37] !== updatedAt || $[38] !== visualDuration ? (t11 = hasDuration && /* @__PURE__ */ jsxRuntime.jsxs(MotionLoadingBar, { variants: content, transition, children: [
|
|
1054
1051
|
/* @__PURE__ */ jsxRuntime.jsx(LoadingBarMask, { tone: cardTone, radius }),
|
|
1055
1052
|
/* @__PURE__ */ jsxRuntime.jsx(MotionLoadingBarProgress, { tone: cardTone, initial: {
|
|
1056
1053
|
scaleX: 0
|
|
@@ -1061,12 +1058,12 @@ function Toast(props) {
|
|
|
1061
1058
|
duration: duration / 1e3,
|
|
1062
1059
|
ease: "linear"
|
|
1063
1060
|
}, onAnimationComplete: onClose }, `progress-${updatedAt}`)
|
|
1064
|
-
] }), $[
|
|
1065
|
-
let
|
|
1066
|
-
return $[
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
] }), $[
|
|
1061
|
+
] }), $[31] = cardTone, $[32] = duration, $[33] = hasDuration, $[34] = onClose, $[35] = radius, $[36] = transition, $[37] = updatedAt, $[38] = visualDuration, $[39] = t11) : t11 = $[39];
|
|
1062
|
+
let t12;
|
|
1063
|
+
return $[40] !== cardTone || $[41] !== radius || $[42] !== restProps || $[43] !== role || $[44] !== t10 || $[45] !== t11 || $[46] !== t5 || $[47] !== transition || $[48] !== visualDuration ? (t12 = /* @__PURE__ */ jsxRuntime.jsxs(MotionToast, { "data-ui": "Toast", role, ...restProps, "data-has-duration": t5, custom: visualDuration, radius, shadow: 2, tone: cardTone, forwardedAs: "li", layout: "position", variants: container, initial, animate, exit, transition, children: [
|
|
1064
|
+
t10,
|
|
1065
|
+
t11
|
|
1066
|
+
] }), $[40] = cardTone, $[41] = radius, $[42] = restProps, $[43] = role, $[44] = t10, $[45] = t11, $[46] = t5, $[47] = transition, $[48] = visualDuration, $[49] = t12) : t12 = $[49], t12;
|
|
1070
1067
|
}
|
|
1071
1068
|
Toast.displayName = "Toast";
|
|
1072
1069
|
const container = {
|