@sanity/ui 4.2.0 → 5.0.0-alpha.10
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 +194 -28
- package/bin/sanity-ui.js +14 -0
- package/dist/_chunks-es/LazyRefractor.js +20 -0
- package/dist/_chunks-es/LazyRefractor.js.map +1 -0
- package/dist/cli/checks.js +148 -0
- package/dist/cli/config.js +23 -0
- package/dist/cli/detect.js +181 -0
- package/dist/cli/doctor.js +49 -0
- package/dist/cli/index.js +69 -0
- package/dist/cli/init.js +189 -0
- package/dist/cli/install.js +79 -0
- package/dist/cli/log.js +66 -0
- package/dist/cli/selfPackage.js +11 -0
- package/dist/cli/styles.js +185 -0
- package/dist/cli/test-utils.js +8 -0
- package/dist/cli/tsconfig.js +236 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/versions.js +45 -0
- package/dist/index.d.ts +1203 -1469
- package/dist/index.js +2123 -1989
- package/dist/index.js.map +1 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.js +5 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/styles.css +1 -547
- package/package.json +57 -58
- package/src/cli/checks.test.ts +38 -0
- package/src/cli/checks.ts +200 -0
- package/src/cli/config.ts +44 -0
- package/src/cli/detect.test.ts +191 -0
- package/src/cli/detect.ts +205 -0
- package/src/cli/doctor.test.ts +52 -0
- package/src/cli/doctor.ts +65 -0
- package/src/cli/index.ts +77 -0
- package/src/cli/init.ts +225 -0
- package/src/cli/install.test.ts +52 -0
- package/src/cli/install.ts +108 -0
- package/src/cli/log.ts +79 -0
- package/src/cli/selfPackage.ts +14 -0
- package/src/cli/styles.test.ts +130 -0
- package/src/cli/styles.ts +205 -0
- package/src/cli/test-utils.ts +10 -0
- package/src/cli/tsconfig.test.ts +174 -0
- package/src/cli/tsconfig.ts +282 -0
- package/src/cli/types.ts +77 -0
- package/src/cli/versions.test.ts +35 -0
- package/src/cli/versions.ts +41 -0
- package/src/components/badge/Badge.tsx +53 -0
- package/src/components/badge/badge.css +6 -0
- package/src/components/badge/badge.props.ts +31 -0
- package/src/components/box/Box.tsx +30 -0
- package/src/components/box/box.css +4 -0
- package/src/components/box/box.props.ts +29 -0
- package/src/components/button/Button.tsx +78 -0
- package/src/components/button/button.css +72 -0
- package/src/components/button/button.props.ts +122 -0
- package/src/components/card/Card.tsx +31 -0
- package/src/components/card/card.css +4 -0
- package/src/components/card/card.props.ts +58 -0
- package/src/components/checkbox/Checkbox.tsx +64 -0
- package/src/components/checkbox/checkbox.css +100 -0
- package/src/components/checkbox/checkbox.props.ts +33 -0
- package/src/components/code/Code.tsx +38 -0
- package/src/components/code/LazyRefractor.tsx +9 -0
- package/src/components/code/code.css +40 -0
- package/src/components/code/code.props.ts +44 -0
- package/src/components/container/Container.tsx +30 -0
- package/src/components/container/container.css +4 -0
- package/src/components/container/container.props.ts +28 -0
- package/src/components/dialog/Dialog.tsx +139 -0
- package/src/components/dialog/dialog.css +49 -0
- package/src/components/dialog/dialog.props.ts +45 -0
- package/src/components/divider/Divider.tsx +23 -0
- package/src/components/divider/divider.props.ts +9 -0
- package/src/components/eyebrow/Eyebrow.tsx +54 -0
- package/src/components/eyebrow/eyebrow.css +11 -0
- package/src/components/eyebrow/eyebrow.props.ts +28 -0
- package/src/components/flex/Flex.tsx +30 -0
- package/src/components/flex/flex.css +4 -0
- package/src/components/flex/flex.props.ts +33 -0
- package/src/components/grid/Grid.tsx +30 -0
- package/src/components/grid/grid.css +4 -0
- package/src/components/grid/grid.props.ts +33 -0
- package/src/components/h-stack/HStack.tsx +34 -0
- package/src/components/h-stack/hStack.props.ts +17 -0
- package/src/components/heading/Heading.tsx +54 -0
- package/src/components/heading/heading.css +9 -0
- package/src/components/heading/heading.props.ts +31 -0
- package/src/components/icon/Icon.tsx +24 -0
- package/src/components/icon/icon.css +17 -0
- package/src/components/icon/icon.props.ts +35 -0
- package/src/components/icon-button/IconButton.tsx +32 -0
- package/src/components/icon-button/iconButton.props.ts +31 -0
- package/src/components/index.css +28 -0
- package/src/components/indicator/Indicator.tsx +42 -0
- package/src/components/indicator/indicator.css +4 -0
- package/src/components/indicator/indicator.props.ts +24 -0
- package/src/components/indicator-stack/IndicatorStack.tsx +31 -0
- package/src/components/indicator-stack/indicator-stack.css +7 -0
- package/src/components/indicator-stack/indicatorStack.props.ts +15 -0
- package/src/components/inline/Inline.tsx +38 -0
- package/src/components/inline/inline.css +4 -0
- package/src/components/inline/inline.props.ts +100 -0
- package/src/components/label/Label.tsx +34 -0
- package/src/components/label/label.css +3 -0
- package/src/components/label/label.props.ts +25 -0
- package/src/components/link/Link.tsx +29 -0
- package/src/components/link/link.css +12 -0
- package/src/components/link/link.props.ts +23 -0
- package/src/components/list/List.tsx +167 -0
- package/src/components/list/list.css +25 -0
- package/src/components/list/list.props.ts +130 -0
- package/src/components/popover/Popover.tsx +85 -0
- package/src/components/popover/popover.css +21 -0
- package/src/components/popover/popover.props.ts +38 -0
- package/src/components/press-area/PressArea.tsx +29 -0
- package/src/components/press-area/press-area.css +22 -0
- package/src/components/press-area/pressArea.props.ts +16 -0
- package/src/components/radio/Radio.tsx +48 -0
- package/src/components/radio/radio.css +97 -0
- package/src/components/radio/radio.props.ts +25 -0
- package/src/components/skip-to-content/SkipToContent.tsx +35 -0
- package/src/components/skip-to-content/skip-to-content.css +9 -0
- package/src/components/skip-to-content/skipToContent.props.ts +25 -0
- package/src/components/spinner/Spinner.tsx +28 -0
- package/src/components/spinner/spinner.css +10 -0
- package/src/components/spinner/spinner.props.ts +19 -0
- package/src/components/switch/Switch.tsx +48 -0
- package/src/components/switch/switch.css +119 -0
- package/src/components/switch/switch.props.ts +25 -0
- package/src/components/text/Text.tsx +53 -0
- package/src/components/text/text.css +9 -0
- package/src/components/text/text.props.ts +28 -0
- package/src/components/tooltip/Tooltip.tsx +97 -0
- package/src/components/tooltip/tooltip.css +31 -0
- package/src/components/tooltip/tooltip.props.ts +36 -0
- package/src/components/tooltip-group/TooltipGroup.tsx +64 -0
- package/src/components/tooltip-group/tooltipGroup.props.ts +15 -0
- package/src/components/v-stack/VStack.tsx +32 -0
- package/src/components/v-stack/vStack.props.ts +17 -0
- package/src/components/visually-hidden/VisuallyHidden.tsx +29 -0
- package/src/components/visually-hidden/visually-hidden.css +9 -0
- package/src/components/visually-hidden/visuallyHidden.props.ts +23 -0
- package/src/css/classes/dynamic/flex-child.css +5 -0
- package/src/css/classes/dynamic/grid-child.css +8 -0
- package/src/css/classes/dynamic/grid-parent.css +6 -0
- package/src/css/classes/dynamic/height.css +5 -0
- package/src/css/classes/dynamic/index.css +7 -0
- package/src/css/classes/dynamic/line-clamp.css +5 -0
- package/src/css/classes/dynamic/readme.md +3 -0
- package/src/css/classes/dynamic/width.css +7 -0
- package/src/css/classes/dynamic/z-index.css +3 -0
- package/src/css/classes/generic/display.css +10 -0
- package/src/css/classes/generic/flex.css +24 -0
- package/src/css/classes/generic/grid.css +7 -0
- package/src/css/classes/generic/index.css +7 -0
- package/src/css/classes/generic/overflow.css +19 -0
- package/src/css/classes/generic/placement.css +202 -0
- package/src/css/classes/generic/position.css +7 -0
- package/src/css/classes/generic/readme.md +3 -0
- package/src/css/classes/generic/text-align.css +5 -0
- package/src/css/classes/index.css +4 -0
- package/src/css/classes/local/animation.css +4 -0
- package/src/css/classes/local/border.css +20 -0
- package/src/css/classes/local/index.css +6 -0
- package/src/css/classes/local/readme.md +3 -0
- package/src/css/classes/local/text-overflow.css +5 -0
- package/src/css/classes/local/text-trim.css +45 -0
- package/src/css/classes/local/tone.css +75 -0
- package/src/css/classes/local/top-anchor.css +4 -0
- package/src/css/classes/system/color.css +223 -0
- package/src/css/classes/system/container.css +8 -0
- package/src/css/classes/system/font-family.css +2 -0
- package/src/css/classes/system/font-weight.css +4 -0
- package/src/css/classes/system/gap.css +37 -0
- package/src/css/classes/system/index.css +10 -0
- package/src/css/classes/system/inset.css +56 -0
- package/src/css/classes/system/margin.css +148 -0
- package/src/css/classes/system/padding.css +78 -0
- package/src/css/classes/system/radius.css +10 -0
- package/src/css/classes/system/readme.md +3 -0
- package/src/css/classes/system/shadow.css +6 -0
- package/src/css/classes/system/typography.css +31 -0
- package/src/css/global/font-face.css +20 -0
- package/src/css/global/index.css +2 -0
- package/src/css/global/reset.css +76 -0
- package/src/css/tokens/index.css +3 -0
- package/src/css/tokens/opacity.css +6 -0
- package/src/css/tokens/semantic.css +25 -0
- package/src/css/tokens/surface.css +27 -0
- package/src/hooks/useIsClient.ts +10 -0
- package/src/index.css +18 -0
- package/src/index.ts +65 -0
- package/src/polyfills.ts +15 -0
- package/src/props/border.ts +51 -0
- package/src/props/flexChild.ts +29 -0
- package/src/props/flexParent.ts +47 -0
- package/src/props/gap.ts +31 -0
- package/src/props/gridChild.ts +50 -0
- package/src/props/gridParent.ts +45 -0
- package/src/props/height.ts +29 -0
- package/src/props/layout.ts +44 -0
- package/src/props/margin.ts +59 -0
- package/src/props/overflow.ts +30 -0
- package/src/props/padding.ts +59 -0
- package/src/props/placement.ts +16 -0
- package/src/props/position.ts +52 -0
- package/src/props/shadow.ts +15 -0
- package/src/props/tone.ts +15 -0
- package/src/props/typography.ts +62 -0
- package/src/props/width.ts +29 -0
- package/src/props/zIndex.ts +15 -0
- package/src/styles.css.d.ts +1 -0
- package/src/styles.css.node.js +2 -0
- package/src/styles.css.test.ts +24 -0
- package/src/types/Button.ts +8 -0
- package/src/types/Code.ts +6 -0
- package/src/types/Container.ts +3 -0
- package/src/types/Density.ts +3 -0
- package/src/types/Display.ts +11 -0
- package/src/types/Eyebrow.ts +3 -0
- package/src/types/Flex.ts +22 -0
- package/src/types/FontWeight.ts +3 -0
- package/src/types/Grid.ts +3 -0
- package/src/types/Heading.ts +6 -0
- package/src/types/Icon.ts +3 -0
- package/src/types/Interactive.ts +8 -0
- package/src/types/List.ts +2 -0
- package/src/types/Overflow.ts +3 -0
- package/src/types/Placement.ts +16 -0
- package/src/types/Position.ts +3 -0
- package/src/types/PropDef.ts +73 -0
- package/src/types/Radius.ts +3 -0
- package/src/types/Responsive.ts +10 -0
- package/src/types/Shadow.ts +3 -0
- package/src/types/Space.ts +15 -0
- package/src/types/Text.ts +3 -0
- package/src/types/TextAlign.ts +3 -0
- package/src/types/Tone.ts +3 -0
- package/src/utils/getProps.test.ts +156 -0
- package/src/utils/getProps.ts +156 -0
- package/src/utils/mergeTriggerProps.ts +66 -0
- package/src/utils/renderPortal.tsx +14 -0
- package/src/utils/suffixClassName.ts +5 -0
- package/src/version.ts +3 -0
- package/LICENSE +0 -21
- package/dist/_system-CTe2lb5l.d.ts +0 -40
- package/dist/_system-CTe2lb5l.d.ts.map +0 -1
- package/dist/arrow-BmX6qbAS.js +0 -170
- package/dist/arrow-BmX6qbAS.js.map +0 -1
- package/dist/autocomplete.d.ts +0 -140
- package/dist/autocomplete.d.ts.map +0 -1
- package/dist/autocomplete.js +0 -470
- package/dist/autocomplete.js.map +0 -1
- package/dist/breadcrumbs.d.ts +0 -18
- package/dist/breadcrumbs.d.ts.map +0 -1
- package/dist/breadcrumbs.js +0 -119
- package/dist/breadcrumbs.js.map +0 -1
- package/dist/button-BNyKSDyA.js +0 -180
- package/dist/button-BNyKSDyA.js.map +0 -1
- package/dist/button-dnqMFkWg.d.ts +0 -76
- package/dist/button-dnqMFkWg.d.ts.map +0 -1
- package/dist/card-C0a0wQTc.d.ts +0 -7
- package/dist/card-C0a0wQTc.d.ts.map +0 -1
- package/dist/code.d.ts +0 -20
- package/dist/code.d.ts.map +0 -1
- package/dist/code.js +0 -90
- package/dist/code.js.map +0 -1
- package/dist/codeFontStyle-84SMhFtI.js +0 -11
- package/dist/codeFontStyle-84SMhFtI.js.map +0 -1
- package/dist/component-DVlwaWB-.d.ts +0 -25
- package/dist/component-DVlwaWB-.d.ts.map +0 -1
- package/dist/element-BYgCE_iK.js +0 -51
- package/dist/element-BYgCE_iK.js.map +0 -1
- package/dist/factory-BzXTX8_Q.js +0 -3056
- package/dist/factory-BzXTX8_Q.js.map +0 -1
- package/dist/flex-DmbDG2ks.js +0 -76
- package/dist/flex-DmbDG2ks.js.map +0 -1
- package/dist/font-EtfxKPUz.d.ts +0 -49
- package/dist/font-EtfxKPUz.d.ts.map +0 -1
- package/dist/getElementRef-Jw7gY0eV.js +0 -102
- package/dist/getElementRef-Jw7gY0eV.js.map +0 -1
- package/dist/getScopedTheme-C-sZsyAz.js +0 -267
- package/dist/getScopedTheme-C-sZsyAz.js.map +0 -1
- package/dist/getTheme_v2-y09KqtEb.js +0 -487
- package/dist/getTheme_v2-y09KqtEb.js.map +0 -1
- package/dist/grid-6JSgMj1O.js +0 -115
- package/dist/grid-6JSgMj1O.js.map +0 -1
- package/dist/helpers-C8xxXAQC.js +0 -63
- package/dist/helpers-C8xxXAQC.js.map +0 -1
- package/dist/hotkeys-CaHsQlsO.js +0 -168
- package/dist/hotkeys-CaHsQlsO.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/layer-Bl5R3uNR.js +0 -61
- package/dist/layer-Bl5R3uNR.js.map +0 -1
- package/dist/layer-ChlP9Ik6.d.ts +0 -242
- package/dist/layer-ChlP9Ik6.d.ts.map +0 -1
- package/dist/menu.d.ts +0 -146
- package/dist/menu.d.ts.map +0 -1
- package/dist/menu.js +0 -626
- package/dist/menu.js.map +0 -1
- package/dist/popover-B7-28L8y.js +0 -408
- package/dist/popover-B7-28L8y.js.map +0 -1
- package/dist/popover-CMlQeKn0.d.ts +0 -96
- package/dist/popover-CMlQeKn0.d.ts.map +0 -1
- package/dist/popover.d.ts +0 -2
- package/dist/popover.js +0 -3
- package/dist/refractor-CC48DwHi.js +0 -20
- package/dist/refractor-CC48DwHi.js.map +0 -1
- package/dist/responsiveFont-CilwaORG.js +0 -55
- package/dist/responsiveFont-CilwaORG.js.map +0 -1
- package/dist/rgba-BSYaEUW6.d.ts +0 -846
- package/dist/rgba-BSYaEUW6.d.ts.map +0 -1
- package/dist/selectable-B0GUIL74.d.ts +0 -7
- package/dist/selectable-B0GUIL74.d.ts.map +0 -1
- package/dist/stack-rsNFPq2-.js +0 -112
- package/dist/stack-rsNFPq2-.js.map +0 -1
- package/dist/styles-css.d.ts +0 -2
- package/dist/styles-css.js +0 -4
- package/dist/textInput-pSfQjkmx.js +0 -313
- package/dist/textInput-pSfQjkmx.js.map +0 -1
- package/dist/theme.d.ts +0 -280
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js +0 -55
- package/dist/theme.js.map +0 -1
- package/dist/toast.d.ts +0 -73
- package/dist/toast.d.ts.map +0 -1
- package/dist/toast.js +0 -302
- package/dist/toast.js.map +0 -1
- package/dist/tooltip.d.ts +0 -88
- package/dist/tooltip.d.ts.map +0 -1
- package/dist/tooltip.js +0 -435
- package/dist/tooltip.js.map +0 -1
- package/dist/useClickOutsideEvent-wGLGWBZN.js +0 -36
- package/dist/useClickOutsideEvent-wGLGWBZN.js.map +0 -1
- package/dist/useElementSize-BJvbGHq8.js +0 -51
- package/dist/useElementSize-BJvbGHq8.js.map +0 -1
- package/dist/useLayer-D1usxIE0.js +0 -712
- package/dist/useLayer-D1usxIE0.js.map +0 -1
package/dist/breadcrumbs.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @beta
|
|
3
|
-
*/
|
|
4
|
-
interface BreadcrumbsProps {
|
|
5
|
-
maxLength?: number;
|
|
6
|
-
separator?: React.ReactNode;
|
|
7
|
-
gap?: number | number[];
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Use `gap` instead.
|
|
10
|
-
*/
|
|
11
|
-
space?: never;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @beta
|
|
15
|
-
*/
|
|
16
|
-
export declare function Breadcrumbs(props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'type'>): import("react").JSX.Element;
|
|
17
|
-
export type { BreadcrumbsProps };
|
|
18
|
-
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","names":[],"sources":["../src/core/components/breadcrumbs/breadcrumbs.tsx"],"mappings":"AAgBA;;;UAAiB;EACf;EACA,YAAY,MAAM;EAClB;;;;EAIA;;;;;wBAMc,YACd,OAAO,mBAAmB,KAAK,MAAM,UAAU,oDAAiC,IAAA"}
|
package/dist/breadcrumbs.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { n as _getArrayProp } from "./helpers-C8xxXAQC.js";
|
|
3
|
-
import { y as Box } from "./useLayer-D1usxIE0.js";
|
|
4
|
-
import { n as Text, t as Stack } from "./stack-rsNFPq2-.js";
|
|
5
|
-
import { t as Button } from "./button-BNyKSDyA.js";
|
|
6
|
-
import { t as Popover } from "./popover-B7-28L8y.js";
|
|
7
|
-
import { t as useClickOutsideEvent } from "./useClickOutsideEvent-wGLGWBZN.js";
|
|
8
|
-
import { c } from "react/compiler-runtime";
|
|
9
|
-
import { clsx } from "clsx/lite";
|
|
10
|
-
import { Children, Fragment, isValidElement, useRef, useState } from "react";
|
|
11
|
-
import { styled } from "styled-components";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
const ExpandButton = styled(Button).withConfig({
|
|
14
|
-
displayName: "ExpandButton",
|
|
15
|
-
componentId: "sc-6vrn4n-0"
|
|
16
|
-
})`margin:-4px;`;
|
|
17
|
-
var breadcrumbs = "_1alqbl40", expandButton = "_1alqbl41";
|
|
18
|
-
/**
|
|
19
|
-
* @beta
|
|
20
|
-
*/
|
|
21
|
-
function Breadcrumbs(props) {
|
|
22
|
-
let $ = c(34), children, className, maxLength, ref, restProps, separator, t0;
|
|
23
|
-
$[0] === props ? (children = $[1], className = $[2], maxLength = $[3], ref = $[4], restProps = $[5], separator = $[6], t0 = $[7]) : ({children, className, gap: t0, maxLength, ref, separator, ...restProps} = props, $[0] = props, $[1] = children, $[2] = className, $[3] = maxLength, $[4] = ref, $[5] = restProps, $[6] = separator, $[7] = t0);
|
|
24
|
-
let gap = t0 === void 0 ? 2 : t0, t1;
|
|
25
|
-
$[8] === gap ? t1 = $[9] : (t1 = _getArrayProp(gap), $[8] = gap, $[9] = t1);
|
|
26
|
-
let space = t1, [open, setOpen] = useState(!1), expandElementRef = useRef(null), popoverElementRef = useRef(null), t2;
|
|
27
|
-
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t2 = () => setOpen(!1), $[10] = t2) : t2 = $[10];
|
|
28
|
-
let collapse = t2, t3;
|
|
29
|
-
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t3 = () => setOpen(!0), $[11] = t3) : t3 = $[11];
|
|
30
|
-
let expand = t3, t4;
|
|
31
|
-
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => [expandElementRef.current, popoverElementRef.current], $[12] = t4) : t4 = $[12], useClickOutsideEvent(collapse, t4);
|
|
32
|
-
let t5;
|
|
33
|
-
$[13] === children ? t5 = $[14] : (t5 = Children.toArray(children).filter(isValidElement), $[13] = children, $[14] = t5);
|
|
34
|
-
let rawItems = t5, t6;
|
|
35
|
-
$[15] !== maxLength || $[16] !== open || $[17] !== rawItems || $[18] !== space ? (t6 = {
|
|
36
|
-
collapse,
|
|
37
|
-
expand,
|
|
38
|
-
expandElementRef,
|
|
39
|
-
maxLength,
|
|
40
|
-
open,
|
|
41
|
-
popoverElementRef,
|
|
42
|
-
rawItems,
|
|
43
|
-
space
|
|
44
|
-
}, $[15] = maxLength, $[16] = open, $[17] = rawItems, $[18] = space, $[19] = t6) : t6 = $[19];
|
|
45
|
-
let items = useItems(t6), t7;
|
|
46
|
-
$[20] === className ? t7 = $[21] : (t7 = clsx(breadcrumbs, className), $[20] = className, $[21] = t7);
|
|
47
|
-
let t8;
|
|
48
|
-
if ($[22] !== items || $[23] !== separator || $[24] !== space) {
|
|
49
|
-
let t9;
|
|
50
|
-
$[26] !== separator || $[27] !== space ? (t9 = (item, itemIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [itemIndex > 0 && /* @__PURE__ */ jsx(Box, {
|
|
51
|
-
"aria-hidden": !0,
|
|
52
|
-
as: "li",
|
|
53
|
-
paddingX: space,
|
|
54
|
-
children: separator || /* @__PURE__ */ jsx(Text, {
|
|
55
|
-
muted: !0,
|
|
56
|
-
children: "/"
|
|
57
|
-
})
|
|
58
|
-
}), /* @__PURE__ */ jsx(Box, {
|
|
59
|
-
as: "li",
|
|
60
|
-
children: item
|
|
61
|
-
})] }, itemIndex), $[26] = separator, $[27] = space, $[28] = t9) : t9 = $[28], t8 = items.map(t9), $[22] = items, $[23] = separator, $[24] = space, $[25] = t8;
|
|
62
|
-
} else t8 = $[25];
|
|
63
|
-
let t9;
|
|
64
|
-
return $[29] !== ref || $[30] !== restProps || $[31] !== t7 || $[32] !== t8 ? (t9 = /* @__PURE__ */ jsx("ol", {
|
|
65
|
-
className: t7,
|
|
66
|
-
"data-ui": "Breadcrumbs",
|
|
67
|
-
ref,
|
|
68
|
-
...restProps,
|
|
69
|
-
children: t8
|
|
70
|
-
}), $[29] = ref, $[30] = restProps, $[31] = t7, $[32] = t8, $[33] = t9) : t9 = $[33], t9;
|
|
71
|
-
}
|
|
72
|
-
function useItems(t0) {
|
|
73
|
-
let $ = c(28), { collapse, expand, expandElementRef, maxLength, open, popoverElementRef, rawItems, space } = t0, len = rawItems.length;
|
|
74
|
-
if (maxLength && len > maxLength) {
|
|
75
|
-
let beforeLength = Math.ceil(maxLength / 2), afterLength = Math.floor(maxLength / 2), t1;
|
|
76
|
-
if ($[0] !== afterLength || $[1] !== beforeLength || $[2] !== collapse || $[3] !== expand || $[4] !== expandElementRef || $[5] !== len || $[6] !== open || $[7] !== popoverElementRef || $[8] !== rawItems || $[9] !== space) {
|
|
77
|
-
let t2 = rawItems.slice(0, beforeLength - 1), t3;
|
|
78
|
-
$[11] !== afterLength || $[12] !== beforeLength || $[13] !== len || $[14] !== rawItems ? (t3 = rawItems.slice(beforeLength - 1, len - afterLength), $[11] = afterLength, $[12] = beforeLength, $[13] = len, $[14] = rawItems, $[15] = t3) : t3 = $[15];
|
|
79
|
-
let t4;
|
|
80
|
-
$[16] !== space || $[17] !== t3 ? (t4 = /* @__PURE__ */ jsx(Stack, {
|
|
81
|
-
as: "ol",
|
|
82
|
-
overflow: "auto",
|
|
83
|
-
padding: space,
|
|
84
|
-
gap: space,
|
|
85
|
-
children: t3
|
|
86
|
-
}), $[16] = space, $[17] = t3, $[18] = t4) : t4 = $[18];
|
|
87
|
-
let t5 = open ? collapse : expand, t6;
|
|
88
|
-
$[19] !== expandElementRef || $[20] !== open || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(ExpandButton, {
|
|
89
|
-
className: expandButton,
|
|
90
|
-
fontSize: 1,
|
|
91
|
-
mode: "bleed",
|
|
92
|
-
onClick: t5,
|
|
93
|
-
padding: 1,
|
|
94
|
-
ref: expandElementRef,
|
|
95
|
-
selected: open,
|
|
96
|
-
text: "…"
|
|
97
|
-
}), $[19] = expandElementRef, $[20] = open, $[21] = t5, $[22] = t6) : t6 = $[22];
|
|
98
|
-
let t7;
|
|
99
|
-
$[23] !== open || $[24] !== popoverElementRef || $[25] !== t4 || $[26] !== t6 ? (t7 = /* @__PURE__ */ jsx(Popover, {
|
|
100
|
-
constrainSize: !0,
|
|
101
|
-
content: t4,
|
|
102
|
-
open,
|
|
103
|
-
placement: "top",
|
|
104
|
-
portal: !0,
|
|
105
|
-
ref: popoverElementRef,
|
|
106
|
-
children: t6
|
|
107
|
-
}, "button"), $[23] = open, $[24] = popoverElementRef, $[25] = t4, $[26] = t6, $[27] = t7) : t7 = $[27], t1 = [
|
|
108
|
-
...t2,
|
|
109
|
-
t7,
|
|
110
|
-
...rawItems.slice(len - afterLength)
|
|
111
|
-
], $[0] = afterLength, $[1] = beforeLength, $[2] = collapse, $[3] = expand, $[4] = expandElementRef, $[5] = len, $[6] = open, $[7] = popoverElementRef, $[8] = rawItems, $[9] = space, $[10] = t1;
|
|
112
|
-
} else t1 = $[10];
|
|
113
|
-
return t1;
|
|
114
|
-
}
|
|
115
|
-
return rawItems;
|
|
116
|
-
}
|
|
117
|
-
export { Breadcrumbs };
|
|
118
|
-
|
|
119
|
-
//# sourceMappingURL=breadcrumbs.js.map
|
package/dist/breadcrumbs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","names":["gap = 2","_getArrayProp(gap)","() => setOpen(false)","useCallback(() => setOpen(false), [])","() => setOpen(true)","useCallback(() => setOpen(true), [])","() => [expandElementRef.current, popoverElementRef.current]","Children.toArray(children).filter(isValidElement)","useMemo(() => Children.toArray(children).filter(isValidElement), [children])","{\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n }","clsx(breadcrumbs, className)","items.map((item, itemIndex) => (\n // oxlint-disable-next-line no-array-index-key\n <Fragment key={itemIndex}>\n {itemIndex > 0 && (\n <Box aria-hidden as=\"li\" paddingX={space}>\n {separator || <Text muted>/</Text>}\n </Box>\n )}\n <Box as=\"li\">{item}</Box>\n </Fragment>\n ))","(item, itemIndex) => (\n // oxlint-disable-next-line no-array-index-key\n <Fragment key={itemIndex}>\n {itemIndex > 0 && (\n <Box aria-hidden as=\"li\" paddingX={space}>\n {separator || <Text muted>/</Text>}\n </Box>\n )}\n <Box as=\"li\">{item}</Box>\n </Fragment>\n )","<ol className={clsx(breadcrumbs, className)} data-ui=\"Breadcrumbs\" ref={ref} {...restProps}>\n {items.map((item, itemIndex) => (\n // oxlint-disable-next-line no-array-index-key\n <Fragment key={itemIndex}>\n {itemIndex > 0 && (\n <Box aria-hidden as=\"li\" paddingX={space}>\n {separator || <Text muted>/</Text>}\n </Box>\n )}\n <Box as=\"li\">{item}</Box>\n </Fragment>\n ))}\n </ol>","{\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n}: {\n collapse: () => void\n expand: () => void\n expandElementRef: React.RefObject<HTMLButtonElement | null>\n maxLength: number | undefined\n open: boolean\n popoverElementRef: React.RefObject<HTMLDivElement | null>\n // oxlint-disable-next-line no-unnecessary-type-arguments\n rawItems: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[]\n space: number[]\n}","[\n ...rawItems.slice(0, beforeLength - 1),\n <Popover\n key=\"button\"\n constrainSize\n content={\n <Stack as=\"ol\" overflow=\"auto\" padding={space} gap={space}>\n {rawItems.slice(beforeLength - 1, len - afterLength)}\n </Stack>\n }\n open={open}\n placement=\"top\"\n portal\n ref={popoverElementRef}\n >\n <ExpandButton\n className={expandButton}\n fontSize={1}\n mode=\"bleed\"\n onClick={open ? collapse : expand}\n padding={1}\n ref={expandElementRef}\n selected={open}\n text=\"…\"\n />\n </Popover>,\n ...rawItems.slice(len - afterLength),\n ]","rawItems.slice(beforeLength - 1, len - afterLength)","<Stack as=\"ol\" overflow=\"auto\" padding={space} gap={space}>\n {rawItems.slice(beforeLength - 1, len - afterLength)}\n </Stack>","<ExpandButton\n className={expandButton}\n fontSize={1}\n mode=\"bleed\"\n onClick={open ? collapse : expand}\n padding={1}\n ref={expandElementRef}\n selected={open}\n text=\"…\"\n />","open ? collapse : expand","<Popover\n key=\"button\"\n constrainSize\n content={\n <Stack as=\"ol\" overflow=\"auto\" padding={space} gap={space}>\n {rawItems.slice(beforeLength - 1, len - afterLength)}\n </Stack>\n }\n open={open}\n placement=\"top\"\n portal\n ref={popoverElementRef}\n >\n <ExpandButton\n className={expandButton}\n fontSize={1}\n mode=\"bleed\"\n onClick={open ? collapse : expand}\n padding={1}\n ref={expandElementRef}\n selected={open}\n text=\"…\"\n />\n </Popover>","rawItems.slice(0, beforeLength - 1)"],"sources":["../src/core/components/breadcrumbs/breadcrumbs.styles.ts","../src/core/components/breadcrumbs/breadcrumbs.css.ts","../src/core/components/breadcrumbs/breadcrumbs.tsx"],"sourcesContent":["import {styled} from 'styled-components'\n\nimport {Button} from '../../primitives/button/button'\n\n// Stays on styled-components: `margin: -4px` must beat Button's runtime\n// `margin: 0` at equal specificity, which needs both rules in the runtime\n// stylesheet.\nexport const ExpandButton = styled(Button)`\n margin: -4px;\n`\n","import {style} from '@vanilla-extract/css'\n\nexport const breadcrumbs = style({\n margin: 0,\n padding: 0,\n display: 'flex',\n listStyle: 'none',\n alignItems: 'center',\n whiteSpace: 'nowrap',\n lineHeight: 0,\n})\n\nexport const expandButton = style({\n appearance: 'none',\n})\n","import {clsx} from 'clsx/lite'\nimport {Children, Fragment, isValidElement, useCallback, useMemo, useRef, useState} from 'react'\n\nimport {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'\nimport {Box} from '../../primitives/box/box'\nimport {Popover} from '../../primitives/popover/popover'\nimport {Stack} from '../../primitives/stack/stack'\nimport {Text} from '../../primitives/text/text'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ExpandButton} from './breadcrumbs.styles'\n\nimport {breadcrumbs, expandButton} from './breadcrumbs.css'\n\n/**\n * @beta\n */\nexport interface BreadcrumbsProps {\n maxLength?: number\n separator?: React.ReactNode\n gap?: number | number[]\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n}\n\n/**\n * @beta\n */\nexport function Breadcrumbs(\n props: BreadcrumbsProps & Omit<React.HTMLProps<HTMLOListElement>, 'as' | 'type'>,\n) {\n const {children, className, gap = 2, maxLength, ref, separator, ...restProps} = props\n const space = _getArrayProp(gap)\n const [open, setOpen] = useState(false)\n const expandElementRef = useRef<HTMLButtonElement | null>(null)\n const popoverElementRef = useRef<HTMLDivElement | null>(null)\n\n const collapse = useCallback(() => setOpen(false), [])\n const expand = useCallback(() => setOpen(true), [])\n\n useClickOutsideEvent(collapse, () => [expandElementRef.current, popoverElementRef.current])\n\n const rawItems = useMemo(() => Children.toArray(children).filter(isValidElement), [children])\n\n const items = useItems({\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n })\n\n return (\n <ol className={clsx(breadcrumbs, className)} data-ui=\"Breadcrumbs\" ref={ref} {...restProps}>\n {items.map((item, itemIndex) => (\n // oxlint-disable-next-line no-array-index-key\n <Fragment key={itemIndex}>\n {itemIndex > 0 && (\n <Box aria-hidden as=\"li\" paddingX={space}>\n {separator || <Text muted>/</Text>}\n </Box>\n )}\n <Box as=\"li\">{item}</Box>\n </Fragment>\n ))}\n </ol>\n )\n}\n\nfunction useItems({\n collapse,\n expand,\n expandElementRef,\n maxLength,\n open,\n popoverElementRef,\n rawItems,\n space,\n}: {\n collapse: () => void\n expand: () => void\n expandElementRef: React.RefObject<HTMLButtonElement | null>\n maxLength: number | undefined\n open: boolean\n popoverElementRef: React.RefObject<HTMLDivElement | null>\n // oxlint-disable-next-line no-unnecessary-type-arguments\n rawItems: React.ReactElement<unknown, string | React.JSXElementConstructor<any>>[]\n space: number[]\n}) {\n const len = rawItems.length\n\n if (maxLength && len > maxLength) {\n const beforeLength = Math.ceil(maxLength / 2)\n const afterLength = Math.floor(maxLength / 2)\n\n return [\n ...rawItems.slice(0, beforeLength - 1),\n <Popover\n key=\"button\"\n constrainSize\n content={\n <Stack as=\"ol\" overflow=\"auto\" padding={space} gap={space}>\n {rawItems.slice(beforeLength - 1, len - afterLength)}\n </Stack>\n }\n open={open}\n placement=\"top\"\n portal\n ref={popoverElementRef}\n >\n <ExpandButton\n className={expandButton}\n fontSize={1}\n mode=\"bleed\"\n onClick={open ? collapse : expand}\n padding={1}\n ref={expandElementRef}\n selected={open}\n text=\"…\"\n />\n </Popover>,\n ...rawItems.slice(len - afterLength),\n ]\n }\n\n return rawItems\n}\n"],"mappings":";;;;;;;;;;;;AAOA,MAAa,eAAe,OAAO,MAAM,CAAC,CAAA,WAAA;;;;;;;;AEsB1C,SAAgB,YACd,OACA;gBACO,UAAU,WAAoB,WAAW,KAAmB,WAAd,WAAzBA;CAAoD,AAAA,EAAA,OAAA,4HAA1E,CAAC,UAAU,WAAW,KAAA,IAAS,WAAW,KAAK,WAAW,GAAA,aAAgB;CAApD,IAAA,MAAA,OAAA,KAAA,IAAM,IAANA,IACdC;CAAc,AAAA,EAAA,OAA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KAAK;IACjDA,UAAAA;GACI,CAAA,GAFiC,EAAA,MAAA,OACrCA,EAAAA,MAAAA;GAYM,IAAA,KAAA,OAAO,WAAW,QAJ7BE;GAMO,AAAA,EAAA,QAAA,oBAAA,EAAA,QACK,QAAA,EAAA,QAHDC,MAJX,KAAA,oBAAC,cAAD;IACE,WAAW;IACX,UAAU;IACV,MAAK;IACL,SAASA;IACT,SAAS;IACT,KAAK;IACL,UAAU;IACV,MAAK;GACN,CAAA,GAHM,EAAA,MAAA,kBACK,EAAA,MAAA,MAHDA,EAAAA,MAAAA;GAjBbC,IAAAA;GAQQ,EAAA,QAAA,QAAA,EAAA,QAGD,qBAAA,EAAA,QAPHH,MAAAA,EAAAA,QASFC,MAbF,KAAA,oBAAC,SAAD;IAEE,eAAA;IACA,SACED;IAII;IACN,WAAU;IACV,QAAA;IACA,KAAK;IAELC,UAAAA;GAUO,GAtBH,QAsBG,GAfD,EAAA,MAAA,MAGD,EAAA,MAAA,mBAPHD,EAAAA,MAAAA,IASFC,EAAAA,MAAAA,8BAfG,KAAA;IACL,GAAGG;IACHD;IAwBA,GAAG,SAAS,MAAM,MAAM,WAAW;GACrC,GApBgD,EAAA,KAAA,aANzB,EAAA,KAAA,cAkBD,EAAA,KAAA,UAAW,EAAA,KAAA,QAEtB,EAAA,KAAA,kBAd+B,EAAA,KAAA,KAY3B,EAAA,KAAA,MANN,EAAA,KAAA,mBAZJ,EAAA,KAAA,UAKyC,EAAA,KAAA;;EAN9C,OAAOL;CA4BT;CAEA,OAAO;AACT"}
|
package/dist/button-BNyKSDyA.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { n as _getArrayProp } from "./helpers-C8xxXAQC.js";
|
|
2
|
-
import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
|
|
3
|
-
import { _ as useTheme_v2, h as _cardColorStyle, m as focusRingStyle, p as focusRingBorderStyle, v as responsiveRadiusStyle, y as Box } from "./useLayer-D1usxIE0.js";
|
|
4
|
-
import { t as Flex } from "./flex-DmbDG2ks.js";
|
|
5
|
-
import { n as Text } from "./stack-rsNFPq2-.js";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
|
-
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
8
|
-
import { isValidElement } from "react";
|
|
9
|
-
import { css, styled } from "styled-components";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { isValidElementType } from "react-is";
|
|
12
|
-
var spinnerIcon = "_1b6o2se1";
|
|
13
|
-
/**
|
|
14
|
-
* Indicate that something is loading for an indeterminate amount of time.
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
function Spinner(props) {
|
|
19
|
-
let $ = c(3), t0;
|
|
20
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(SpinnerIcon, { className: spinnerIcon }), $[0] = t0) : t0 = $[0];
|
|
21
|
-
let t1;
|
|
22
|
-
return $[1] === props ? t1 = $[2] : (t1 = /* @__PURE__ */ jsx(Text, {
|
|
23
|
-
"data-ui": "Spinner",
|
|
24
|
-
...props,
|
|
25
|
-
children: t0
|
|
26
|
-
}), $[1] = props, $[2] = t1), t1;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
function buttonBaseStyles(props) {
|
|
32
|
-
let { $width } = props, { style } = getTheme_v2(props.theme);
|
|
33
|
-
return css`${style?.button};-webkit-font-smoothing:inherit;appearance:none;display:inline-flex;align-items:center;font:inherit;border:0;outline:none;user-select:none;text-decoration:none;border:0;box-sizing:border-box;padding:0;margin:0;white-space:nowrap;text-align:left;position:relative;vertical-align:top;${$width === "fill" && css`width:-moz-available;width:-webkit-fill-available;width:stretch;`} & > span{display:block;flex:1;min-width:0;border-radius:inherit;}&::-moz-focus-inner{border:0;padding:0;}`;
|
|
34
|
-
}
|
|
35
|
-
function combineBoxShadow(...boxShadows) {
|
|
36
|
-
return boxShadows.filter(Boolean).join(",");
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
function buttonColorStyles(props) {
|
|
42
|
-
let { $mode } = props, { button, color: baseColor, style } = getTheme_v2(props.theme);
|
|
43
|
-
props.$mode;
|
|
44
|
-
let mode = baseColor.button[$mode] || baseColor.button.default, color = mode[props.$tone] || mode.default, border = {
|
|
45
|
-
width: button.border.width,
|
|
46
|
-
color: "var(--card-border-color)"
|
|
47
|
-
};
|
|
48
|
-
return [
|
|
49
|
-
_cardColorStyle(baseColor, color.enabled),
|
|
50
|
-
{
|
|
51
|
-
backgroundColor: "var(--card-bg-color)",
|
|
52
|
-
color: "var(--card-fg-color)",
|
|
53
|
-
boxShadow: focusRingBorderStyle(border),
|
|
54
|
-
"&:disabled, &[data-disabled=\"true\"]": _cardColorStyle(baseColor, color.disabled),
|
|
55
|
-
"&:not([data-disabled='true'])": {
|
|
56
|
-
boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0),
|
|
57
|
-
"&:focus": { boxShadow: focusRingStyle({
|
|
58
|
-
base: baseColor,
|
|
59
|
-
border: {
|
|
60
|
-
width: 2,
|
|
61
|
-
color: baseColor.bg
|
|
62
|
-
},
|
|
63
|
-
focusRing: button.focusRing
|
|
64
|
-
}) },
|
|
65
|
-
"&:focus:not(:focus-visible)": { boxShadow: combineBoxShadow(focusRingBorderStyle(border), void 0) },
|
|
66
|
-
"@media (hover: hover)": {
|
|
67
|
-
"&:hover": _cardColorStyle(baseColor, color.hovered),
|
|
68
|
-
"&:active": _cardColorStyle(baseColor, color.pressed),
|
|
69
|
-
"&[data-hovered]": _cardColorStyle(baseColor, color.hovered)
|
|
70
|
-
},
|
|
71
|
-
"&[data-selected]": _cardColorStyle(baseColor, color.pressed)
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
style?.button?.root
|
|
75
|
-
].filter(Boolean);
|
|
76
|
-
}
|
|
77
|
-
const StyledButton = /* @__PURE__ */ styled.button.withConfig({
|
|
78
|
-
displayName: "StyledButton",
|
|
79
|
-
componentId: "sc-d920a4-0"
|
|
80
|
-
})(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
81
|
-
function ButtonComponent(props) {
|
|
82
|
-
let $ = c(87), IconComponent, IconRightComponent, children, disabled, loading, paddingBottomProp, paddingLeftProp, paddingRightProp, paddingTopProp, paddingXProp, paddingYProp, ref, restProps, selected, t0, t1, t2, t3, t4, t5, t6, t7, t8, text, textAlign, textWeight, width;
|
|
83
|
-
$[0] === props ? (IconComponent = $[1], IconRightComponent = $[2], children = $[3], disabled = $[4], loading = $[5], paddingBottomProp = $[6], paddingLeftProp = $[7], paddingRightProp = $[8], paddingTopProp = $[9], paddingXProp = $[10], paddingYProp = $[11], ref = $[12], restProps = $[13], selected = $[14], t0 = $[15], t1 = $[16], t2 = $[17], t3 = $[18], t4 = $[19], t5 = $[20], t6 = $[21], t7 = $[22], t8 = $[23], text = $[24], textAlign = $[25], textWeight = $[26], width = $[27]) : ({children, disabled, ref, fontSize: t0, icon: IconComponent, iconRight: IconRightComponent, justify: t1, loading, mode: t2, padding: t3, paddingX: paddingXProp, paddingY: paddingYProp, paddingTop: paddingTopProp, paddingBottom: paddingBottomProp, paddingLeft: paddingLeftProp, paddingRight: paddingRightProp, radius: t4, selected, gap: t5, text, textAlign, textWeight, tone: t6, type: t7, muted: t8, width, ...restProps} = props, $[0] = props, $[1] = IconComponent, $[2] = IconRightComponent, $[3] = children, $[4] = disabled, $[5] = loading, $[6] = paddingBottomProp, $[7] = paddingLeftProp, $[8] = paddingRightProp, $[9] = paddingTopProp, $[10] = paddingXProp, $[11] = paddingYProp, $[12] = ref, $[13] = restProps, $[14] = selected, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8, $[24] = text, $[25] = textAlign, $[26] = textWeight, $[27] = width);
|
|
84
|
-
let fontSize = t0 === void 0 ? 1 : t0, justifyProp = t1 === void 0 ? "center" : t1, mode = t2 === void 0 ? "default" : t2, paddingProp = t3 === void 0 ? 3 : t3, radiusProp = t4 === void 0 ? 2 : t4, gap = t5 === void 0 ? 3 : t5, tone = t6 === void 0 ? "default" : t6, type = t7 === void 0 ? "button" : t7, muted = t8 !== void 0 && t8, { button } = useTheme_v2(), t9;
|
|
85
|
-
$[28] === justifyProp ? t9 = $[29] : (t9 = _getArrayProp(justifyProp), $[28] = justifyProp, $[29] = t9);
|
|
86
|
-
let justify = t9, t10;
|
|
87
|
-
$[30] === paddingProp ? t10 = $[31] : (t10 = _getArrayProp(paddingProp), $[30] = paddingProp, $[31] = t10);
|
|
88
|
-
let padding = t10, t11;
|
|
89
|
-
$[32] === paddingXProp ? t11 = $[33] : (t11 = _getArrayProp(paddingXProp), $[32] = paddingXProp, $[33] = t11);
|
|
90
|
-
let paddingX = t11, t12;
|
|
91
|
-
$[34] === paddingYProp ? t12 = $[35] : (t12 = _getArrayProp(paddingYProp), $[34] = paddingYProp, $[35] = t12);
|
|
92
|
-
let paddingY = t12, t13;
|
|
93
|
-
$[36] === paddingTopProp ? t13 = $[37] : (t13 = _getArrayProp(paddingTopProp), $[36] = paddingTopProp, $[37] = t13);
|
|
94
|
-
let paddingTop = t13, t14;
|
|
95
|
-
$[38] === paddingBottomProp ? t14 = $[39] : (t14 = _getArrayProp(paddingBottomProp), $[38] = paddingBottomProp, $[39] = t14);
|
|
96
|
-
let paddingBottom = t14, t15;
|
|
97
|
-
$[40] === paddingLeftProp ? t15 = $[41] : (t15 = _getArrayProp(paddingLeftProp), $[40] = paddingLeftProp, $[41] = t15);
|
|
98
|
-
let paddingLeft = t15, t16;
|
|
99
|
-
$[42] === paddingRightProp ? t16 = $[43] : (t16 = _getArrayProp(paddingRightProp), $[42] = paddingRightProp, $[43] = t16);
|
|
100
|
-
let paddingRight = t16, t17;
|
|
101
|
-
$[44] === radiusProp ? t17 = $[45] : (t17 = _getArrayProp(radiusProp), $[44] = radiusProp, $[45] = t17);
|
|
102
|
-
let radius = t17, t18;
|
|
103
|
-
$[46] === gap ? t18 = $[47] : (t18 = _getArrayProp(gap), $[46] = gap, $[47] = t18);
|
|
104
|
-
let spacing = t18, t19;
|
|
105
|
-
$[48] !== padding || $[49] !== paddingBottom || $[50] !== paddingLeft || $[51] !== paddingRight || $[52] !== paddingTop || $[53] !== paddingX || $[54] !== paddingY ? (t19 = {
|
|
106
|
-
padding,
|
|
107
|
-
paddingX,
|
|
108
|
-
paddingY,
|
|
109
|
-
paddingTop,
|
|
110
|
-
paddingBottom,
|
|
111
|
-
paddingLeft,
|
|
112
|
-
paddingRight
|
|
113
|
-
}, $[48] = padding, $[49] = paddingBottom, $[50] = paddingLeft, $[51] = paddingRight, $[52] = paddingTop, $[53] = paddingX, $[54] = paddingY, $[55] = t19) : t19 = $[55];
|
|
114
|
-
let boxProps = t19, t20 = !!(loading || disabled), t21 = selected ? "" : void 0, t22 = !!(loading || disabled), t23;
|
|
115
|
-
$[56] === loading ? t23 = $[57] : (t23 = !!loading && /* @__PURE__ */ jsx("div", {
|
|
116
|
-
className: "_2mi48t0",
|
|
117
|
-
"data-ui": "ButtonLoading",
|
|
118
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
119
|
-
}), $[56] = loading, $[57] = t23);
|
|
120
|
-
let t24;
|
|
121
|
-
$[58] !== IconComponent || $[59] !== IconRightComponent || $[60] !== boxProps || $[61] !== button || $[62] !== fontSize || $[63] !== justify || $[64] !== muted || $[65] !== spacing || $[66] !== text || $[67] !== textAlign || $[68] !== textWeight ? (t24 = (IconComponent || text || IconRightComponent) && /* @__PURE__ */ jsx(Box, {
|
|
122
|
-
as: "span",
|
|
123
|
-
...boxProps,
|
|
124
|
-
children: /* @__PURE__ */ jsxs(Flex, {
|
|
125
|
-
as: "span",
|
|
126
|
-
justify,
|
|
127
|
-
gap: spacing,
|
|
128
|
-
children: [
|
|
129
|
-
IconComponent && /* @__PURE__ */ jsxs(Text, {
|
|
130
|
-
size: fontSize,
|
|
131
|
-
children: [isValidElement(IconComponent) && IconComponent, isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})]
|
|
132
|
-
}),
|
|
133
|
-
text && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, {
|
|
134
|
-
muted,
|
|
135
|
-
align: textAlign,
|
|
136
|
-
size: fontSize,
|
|
137
|
-
textOverflow: "ellipsis",
|
|
138
|
-
weight: textWeight ?? button.textWeight,
|
|
139
|
-
children: text
|
|
140
|
-
}) }),
|
|
141
|
-
IconRightComponent && /* @__PURE__ */ jsxs(Text, {
|
|
142
|
-
size: fontSize,
|
|
143
|
-
children: [isValidElement(IconRightComponent) && IconRightComponent, isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})]
|
|
144
|
-
})
|
|
145
|
-
]
|
|
146
|
-
})
|
|
147
|
-
}), $[58] = IconComponent, $[59] = IconRightComponent, $[60] = boxProps, $[61] = button, $[62] = fontSize, $[63] = justify, $[64] = muted, $[65] = spacing, $[66] = text, $[67] = textAlign, $[68] = textWeight, $[69] = t24) : t24 = $[69];
|
|
148
|
-
let t25;
|
|
149
|
-
$[70] !== boxProps || $[71] !== children ? (t25 = children && /* @__PURE__ */ jsx(Box, {
|
|
150
|
-
as: "span",
|
|
151
|
-
...boxProps,
|
|
152
|
-
children
|
|
153
|
-
}), $[70] = boxProps, $[71] = children, $[72] = t25) : t25 = $[72];
|
|
154
|
-
let t26;
|
|
155
|
-
return $[73] !== mode || $[74] !== radius || $[75] !== ref || $[76] !== restProps || $[77] !== t20 || $[78] !== t21 || $[79] !== t22 || $[80] !== t23 || $[81] !== t24 || $[82] !== t25 || $[83] !== tone || $[84] !== type || $[85] !== width ? (t26 = /* @__PURE__ */ jsxs(StyledButton, {
|
|
156
|
-
"data-ui": "Button",
|
|
157
|
-
...restProps,
|
|
158
|
-
$mode: mode,
|
|
159
|
-
$radius: radius,
|
|
160
|
-
$tone: tone,
|
|
161
|
-
"data-disabled": t20,
|
|
162
|
-
"data-selected": t21,
|
|
163
|
-
disabled: t22,
|
|
164
|
-
ref,
|
|
165
|
-
type,
|
|
166
|
-
$width: width,
|
|
167
|
-
children: [
|
|
168
|
-
t23,
|
|
169
|
-
t24,
|
|
170
|
-
t25
|
|
171
|
-
]
|
|
172
|
-
}), $[73] = mode, $[74] = radius, $[75] = ref, $[76] = restProps, $[77] = t20, $[78] = t21, $[79] = t22, $[80] = t23, $[81] = t24, $[82] = t25, $[83] = tone, $[84] = type, $[85] = width, $[86] = t26) : t26 = $[86], t26;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @public
|
|
176
|
-
*/
|
|
177
|
-
const Button = ButtonComponent;
|
|
178
|
-
export { Spinner as n, spinnerIcon as r, Button as t };
|
|
179
|
-
|
|
180
|
-
//# sourceMappingURL=button-BNyKSDyA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-BNyKSDyA.js","names":["<SpinnerIcon className={spinnerIcon} />","<Text data-ui=\"Spinner\" {...props}>\n <SpinnerIcon className={spinnerIcon} />\n </Text>","fontSize = 1","justifyProp = 'center'","mode = 'default'","paddingProp = 3","radiusProp = 2","gap = 3","tone = 'default'","type = 'button'","muted = false","_getArrayProp(justifyProp)","_getArrayProp(paddingProp)","_getArrayProp(paddingXProp)","_getArrayProp(paddingYProp)","_getArrayProp(paddingTopProp)","_getArrayProp(paddingBottomProp)","_getArrayProp(paddingLeftProp)","_getArrayProp(paddingRightProp)","_getArrayProp(radiusProp)","_getArrayProp(gap)","{\n // flex: 1,\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n }","useMemo(\n () => ({\n // flex: 1,\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n }),\n [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight],\n )","Boolean(loading) && (\n <div className={buttonLoadingBox} data-ui=\"ButtonLoading\">\n <Spinner />\n </div>\n )","(IconComponent || text || IconRightComponent) && (\n <Box as=\"span\" {...boxProps}>\n <Flex as=\"span\" justify={justify} gap={spacing}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box>\n <Text\n muted={muted}\n align={textAlign}\n size={fontSize}\n textOverflow=\"ellipsis\"\n weight={textWeight ?? button.textWeight}\n >\n {text}\n </Text>\n </Box>\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n </Box>\n )","button.textWeight","children && (\n <Box as=\"span\" {...boxProps}>\n {children}\n </Box>\n )","<StyledButton\n data-ui=\"Button\"\n {...restProps}\n $mode={mode}\n $radius={radius}\n $tone={tone}\n data-disabled={Boolean(loading || disabled)}\n data-selected={selected ? '' : undefined}\n disabled={Boolean(loading || disabled)}\n ref={ref}\n type={type}\n $width={width}\n >\n {Boolean(loading) && (\n <div className={buttonLoadingBox} data-ui=\"ButtonLoading\">\n <Spinner />\n </div>\n )}\n\n {(IconComponent || text || IconRightComponent) && (\n <Box as=\"span\" {...boxProps}>\n <Flex as=\"span\" justify={justify} gap={spacing}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box>\n <Text\n muted={muted}\n align={textAlign}\n size={fontSize}\n textOverflow=\"ellipsis\"\n weight={textWeight ?? button.textWeight}\n >\n {text}\n </Text>\n </Box>\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n </Box>\n )}\n\n {children && (\n <Box as=\"span\" {...boxProps}>\n {children}\n </Box>\n )}\n </StyledButton>","Boolean(loading || disabled)","selected ? '' : undefined"],"sources":["../src/core/primitives/spinner/spinner.css.ts","../src/core/primitives/spinner/spinner.tsx","../src/core/primitives/button/styles.ts","../src/core/primitives/button/button.css.ts","../src/core/primitives/button/button.tsx"],"sourcesContent":["import {keyframes, style} from '@vanilla-extract/css'\n\nconst rotate = keyframes({\n from: {transform: 'rotate(0deg)'},\n to: {transform: 'rotate(360deg)'},\n})\n\nexport const spinnerIcon = style({\n animation: `${rotate} 500ms linear infinite`,\n})\n","import {SpinnerIcon} from '@sanity/icons/Spinner'\n\nimport {Text} from '../text/text'\n\nimport {spinnerIcon} from './spinner.css'\n\n/**\n * @public\n */\nexport interface SpinnerProps {\n muted?: boolean\n size?: number | number[]\n}\n\n/**\n * Indicate that something is loading for an indeterminate amount of time.\n *\n * @public\n */\nexport function Spinner(\n props: SpinnerProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'size'>,\n) {\n return (\n <Text data-ui=\"Spinner\" {...props}>\n <SpinnerIcon className={spinnerIcon} />\n </Text>\n )\n}\n","import {css} from 'styled-components'\n\nimport {CSSObject} from '../../../theme/system/css'\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\nimport {_cardColorStyle} from '../../styles/card/_cardColorStyle'\nimport {focusRingBorderStyle, focusRingStyle} from '../../styles/focusRing'\nimport {ThemeProps} from '../../styles/types'\nimport {ButtonMode, ButtonTone, ButtonWidth} from '../../types/button'\n\n/**\n * @internal\n */\nexport function buttonBaseStyles(\n props: {$width?: ButtonWidth} & ThemeProps,\n): ReturnType<typeof css> {\n const {$width} = props\n const {style} = getTheme_v2(props.theme)\n\n return css`\n ${style?.button};\n\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n vertical-align: top;\n\n ${\n $width === 'fill' &&\n css`\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n `\n }\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n `\n}\n\nfunction combineBoxShadow(...boxShadows: (string | undefined)[]): string {\n return boxShadows.filter(Boolean).join(',')\n}\n\n/**\n * @internal\n */\nexport function buttonColorStyles(\n props: {$mode: ButtonMode; $tone: ButtonTone} & ThemeProps,\n): CSSObject[] {\n const {$mode} = props\n const {button, color: baseColor, style} = getTheme_v2(props.theme)\n const shadow = props.$mode === 'ghost'\n const mode = baseColor.button[$mode] || baseColor.button.default\n const color = mode[props.$tone] || mode.default\n const border = {\n width: button.border.width,\n color: 'var(--card-border-color)',\n }\n // const defaultBoxShadow = `inset 0px -1.5px 0px ${buttonTheme.border.width}px color-mix(in srgb, var(--card-border-color) 25%, var(--card-bg-color))`\n const defaultBoxShadow = undefined\n\n // oxlint-disable-next-line no-unsafe-type-assertion\n return [\n _cardColorStyle(baseColor, color.enabled),\n {\n 'backgroundColor': 'var(--card-bg-color)',\n 'color': 'var(--card-fg-color)',\n 'boxShadow': focusRingBorderStyle(border),\n '&:disabled, &[data-disabled=\"true\"]': _cardColorStyle(baseColor, color.disabled),\n \"&:not([data-disabled='true'])\": {\n 'boxShadow': combineBoxShadow(\n focusRingBorderStyle(border),\n shadow ? defaultBoxShadow : undefined,\n ),\n '&:focus': {\n boxShadow: focusRingStyle({\n base: baseColor,\n border: {width: 2, color: baseColor.bg},\n focusRing: button.focusRing,\n }),\n },\n '&:focus:not(:focus-visible)': {\n boxShadow: combineBoxShadow(\n focusRingBorderStyle(border),\n shadow ? defaultBoxShadow : undefined,\n ),\n },\n '@media (hover: hover)': {\n '&:hover': _cardColorStyle(baseColor, color.hovered),\n '&:active': _cardColorStyle(baseColor, color.pressed),\n '&[data-hovered]': _cardColorStyle(baseColor, color.hovered),\n },\n '&[data-selected]': _cardColorStyle(baseColor, color.pressed),\n },\n },\n style?.button?.root,\n ].filter(Boolean) as CSSObject[]\n}\n","import {style} from '@vanilla-extract/css'\n\nexport const buttonLoadingBox = style({\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'var(--card-bg-color)',\n borderRadius: 'inherit',\n zIndex: 1,\n boxShadow: 'inherit',\n})\n","import {isValidElement, useMemo} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {styled} from 'styled-components'\n\nimport {ThemeFontWeightKey} from '../../../theme/system/font'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {responsiveRadiusStyle} from '../../styles/radius/radiusStyle'\nimport {ResponsiveRadiusStyleProps} from '../../styles/radius/types'\nimport {useTheme_v2} from '../../theme/useTheme'\nimport {ButtonMode, ButtonTextAlign, ButtonTone, ButtonWidth} from '../../types/button'\nimport {ElementType, Props} from '../../types/component'\nimport {FlexJustify} from '../../types/flex'\nimport {Box} from '../box/box'\nimport {Flex} from '../flex/flex'\nimport {Spinner} from '../spinner/spinner'\nimport {Text} from '../text/text'\nimport {ResponsivePaddingProps, ResponsiveRadiusProps} from '../types'\nimport {buttonBaseStyles, buttonColorStyles} from './styles'\n\nimport {buttonLoadingBox} from './button.css'\n\n/**\n * @public\n */\nexport interface ButtonOwnProps extends ResponsivePaddingProps, ResponsiveRadiusProps {\n fontSize?: number | number[]\n mode?: ButtonMode\n // oxlint-disable-next-line no-redundant-type-constituents\n icon?: React.ElementType | React.ReactNode\n // oxlint-disable-next-line no-redundant-type-constituents\n iconRight?: React.ElementType | React.ReactNode\n justify?: FlexJustify | FlexJustify[]\n /**\n * @beta Do not use in production, as this might change.\n */\n loading?: boolean\n selected?: boolean\n /**\n * @deprecated Use `gap` instead.\n */\n space?: never\n gap?: number | number[]\n muted?: boolean\n text?: React.ReactNode\n textAlign?: ButtonTextAlign\n textWeight?: ThemeFontWeightKey\n tone?: ButtonTone\n type?: 'button' | 'reset' | 'submit'\n width?: ButtonWidth\n}\n\n/**\n * @public\n */\nexport type ButtonProps<E extends ElementType = 'button'> = Props<ButtonOwnProps, E>\n\nconst StyledButton = styled.button<\n {$mode: ButtonMode; $tone: ButtonTone; $width?: ButtonWidth} & ResponsiveRadiusStyleProps\n>(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles)\n\nfunction ButtonComponent(\n props: ButtonOwnProps & {as?: ElementType} & Omit<\n React.HTMLProps<HTMLButtonElement>,\n 'as' | 'width'\n >,\n) {\n const {\n children,\n disabled,\n ref,\n fontSize = 1,\n icon: IconComponent,\n iconRight: IconRightComponent,\n justify: justifyProp = 'center',\n loading,\n mode = 'default',\n padding: paddingProp = 3,\n paddingX: paddingXProp,\n paddingY: paddingYProp,\n paddingTop: paddingTopProp,\n paddingBottom: paddingBottomProp,\n paddingLeft: paddingLeftProp,\n paddingRight: paddingRightProp,\n radius: radiusProp = 2,\n selected,\n gap = 3,\n text,\n textAlign,\n textWeight,\n tone = 'default',\n type = 'button',\n muted = false,\n width,\n ...restProps\n } = props\n const {button} = useTheme_v2()\n\n const justify = _getArrayProp(justifyProp)\n const padding = _getArrayProp(paddingProp)\n const paddingX = _getArrayProp(paddingXProp)\n const paddingY = _getArrayProp(paddingYProp)\n const paddingTop = _getArrayProp(paddingTopProp)\n const paddingBottom = _getArrayProp(paddingBottomProp)\n const paddingLeft = _getArrayProp(paddingLeftProp)\n const paddingRight = _getArrayProp(paddingRightProp)\n const radius = _getArrayProp(radiusProp)\n const spacing = _getArrayProp(gap)\n\n const boxProps = useMemo(\n () => ({\n // flex: 1,\n padding,\n paddingX,\n paddingY,\n paddingTop,\n paddingBottom,\n paddingLeft,\n paddingRight,\n }),\n [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight],\n )\n\n return (\n <StyledButton\n data-ui=\"Button\"\n {...restProps}\n $mode={mode}\n $radius={radius}\n $tone={tone}\n data-disabled={Boolean(loading || disabled)}\n data-selected={selected ? '' : undefined}\n disabled={Boolean(loading || disabled)}\n ref={ref}\n type={type}\n $width={width}\n >\n {Boolean(loading) && (\n <div className={buttonLoadingBox} data-ui=\"ButtonLoading\">\n <Spinner />\n </div>\n )}\n\n {(IconComponent || text || IconRightComponent) && (\n <Box as=\"span\" {...boxProps}>\n <Flex as=\"span\" justify={justify} gap={spacing}>\n {IconComponent && (\n <Text size={fontSize}>\n {isValidElement(IconComponent) && IconComponent}\n {isValidElementType(IconComponent) && <IconComponent />}\n </Text>\n )}\n\n {text && (\n <Box>\n <Text\n muted={muted}\n align={textAlign}\n size={fontSize}\n textOverflow=\"ellipsis\"\n weight={textWeight ?? button.textWeight}\n >\n {text}\n </Text>\n </Box>\n )}\n\n {IconRightComponent && (\n <Text size={fontSize}>\n {isValidElement(IconRightComponent) && IconRightComponent}\n {isValidElementType(IconRightComponent) && <IconRightComponent />}\n </Text>\n )}\n </Flex>\n </Box>\n )}\n\n {children && (\n <Box as=\"span\" {...boxProps}>\n {children}\n </Box>\n )}\n </StyledButton>\n )\n}\n\n/**\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const Button = ButtonComponent as unknown as <E extends ElementType = 'button'>(\n props: ButtonProps<E>,\n) => React.JSX.Element\n"],"mappings":";;;;;;;;;;;;;;;;;ACmBA,SAAgB,QACd,OACA;eAGIA;qDAAC,KAAA,oBAAA,aAAD,EAAa,WAAW,YAAc,CAAA;CADxCC,IAAAA;CADF,OAC8B,EAAA,OAAA,qBAA5B,KAAA,oBAAC,MAAD;EAAM,WAAQ;EAAU,GAAI;EAC1BD,UAAAA;CACI,CAAA,GAFsB,EAAA,KAAA,mBAA5BC;AAIJ;;;;ACfA,SAAgB,iBACd,OACwB;CACxB,IAAM,EAAC,WAAU,OACX,EAAC,UAAS,YAAY,MAAM,KAAK;CAEvC,OAAO,GAAG,GACN,OAAO,OAAO,4RAqBd,WAAW,UACX,GA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;EACE,WAAQ;EACR,GAAI;EACJ,OAAO;EACP,SAAS;EACT,OAAO;EACP,iBAAeE;EACf,iBAAeC;EACf,UAAUD;EACL;EACC;EACN,QAAQ;EAXV,UAAA;GAaGL;GAMAC;GAkCAE;EAKW;KAvDL,EAAA,MAAA,MACE,EAAA,MAAA,QAKJ,EAAA,MAAA,KAPD,EAAA,MAAA,WAIWE,EAAAA,MAAAA,KACAC,EAAAA,MAAAA,KACLD,EAAAA,MAAAA,KAKTL,EAAAA,MAAAA,KAMAC,EAAAA,MAAAA,KAkCAE,EAAAA,MAAAA,KAhDM,EAAA,MAAA,MAKD,EAAA,MAAA,MACE,EAAA,MAAA,mCAXVC;AA4DJ;;;;AAMA,MAAa,SAAS"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { a as Props, r as ElementType } from "./component-DVlwaWB-.js";
|
|
2
|
-
import { O as FlexJustify, d as ResponsiveMarginProps, f as ResponsivePaddingProps, l as ResponsiveGridItemProps, o as ResponsiveBoxProps, p as ResponsiveRadiusProps, s as ResponsiveFlexItemProps } from "./layer-ChlP9Ik6.js";
|
|
3
|
-
import { l as ThemeColorStateToneKey, r as ThemeColorButtonModeKey } from "./_system-CTe2lb5l.js";
|
|
4
|
-
import { a as ThemeFontWeightKey } from "./font-EtfxKPUz.js";
|
|
5
|
-
/**
|
|
6
|
-
* The props that `Box` adds on top of the element it renders as.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
interface BoxOwnProps extends ResponsiveFlexItemProps, ResponsiveBoxProps, ResponsiveGridItemProps, ResponsiveMarginProps, ResponsivePaddingProps {
|
|
11
|
-
forwardedAs?: ElementType;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
type BoxProps<E extends ElementType = 'div'> = Props<BoxOwnProps, E>;
|
|
17
|
-
/**
|
|
18
|
-
* The `Box` component is a basic layout wrapper component which provides utility properties
|
|
19
|
-
* for flex, margins and padding.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
declare const Box: <E extends ElementType = 'div'>(props: BoxProps<E>) => React.JSX.Element;
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
type ButtonMode = ThemeColorButtonModeKey;
|
|
28
|
-
/**
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
type ButtonTextAlign = 'left' | 'right' | 'center';
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
type ButtonTone = ThemeColorStateToneKey;
|
|
36
|
-
/**
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
type ButtonWidth = 'fill';
|
|
40
|
-
/**
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
interface ButtonOwnProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
|
|
44
|
-
fontSize?: number | number[];
|
|
45
|
-
mode?: ButtonMode;
|
|
46
|
-
icon?: React.ElementType | React.ReactNode;
|
|
47
|
-
iconRight?: React.ElementType | React.ReactNode;
|
|
48
|
-
justify?: FlexJustify | FlexJustify[];
|
|
49
|
-
/**
|
|
50
|
-
* @beta Do not use in production, as this might change.
|
|
51
|
-
*/
|
|
52
|
-
loading?: boolean;
|
|
53
|
-
selected?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated Use `gap` instead.
|
|
56
|
-
*/
|
|
57
|
-
space?: never;
|
|
58
|
-
gap?: number | number[];
|
|
59
|
-
muted?: boolean;
|
|
60
|
-
text?: React.ReactNode;
|
|
61
|
-
textAlign?: ButtonTextAlign;
|
|
62
|
-
textWeight?: ThemeFontWeightKey;
|
|
63
|
-
tone?: ButtonTone;
|
|
64
|
-
type?: 'button' | 'reset' | 'submit';
|
|
65
|
-
width?: ButtonWidth;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @public
|
|
69
|
-
*/
|
|
70
|
-
type ButtonProps<E extends ElementType = 'button'> = Props<ButtonOwnProps, E>;
|
|
71
|
-
/**
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
declare const Button: <E extends ElementType = 'button'>(props: ButtonProps<E>) => React.JSX.Element;
|
|
75
|
-
export { ButtonTextAlign as a, Box as c, ButtonMode as i, BoxOwnProps as l, ButtonOwnProps as n, ButtonTone as o, ButtonProps as r, ButtonWidth as s, Button as t, BoxProps as u };
|
|
76
|
-
//# sourceMappingURL=button-dnqMFkWg.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-dnqMFkWg.d.ts","names":[],"sources":["../src/core/primitives/box/box.tsx","../src/core/types/button.ts","../src/core/primitives/button/button.tsx"],"mappings":";;;;;;;;;UA2BiB,oBAEb,yBACA,oBACA,yBACA,uBACA;EACF,cAAc;;;;;KAMJ,SAAS,UAAU,uBAAuB,MAAM,aAAa;;;;;;;cAmG5D,MAAkC,UAAU,qBACvD,OAAO,SAAS,OACb,MAAM,IAAI;;;;KCxIH,aAAa;;;;KAKb;;;;KAKA,aAAa;;;;KAKb;;;;UCIK,uBAAuB,wBAAwB;EAC9D;EACA,OAAO;EAEP,OAAO,MAAM,cAAc,MAAM;EAEjC,YAAY,MAAM,cAAc,MAAM;EACtC,UAAU,cAAc;;;;EAIxB;EACA;;;;EAIA;EACA;EACA;EACA,OAAO,MAAM;EACb,YAAY;EACZ,aAAa;EACb,OAAO;EACP;EACA,QAAQ;;;;;KAME,YAAY,UAAU,0BAA0B,MAAM,gBAAgB;;;;cAuIrE,SAAwC,UAAU,wBAC7D,OAAO,YAAY,OAChB,MAAM,IAAI"}
|
package/dist/card-C0a0wQTc.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"card-C0a0wQTc.d.ts","names":[],"sources":["../src/core/types/card.ts"],"mappings":";;;;KAKY,WAAW"}
|
package/dist/code.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { a as Props, r as ElementType } from "./component-DVlwaWB-.js";
|
|
2
|
-
/**
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
interface CodeOwnProps {
|
|
6
|
-
/** Define the language to use for syntax highlighting. */
|
|
7
|
-
language?: string;
|
|
8
|
-
size?: number | number[];
|
|
9
|
-
weight?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
type CodeProps<E extends ElementType = 'pre'> = Props<CodeOwnProps, E>;
|
|
15
|
-
/**
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export declare const Code: <E extends ElementType = 'pre'>(props: CodeProps<E>) => React.JSX.Element;
|
|
19
|
-
export type { CodeOwnProps, CodeProps };
|
|
20
|
-
//# sourceMappingURL=code.d.ts.map
|
package/dist/code.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","names":[],"sources":["../src/core/primitives/code/code.tsx"],"mappings":";;;;UAeiB;;EAEf;EACA;EACA;;;;;KAMU,UAAU,UAAU,uBAAuB,MAAM,cAAc;;;;qBAgC9D,OAAoC,UAAU,qBACzD,OAAO,UAAU,OACd,MAAM,IAAI"}
|
package/dist/code.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { n as _getArrayProp } from "./helpers-C8xxXAQC.js";
|
|
3
|
-
import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
|
|
4
|
-
import { t as responsiveCodeFontStyle } from "./codeFontStyle-84SMhFtI.js";
|
|
5
|
-
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { Suspense, lazy } from "react";
|
|
7
|
-
import { css, styled } from "styled-components";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
function codeSyntaxHighlightingStyle({ theme }) {
|
|
10
|
-
let { color: { syntax: color } } = getTheme_v2(theme);
|
|
11
|
-
return {
|
|
12
|
-
"&.atrule": { color: color.atrule },
|
|
13
|
-
"&.attr-name": { color: color.attrName },
|
|
14
|
-
"&.attr-value": { color: color.attrValue },
|
|
15
|
-
"&.attribute": { color: color.attribute },
|
|
16
|
-
"&.boolean": { color: color.boolean },
|
|
17
|
-
"&.builtin": { color: color.builtin },
|
|
18
|
-
"&.cdata": { color: color.cdata },
|
|
19
|
-
"&.char": { color: color.char },
|
|
20
|
-
"&.class": { color: color.class },
|
|
21
|
-
"&.class-name": { color: color.className },
|
|
22
|
-
"&.comment": { color: color.comment },
|
|
23
|
-
"&.constant": { color: color.constant },
|
|
24
|
-
"&.deleted": { color: color.deleted },
|
|
25
|
-
"&.doctype": { color: color.doctype },
|
|
26
|
-
"&.entity": { color: color.entity },
|
|
27
|
-
"&.function": { color: color.function },
|
|
28
|
-
"&.hexcode": { color: color.hexcode },
|
|
29
|
-
"&.id": { color: color.id },
|
|
30
|
-
"&.important": { color: color.important },
|
|
31
|
-
"&.inserted": { color: color.inserted },
|
|
32
|
-
"&.keyword": { color: color.keyword },
|
|
33
|
-
"&.number": { color: color.number },
|
|
34
|
-
"&.operator": { color: color.operator },
|
|
35
|
-
"&.prolog": { color: color.prolog },
|
|
36
|
-
"&.property": { color: color.property },
|
|
37
|
-
"&.pseudo-class": { color: color.pseudoClass },
|
|
38
|
-
"&.pseudo-element": { color: color.pseudoElement },
|
|
39
|
-
"&.punctuation": { color: color.punctuation },
|
|
40
|
-
"&.regex": { color: color.regex },
|
|
41
|
-
"&.selector": { color: color.selector },
|
|
42
|
-
"&.string": { color: color.string },
|
|
43
|
-
"&.symbol": { color: color.symbol },
|
|
44
|
-
"&.tag": { color: color.tag },
|
|
45
|
-
"&.unit": { color: color.unit },
|
|
46
|
-
"&.url": { color: color.url },
|
|
47
|
-
"&.variable": { color: color.variable }
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function codeBaseStyle() {
|
|
51
|
-
return css`color:var(--card-code-fg-color);& code{font-family:inherit;&.refractor .token{${codeSyntaxHighlightingStyle}}}& a{color:inherit;text-decoration:underline;border-radius:1px;}& svg{display:inline;max-width:unset;}& [data-sanity-icon]{vertical-align:baseline;}`;
|
|
52
|
-
}
|
|
53
|
-
const LazyRefractor = lazy(() => import("./refractor-CC48DwHi.js")), StyledCode = /* @__PURE__ */ styled.pre.withConfig({
|
|
54
|
-
displayName: "StyledCode",
|
|
55
|
-
componentId: "sc-8yzjqy-0"
|
|
56
|
-
})(codeBaseStyle, responsiveCodeFontStyle);
|
|
57
|
-
function CodeComponent(props) {
|
|
58
|
-
let $ = c(23), children, language, ref, restProps, t0, weight;
|
|
59
|
-
$[0] === props ? (children = $[1], language = $[2], ref = $[3], restProps = $[4], t0 = $[5], weight = $[6]) : ({children, language, ref, size: t0, weight, ...restProps} = props, $[0] = props, $[1] = children, $[2] = language, $[3] = ref, $[4] = restProps, $[5] = t0, $[6] = weight);
|
|
60
|
-
let size = t0 === void 0 ? 2 : t0, t1;
|
|
61
|
-
$[7] === size ? t1 = $[8] : (t1 = _getArrayProp(size), $[7] = size, $[8] = t1);
|
|
62
|
-
let t2 = weight, t3;
|
|
63
|
-
$[9] === children ? t3 = $[10] : (t3 = /* @__PURE__ */ jsx("code", { children }), $[9] = children, $[10] = t3);
|
|
64
|
-
let t4;
|
|
65
|
-
$[11] !== children || $[12] !== language ? (t4 = /* @__PURE__ */ jsx(LazyRefractor, {
|
|
66
|
-
language,
|
|
67
|
-
value: children
|
|
68
|
-
}), $[11] = children, $[12] = language, $[13] = t4) : t4 = $[13];
|
|
69
|
-
let t5;
|
|
70
|
-
$[14] !== t3 || $[15] !== t4 ? (t5 = /* @__PURE__ */ jsx(Suspense, {
|
|
71
|
-
fallback: t3,
|
|
72
|
-
children: t4
|
|
73
|
-
}), $[14] = t3, $[15] = t4, $[16] = t5) : t5 = $[16];
|
|
74
|
-
let t6;
|
|
75
|
-
return $[17] !== ref || $[18] !== restProps || $[19] !== t1 || $[20] !== t2 || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(StyledCode, {
|
|
76
|
-
"data-ui": "Code",
|
|
77
|
-
...restProps,
|
|
78
|
-
$size: t1,
|
|
79
|
-
$weight: t2,
|
|
80
|
-
ref,
|
|
81
|
-
children: t5
|
|
82
|
-
}), $[17] = ref, $[18] = restProps, $[19] = t1, $[20] = t2, $[21] = t5, $[22] = t6) : t6 = $[22], t6;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @public
|
|
86
|
-
*/
|
|
87
|
-
const Code = CodeComponent;
|
|
88
|
-
export { Code };
|
|
89
|
-
|
|
90
|
-
//# sourceMappingURL=code.js.map
|
package/dist/code.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","names":["size = 2","_getArrayProp(size)","<code>{children}</code>","<LazyRefractor language={language} value={children} />","<Suspense fallback={<code>{children}</code>}>\n <LazyRefractor language={language} value={children} />\n </Suspense>","<StyledCode\n data-ui=\"Code\"\n {...restProps}\n $size={_getArrayProp(size)}\n // oxlint-disable-next-line no-unsafe-type-assertion -- `weight` is typed as `string` in the public API; unknown weights fall back to `regular` at runtime\n $weight={weight as ThemeFontWeightKey | undefined}\n ref={ref}\n >\n <Suspense fallback={<code>{children}</code>}>\n <LazyRefractor language={language} value={children} />\n </Suspense>\n </StyledCode>","weight as ThemeFontWeightKey | undefined"],"sources":["../src/core/primitives/code/styles.ts","../src/core/primitives/code/code.tsx"],"sourcesContent":["import {css, ExecutionContext} from 'styled-components'\n\nimport {getTheme_v2} from '../../../theme/versioning/getTheme_v2'\n\nfunction codeSyntaxHighlightingStyle({theme}: ExecutionContext) {\n const {\n color: {syntax: color},\n } = getTheme_v2(theme)\n\n return {\n '&.atrule': {color: color.atrule},\n '&.attr-name': {color: color.attrName},\n '&.attr-value': {color: color.attrValue},\n '&.attribute': {color: color.attribute},\n '&.boolean': {color: color.boolean},\n '&.builtin': {color: color.builtin},\n '&.cdata': {color: color.cdata},\n '&.char': {color: color.char},\n '&.class': {color: color.class},\n '&.class-name': {color: color.className},\n '&.comment': {color: color.comment},\n '&.constant': {color: color.constant},\n '&.deleted': {color: color.deleted},\n '&.doctype': {color: color.doctype},\n '&.entity': {color: color.entity},\n '&.function': {color: color.function},\n '&.hexcode': {color: color.hexcode},\n '&.id': {color: color.id},\n '&.important': {color: color.important},\n '&.inserted': {color: color.inserted},\n '&.keyword': {color: color.keyword},\n '&.number': {color: color.number},\n '&.operator': {color: color.operator},\n '&.prolog': {color: color.prolog},\n '&.property': {color: color.property},\n '&.pseudo-class': {color: color.pseudoClass},\n '&.pseudo-element': {color: color.pseudoElement},\n '&.punctuation': {color: color.punctuation},\n '&.regex': {color: color.regex},\n '&.selector': {color: color.selector},\n '&.string': {color: color.string},\n '&.symbol': {color: color.symbol},\n '&.tag': {color: color.tag},\n '&.unit': {color: color.unit},\n '&.url': {color: color.url},\n '&.variable': {color: color.variable},\n }\n}\n\nexport function codeBaseStyle(): ReturnType<typeof css> {\n return css`\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ${codeSyntaxHighlightingStyle}\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n /* ...and aren't squeezed by resets that set max-width: 100% */\n max-width: unset;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n `\n}\n","import {lazy, Suspense} from 'react'\nimport {styled} from 'styled-components'\n\nimport {ThemeFontWeightKey} from '../../../theme/system/font'\nimport {responsiveCodeFontStyle} from '../../styles/font/codeFontStyle'\nimport {FontWeightStyleProps, ResponsiveFontSizeStyleProps} from '../../styles/font/types'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {ElementType, Props} from '../../types/component'\nimport {codeBaseStyle} from './styles'\n\nconst LazyRefractor = lazy(() => import('./refractor'))\n\n/**\n * @public\n */\nexport interface CodeOwnProps {\n /** Define the language to use for syntax highlighting. */\n language?: string\n size?: number | number[]\n weight?: string\n}\n\n/**\n * @public\n */\nexport type CodeProps<E extends ElementType = 'pre'> = Props<CodeOwnProps, E>\n\nconst StyledCode = styled.pre<FontWeightStyleProps & ResponsiveFontSizeStyleProps>(\n codeBaseStyle,\n responsiveCodeFontStyle,\n)\n\nfunction CodeComponent(\n props: CodeOwnProps & {as?: ElementType} & Omit<React.HTMLProps<HTMLPreElement>, 'as' | 'size'>,\n) {\n const {children, language, ref, size = 2, weight, ...restProps} = props\n\n return (\n <StyledCode\n data-ui=\"Code\"\n {...restProps}\n $size={_getArrayProp(size)}\n // oxlint-disable-next-line no-unsafe-type-assertion -- `weight` is typed as `string` in the public API; unknown weights fall back to `regular` at runtime\n $weight={weight as ThemeFontWeightKey | undefined}\n ref={ref}\n >\n <Suspense fallback={<code>{children}</code>}>\n <LazyRefractor language={language} value={children} />\n </Suspense>\n </StyledCode>\n )\n}\n\n/**\n * @public\n */\n// oxlint-disable-next-line no-unsafe-type-assertion\nexport const Code = CodeComponent as unknown as <E extends ElementType = 'pre'>(\n props: CodeProps<E>,\n) => React.JSX.Element\n"],"mappings":";;;;;;;;AAIA,SAAS,4BAA4B,EAAC,SAA0B;CAC9D,IAAM,EACJ,OAAO,EAAC,QAAQ,YACd,YAAY,KAAK;CAErB,OAAO;EACL,YAAY,EAAC,OAAO,MAAM,OAAM;EAChC,eAAe,EAAC,OAAO,MAAM,SAAQ;EACrC,gBAAgB,EAAC,OAAO,MAAM,UAAS;EACvC,eAAe,EAAC,OAAO,MAAM,UAAS;EACtC,aAAa,EAAC,OAAO,MAAM,QAAO;EAClC,aAAa,EAAC,OAAO,MAAM,QAAO;EAClC,WAAW,EAAC,OAAO,MAAM,MAAK;EAC9B,UAAU,EAAC,OAAO,MAAM,KAAI;EAC5B,WAAW,EAAC,OAAO,MAAM,MAAK;EAC9B,gBAAgB,EAAC,OAAO,MAAM,UAAS;EACvC,aAAa,EAAC,OAAO,MAAM,QAAO;E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