@bitrise/bitkit-v2 0.3.544 → 0.3.545-beta.3456

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.
@@ -1,21 +1,35 @@
1
1
  import { BoxProps } from '@chakra-ui/react/box';
2
- import { ReactNode, Ref } from 'react';
2
+ import { ComponentPropsWithoutRef, ReactNode, Ref } from 'react';
3
3
  export interface BitkitDraggableCardProps extends Omit<BoxProps, 'children'> {
4
4
  children: ReactNode;
5
- /** Ref for the drag handle element — pass useSortable().handleRef here. When provided, only the handle initiates drag. */
5
+ /**
6
+ * Props spread onto the drag handle `<button>` — pass `{ ...attributes, ...listeners }` from `@dnd-kit/core`'s
7
+ * `useSortable()` / `useDraggable()` here. When provided, only the handle initiates drag. Overrides the default
8
+ * `aria-label="Drag handle"`, so name what is being reordered (e.g. `aria-label="Reorder trigger"`).
9
+ */
10
+ handleProps?: Omit<ComponentPropsWithoutRef<'button'>, 'children' | 'type'>;
11
+ /**
12
+ * Ref for the drag handle `<button>` — pass `handleRef` from `@dnd-kit/react`'s `useSortable()`, or
13
+ * `setActivatorNodeRef` from `@dnd-kit/core`'s. When provided, only the handle initiates drag.
14
+ */
6
15
  handleRef?: Ref<HTMLButtonElement>;
7
16
  /** Whether this card is currently being dragged */
8
17
  isDragging?: boolean;
9
18
  /** Whether this card is a drop target placeholder */
10
19
  isDropTarget?: boolean;
20
+ /**
21
+ * `readOnly` renders a plain card: no drag handle, no hover or drag styles. `handleProps`, `handleRef`,
22
+ * `isDragging` and `isDropTarget` are ignored.
23
+ */
24
+ state?: 'readOnly';
11
25
  }
12
26
  /**
13
- * A card with a drag handle, designed for use with `@dnd-kit/react`.
27
+ * A card with a drag handle, designed for use with `@dnd-kit/react` or `@dnd-kit/core`.
14
28
  *
15
29
  * The component is purely presentational — it does not depend on `@dnd-kit`.
16
- * Pass the refs and state flags from `useSortable` (or `useDraggable`) to wire it up.
30
+ * Pass the refs, handle props and state flags from `useSortable` (or `useDraggable`) to wire it up.
17
31
  *
18
- * @example Full-card drag (default — the entire card is draggable)
32
+ * @example Full-card drag (default — no `handleRef` / `handleProps`, the entire card is draggable)
19
33
  * ```tsx
20
34
  * const { ref, isDragSource, isDropTarget } = useSortable({ id, index });
21
35
  *
@@ -32,6 +46,25 @@ export interface BitkitDraggableCardProps extends Omit<BoxProps, 'children'> {
32
46
  * {children}
33
47
  * </BitkitDraggableCard>
34
48
  * ```
49
+ *
50
+ * @example Read-only (a plain card, e.g. when the list can't be reordered)
51
+ * ```tsx
52
+ * <BitkitDraggableCard state="readOnly">{children}</BitkitDraggableCard>
53
+ * ```
54
+ *
55
+ * @example Handle-only drag with `@dnd-kit/core` / `@dnd-kit/sortable` (pass handleProps and handleRef)
56
+ * ```tsx
57
+ * const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef } = useSortable({ id });
58
+ *
59
+ * <BitkitDraggableCard
60
+ * ref={setNodeRef}
61
+ * handleProps={{ ...attributes, ...listeners, 'aria-label': 'Reorder trigger' }}
62
+ * handleRef={setActivatorNodeRef}
63
+ * isDragging={isDragging}
64
+ * >
65
+ * {children}
66
+ * </BitkitDraggableCard>
67
+ * ```
35
68
  */
36
69
  declare const BitkitDraggableCard: import('react').ForwardRefExoticComponent<BitkitDraggableCardProps & import('react').RefAttributes<HTMLDivElement>>;
37
70
  export default BitkitDraggableCard;
@@ -5,12 +5,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Box } from "@chakra-ui/react/box";
6
6
  // lib/components/BitkitDraggableCard/BitkitDraggableCard.tsx
7
7
  /**
8
- * A card with a drag handle, designed for use with `@dnd-kit/react`.
8
+ * A card with a drag handle, designed for use with `@dnd-kit/react` or `@dnd-kit/core`.
9
9
  *
10
10
  * The component is purely presentational — it does not depend on `@dnd-kit`.
11
- * Pass the refs and state flags from `useSortable` (or `useDraggable`) to wire it up.
11
+ * Pass the refs, handle props and state flags from `useSortable` (or `useDraggable`) to wire it up.
12
12
  *
13
- * @example Full-card drag (default — the entire card is draggable)
13
+ * @example Full-card drag (default — no `handleRef` / `handleProps`, the entire card is draggable)
14
14
  * ```tsx
15
15
  * const { ref, isDragSource, isDropTarget } = useSortable({ id, index });
16
16
  *
@@ -27,32 +27,57 @@ import { Box } from "@chakra-ui/react/box";
27
27
  * {children}
28
28
  * </BitkitDraggableCard>
29
29
  * ```
30
+ *
31
+ * @example Read-only (a plain card, e.g. when the list can't be reordered)
32
+ * ```tsx
33
+ * <BitkitDraggableCard state="readOnly">{children}</BitkitDraggableCard>
34
+ * ```
35
+ *
36
+ * @example Handle-only drag with `@dnd-kit/core` / `@dnd-kit/sortable` (pass handleProps and handleRef)
37
+ * ```tsx
38
+ * const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef } = useSortable({ id });
39
+ *
40
+ * <BitkitDraggableCard
41
+ * ref={setNodeRef}
42
+ * handleProps={{ ...attributes, ...listeners, 'aria-label': 'Reorder trigger' }}
43
+ * handleRef={setActivatorNodeRef}
44
+ * isDragging={isDragging}
45
+ * >
46
+ * {children}
47
+ * </BitkitDraggableCard>
48
+ * ```
30
49
  */
31
50
  var BitkitDraggableCard = forwardRef((props, ref) => {
32
- const { children, css, handleRef, isDragging = false, isDropTarget = false, ...rest } = props;
33
- const isFullCardDrag = !handleRef;
51
+ const { children, css, handleProps, handleRef, isDragging = false, isDropTarget = false, state, ...rest } = props;
52
+ const isReadOnly = state === "readOnly";
53
+ const dragMode = isReadOnly ? "none" : !handleRef && !handleProps ? "card" : "handle";
34
54
  const styles = useSlotRecipe({ key: "draggableCard" })({
35
- isDragging,
36
- isDropTarget,
37
- isFullCardDrag
55
+ dragMode,
56
+ isDragging: !isReadOnly && isDragging,
57
+ isDropTarget: !isReadOnly && isDropTarget
38
58
  });
39
59
  return /* @__PURE__ */ jsxs(Box, {
40
60
  ref,
41
61
  css: [styles.root, css],
42
62
  ...rest,
43
- children: [isFullCardDrag ? /* @__PURE__ */ jsx(chakra.div, {
44
- css: styles.handle,
45
- children: /* @__PURE__ */ jsx(IconDragHandle, { size: "16" })
46
- }) : /* @__PURE__ */ jsx(chakra.button, {
47
- ref: handleRef,
48
- type: "button",
49
- "aria-label": "Drag handle",
50
- css: styles.handle,
51
- children: /* @__PURE__ */ jsx(IconDragHandle, { size: "16" })
52
- }), /* @__PURE__ */ jsx(Box, {
53
- css: styles.content,
54
- children
55
- })]
63
+ children: [
64
+ dragMode === "card" && /* @__PURE__ */ jsx(chakra.div, {
65
+ css: styles.handle,
66
+ children: /* @__PURE__ */ jsx(IconDragHandle, { size: "16" })
67
+ }),
68
+ dragMode === "handle" && /* @__PURE__ */ jsx(chakra.button, {
69
+ "aria-label": "Drag handle",
70
+ ...handleProps,
71
+ ref: handleRef,
72
+ type: "button",
73
+ css: styles.handle,
74
+ children: /* @__PURE__ */ jsx(IconDragHandle, { size: "16" })
75
+ }),
76
+ /* @__PURE__ */ jsx(Box, {
77
+ css: styles.content,
78
+ children
79
+ })
80
+ ]
56
81
  });
57
82
  });
58
83
  BitkitDraggableCard.displayName = "BitkitDraggableCard";
@@ -1 +1 @@
1
- {"version":3,"file":"BitkitDraggableCard.js","names":[],"sources":["../../../lib/components/BitkitDraggableCard/BitkitDraggableCard.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { forwardRef, type ReactNode, type Ref } from 'react';\n\nimport IconDragHandle from '../../icons/IconDragHandle';\n\n// ----- Props -----\n\nexport interface BitkitDraggableCardProps extends Omit<BoxProps, 'children'> {\n children: ReactNode;\n /** Ref for the drag handle element — pass useSortable().handleRef here. When provided, only the handle initiates drag. */\n handleRef?: Ref<HTMLButtonElement>;\n /** Whether this card is currently being dragged */\n isDragging?: boolean;\n /** Whether this card is a drop target placeholder */\n isDropTarget?: boolean;\n}\n\n// ----- Component -----\n\n/**\n * A card with a drag handle, designed for use with `@dnd-kit/react`.\n *\n * The component is purely presentational — it does not depend on `@dnd-kit`.\n * Pass the refs and state flags from `useSortable` (or `useDraggable`) to wire it up.\n *\n * @example Full-card drag (default — the entire card is draggable)\n * ```tsx\n * const { ref, isDragSource, isDropTarget } = useSortable({ id, index });\n *\n * <BitkitDraggableCard ref={ref} isDragging={isDragSource} isDropTarget={isDropTarget}>\n * {children}\n * </BitkitDraggableCard>\n * ```\n *\n * @example Handle-only drag (pass handleRef to restrict drag to the handle)\n * ```tsx\n * const { ref, handleRef, isDragSource, isDropTarget } = useSortable({ id, index });\n *\n * <BitkitDraggableCard ref={ref} handleRef={handleRef} isDragging={isDragSource} isDropTarget={isDropTarget}>\n * {children}\n * </BitkitDraggableCard>\n * ```\n */\nconst BitkitDraggableCard = forwardRef<HTMLDivElement, BitkitDraggableCardProps>((props, ref) => {\n const { children, css, handleRef, isDragging = false, isDropTarget = false, ...rest } = props;\n\n const isFullCardDrag = !handleRef;\n const recipe = useSlotRecipe({ key: 'draggableCard' });\n const styles = recipe({ isDragging, isDropTarget, isFullCardDrag });\n\n return (\n <Box ref={ref} css={[styles.root, css]} {...rest}>\n {isFullCardDrag ? (\n <chakra.div css={styles.handle}>\n <IconDragHandle size=\"16\" />\n </chakra.div>\n ) : (\n <chakra.button ref={handleRef} type=\"button\" aria-label=\"Drag handle\" css={styles.handle}>\n <IconDragHandle size=\"16\" />\n </chakra.button>\n )}\n <Box css={styles.content}>{children}</Box>\n </Box>\n );\n});\n\nBitkitDraggableCard.displayName = 'BitkitDraggableCard';\n\nexport default BitkitDraggableCard;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAM,sBAAsB,YAAsD,OAAO,QAAQ;CAC/F,MAAM,EAAE,UAAU,KAAK,WAAW,aAAa,OAAO,eAAe,OAAO,GAAG,SAAS;CAExF,MAAM,iBAAiB,CAAC;CAExB,MAAM,SADS,cAAc,EAAE,KAAK,gBAAgB,CACrC,CAAA,CAAO;EAAE;EAAY;EAAc;CAAe,CAAC;CAElE,OACE,qBAAC,KAAD;EAAU;EAAK,KAAK,CAAC,OAAO,MAAM,GAAG;EAAG,GAAI;EAA5C,UAAA,CACG,iBACC,oBAAC,OAAO,KAAR;GAAY,KAAK,OAAO;GACtB,UAAA,oBAAC,gBAAD,EAAgB,MAAK,KAAM,CAAA;EACjB,CAAA,IAEZ,oBAAC,OAAO,QAAR;GAAe,KAAK;GAAW,MAAK;GAAS,cAAW;GAAc,KAAK,OAAO;GAChF,UAAA,oBAAC,gBAAD,EAAgB,MAAK,KAAM,CAAA;EACd,CAAA,GAEjB,oBAAC,KAAD;GAAK,KAAK,OAAO;GAAU;EAAc,CAAA,CACtC;;AAET,CAAC;AAED,oBAAoB,cAAc"}
1
+ {"version":3,"file":"BitkitDraggableCard.js","names":[],"sources":["../../../lib/components/BitkitDraggableCard/BitkitDraggableCard.tsx"],"sourcesContent":["import { Box, type BoxProps } from '@chakra-ui/react/box';\nimport { chakra, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { type ComponentPropsWithoutRef, forwardRef, type ReactNode, type Ref } from 'react';\n\nimport IconDragHandle from '../../icons/IconDragHandle';\n\n// ----- Props -----\n\nexport interface BitkitDraggableCardProps extends Omit<BoxProps, 'children'> {\n children: ReactNode;\n /**\n * Props spread onto the drag handle `<button>` — pass `{ ...attributes, ...listeners }` from `@dnd-kit/core`'s\n * `useSortable()` / `useDraggable()` here. When provided, only the handle initiates drag. Overrides the default\n * `aria-label=\"Drag handle\"`, so name what is being reordered (e.g. `aria-label=\"Reorder trigger\"`).\n */\n handleProps?: Omit<ComponentPropsWithoutRef<'button'>, 'children' | 'type'>;\n /**\n * Ref for the drag handle `<button>` — pass `handleRef` from `@dnd-kit/react`'s `useSortable()`, or\n * `setActivatorNodeRef` from `@dnd-kit/core`'s. When provided, only the handle initiates drag.\n */\n handleRef?: Ref<HTMLButtonElement>;\n /** Whether this card is currently being dragged */\n isDragging?: boolean;\n /** Whether this card is a drop target placeholder */\n isDropTarget?: boolean;\n /**\n * `readOnly` renders a plain card: no drag handle, no hover or drag styles. `handleProps`, `handleRef`,\n * `isDragging` and `isDropTarget` are ignored.\n */\n state?: 'readOnly';\n}\n\n// ----- Component -----\n\n/**\n * A card with a drag handle, designed for use with `@dnd-kit/react` or `@dnd-kit/core`.\n *\n * The component is purely presentational — it does not depend on `@dnd-kit`.\n * Pass the refs, handle props and state flags from `useSortable` (or `useDraggable`) to wire it up.\n *\n * @example Full-card drag (default — no `handleRef` / `handleProps`, the entire card is draggable)\n * ```tsx\n * const { ref, isDragSource, isDropTarget } = useSortable({ id, index });\n *\n * <BitkitDraggableCard ref={ref} isDragging={isDragSource} isDropTarget={isDropTarget}>\n * {children}\n * </BitkitDraggableCard>\n * ```\n *\n * @example Handle-only drag (pass handleRef to restrict drag to the handle)\n * ```tsx\n * const { ref, handleRef, isDragSource, isDropTarget } = useSortable({ id, index });\n *\n * <BitkitDraggableCard ref={ref} handleRef={handleRef} isDragging={isDragSource} isDropTarget={isDropTarget}>\n * {children}\n * </BitkitDraggableCard>\n * ```\n *\n * @example Read-only (a plain card, e.g. when the list can't be reordered)\n * ```tsx\n * <BitkitDraggableCard state=\"readOnly\">{children}</BitkitDraggableCard>\n * ```\n *\n * @example Handle-only drag with `@dnd-kit/core` / `@dnd-kit/sortable` (pass handleProps and handleRef)\n * ```tsx\n * const { attributes, isDragging, listeners, setActivatorNodeRef, setNodeRef } = useSortable({ id });\n *\n * <BitkitDraggableCard\n * ref={setNodeRef}\n * handleProps={{ ...attributes, ...listeners, 'aria-label': 'Reorder trigger' }}\n * handleRef={setActivatorNodeRef}\n * isDragging={isDragging}\n * >\n * {children}\n * </BitkitDraggableCard>\n * ```\n */\nconst BitkitDraggableCard = forwardRef<HTMLDivElement, BitkitDraggableCardProps>((props, ref) => {\n const { children, css, handleProps, handleRef, isDragging = false, isDropTarget = false, state, ...rest } = props;\n\n const isReadOnly = state === 'readOnly';\n const isFullCardDrag = !handleRef && !handleProps;\n const dragMode = isReadOnly ? 'none' : isFullCardDrag ? 'card' : 'handle';\n const recipe = useSlotRecipe({ key: 'draggableCard' });\n const styles = recipe({\n dragMode,\n isDragging: !isReadOnly && isDragging,\n isDropTarget: !isReadOnly && isDropTarget,\n });\n\n return (\n <Box ref={ref} css={[styles.root, css]} {...rest}>\n {dragMode === 'card' && (\n <chakra.div css={styles.handle}>\n <IconDragHandle size=\"16\" />\n </chakra.div>\n )}\n {dragMode === 'handle' && (\n <chakra.button aria-label=\"Drag handle\" {...handleProps} ref={handleRef} type=\"button\" css={styles.handle}>\n <IconDragHandle size=\"16\" />\n </chakra.button>\n )}\n <Box css={styles.content}>{children}</Box>\n </Box>\n );\n});\n\nBitkitDraggableCard.displayName = 'BitkitDraggableCard';\n\nexport default BitkitDraggableCard;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,IAAM,sBAAsB,YAAsD,OAAO,QAAQ;CAC/F,MAAM,EAAE,UAAU,KAAK,aAAa,WAAW,aAAa,OAAO,eAAe,OAAO,OAAO,GAAG,SAAS;CAE5G,MAAM,aAAa,UAAU;CAE7B,MAAM,WAAW,aAAa,SADP,CAAC,aAAa,CAAC,cACkB,SAAS;CAEjE,MAAM,SADS,cAAc,EAAE,KAAK,gBAAgB,CACrC,CAAA,CAAO;EACpB;EACA,YAAY,CAAC,cAAc;EAC3B,cAAc,CAAC,cAAc;CAC/B,CAAC;CAED,OACE,qBAAC,KAAD;EAAU;EAAK,KAAK,CAAC,OAAO,MAAM,GAAG;EAAG,GAAI;EAA5C,UAAA;GACG,aAAa,UACZ,oBAAC,OAAO,KAAR;IAAY,KAAK,OAAO;IACtB,UAAA,oBAAC,gBAAD,EAAgB,MAAK,KAAM,CAAA;GACjB,CAAA;GAEb,aAAa,YACZ,oBAAC,OAAO,QAAR;IAAe,cAAW;IAAc,GAAI;IAAa,KAAK;IAAW,MAAK;IAAS,KAAK,OAAO;IACjG,UAAA,oBAAC,gBAAD,EAAgB,MAAK,KAAM,CAAA;GACd,CAAA;GAEjB,oBAAC,KAAD;IAAK,KAAK,OAAO;IAAU;GAAc,CAAA;EACtC;;AAET,CAAC;AAED,oBAAoB,cAAc"}
@@ -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 isRequired = fieldProps.required ?? state !== "readOnly";
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 ?? state !== 'readOnly';\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 setCurrentValue(details.valueAsString);\n onValueChange?.(details.valueAsString);\n };\n\n const handleValueComplete: PinInputRootProps['onValueComplete'] = onValueComplete\n ? (details) => onValueComplete(details.valueAsString)\n : 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,WAAW,YAAY,UAAU;CACpD,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,gBAAgB,QAAQ,aAAa;EACrC,gBAAgB,QAAQ,aAAa;CACvC;CAEA,MAAM,sBAA4D,mBAC7D,YAAY,gBAAgB,QAAQ,aAAa,IAClD,KAAA;CAEJ,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"}
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: ReactNode;
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
- placement,
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,QAAQ,YAA+CA,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,WAAW,YAAkDA,QAAW,UAAU,YAAY,EAClG,gBAAgB,KAClB,CAAC;;;;;;;;;;;;AAqDD,IAAM,mBAAmB,EACvB,QACA,UACA,aACA,eACA,UACA,MAAM,MACN,iBACA,cACA,cACA,MACA,YAAY,OACZ,MACA,kBACA,kBAC0B;CAC1B,MAAM,EAAE,eAAe,6BAA6B,WAAW,mBAAmB;CAClF,MAAM,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAEvC,IAAI,UACF,OAAO,oBAAAC,YAAA,EAAG,SAAW,CAAA;CAGvB,OAEE,qBAAC,MAAD;EACe;EACb,WAAA;EACc;EACR;EACN,aAAa;GAAE;GAAW,QAAQ;IAAE,UAAU;IAAG,WAAW;GAAE;EAAE;EAChE,eAAA;EANF,UAAA,CAQG,eAAe,CAAC,eAAe,QAAQ,IACtC,oBAAC,SAAD;GACE,cAAY;GACZ,KAAK;IACH,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;IAIT,eAAe;KACb,SAAS;KACT,SAAS;MACP,cAAc;MACd,eAAe;MACf,cAAc;MACd,cAAc;KAChB;IACF;GACF;GAEC;EACM,CAAA,IAET,oBAAC,SAAD;GAAS,SAAA;GAAS;EAAkB,CAAA,GAEtC,oBAAC,QAAD;GAAQ,UAAU,iBAAiB;GACjC,UAAA,oBAAC,YAAD,EAAA,UACE,qBAAC,SAAD,EAAA,UAAA;IACE,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD,CAAW,CAAA,EACN,CAAA;IACP,qBAAC,KAAD;KAAK,SAAQ;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"}
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,CAAC;AAED,IAAM,QAAQ,YAA+CA,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,QAAQ,YAA+CA,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,WAAW,YAAkDA,QAAW,UAAU,YAAY,EAClG,gBAAgB,KAClB,CAAC;;;;;;;;;;;;;;;AA2DD,IAAM,mBAAmB,EACvB,QACA,UACA,aACA,eACA,UACA,MAAM,MACN,iBACA,cACA,cACA,MACA,YAAY,OACZ,aACA,MACA,kBACA,kBAC0B;CAC1B,MAAM,EAAE,eAAe,6BAA6B,WAAW,mBAAmB;CAClF,MAAM,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAAC;CAEvC,IAAI,UACF,OAAO,YAAY,OAAO,OAAO,oBAAAC,YAAA,EAAG,SAAW,CAAA;CAGjD,OAEE,qBAAC,MAAD;EACe;EACb,WAAA;EACc;EACR;EACN,aAAa;GAAE,GAAG;GAAa,QAAQ;IAAE,UAAU;IAAG,WAAW;GAAE;GAAG;EAAU;EAChF,eAAA;EANF,UAAA,CAQG,YAAY,SAAS,eAAe,CAAC,eAAe,QAAQ,KAC3D,oBAAC,SAAD;GACE,cAAY;GACZ,KAAK;IACH,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;IAIT,eAAe;KACb,SAAS;KACT,SAAS;MACP,cAAc;MACd,eAAe;MACf,cAAc;MACd,cAAc;KAChB;IACF;GACF;GAEC;EACM,CAAA,IAET,YAAY,QAAQ,oBAAC,SAAD;GAAS,SAAA;GAAS;EAAkB,CAAA,GAE1D,oBAAC,QAAD;GAAQ,UAAU,iBAAiB;GACjC,UAAA,oBAAC,YAAD,EAAA,UACE,qBAAC,SAAD,EAAA,UAAA;IACE,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD,CAAW,CAAA,EACN,CAAA;IACP,qBAAC,KAAD;KAAK,SAAQ;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"}
@@ -1,34 +1,6 @@
1
1
  declare const draggableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "root" | "handle", {
2
- isDragging: {
3
- true: {
4
- root: {
5
- borderColor: "border/strong";
6
- boxShadow: "elevation/lg";
7
- cursor: "grabbing";
8
- };
9
- handle: {
10
- color: "icon/secondary";
11
- };
12
- };
13
- };
14
- isDropTarget: {
15
- true: {
16
- root: {
17
- background: "background/secondary";
18
- borderColor: "border/strong";
19
- borderStyle: "dashed";
20
- boxShadow: "none";
21
- };
22
- handle: {
23
- visibility: "hidden";
24
- };
25
- content: {
26
- visibility: "hidden";
27
- };
28
- };
29
- };
30
- isFullCardDrag: {
31
- true: {
2
+ dragMode: {
3
+ card: {
32
4
  root: {
33
5
  cursor: "grab";
34
6
  _hover: {
@@ -48,7 +20,7 @@ declare const draggableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
48
20
  paddingInlineStart: number;
49
21
  };
50
22
  };
51
- false: {
23
+ handle: {
52
24
  root: {
53
25
  _hover: {
54
26
  borderColor: "border/regular";
@@ -60,6 +32,7 @@ declare const draggableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
60
32
  border: "none";
61
33
  cursor: "grab";
62
34
  focusVisibleRing: "none";
35
+ touchAction: "none";
63
36
  _focusVisible: {
64
37
  boxShadow: "inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color)";
65
38
  };
@@ -78,6 +51,39 @@ declare const draggableCardSlotRecipe: import('@chakra-ui/react').SlotRecipeDefi
78
51
  paddingInlineStart: "8";
79
52
  };
80
53
  };
54
+ none: {
55
+ content: {
56
+ paddingInlineStart: "16";
57
+ };
58
+ };
59
+ };
60
+ isDragging: {
61
+ true: {
62
+ root: {
63
+ borderColor: "border/strong";
64
+ boxShadow: "elevation/lg";
65
+ cursor: "grabbing";
66
+ };
67
+ handle: {
68
+ color: "icon/secondary";
69
+ };
70
+ };
71
+ };
72
+ isDropTarget: {
73
+ true: {
74
+ root: {
75
+ background: "background/secondary";
76
+ borderColor: "border/strong";
77
+ borderStyle: "dashed";
78
+ boxShadow: "none";
79
+ };
80
+ handle: {
81
+ visibility: "hidden";
82
+ };
83
+ content: {
84
+ visibility: "hidden";
85
+ };
86
+ };
81
87
  };
82
88
  }>;
83
89
  export default draggableCardSlotRecipe;
@@ -35,26 +35,8 @@ var draggableCardSlotRecipe = defineSlotRecipe({
35
35
  }
36
36
  },
37
37
  variants: {
38
- isDragging: { true: {
39
- root: {
40
- borderColor: "border/strong",
41
- boxShadow: "elevation/lg",
42
- cursor: "grabbing"
43
- },
44
- handle: { color: "icon/secondary" }
45
- } },
46
- isDropTarget: { true: {
47
- root: {
48
- background: "background/secondary",
49
- borderColor: "border/strong",
50
- borderStyle: "dashed",
51
- boxShadow: "none"
52
- },
53
- handle: { visibility: "hidden" },
54
- content: { visibility: "hidden" }
55
- } },
56
- isFullCardDrag: {
57
- true: {
38
+ dragMode: {
39
+ card: {
58
40
  root: {
59
41
  cursor: "grab",
60
42
  _hover: {
@@ -66,7 +48,7 @@ var draggableCardSlotRecipe = defineSlotRecipe({
66
48
  handle: { pointerEvents: "none" },
67
49
  content: { paddingInlineStart: 0 }
68
50
  },
69
- false: {
51
+ handle: {
70
52
  root: { _hover: { borderColor: "border/regular" } },
71
53
  handle: {
72
54
  appearance: "none",
@@ -74,6 +56,7 @@ var draggableCardSlotRecipe = defineSlotRecipe({
74
56
  border: "none",
75
57
  cursor: "grab",
76
58
  focusVisibleRing: "none",
59
+ touchAction: "none",
77
60
  _focusVisible: { boxShadow: "inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color)" },
78
61
  _hover: {
79
62
  background: "background/hover",
@@ -83,21 +66,40 @@ var draggableCardSlotRecipe = defineSlotRecipe({
83
66
  _active: { background: "background/active" }
84
67
  },
85
68
  content: { paddingInlineStart: "8" }
86
- }
87
- }
69
+ },
70
+ none: { content: { paddingInlineStart: "16" } }
71
+ },
72
+ isDragging: { true: {
73
+ root: {
74
+ borderColor: "border/strong",
75
+ boxShadow: "elevation/lg",
76
+ cursor: "grabbing"
77
+ },
78
+ handle: { color: "icon/secondary" }
79
+ } },
80
+ isDropTarget: { true: {
81
+ root: {
82
+ background: "background/secondary",
83
+ borderColor: "border/strong",
84
+ borderStyle: "dashed",
85
+ boxShadow: "none"
86
+ },
87
+ handle: { visibility: "hidden" },
88
+ content: { visibility: "hidden" }
89
+ } }
88
90
  },
89
91
  compoundVariants: [
90
92
  {
93
+ dragMode: "card",
91
94
  isDragging: true,
92
- isFullCardDrag: true,
93
95
  css: { root: {
94
96
  cursor: "grabbing",
95
97
  _hover: { borderColor: "border/strong" }
96
98
  } }
97
99
  },
98
100
  {
101
+ dragMode: "handle",
99
102
  isDragging: true,
100
- isFullCardDrag: false,
101
103
  css: {
102
104
  root: { _hover: { borderColor: "border/strong" } },
103
105
  handle: {
@@ -108,23 +110,23 @@ var draggableCardSlotRecipe = defineSlotRecipe({
108
110
  }
109
111
  },
110
112
  {
113
+ dragMode: "card",
111
114
  isDropTarget: true,
112
- isFullCardDrag: true,
113
115
  css: { root: {
114
116
  cursor: "default",
115
117
  _hover: { borderColor: "border/strong" }
116
118
  } }
117
119
  },
118
120
  {
121
+ dragMode: "handle",
119
122
  isDropTarget: true,
120
- isFullCardDrag: false,
121
123
  css: { root: { _hover: { borderColor: "border/strong" } } }
122
124
  }
123
125
  ],
124
126
  defaultVariants: {
127
+ dragMode: "card",
125
128
  isDragging: false,
126
- isDropTarget: false,
127
- isFullCardDrag: true
129
+ isDropTarget: false
128
130
  }
129
131
  });
130
132
  export { draggableCardSlotRecipe as default };
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/DraggableCard.recipe.ts"],"sourcesContent":["import { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nconst draggableCardSlotRecipe = defineSlotRecipe({\n className: 'draggable-card',\n slots: ['root', 'handle', 'content'],\n base: {\n root: {\n alignItems: 'stretch',\n backgroundColor: 'background/primary',\n border: '1px solid',\n borderColor: 'border/minimal',\n borderRadius: '8',\n boxShadow: 'elevation/sm',\n display: 'flex',\n overflow: 'hidden',\n },\n handle: {\n alignItems: 'center',\n color: 'icon/tertiary',\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n width: '24',\n },\n content: {\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n paddingBlock: '16',\n paddingInlineEnd: '16',\n },\n },\n variants: {\n isDragging: {\n true: {\n root: {\n borderColor: 'border/strong',\n boxShadow: 'elevation/lg',\n cursor: 'grabbing',\n },\n handle: {\n color: 'icon/secondary',\n },\n },\n },\n isDropTarget: {\n true: {\n root: {\n background: 'background/secondary',\n borderColor: 'border/strong',\n borderStyle: 'dashed',\n boxShadow: 'none',\n },\n handle: {\n visibility: 'hidden',\n },\n content: {\n visibility: 'hidden',\n },\n },\n },\n isFullCardDrag: {\n true: {\n root: {\n cursor: 'grab',\n _hover: {\n borderColor: 'border/regular',\n _active: {\n borderColor: 'border/strong',\n },\n },\n _active: {\n borderColor: 'border/strong',\n },\n },\n handle: {\n pointerEvents: 'none',\n },\n content: {\n paddingInlineStart: 0,\n },\n },\n false: {\n root: {\n _hover: {\n borderColor: 'border/regular',\n },\n },\n handle: {\n appearance: 'none',\n background: 'transparent',\n border: 'none',\n cursor: 'grab',\n focusVisibleRing: 'none',\n _focusVisible: {\n boxShadow: 'inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color)',\n },\n _hover: {\n background: 'background/hover',\n color: 'icon/secondary',\n _active: {\n background: 'background/active',\n },\n },\n _active: {\n background: 'background/active',\n },\n },\n content: {\n paddingInlineStart: '8',\n },\n },\n },\n },\n compoundVariants: [\n {\n isDragging: true,\n isFullCardDrag: true,\n css: {\n root: {\n cursor: 'grabbing',\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n {\n isDragging: true,\n isFullCardDrag: false,\n css: {\n root: {\n _hover: {\n borderColor: 'border/strong',\n },\n },\n handle: {\n background: 'background/active',\n cursor: 'grabbing',\n _hover: {\n background: 'background/active',\n },\n },\n },\n },\n {\n isDropTarget: true,\n isFullCardDrag: true,\n css: {\n root: {\n cursor: 'default',\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n {\n isDropTarget: true,\n isFullCardDrag: false,\n css: {\n root: {\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n ],\n defaultVariants: {\n isDragging: false,\n isDropTarget: false,\n isFullCardDrag: true,\n },\n});\n\nexport default draggableCardSlotRecipe;\n"],"mappings":";;AAEA,IAAM,0BAA0B,iBAAiB;CAC/C,WAAW;CACX,OAAO;EAAC;EAAQ;EAAU;CAAS;CACnC,MAAM;EACJ,MAAM;GACJ,YAAY;GACZ,iBAAiB;GACjB,QAAQ;GACR,aAAa;GACb,cAAc;GACd,WAAW;GACX,SAAS;GACT,UAAU;EACZ;EACA,QAAQ;GACN,YAAY;GACZ,OAAO;GACP,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,OAAO;EACT;EACA,SAAS;GACP,MAAM;GACN,UAAU;GACV,UAAU;GACV,cAAc;GACd,kBAAkB;EACpB;CACF;CACA,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM;IACJ,aAAa;IACb,WAAW;IACX,QAAQ;GACV;GACA,QAAQ,EACN,OAAO,iBACT;EACF,EACF;EACA,cAAc,EACZ,MAAM;GACJ,MAAM;IACJ,YAAY;IACZ,aAAa;IACb,aAAa;IACb,WAAW;GACb;GACA,QAAQ,EACN,YAAY,SACd;GACA,SAAS,EACP,YAAY,SACd;EACF,EACF;EACA,gBAAgB;GACd,MAAM;IACJ,MAAM;KACJ,QAAQ;KACR,QAAQ;MACN,aAAa;MACb,SAAS,EACP,aAAa,gBACf;KACF;KACA,SAAS,EACP,aAAa,gBACf;IACF;IACA,QAAQ,EACN,eAAe,OACjB;IACA,SAAS,EACP,oBAAoB,EACtB;GACF;GACA,OAAO;IACL,MAAM,EACJ,QAAQ,EACN,aAAa,iBACf,EACF;IACA,QAAQ;KACN,YAAY;KACZ,YAAY;KACZ,QAAQ;KACR,QAAQ;KACR,kBAAkB;KAClB,eAAe,EACb,WAAW,8DACb;KACA,QAAQ;MACN,YAAY;MACZ,OAAO;MACP,SAAS,EACP,YAAY,oBACd;KACF;KACA,SAAS,EACP,YAAY,oBACd;IACF;IACA,SAAS,EACP,oBAAoB,IACtB;GACF;EACF;CACF;CACA,kBAAkB;EAChB;GACE,YAAY;GACZ,gBAAgB;GAChB,KAAK,EACH,MAAM;IACJ,QAAQ;IACR,QAAQ,EACN,aAAa,gBACf;GACF,EACF;EACF;EACA;GACE,YAAY;GACZ,gBAAgB;GAChB,KAAK;IACH,MAAM,EACJ,QAAQ,EACN,aAAa,gBACf,EACF;IACA,QAAQ;KACN,YAAY;KACZ,QAAQ;KACR,QAAQ,EACN,YAAY,oBACd;IACF;GACF;EACF;EACA;GACE,cAAc;GACd,gBAAgB;GAChB,KAAK,EACH,MAAM;IACJ,QAAQ;IACR,QAAQ,EACN,aAAa,gBACf;GACF,EACF;EACF;EACA;GACE,cAAc;GACd,gBAAgB;GAChB,KAAK,EACH,MAAM,EACJ,QAAQ,EACN,aAAa,gBACf,EACF,EACF;EACF;CACF;CACA,iBAAiB;EACf,YAAY;EACZ,cAAc;EACd,gBAAgB;CAClB;AACF,CAAC"}
1
+ {"version":3,"file":"DraggableCard.recipe.js","names":[],"sources":["../../../lib/theme/slot-recipes/DraggableCard.recipe.ts"],"sourcesContent":["import { defineSlotRecipe } from '@chakra-ui/react/styled-system';\n\nconst draggableCardSlotRecipe = defineSlotRecipe({\n className: 'draggable-card',\n slots: ['root', 'handle', 'content'],\n base: {\n root: {\n alignItems: 'stretch',\n backgroundColor: 'background/primary',\n border: '1px solid',\n borderColor: 'border/minimal',\n borderRadius: '8',\n boxShadow: 'elevation/sm',\n display: 'flex',\n overflow: 'hidden',\n },\n handle: {\n alignItems: 'center',\n color: 'icon/tertiary',\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n width: '24',\n },\n content: {\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n paddingBlock: '16',\n paddingInlineEnd: '16',\n },\n },\n variants: {\n dragMode: {\n card: {\n root: {\n cursor: 'grab',\n _hover: {\n borderColor: 'border/regular',\n _active: {\n borderColor: 'border/strong',\n },\n },\n _active: {\n borderColor: 'border/strong',\n },\n },\n handle: {\n pointerEvents: 'none',\n },\n content: {\n paddingInlineStart: 0,\n },\n },\n handle: {\n root: {\n _hover: {\n borderColor: 'border/regular',\n },\n },\n handle: {\n appearance: 'none',\n background: 'transparent',\n border: 'none',\n cursor: 'grab',\n focusVisibleRing: 'none',\n touchAction: 'none',\n _focusVisible: {\n boxShadow: 'inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color)',\n },\n _hover: {\n background: 'background/hover',\n color: 'icon/secondary',\n _active: {\n background: 'background/active',\n },\n },\n _active: {\n background: 'background/active',\n },\n },\n content: {\n paddingInlineStart: '8',\n },\n },\n none: {\n content: {\n paddingInlineStart: '16',\n },\n },\n },\n isDragging: {\n true: {\n root: {\n borderColor: 'border/strong',\n boxShadow: 'elevation/lg',\n cursor: 'grabbing',\n },\n handle: {\n color: 'icon/secondary',\n },\n },\n },\n isDropTarget: {\n true: {\n root: {\n background: 'background/secondary',\n borderColor: 'border/strong',\n borderStyle: 'dashed',\n boxShadow: 'none',\n },\n handle: {\n visibility: 'hidden',\n },\n content: {\n visibility: 'hidden',\n },\n },\n },\n },\n compoundVariants: [\n {\n dragMode: 'card',\n isDragging: true,\n css: {\n root: {\n cursor: 'grabbing',\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n {\n dragMode: 'handle',\n isDragging: true,\n css: {\n root: {\n _hover: {\n borderColor: 'border/strong',\n },\n },\n handle: {\n background: 'background/active',\n cursor: 'grabbing',\n _hover: {\n background: 'background/active',\n },\n },\n },\n },\n {\n dragMode: 'card',\n isDropTarget: true,\n css: {\n root: {\n cursor: 'default',\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n {\n dragMode: 'handle',\n isDropTarget: true,\n css: {\n root: {\n _hover: {\n borderColor: 'border/strong',\n },\n },\n },\n },\n ],\n defaultVariants: {\n dragMode: 'card',\n isDragging: false,\n isDropTarget: false,\n },\n});\n\nexport default draggableCardSlotRecipe;\n"],"mappings":";;AAEA,IAAM,0BAA0B,iBAAiB;CAC/C,WAAW;CACX,OAAO;EAAC;EAAQ;EAAU;CAAS;CACnC,MAAM;EACJ,MAAM;GACJ,YAAY;GACZ,iBAAiB;GACjB,QAAQ;GACR,aAAa;GACb,cAAc;GACd,WAAW;GACX,SAAS;GACT,UAAU;EACZ;EACA,QAAQ;GACN,YAAY;GACZ,OAAO;GACP,SAAS;GACT,YAAY;GACZ,gBAAgB;GAChB,OAAO;EACT;EACA,SAAS;GACP,MAAM;GACN,UAAU;GACV,UAAU;GACV,cAAc;GACd,kBAAkB;EACpB;CACF;CACA,UAAU;EACR,UAAU;GACR,MAAM;IACJ,MAAM;KACJ,QAAQ;KACR,QAAQ;MACN,aAAa;MACb,SAAS,EACP,aAAa,gBACf;KACF;KACA,SAAS,EACP,aAAa,gBACf;IACF;IACA,QAAQ,EACN,eAAe,OACjB;IACA,SAAS,EACP,oBAAoB,EACtB;GACF;GACA,QAAQ;IACN,MAAM,EACJ,QAAQ,EACN,aAAa,iBACf,EACF;IACA,QAAQ;KACN,YAAY;KACZ,YAAY;KACZ,QAAQ;KACR,QAAQ;KACR,kBAAkB;KAClB,aAAa;KACb,eAAe,EACb,WAAW,8DACb;KACA,QAAQ;MACN,YAAY;MACZ,OAAO;MACP,SAAS,EACP,YAAY,oBACd;KACF;KACA,SAAS,EACP,YAAY,oBACd;IACF;IACA,SAAS,EACP,oBAAoB,IACtB;GACF;GACA,MAAM,EACJ,SAAS,EACP,oBAAoB,KACtB,EACF;EACF;EACA,YAAY,EACV,MAAM;GACJ,MAAM;IACJ,aAAa;IACb,WAAW;IACX,QAAQ;GACV;GACA,QAAQ,EACN,OAAO,iBACT;EACF,EACF;EACA,cAAc,EACZ,MAAM;GACJ,MAAM;IACJ,YAAY;IACZ,aAAa;IACb,aAAa;IACb,WAAW;GACb;GACA,QAAQ,EACN,YAAY,SACd;GACA,SAAS,EACP,YAAY,SACd;EACF,EACF;CACF;CACA,kBAAkB;EAChB;GACE,UAAU;GACV,YAAY;GACZ,KAAK,EACH,MAAM;IACJ,QAAQ;IACR,QAAQ,EACN,aAAa,gBACf;GACF,EACF;EACF;EACA;GACE,UAAU;GACV,YAAY;GACZ,KAAK;IACH,MAAM,EACJ,QAAQ,EACN,aAAa,gBACf,EACF;IACA,QAAQ;KACN,YAAY;KACZ,QAAQ;KACR,QAAQ,EACN,YAAY,oBACd;IACF;GACF;EACF;EACA;GACE,UAAU;GACV,cAAc;GACd,KAAK,EACH,MAAM;IACJ,QAAQ;IACR,QAAQ,EACN,aAAa,gBACf;GACF,EACF;EACF;EACA;GACE,UAAU;GACV,cAAc;GACd,KAAK,EACH,MAAM,EACJ,QAAQ,EACN,aAAa,gBACf,EACF,EACF;EACF;CACF;CACA,iBAAiB;EACf,UAAU;EACV,YAAY;EACZ,cAAc;CAChB;AACF,CAAC"}
@@ -41,7 +41,7 @@ declare const drawerSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<
41
41
  paddingBlockEnd: "24";
42
42
  paddingBlockStart: "8";
43
43
  paddingInline: "24";
44
- '.chakra-drawer__header:has([role=tablist]) ~ &': {
44
+ '*:has([role=tablist]) ~ &': {
45
45
  paddingBlockStart: "24";
46
46
  };
47
47
  };
@@ -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",
@@ -57,7 +59,8 @@ var drawerSlotRecipe = defineSlotRecipe({
57
59
  paddingBlockEnd: "8",
58
60
  paddingBlockStart: "24",
59
61
  paddingInline: "24",
60
- "&:has([role=tablist])": { paddingBlockEnd: 0 }
62
+ "&:has([role=tablist])": { paddingBlockEnd: 0 },
63
+ "& > :first-child": { paddingInlineEnd: "48" }
61
64
  },
62
65
  body: {
63
66
  flex: "1",
@@ -70,8 +73,6 @@ var drawerSlotRecipe = defineSlotRecipe({
70
73
  },
71
74
  title: {
72
75
  color: "text/tertiary",
73
- flex: "1",
74
- paddingInlineEnd: "48",
75
76
  textStyle: "heading/h6"
76
77
  },
77
78
  description: {},
@@ -124,7 +125,7 @@ var drawerSlotRecipe = defineSlotRecipe({
124
125
  paddingBlockEnd: "24",
125
126
  paddingBlockStart: "8",
126
127
  paddingInline: "24",
127
- ".chakra-drawer__header:has([role=tablist]) ~ &": { paddingBlockStart: "24" }
128
+ "*:has([role=tablist]) ~ &": { paddingBlockStart: "24" }
128
129
  },
129
130
  closeTrigger: {
130
131
  height: "32",
@@ -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 flex: '1',\n // The close button is absolutely positioned, so the title keeps clear of it.\n paddingInlineEnd: '48',\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 // Tabs sit 8px from the edge, so their baseline runs nearly full width.\n '& :has(> [role=tablist])': {\n marginInline: { 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 '.chakra-drawer__header: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 '& :has(> [role=tablist])': {\n marginInline: '-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":"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"}
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 '& > :first-child': {\n paddingInlineEnd: '48',\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 // Tabs sit 8px from the edge, so their baseline runs nearly full width.\n '& :has(> [role=tablist])': {\n marginInline: { 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 '& :has(> [role=tablist])': {\n marginInline: '-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":"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"}
@@ -934,36 +934,8 @@ declare const slotRecipes: {
934
934
  };
935
935
  }>;
936
936
  draggableCard: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "root" | "handle", {
937
- isDragging: {
938
- true: {
939
- root: {
940
- borderColor: "border/strong";
941
- boxShadow: "elevation/lg";
942
- cursor: "grabbing";
943
- };
944
- handle: {
945
- color: "icon/secondary";
946
- };
947
- };
948
- };
949
- isDropTarget: {
950
- true: {
951
- root: {
952
- background: "background/secondary";
953
- borderColor: "border/strong";
954
- borderStyle: "dashed";
955
- boxShadow: "none";
956
- };
957
- handle: {
958
- visibility: "hidden";
959
- };
960
- content: {
961
- visibility: "hidden";
962
- };
963
- };
964
- };
965
- isFullCardDrag: {
966
- true: {
937
+ dragMode: {
938
+ card: {
967
939
  root: {
968
940
  cursor: "grab";
969
941
  _hover: {
@@ -983,7 +955,7 @@ declare const slotRecipes: {
983
955
  paddingInlineStart: number;
984
956
  };
985
957
  };
986
- false: {
958
+ handle: {
987
959
  root: {
988
960
  _hover: {
989
961
  borderColor: "border/regular";
@@ -995,6 +967,7 @@ declare const slotRecipes: {
995
967
  border: "none";
996
968
  cursor: "grab";
997
969
  focusVisibleRing: "none";
970
+ touchAction: "none";
998
971
  _focusVisible: {
999
972
  boxShadow: "inset 0 0 0 var(--focus-ring-width) var(--focus-ring-color)";
1000
973
  };
@@ -1013,6 +986,39 @@ declare const slotRecipes: {
1013
986
  paddingInlineStart: "8";
1014
987
  };
1015
988
  };
989
+ none: {
990
+ content: {
991
+ paddingInlineStart: "16";
992
+ };
993
+ };
994
+ };
995
+ isDragging: {
996
+ true: {
997
+ root: {
998
+ borderColor: "border/strong";
999
+ boxShadow: "elevation/lg";
1000
+ cursor: "grabbing";
1001
+ };
1002
+ handle: {
1003
+ color: "icon/secondary";
1004
+ };
1005
+ };
1006
+ };
1007
+ isDropTarget: {
1008
+ true: {
1009
+ root: {
1010
+ background: "background/secondary";
1011
+ borderColor: "border/strong";
1012
+ borderStyle: "dashed";
1013
+ boxShadow: "none";
1014
+ };
1015
+ handle: {
1016
+ visibility: "hidden";
1017
+ };
1018
+ content: {
1019
+ visibility: "hidden";
1020
+ };
1021
+ };
1016
1022
  };
1017
1023
  }>;
1018
1024
  drawer: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "body" | "footer" | "header" | "title" | "trigger" | "positioner" | "closeTrigger" | "description" | "backdrop", {
@@ -1058,7 +1064,7 @@ declare const slotRecipes: {
1058
1064
  paddingBlockEnd: "24";
1059
1065
  paddingBlockStart: "8";
1060
1066
  paddingInline: "24";
1061
- '.chakra-drawer__header:has([role=tablist]) ~ &': {
1067
+ '*:has([role=tablist]) ~ &': {
1062
1068
  paddingBlockStart: "24";
1063
1069
  };
1064
1070
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.544",
4
+ "version": "0.3.545-beta.3456",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",