@bitrise/bitkit-v2 0.3.544-beta.3449 → 0.3.544-beta.3453
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/components/BitkitPinInput/BitkitPinInput.js +4 -2
- package/dist/components/BitkitPinInput/BitkitPinInput.js.map +1 -1
- package/dist/components/BitkitToggletip/BitkitToggletip.d.ts +9 -3
- package/dist/components/BitkitToggletip/BitkitToggletip.js +10 -6
- package/dist/components/BitkitToggletip/BitkitToggletip.js.map +1 -1
- package/dist/theme/slot-recipes/Drawer.recipe.d.ts +12 -2
- package/dist/theme/slot-recipes/Drawer.recipe.js +21 -7
- package/dist/theme/slot-recipes/Drawer.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +12 -2
- package/package.json +1 -1
|
@@ -30,7 +30,8 @@ var BitkitPinInput = forwardRef((props, ref) => {
|
|
|
30
30
|
});
|
|
31
31
|
const hasWarning = state === "warning" || !!fieldProps.warningText;
|
|
32
32
|
const isInvalid = state === "error" || !!fieldProps.errorText;
|
|
33
|
-
const
|
|
33
|
+
const isReadOnly = state === "readOnly";
|
|
34
|
+
const isRequired = fieldProps.required ?? !isReadOnly;
|
|
34
35
|
const iconSize = size === "lg" ? "24" : "16";
|
|
35
36
|
let describedBy;
|
|
36
37
|
if (fieldProps.errorText) describedBy = fieldIds.errorText;
|
|
@@ -42,10 +43,11 @@ var BitkitPinInput = forwardRef((props, ref) => {
|
|
|
42
43
|
});
|
|
43
44
|
else if (hasWarning) statusIcon = /* @__PURE__ */ jsx(IconWarningYellow, { size: iconSize });
|
|
44
45
|
const handleValueChange = (details) => {
|
|
46
|
+
if (isReadOnly) return;
|
|
45
47
|
setCurrentValue(details.valueAsString);
|
|
46
48
|
onValueChange?.(details.valueAsString);
|
|
47
49
|
};
|
|
48
|
-
const handleValueComplete = onValueComplete ? (details) => onValueComplete(details.valueAsString) : void 0;
|
|
50
|
+
const handleValueComplete = onValueComplete && !isReadOnly ? (details) => onValueComplete(details.valueAsString) : void 0;
|
|
49
51
|
const cells = toCells(currentValue, count);
|
|
50
52
|
return /* @__PURE__ */ jsx(BitkitField, {
|
|
51
53
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitPinInput.js","names":[],"sources":["../../../lib/components/BitkitPinInput/BitkitPinInput.tsx"],"sourcesContent":["import { useControllableState } from '@chakra-ui/react/hooks';\nimport { PinInput, type PinInputRootProps } from '@chakra-ui/react/pin-input';\nimport { forwardRef, type ReactNode, useId } from 'react';\n\nimport { IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\n\nconst toCells = (value: string, count: number) => Array.from({ length: count }, (_, index) => value[index] ?? '');\n\nconst stripSeparators = (value: string) => value.replace(/[\\s-]/g, '');\n\nexport interface BitkitPinInputProps extends Omit<\n BitkitFieldProps,\n 'children' | 'counterText' | 'defaultValue' | 'disabled' | 'invalid' | 'optional' | 'readOnly'\n> {\n /** Number of characters (and input cells). */\n count?: number;\n /** Initial value for uncontrolled usage, as a single string (e.g. `'123'`). */\n defaultValue?: string;\n /**\n * Escape hatch for Ark's `PinInput.Root` — options like `pattern`, `sanitizeValue`, `autoSubmit`,\n * `blurOnComplete` or `name`. `sanitizeValue` defaults to stripping whitespace and dashes from a\n * pasted code, so `123 456` and `123-456` are accepted.\n */\n inputProps?: Omit<\n PinInputRootProps,\n | 'count'\n | 'defaultValue'\n | 'disabled'\n | 'ids'\n | 'invalid'\n | 'mask'\n | 'onValueChange'\n | 'onValueComplete'\n | 'otp'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'size'\n | 'type'\n | 'value'\n >;\n /** Mask the entered characters, like `type=\"password\"`. */\n masked?: boolean;\n /** Called with the whole value as a string whenever a cell changes. */\n onValueChange?: (value: string) => void;\n /** Called with the whole value once every cell is filled. */\n onValueComplete?: (value: string) => void;\n /** Hint the browser to autofill a one-time code from SMS or email (`autocomplete=\"one-time-code\"`). */\n otp?: boolean;\n /** Field size — controls the cell size and typography. */\n size?: 'md' | 'lg';\n /**\n * Field state. `error`/`warning` are also implied by `errorText`/`warningText`; `disabled` and\n * `readOnly` gate interaction.\n */\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n /** Which characters each cell accepts. */\n type?: 'alphabetic' | 'alphanumeric' | 'numeric';\n /** Controlled value, as a single string. Pair with `onValueChange`. */\n value?: string;\n}\n\n/**\n * A row of single-character cells for verification codes and PINs, built on Ark's PinInput. The\n * value is a plain string — control it with `value` + `onValueChange`, or start uncontrolled with\n * `defaultValue`; `onValueComplete` fires once every cell is filled. `count` sets the number of\n * cells. Includes the standard label and helper/error/warning chrome.\n */\nconst BitkitPinInput = forwardRef<HTMLDivElement, BitkitPinInputProps>((props, ref) => {\n const {\n count = 6,\n defaultValue,\n inputProps,\n masked,\n onValueChange,\n onValueComplete,\n otp,\n size = 'lg',\n state,\n type = 'numeric',\n value,\n ...fieldProps\n } = props;\n\n const id = useId();\n const getCellId = (index: number | string) => `${id}-cell-${index}`;\n const fieldIds = {\n control: getCellId(0),\n errorText: `${id}-error-text`,\n helperText: `${id}-helper-text`,\n label: `${id}-label`,\n };\n\n const [currentValue, setCurrentValue] = useControllableState({ defaultValue: defaultValue ?? '', value });\n\n const hasWarning = state === 'warning' || !!fieldProps.warningText;\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n const isRequired = fieldProps.required ??
|
|
1
|
+
{"version":3,"file":"BitkitPinInput.js","names":[],"sources":["../../../lib/components/BitkitPinInput/BitkitPinInput.tsx"],"sourcesContent":["import { useControllableState } from '@chakra-ui/react/hooks';\nimport { PinInput, type PinInputRootProps } from '@chakra-ui/react/pin-input';\nimport { forwardRef, type ReactNode, useId } from 'react';\n\nimport { IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField';\n\nconst toCells = (value: string, count: number) => Array.from({ length: count }, (_, index) => value[index] ?? '');\n\nconst stripSeparators = (value: string) => value.replace(/[\\s-]/g, '');\n\nexport interface BitkitPinInputProps extends Omit<\n BitkitFieldProps,\n 'children' | 'counterText' | 'defaultValue' | 'disabled' | 'invalid' | 'optional' | 'readOnly'\n> {\n /** Number of characters (and input cells). */\n count?: number;\n /** Initial value for uncontrolled usage, as a single string (e.g. `'123'`). */\n defaultValue?: string;\n /**\n * Escape hatch for Ark's `PinInput.Root` — options like `pattern`, `sanitizeValue`, `autoSubmit`,\n * `blurOnComplete` or `name`. `sanitizeValue` defaults to stripping whitespace and dashes from a\n * pasted code, so `123 456` and `123-456` are accepted.\n */\n inputProps?: Omit<\n PinInputRootProps,\n | 'count'\n | 'defaultValue'\n | 'disabled'\n | 'ids'\n | 'invalid'\n | 'mask'\n | 'onValueChange'\n | 'onValueComplete'\n | 'otp'\n | 'placeholder'\n | 'readOnly'\n | 'required'\n | 'size'\n | 'type'\n | 'value'\n >;\n /** Mask the entered characters, like `type=\"password\"`. */\n masked?: boolean;\n /** Called with the whole value as a string whenever a cell changes. */\n onValueChange?: (value: string) => void;\n /** Called with the whole value once every cell is filled. */\n onValueComplete?: (value: string) => void;\n /** Hint the browser to autofill a one-time code from SMS or email (`autocomplete=\"one-time-code\"`). */\n otp?: boolean;\n /** Field size — controls the cell size and typography. */\n size?: 'md' | 'lg';\n /**\n * Field state. `error`/`warning` are also implied by `errorText`/`warningText`; `disabled` and\n * `readOnly` gate interaction.\n */\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n /** Which characters each cell accepts. */\n type?: 'alphabetic' | 'alphanumeric' | 'numeric';\n /** Controlled value, as a single string. Pair with `onValueChange`. */\n value?: string;\n}\n\n/**\n * A row of single-character cells for verification codes and PINs, built on Ark's PinInput. The\n * value is a plain string — control it with `value` + `onValueChange`, or start uncontrolled with\n * `defaultValue`; `onValueComplete` fires once every cell is filled. `count` sets the number of\n * cells. Includes the standard label and helper/error/warning chrome.\n */\nconst BitkitPinInput = forwardRef<HTMLDivElement, BitkitPinInputProps>((props, ref) => {\n const {\n count = 6,\n defaultValue,\n inputProps,\n masked,\n onValueChange,\n onValueComplete,\n otp,\n size = 'lg',\n state,\n type = 'numeric',\n value,\n ...fieldProps\n } = props;\n\n const id = useId();\n const getCellId = (index: number | string) => `${id}-cell-${index}`;\n const fieldIds = {\n control: getCellId(0),\n errorText: `${id}-error-text`,\n helperText: `${id}-helper-text`,\n label: `${id}-label`,\n };\n\n const [currentValue, setCurrentValue] = useControllableState({ defaultValue: defaultValue ?? '', value });\n\n const hasWarning = state === 'warning' || !!fieldProps.warningText;\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n const isReadOnly = state === 'readOnly';\n const isRequired = fieldProps.required ?? !isReadOnly;\n const iconSize = size === 'lg' ? '24' : '16';\n\n let describedBy: string | undefined;\n if (fieldProps.errorText) {\n describedBy = fieldIds.errorText;\n } else if (fieldProps.helperText || fieldProps.warningText) {\n describedBy = fieldIds.helperText;\n }\n\n let statusIcon: ReactNode = null;\n if (isInvalid) {\n statusIcon = <IconErrorCircleFilled color=\"icon/negative\" size={iconSize} />;\n } else if (hasWarning) {\n statusIcon = <IconWarningYellow size={iconSize} />;\n }\n\n const handleValueChange: PinInputRootProps['onValueChange'] = (details) => {\n if (isReadOnly) {\n return;\n }\n setCurrentValue(details.valueAsString);\n onValueChange?.(details.valueAsString);\n };\n\n const handleValueComplete: PinInputRootProps['onValueComplete'] =\n onValueComplete && !isReadOnly ? (details) => onValueComplete(details.valueAsString) : undefined;\n\n const cells = toCells(currentValue, count);\n\n return (\n <BitkitField ref={ref} state={state} {...fieldProps} ids={fieldIds}>\n <PinInput.Root\n count={count}\n key={count}\n mask={masked}\n onValueChange={handleValueChange}\n onValueComplete={handleValueComplete}\n otp={otp}\n placeholder=\"\"\n sanitizeValue={stripSeparators}\n size={size}\n type={type}\n value={cells}\n {...inputProps}\n ids={{ hiddenInput: `${id}-hidden-input`, input: getCellId, label: fieldIds.label }}\n required={false}\n >\n <PinInput.HiddenInput />\n <PinInput.Control>\n {cells.map((_, index) => (\n <PinInput.Input\n aria-describedby={describedBy}\n aria-labelledby={fieldProps.label ? `${fieldIds.label} ${getCellId(index)}` : undefined}\n index={index}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n required={isRequired}\n />\n ))}\n </PinInput.Control>\n {statusIcon}\n </PinInput.Root>\n </BitkitField>\n );\n});\n\nBitkitPinInput.displayName = 'BitkitPinInput';\n\nexport default BitkitPinInput;\n"],"mappings":";;;;;;;;AAOA,IAAM,WAAW,OAAe,UAAkB,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU,MAAM,UAAU,EAAE;AAEhH,IAAM,mBAAmB,UAAkB,MAAM,QAAQ,UAAU,EAAE;;;;;;;AA4DrE,IAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,EACJ,QAAQ,GACR,cACA,YACA,QACA,eACA,iBACA,KACA,OAAO,MACP,OACA,OAAO,WACP,OACA,GAAG,eACD;CAEJ,MAAM,KAAK,MAAM;CACjB,MAAM,aAAa,UAA2B,GAAG,GAAG,QAAQ;CAC5D,MAAM,WAAW;EACf,SAAS,UAAU,CAAC;EACpB,WAAW,GAAG,GAAG;EACjB,YAAY,GAAG,GAAG;EAClB,OAAO,GAAG,GAAG;CACf;CAEA,MAAM,CAAC,cAAc,mBAAmB,qBAAqB;EAAE,cAAc,gBAAgB;EAAI;CAAM,CAAC;CAExG,MAAM,aAAa,UAAU,aAAa,CAAC,CAAC,WAAW;CACvD,MAAM,YAAY,UAAU,WAAW,CAAC,CAAC,WAAW;CACpD,MAAM,aAAa,UAAU;CAC7B,MAAM,aAAa,WAAW,YAAY,CAAC;CAC3C,MAAM,WAAW,SAAS,OAAO,OAAO;CAExC,IAAI;CACJ,IAAI,WAAW,WACb,cAAc,SAAS;MAClB,IAAI,WAAW,cAAc,WAAW,aAC7C,cAAc,SAAS;CAGzB,IAAI,aAAwB;CAC5B,IAAI,WACF,aAAa,oBAAC,uBAAD;EAAuB,OAAM;EAAgB,MAAM;CAAW,CAAA;MACtE,IAAI,YACT,aAAa,oBAAC,mBAAD,EAAmB,MAAM,SAAW,CAAA;CAGnD,MAAM,qBAAyD,YAAY;EACzE,IAAI,YACF;EAEF,gBAAgB,QAAQ,aAAa;EACrC,gBAAgB,QAAQ,aAAa;CACvC;CAEA,MAAM,sBACJ,mBAAmB,CAAC,cAAc,YAAY,gBAAgB,QAAQ,aAAa,IAAI,KAAA;CAEzF,MAAM,QAAQ,QAAQ,cAAc,KAAK;CAEzC,OACE,oBAAC,aAAD;EAAkB;EAAY;EAAO,GAAI;EAAY,KAAK;EACxD,UAAA,qBAAC,SAAS,MAAV;GACS;GAEP,MAAM;GACN,eAAe;GACf,iBAAiB;GACZ;GACL,aAAY;GACZ,eAAe;GACT;GACA;GACN,OAAO;GACP,GAAI;GACJ,KAAK;IAAE,aAAa,GAAG,GAAG;IAAgB,OAAO;IAAW,OAAO,SAAS;GAAM;GAClF,UAAU;GAdZ,UAAA;IAgBE,oBAAC,SAAS,aAAV,CAAuB,CAAA;IACvB,oBAAC,SAAS,SAAV,EAAA,UACG,MAAM,KAAK,GAAG,UACb,oBAAC,SAAS,OAAV;KACE,oBAAkB;KAClB,mBAAiB,WAAW,QAAQ,GAAG,SAAS,MAAM,GAAG,UAAU,KAAK,MAAM,KAAA;KACvE;KAGP,UAAU;IACX,GAFM,KAEN,CACF,EACe,CAAA;IACjB;GACY;EA5BR,GAAA,KA4BQ;CACJ,CAAA;AAEjB,CAAC;AAED,eAAe,cAAc"}
|
|
@@ -7,9 +7,10 @@ export type BitkitToggletipProps = {
|
|
|
7
7
|
button?: BitkitColorButtonProps;
|
|
8
8
|
/**
|
|
9
9
|
* The trigger the toggletip opens from. Rendered via `asChild`, so it must be a focusable control
|
|
10
|
-
* that accepts a ref — unless `wrapTrigger` puts a button in between.
|
|
10
|
+
* that accepts a ref — unless `wrapTrigger` puts a button in between. Omit it for a hint that is
|
|
11
|
+
* only anchored to an element, not opened by it: control `open` and pass `positioning.getAnchorElement`.
|
|
11
12
|
*/
|
|
12
|
-
children
|
|
13
|
+
children?: ReactNode;
|
|
13
14
|
/** Open on first render, for an uncontrolled toggletip. */
|
|
14
15
|
defaultOpen?: PopoverRootProps['defaultOpen'];
|
|
15
16
|
/**
|
|
@@ -31,6 +32,8 @@ export type BitkitToggletipProps = {
|
|
|
31
32
|
open?: PopoverRootProps['open'];
|
|
32
33
|
/** Where the toggletip sits relative to the trigger (default `top`). It flips if space is short. */
|
|
33
34
|
placement?: NonNullable<PopoverRootProps['positioning']>['placement'];
|
|
35
|
+
/** `getAnchorElement` positions the toggletip against that element instead of the trigger. */
|
|
36
|
+
positioning?: Pick<NonNullable<PopoverRootProps['positioning']>, 'getAnchorElement'>;
|
|
34
37
|
/** The toggletip's text. */
|
|
35
38
|
text: string;
|
|
36
39
|
/** Accessible name of the `wrapTrigger` button, for a trigger with no text of its own, like an icon. */
|
|
@@ -49,11 +52,14 @@ export type BitkitToggletipProps = {
|
|
|
49
52
|
*
|
|
50
53
|
* Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.
|
|
51
54
|
*
|
|
55
|
+
* Without `children` it renders no trigger: anchor it with `positioning.getAnchorElement` and control
|
|
56
|
+
* `open`, for a hint that points at an element without the element opening it.
|
|
57
|
+
*
|
|
52
58
|
* The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.
|
|
53
59
|
* Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
54
60
|
*/
|
|
55
61
|
declare const BitkitToggletip: {
|
|
56
|
-
({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement, text, triggerAriaLabel, wrapTrigger, }: BitkitToggletipProps): import('react').JSX.Element;
|
|
62
|
+
({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement, positioning, text, triggerAriaLabel, wrapTrigger, }: BitkitToggletipProps): import('react').JSX.Element | null;
|
|
57
63
|
displayName: string;
|
|
58
64
|
};
|
|
59
65
|
export default BitkitToggletip;
|
|
@@ -24,27 +24,31 @@ var ArrowTip = withContext(Popover.ArrowTip, "arrowTip", { forwardAsChild: true
|
|
|
24
24
|
*
|
|
25
25
|
* Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.
|
|
26
26
|
*
|
|
27
|
+
* Without `children` it renders no trigger: anchor it with `positioning.getAnchorElement` and control
|
|
28
|
+
* `open`, for a hint that points at an element without the element opening it.
|
|
29
|
+
*
|
|
27
30
|
* The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.
|
|
28
31
|
* Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
29
32
|
*/
|
|
30
|
-
var BitkitToggletip = ({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement = "top", text, triggerAriaLabel, wrapTrigger }) => {
|
|
33
|
+
var BitkitToggletip = ({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement = "top", positioning, text, triggerAriaLabel, wrapTrigger }) => {
|
|
31
34
|
const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);
|
|
32
35
|
const hasActions = !!learnMoreUrl || !!button;
|
|
33
|
-
if (disabled) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
36
|
+
if (disabled) return children == null ? null : /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
34
37
|
return /* @__PURE__ */ jsxs(Root, {
|
|
35
38
|
defaultOpen,
|
|
36
39
|
lazyMount: true,
|
|
37
40
|
onOpenChange,
|
|
38
41
|
open,
|
|
39
42
|
positioning: {
|
|
40
|
-
|
|
43
|
+
...positioning,
|
|
41
44
|
offset: {
|
|
42
45
|
mainAxis: 4,
|
|
43
46
|
crossAxis: 0
|
|
44
|
-
}
|
|
47
|
+
},
|
|
48
|
+
placement
|
|
45
49
|
},
|
|
46
50
|
unmountOnExit: true,
|
|
47
|
-
children: [wrapTrigger || !isValidElement(children) ? /* @__PURE__ */ jsx(Trigger, {
|
|
51
|
+
children: [children != null && (wrapTrigger || !isValidElement(children)) ? /* @__PURE__ */ jsx(Trigger, {
|
|
48
52
|
"aria-label": triggerAriaLabel,
|
|
49
53
|
css: {
|
|
50
54
|
alignItems: "center",
|
|
@@ -66,7 +70,7 @@ var BitkitToggletip = ({ button, children, defaultOpen, disablePortal, disabled,
|
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
children
|
|
69
|
-
}) : /* @__PURE__ */ jsx(Trigger, {
|
|
73
|
+
}) : children != null && /* @__PURE__ */ jsx(Trigger, {
|
|
70
74
|
asChild: true,
|
|
71
75
|
children
|
|
72
76
|
}), /* @__PURE__ */ jsx(Portal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitToggletip.js","names":["ArkPopover","_Fragment"],"sources":["../../../lib/components/BitkitToggletip/BitkitToggletip.tsx"],"sourcesContent":["import { Popover as ArkPopover, type PopoverRootProps } from '@ark-ui/react/popover';\nimport { Box } from '@chakra-ui/react/box';\nimport { Link } from '@chakra-ui/react/link';\nimport {\n type PopoverArrowProps,\n type PopoverArrowTipProps,\n type PopoverContentProps,\n type PopoverPositionerProps,\n type PopoverTitleProps,\n type PopoverTriggerProps,\n} from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { createSlotRecipeContext } from '@chakra-ui/react/styled-system';\nimport { isValidElement, type ReactNode, useContext } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitColorButton, { type BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';\n\n// Chakra's own Popover is Ark's popover under the `popover` recipe; this is the same composition\n// under `toggletip`, so the bubble can share the tooltip's surface instead of the popover's card.\nconst { withRootProvider, withContext } = createSlotRecipeContext({ key: 'toggletip' });\nconst Root = withRootProvider<PopoverRootProps>(ArkPopover.Root);\nconst Trigger = withContext<HTMLButtonElement, PopoverTriggerProps>(ArkPopover.Trigger, 'trigger', {\n forwardAsChild: true,\n});\nconst Positioner = withContext<HTMLDivElement, PopoverPositionerProps>(ArkPopover.Positioner, 'positioner', {\n forwardAsChild: true,\n});\nconst Content = withContext<HTMLDivElement, PopoverContentProps>(ArkPopover.Content, 'content', {\n forwardAsChild: true,\n});\n// The text is the popover's title, which is what names its dialog for assistive technology.\nconst Title = withContext<HTMLDivElement, PopoverTitleProps>(ArkPopover.Title, 'title', { forwardAsChild: true });\nconst Arrow = withContext<HTMLDivElement, PopoverArrowProps>(ArkPopover.Arrow, 'arrow', { forwardAsChild: true });\nconst ArrowTip = withContext<HTMLDivElement, PopoverArrowTipProps>(ArkPopover.ArrowTip, 'arrowTip', {\n forwardAsChild: true,\n});\n\nexport type BitkitToggletipProps = {\n /** Action button at the end of the toggletip. Defaults to the `contrast` colour variant, which follows the toggletip's background in both color modes. */\n button?: BitkitColorButtonProps;\n /**\n * The trigger the toggletip opens from. Rendered via `asChild`, so it must be a focusable control\n * that accepts a ref — unless `wrapTrigger` puts a button in between.\n */\n children: ReactNode;\n /** Open on first render, for an uncontrolled toggletip. */\n defaultOpen?: PopoverRootProps['defaultOpen'];\n /**\n * Render the toggletip inline instead of in a portal. Only needed when it must stay inside its\n * parent's DOM subtree — a dialog already sets this for you.\n */\n disablePortal?: boolean;\n /** Render the trigger without a toggletip — for hints that only apply in some states. */\n disabled?: boolean;\n /** Icon after the text — `IconArrowNortheast` when the trigger opens something in a new tab, for instance. */\n icon?: BitkitIconComponent;\n /** Target for the \"Learn more\" link. `_blank` also sets `rel=\"noopener noreferrer\"`. */\n learnMoreTarget?: HTMLAnchorElement['target'];\n /** Adds a \"Learn more\" link pointing here, for the fuller explanation. */\n learnMoreUrl?: string;\n /** Called when the toggletip opens or closes. */\n onOpenChange?: PopoverRootProps['onOpenChange'];\n /** Controls the open state. */\n open?: PopoverRootProps['open'];\n /** Where the toggletip sits relative to the trigger (default `top`). It flips if space is short. */\n placement?: NonNullable<PopoverRootProps['positioning']>['placement'];\n /** The toggletip's text. */\n text: string;\n /** Accessible name of the `wrapTrigger` button, for a trigger with no text of its own, like an icon. */\n triggerAriaLabel?: string;\n /**\n * Put the trigger inside a button instead of rendering on it — for a trigger that is not a control\n * itself, like a badge or an icon. The button takes the click, the tap and the keyboard.\n */\n wrapTrigger?: boolean;\n};\n\n/**\n * A tooltip's bubble that opens on click, tap or Enter and stays open, so what it carries — a \"Learn\n * more\" link, an action button — can be reached by pointer, touch and keyboard alike. It is a\n * popover, not a tooltip: a tooltip closes as soon as focus leaves its trigger and ignores touch, so\n * anything clickable inside one can't be reached.\n *\n * Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.\n *\n * The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.\n * Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.\n */\nconst BitkitToggletip = ({\n button,\n children,\n defaultOpen,\n disablePortal,\n disabled,\n icon: Icon,\n learnMoreTarget,\n learnMoreUrl,\n onOpenChange,\n open,\n placement = 'top',\n text,\n triggerAriaLabel,\n wrapTrigger,\n}: BitkitToggletipProps) => {\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const hasActions = !!learnMoreUrl || !!button;\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n // Mounted only while open, like Chakra's tooltip: a list of closed toggletips keeps no content in the DOM.\n <Root\n defaultOpen={defaultOpen}\n lazyMount\n onOpenChange={onOpenChange}\n open={open}\n positioning={{ placement, offset: { mainAxis: 4, crossAxis: 0 } }}\n unmountOnExit\n >\n {wrapTrigger || !isValidElement(children) ? (\n <Trigger\n aria-label={triggerAriaLabel}\n css={{\n alignItems: 'center',\n appearance: 'none',\n background: 'none',\n border: 0,\n color: 'inherit',\n display: 'inline-flex',\n font: 'inherit',\n padding: 0,\n // The button owns the tab stop, but the focus ring belongs on the trigger inside it: an\n // outline follows the border-radius of the element it is drawn on, and the button has\n // none — so leaving it here squares off a pill or a round trigger.\n _focusVisible: {\n outline: 'none',\n '& > *': {\n outlineColor: 'var(--focus-ring-color)',\n outlineOffset: 'var(--focus-ring-offset, 2px)',\n outlineStyle: 'var(--focus-ring-style, solid)',\n outlineWidth: 'var(--focus-ring-width, 2px)',\n },\n },\n }}\n >\n {children}\n </Trigger>\n ) : (\n <Trigger asChild>{children}</Trigger>\n )}\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Positioner>\n <Content>\n <Arrow>\n <ArrowTip />\n </Arrow>\n <Box display=\"flex\" gap=\"8\">\n <Title>{text}</Title>\n {Icon && <Icon flexShrink=\"0\" size=\"16\" />}\n </Box>\n {hasActions && (\n <Box alignItems=\"center\" display=\"flex\" gap=\"16\" marginBlockStart=\"16\">\n {learnMoreUrl && (\n <Link\n color=\"color/purple/highlight\"\n href={learnMoreUrl}\n rel={learnMoreTarget === '_blank' ? 'noopener noreferrer' : undefined}\n target={learnMoreTarget}\n >\n Learn more\n </Link>\n )}\n {button && <BitkitColorButton colorVariant=\"contrast\" marginInlineStart=\"auto\" {...button} />}\n </Box>\n )}\n </Content>\n </Positioner>\n </Portal>\n </Root>\n );\n};\n\nBitkitToggletip.displayName = 'BitkitToggletip';\n\nexport default BitkitToggletip;\n"],"mappings":";;;;;;;;;;AAqBA,IAAM,EAAE,kBAAkB,gBAAgB,wBAAwB,EAAE,KAAK,YAAY,CAAC;AACtF,IAAM,OAAO,iBAAmCA,QAAW,IAAI;AAC/D,IAAM,UAAU,YAAoDA,QAAW,SAAS,WAAW,EACjG,gBAAgB,KAClB,CAAC;AACD,IAAM,aAAa,YAAoDA,QAAW,YAAY,cAAc,EAC1G,gBAAgB,KAClB,CAAC;AACD,IAAM,UAAU,YAAiDA,QAAW,SAAS,WAAW,EAC9F,gBAAgB,KAClB,CAAC;AAED,IAAM,QAAQ,YAA+CA,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,QA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KAAD;KAAK,YAAW;KAAS,SAAQ;KAAO,KAAI;KAAK,kBAAiB;KAAlE,UAAA,CACG,gBACC,oBAAC,MAAD;MACE,OAAM;MACN,MAAM;MACN,KAAK,oBAAoB,WAAW,wBAAwB,KAAA;MAC5D,QAAQ;MACT,UAAA;KAEK,CAAA,GAEP,UAAU,oBAAC,mBAAD;MAAmB,cAAa;MAAW,mBAAkB;MAAO,GAAI;KAAS,CAAA,CACzF;;GAEA,EAAA,CAAA,EACC,CAAA;EACN,CAAA,CACJ;;AAEV;AAEA,gBAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"BitkitToggletip.js","names":["ArkPopover","_Fragment"],"sources":["../../../lib/components/BitkitToggletip/BitkitToggletip.tsx"],"sourcesContent":["import { Popover as ArkPopover, type PopoverRootProps } from '@ark-ui/react/popover';\nimport { Box } from '@chakra-ui/react/box';\nimport { Link } from '@chakra-ui/react/link';\nimport {\n type PopoverArrowProps,\n type PopoverArrowTipProps,\n type PopoverContentProps,\n type PopoverPositionerProps,\n type PopoverTitleProps,\n type PopoverTriggerProps,\n} from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { createSlotRecipeContext } from '@chakra-ui/react/styled-system';\nimport { isValidElement, type ReactNode, useContext } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitColorButton, { type BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';\n\n// Chakra's own Popover is Ark's popover under the `popover` recipe; this is the same composition\n// under `toggletip`, so the bubble can share the tooltip's surface instead of the popover's card.\nconst { withRootProvider, withContext } = createSlotRecipeContext({ key: 'toggletip' });\nconst Root = withRootProvider<PopoverRootProps>(ArkPopover.Root);\nconst Trigger = withContext<HTMLButtonElement, PopoverTriggerProps>(ArkPopover.Trigger, 'trigger', {\n forwardAsChild: true,\n});\nconst Positioner = withContext<HTMLDivElement, PopoverPositionerProps>(ArkPopover.Positioner, 'positioner', {\n forwardAsChild: true,\n});\nconst Content = withContext<HTMLDivElement, PopoverContentProps>(ArkPopover.Content, 'content', {\n forwardAsChild: true,\n});\n// The text is the popover's title, which is what names its dialog for assistive technology.\nconst Title = withContext<HTMLDivElement, PopoverTitleProps>(ArkPopover.Title, 'title', { forwardAsChild: true });\nconst Arrow = withContext<HTMLDivElement, PopoverArrowProps>(ArkPopover.Arrow, 'arrow', { forwardAsChild: true });\nconst ArrowTip = withContext<HTMLDivElement, PopoverArrowTipProps>(ArkPopover.ArrowTip, 'arrowTip', {\n forwardAsChild: true,\n});\n\nexport type BitkitToggletipProps = {\n /** Action button at the end of the toggletip. Defaults to the `contrast` colour variant, which follows the toggletip's background in both color modes. */\n button?: BitkitColorButtonProps;\n /**\n * The trigger the toggletip opens from. Rendered via `asChild`, so it must be a focusable control\n * that accepts a ref — unless `wrapTrigger` puts a button in between. Omit it for a hint that is\n * only anchored to an element, not opened by it: control `open` and pass `positioning.getAnchorElement`.\n */\n children?: ReactNode;\n /** Open on first render, for an uncontrolled toggletip. */\n defaultOpen?: PopoverRootProps['defaultOpen'];\n /**\n * Render the toggletip inline instead of in a portal. Only needed when it must stay inside its\n * parent's DOM subtree — a dialog already sets this for you.\n */\n disablePortal?: boolean;\n /** Render the trigger without a toggletip — for hints that only apply in some states. */\n disabled?: boolean;\n /** Icon after the text — `IconArrowNortheast` when the trigger opens something in a new tab, for instance. */\n icon?: BitkitIconComponent;\n /** Target for the \"Learn more\" link. `_blank` also sets `rel=\"noopener noreferrer\"`. */\n learnMoreTarget?: HTMLAnchorElement['target'];\n /** Adds a \"Learn more\" link pointing here, for the fuller explanation. */\n learnMoreUrl?: string;\n /** Called when the toggletip opens or closes. */\n onOpenChange?: PopoverRootProps['onOpenChange'];\n /** Controls the open state. */\n open?: PopoverRootProps['open'];\n /** Where the toggletip sits relative to the trigger (default `top`). It flips if space is short. */\n placement?: NonNullable<PopoverRootProps['positioning']>['placement'];\n /** `getAnchorElement` positions the toggletip against that element instead of the trigger. */\n positioning?: Pick<NonNullable<PopoverRootProps['positioning']>, 'getAnchorElement'>;\n /** The toggletip's text. */\n text: string;\n /** Accessible name of the `wrapTrigger` button, for a trigger with no text of its own, like an icon. */\n triggerAriaLabel?: string;\n /**\n * Put the trigger inside a button instead of rendering on it — for a trigger that is not a control\n * itself, like a badge or an icon. The button takes the click, the tap and the keyboard.\n */\n wrapTrigger?: boolean;\n};\n\n/**\n * A tooltip's bubble that opens on click, tap or Enter and stays open, so what it carries — a \"Learn\n * more\" link, an action button — can be reached by pointer, touch and keyboard alike. It is a\n * popover, not a tooltip: a tooltip closes as soon as focus leaves its trigger and ignores touch, so\n * anything clickable inside one can't be reached.\n *\n * Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.\n *\n * Without `children` it renders no trigger: anchor it with `positioning.getAnchorElement` and control\n * `open`, for a hint that points at an element without the element opening it.\n *\n * The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.\n * Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.\n */\nconst BitkitToggletip = ({\n button,\n children,\n defaultOpen,\n disablePortal,\n disabled,\n icon: Icon,\n learnMoreTarget,\n learnMoreUrl,\n onOpenChange,\n open,\n placement = 'top',\n positioning,\n text,\n triggerAriaLabel,\n wrapTrigger,\n}: BitkitToggletipProps) => {\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const hasActions = !!learnMoreUrl || !!button;\n\n if (disabled) {\n return children == null ? null : <>{children}</>;\n }\n\n return (\n // Mounted only while open, like Chakra's tooltip: a list of closed toggletips keeps no content in the DOM.\n <Root\n defaultOpen={defaultOpen}\n lazyMount\n onOpenChange={onOpenChange}\n open={open}\n positioning={{ ...positioning, offset: { mainAxis: 4, crossAxis: 0 }, placement }}\n unmountOnExit\n >\n {children != null && (wrapTrigger || !isValidElement(children)) ? (\n <Trigger\n aria-label={triggerAriaLabel}\n css={{\n alignItems: 'center',\n appearance: 'none',\n background: 'none',\n border: 0,\n color: 'inherit',\n display: 'inline-flex',\n font: 'inherit',\n padding: 0,\n // The button owns the tab stop, but the focus ring belongs on the trigger inside it: an\n // outline follows the border-radius of the element it is drawn on, and the button has\n // none — so leaving it here squares off a pill or a round trigger.\n _focusVisible: {\n outline: 'none',\n '& > *': {\n outlineColor: 'var(--focus-ring-color)',\n outlineOffset: 'var(--focus-ring-offset, 2px)',\n outlineStyle: 'var(--focus-ring-style, solid)',\n outlineWidth: 'var(--focus-ring-width, 2px)',\n },\n },\n }}\n >\n {children}\n </Trigger>\n ) : (\n children != null && <Trigger asChild>{children}</Trigger>\n )}\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Positioner>\n <Content>\n <Arrow>\n <ArrowTip />\n </Arrow>\n <Box display=\"flex\" gap=\"8\">\n <Title>{text}</Title>\n {Icon && <Icon flexShrink=\"0\" size=\"16\" />}\n </Box>\n {hasActions && (\n <Box alignItems=\"center\" display=\"flex\" gap=\"16\" marginBlockStart=\"16\">\n {learnMoreUrl && (\n <Link\n color=\"color/purple/highlight\"\n href={learnMoreUrl}\n rel={learnMoreTarget === '_blank' ? 'noopener noreferrer' : undefined}\n target={learnMoreTarget}\n >\n Learn more\n </Link>\n )}\n {button && <BitkitColorButton colorVariant=\"contrast\" marginInlineStart=\"auto\" {...button} />}\n </Box>\n )}\n </Content>\n </Positioner>\n </Portal>\n </Root>\n );\n};\n\nBitkitToggletip.displayName = 'BitkitToggletip';\n\nexport default BitkitToggletip;\n"],"mappings":";;;;;;;;;;AAqBA,IAAM,EAAE,kBAAkB,gBAAgB,wBAAwB,EAAE,KAAK,YAAY,CAAC;AACtF,IAAM,OAAO,iBAAmCA,QAAW,IAAI;AAC/D,IAAM,UAAU,YAAoDA,QAAW,SAAS,WAAW,EACjG,gBAAgB,KAClB,CAAC;AACD,IAAM,aAAa,YAAoDA,QAAW,YAAY,cAAc,EAC1G,gBAAgB,KAClB,CAAC;AACD,IAAM,UAAU,YAAiDA,QAAW,SAAS,WAAW,EAC9F,gBAAgB,KAClB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;KAAO,KAAI;KAAxB,UAAA,CACE,oBAAC,OAAD,EAAA,UAAQ,KAAY,CAAA,GACnB,QAAQ,oBAAC,MAAD;MAAM,YAAW;MAAI,MAAK;KAAM,CAAA,CACtC;;IACJ,cACC,qBAAC,KAAD;KAAK,YAAW;KAAS,SAAQ;KAAO,KAAI;KAAK,kBAAiB;KAAlE,UAAA,CACG,gBACC,oBAAC,MAAD;MACE,OAAM;MACN,MAAM;MACN,KAAK,oBAAoB,WAAW,wBAAwB,KAAA;MAC5D,QAAQ;MACT,UAAA;KAEK,CAAA,GAEP,UAAU,oBAAC,mBAAD;MAAmB,cAAa;MAAW,mBAAkB;MAAO,GAAI;KAAS,CAAA,CACzF;;GAEA,EAAA,CAAA,EACC,CAAA;EACN,CAAA,CACJ;;AAEV;AAEA,gBAAgB,cAAc"}
|
|
@@ -28,8 +28,16 @@ declare const drawerSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<
|
|
|
28
28
|
base: "16";
|
|
29
29
|
tablet: "24";
|
|
30
30
|
};
|
|
31
|
+
paddingInlineEnd: {
|
|
32
|
+
base: "64";
|
|
33
|
+
tablet: `${number}rem`;
|
|
34
|
+
};
|
|
31
35
|
'& :has(> [role=tablist])': {
|
|
32
|
-
|
|
36
|
+
marginInlineEnd: {
|
|
37
|
+
base: `${number}rem`;
|
|
38
|
+
tablet: "-64";
|
|
39
|
+
};
|
|
40
|
+
marginInlineStart: {
|
|
33
41
|
base: "-8";
|
|
34
42
|
tablet: "-16";
|
|
35
43
|
};
|
|
@@ -64,8 +72,10 @@ declare const drawerSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<
|
|
|
64
72
|
paddingBlockEnd: "16";
|
|
65
73
|
paddingBlockStart: "24";
|
|
66
74
|
paddingInline: "24";
|
|
75
|
+
paddingInlineEnd: `${number}rem`;
|
|
67
76
|
'& :has(> [role=tablist])': {
|
|
68
|
-
|
|
77
|
+
marginInlineEnd: "-64";
|
|
78
|
+
marginInlineStart: "-16";
|
|
69
79
|
};
|
|
70
80
|
};
|
|
71
81
|
footer: {
|
|
@@ -26,6 +26,7 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
|
26
26
|
inset: 0,
|
|
27
27
|
justifyContent: "flex-end",
|
|
28
28
|
overscrollBehaviorY: "none",
|
|
29
|
+
pointerEvents: "none",
|
|
29
30
|
position: "fixed",
|
|
30
31
|
zIndex: "calc({zIndex.dialog} + var(--layer-index, 0))"
|
|
31
32
|
},
|
|
@@ -35,6 +36,7 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
|
35
36
|
flexDirection: "column",
|
|
36
37
|
maxHeight: "100dvh",
|
|
37
38
|
outline: "none",
|
|
39
|
+
pointerEvents: "auto",
|
|
38
40
|
position: "relative",
|
|
39
41
|
_open: {
|
|
40
42
|
animationDuration: "slowest",
|
|
@@ -70,8 +72,6 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
|
70
72
|
},
|
|
71
73
|
title: {
|
|
72
74
|
color: "text/tertiary",
|
|
73
|
-
flex: "1",
|
|
74
|
-
paddingInlineEnd: "48",
|
|
75
75
|
textStyle: "heading/h6"
|
|
76
76
|
},
|
|
77
77
|
description: {},
|
|
@@ -113,10 +113,20 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
|
113
113
|
base: "16",
|
|
114
114
|
tablet: "24"
|
|
115
115
|
},
|
|
116
|
-
|
|
117
|
-
base: "
|
|
118
|
-
tablet:
|
|
119
|
-
}
|
|
116
|
+
paddingInlineEnd: {
|
|
117
|
+
base: "64",
|
|
118
|
+
tablet: rem(72)
|
|
119
|
+
},
|
|
120
|
+
"& :has(> [role=tablist])": {
|
|
121
|
+
marginInlineEnd: {
|
|
122
|
+
base: rem(-56),
|
|
123
|
+
tablet: "-64"
|
|
124
|
+
},
|
|
125
|
+
marginInlineStart: {
|
|
126
|
+
base: "-8",
|
|
127
|
+
tablet: "-16"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
120
130
|
}
|
|
121
131
|
},
|
|
122
132
|
floating: {
|
|
@@ -143,7 +153,11 @@ var drawerSlotRecipe = defineSlotRecipe({
|
|
|
143
153
|
paddingBlockEnd: "16",
|
|
144
154
|
paddingBlockStart: "24",
|
|
145
155
|
paddingInline: "24",
|
|
146
|
-
|
|
156
|
+
paddingInlineEnd: rem(72),
|
|
157
|
+
"& :has(> [role=tablist])": {
|
|
158
|
+
marginInlineEnd: "-64",
|
|
159
|
+
marginInlineStart: "-16"
|
|
160
|
+
}
|
|
147
161
|
},
|
|
148
162
|
footer: {
|
|
149
163
|
borderBlockStartColor: "transparent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Drawer.recipe.ts"],"sourcesContent":["import { drawerAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst drawerSlotRecipe = defineSlotRecipe({\n className: 'drawer',\n slots: drawerAnatomy.keys(),\n base: {\n backdrop: {\n background: 'utilities/overlay-light',\n inset: 0,\n position: 'fixed',\n zIndex: 'calc({zIndex.dialogOverlay} + var(--layer-index, 0))',\n _open: {\n animationName: 'fade-in',\n animationDuration: 'slow',\n },\n _closed: {\n animationName: 'fade-out',\n animationDuration: 'moderate',\n },\n },\n positioner: {\n alignItems: 'stretch',\n display: 'flex',\n inset: 0,\n justifyContent: 'flex-end',\n overscrollBehaviorY: 'none',\n position: 'fixed',\n zIndex: 'calc({zIndex.dialog} + var(--layer-index, 0))',\n },\n content: {\n background: 'background/primary',\n display: 'flex',\n flexDirection: 'column',\n maxHeight: '100dvh',\n outline: 'none',\n position: 'relative',\n _open: {\n animationDuration: 'slowest',\n animationName: {\n base: 'slide-from-right-full, fade-in',\n _rtl: 'slide-from-left-full, fade-in',\n },\n animationTimingFunction: 'ease-in-smooth',\n },\n _closed: {\n animationDuration: 'slower',\n animationName: {\n base: 'slide-to-right-full, fade-out',\n _rtl: 'slide-to-left-full, fade-out',\n },\n animationTimingFunction: 'ease-in-smooth',\n },\n },\n header: {\n paddingBlockEnd: '8',\n paddingBlockStart: '24',\n paddingInline: '24',\n // A tab list in the header closes it off with its own baseline.\n '&:has([role=tablist])': {\n paddingBlockEnd: 0,\n },\n },\n body: {\n flex: '1',\n overflow: 'auto',\n },\n footer: {\n borderBlockStartColor: 'border/regular',\n borderBlockStartWidth: '1',\n paddingBlock: '12',\n },\n title: {\n color: 'text/tertiary',\n
|
|
1
|
+
{"version":3,"file":"Drawer.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/Drawer.recipe.ts"],"sourcesContent":["import { drawerAnatomy } from '@chakra-ui/react/anatomy';\nimport { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nimport { rem } from '../themeUtils';\n\nconst drawerSlotRecipe = defineSlotRecipe({\n className: 'drawer',\n slots: drawerAnatomy.keys(),\n base: {\n backdrop: {\n background: 'utilities/overlay-light',\n inset: 0,\n position: 'fixed',\n zIndex: 'calc({zIndex.dialogOverlay} + var(--layer-index, 0))',\n _open: {\n animationName: 'fade-in',\n animationDuration: 'slow',\n },\n _closed: {\n animationName: 'fade-out',\n animationDuration: 'moderate',\n },\n },\n positioner: {\n alignItems: 'stretch',\n display: 'flex',\n inset: 0,\n justifyContent: 'flex-end',\n overscrollBehaviorY: 'none',\n pointerEvents: 'none',\n position: 'fixed',\n zIndex: 'calc({zIndex.dialog} + var(--layer-index, 0))',\n },\n content: {\n background: 'background/primary',\n display: 'flex',\n flexDirection: 'column',\n maxHeight: '100dvh',\n outline: 'none',\n pointerEvents: 'auto',\n position: 'relative',\n _open: {\n animationDuration: 'slowest',\n animationName: {\n base: 'slide-from-right-full, fade-in',\n _rtl: 'slide-from-left-full, fade-in',\n },\n animationTimingFunction: 'ease-in-smooth',\n },\n _closed: {\n animationDuration: 'slower',\n animationName: {\n base: 'slide-to-right-full, fade-out',\n _rtl: 'slide-to-left-full, fade-out',\n },\n animationTimingFunction: 'ease-in-smooth',\n },\n },\n header: {\n paddingBlockEnd: '8',\n paddingBlockStart: '24',\n paddingInline: '24',\n // A tab list in the header closes it off with its own baseline.\n '&:has([role=tablist])': {\n paddingBlockEnd: 0,\n },\n },\n body: {\n flex: '1',\n overflow: 'auto',\n },\n footer: {\n borderBlockStartColor: 'border/regular',\n borderBlockStartWidth: '1',\n paddingBlock: '12',\n },\n title: {\n color: 'text/tertiary',\n textStyle: 'heading/h6',\n },\n description: {},\n closeTrigger: {\n alignItems: 'center',\n borderRadius: '4',\n color: 'icon/primary',\n cursor: 'pointer',\n display: 'inline-flex',\n height: '40',\n justifyContent: 'center',\n position: 'absolute',\n width: '40',\n _hover: {\n backgroundColor: 'color/neutral/subtle',\n },\n _active: {\n backgroundColor: 'color/neutral/moderate',\n },\n },\n },\n variants: {\n variant: {\n // One inline padding for header, body and footer, so their content lines up: 16 on mobile, 24 from tablet.\n docked: {\n body: {\n padding: { base: '16', tablet: '24' },\n },\n closeTrigger: {\n insetEnd: rem(18),\n top: '12',\n },\n content: {\n width: { base: '100vw', tablet: rem(320) },\n },\n footer: {\n paddingInline: { base: '16', tablet: '24' },\n },\n header: {\n paddingInline: { base: '16', tablet: '24' },\n paddingInlineEnd: { base: '64', tablet: rem(72) },\n // Tabs sit 8px from the edge, so their baseline runs nearly full width.\n '& :has(> [role=tablist])': {\n marginInlineEnd: { base: rem(-56), tablet: '-64' },\n marginInlineStart: { base: '-8', tablet: '-16' },\n },\n },\n },\n floating: {\n body: {\n // The bottom 24 is the body's, not the footer's, so a drawer without a footer still ends on it.\n paddingBlockEnd: '24',\n paddingBlockStart: '8',\n paddingInline: '24',\n '*:has([role=tablist]) ~ &': {\n paddingBlockStart: '24',\n },\n },\n closeTrigger: {\n height: '32',\n insetEnd: '20',\n top: '20',\n width: '32',\n },\n positioner: {\n padding: '32',\n },\n content: {\n borderRadius: '12',\n boxShadow: 'elevation/lg',\n // A size lifts this cap through the variable, which also reaches a responsive `variant`'s tablet-scoped rule.\n maxWidth: `var(--drawer-floating-max-width, ${rem(700)})`,\n // 480 is the floating drawer's smallest step, so xxs and xs land on it too; on narrow screens it gives way to the viewport.\n minWidth: `min(100%, ${rem(480)})`,\n },\n header: {\n paddingBlockEnd: '16',\n paddingBlockStart: '24',\n paddingInline: '24',\n paddingInlineEnd: rem(72),\n '& :has(> [role=tablist])': {\n marginInlineEnd: '-64',\n marginInlineStart: '-16',\n },\n },\n footer: {\n borderBlockStartColor: 'transparent',\n borderBlockStartWidth: 0,\n paddingBlockEnd: '24',\n // With the body's bottom 24, the gap above the footer stays 32.\n paddingBlockStart: '8',\n paddingInline: '24',\n },\n title: {\n color: 'text/primary',\n textStyle: 'heading/h3',\n },\n },\n },\n // Plain variants rather than compounds, so a size also works with a responsive `variant`, which compound variants\n // never match. Widths apply from tablet up; below that the variant's own width stays (docked: full width,\n // floating: sized to content).\n size: {\n xxs: { content: { '--drawer-floating-max-width': '100%', width: { tablet: rem(320) } } },\n xs: { content: { '--drawer-floating-max-width': '100%', width: { tablet: rem(360) } } },\n sm: { content: { '--drawer-floating-max-width': '100%', width: { tablet: rem(480) } } },\n md: { content: { '--drawer-floating-max-width': '100%', width: { tablet: rem(640) } } },\n lg: { content: { '--drawer-floating-max-width': '100%', width: { tablet: rem(800) } } },\n },\n },\n defaultVariants: {\n variant: 'docked',\n },\n});\n\nexport default drawerSlotRecipe;\n"],"mappings":";;;;AAKA,IAAM,mBAAmB,iBAAiB;CACxC,WAAW;CACX,OAAO,cAAc,KAAK;CAC1B,MAAM;EACJ,UAAU;GACR,YAAY;GACZ,OAAO;GACP,UAAU;GACV,QAAQ;GACR,OAAO;IACL,eAAe;IACf,mBAAmB;GACrB;GACA,SAAS;IACP,eAAe;IACf,mBAAmB;GACrB;EACF;EACA,YAAY;GACV,YAAY;GACZ,SAAS;GACT,OAAO;GACP,gBAAgB;GAChB,qBAAqB;GACrB,eAAe;GACf,UAAU;GACV,QAAQ;EACV;EACA,SAAS;GACP,YAAY;GACZ,SAAS;GACT,eA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KACnB,eAAe;KACf,6BAA6B,EAC3B,mBAAmB,KACrB;IACF;IACA,cAAc;KACZ,QAAQ;KACR,UAAU;KACV,KAAK;KACL,OAAO;IACT;IACA,YAAY,EACV,SAAS,KACX;IACA,SAAS;KACP,cAAc;KACd,WAAW;KAEX,UAAU,oCAAoC,IAAI,GAAG,EAAE;KAEvD,UAAU,aAAa,IAAI,GAAG,EAAE;IAClC;IACA,QAAQ;KACN,iBAAiB;KACjB,mBAAmB;KACnB,eAAe;KACf,kBAAkB,IAAI,EAAE;KACxB,4BAA4B;MAC1B,iBAAiB;MACjB,mBAAmB;KACrB;IACF;IACA,QAAQ;KACN,uBAAuB;KACvB,uBAAuB;KACvB,iBAAiB;KAEjB,mBAAmB;KACnB,eAAe;IACjB;IACA,OAAO;KACL,OAAO;KACP,WAAW;IACb;GACF;EACF;EAIA,MAAM;GACJ,KAAK,EAAE,SAAS;IAAE,+BAA+B;IAAQ,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE;GAAE,EAAE;GACvF,IAAI,EAAE,SAAS;IAAE,+BAA+B;IAAQ,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE;GAAE,EAAE;GACtF,IAAI,EAAE,SAAS;IAAE,+BAA+B;IAAQ,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE;GAAE,EAAE;GACtF,IAAI,EAAE,SAAS;IAAE,+BAA+B;IAAQ,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE;GAAE,EAAE;GACtF,IAAI,EAAE,SAAS;IAAE,+BAA+B;IAAQ,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE;GAAE,EAAE;EACxF;CACF;CACA,iBAAiB,EACf,SAAS,SACX;AACF,CAAC"}
|
|
@@ -1051,8 +1051,16 @@ declare const slotRecipes: {
|
|
|
1051
1051
|
base: "16";
|
|
1052
1052
|
tablet: "24";
|
|
1053
1053
|
};
|
|
1054
|
+
paddingInlineEnd: {
|
|
1055
|
+
base: "64";
|
|
1056
|
+
tablet: `${number}rem`;
|
|
1057
|
+
};
|
|
1054
1058
|
'& :has(> [role=tablist])': {
|
|
1055
|
-
|
|
1059
|
+
marginInlineEnd: {
|
|
1060
|
+
base: `${number}rem`;
|
|
1061
|
+
tablet: "-64";
|
|
1062
|
+
};
|
|
1063
|
+
marginInlineStart: {
|
|
1056
1064
|
base: "-8";
|
|
1057
1065
|
tablet: "-16";
|
|
1058
1066
|
};
|
|
@@ -1087,8 +1095,10 @@ declare const slotRecipes: {
|
|
|
1087
1095
|
paddingBlockEnd: "16";
|
|
1088
1096
|
paddingBlockStart: "24";
|
|
1089
1097
|
paddingInline: "24";
|
|
1098
|
+
paddingInlineEnd: `${number}rem`;
|
|
1090
1099
|
'& :has(> [role=tablist])': {
|
|
1091
|
-
|
|
1100
|
+
marginInlineEnd: "-64";
|
|
1101
|
+
marginInlineStart: "-16";
|
|
1092
1102
|
};
|
|
1093
1103
|
};
|
|
1094
1104
|
footer: {
|