@calcifer-design/ui 0.6.0 → 0.8.0

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.
Files changed (189) hide show
  1. package/dist/components/Alert/Alert.d.ts +5 -2
  2. package/dist/components/Alert/Alert.js +1 -0
  3. package/dist/components/Alert/Alert.module.js +5 -5
  4. package/dist/components/Alert/Alert_module.css +20 -17
  5. package/dist/components/Avatar/Avatar.d.ts +16 -2
  6. package/dist/components/Avatar/Avatar.js +23 -7
  7. package/dist/components/Avatar/Avatar.module.js +3 -3
  8. package/dist/components/Avatar/Avatar_module.css +58 -17
  9. package/dist/components/Avatar/avatarColor.d.ts +12 -0
  10. package/dist/components/Avatar/avatarColor.js +12 -0
  11. package/dist/components/AvatarGroup/AvatarGroup.d.ts +37 -0
  12. package/dist/components/AvatarGroup/AvatarGroup.js +52 -0
  13. package/dist/components/AvatarGroup/AvatarGroup.module.js +8 -0
  14. package/dist/components/AvatarGroup/AvatarGroup_module.css +67 -0
  15. package/dist/components/Breadcrumb/Breadcrumb.module.js +6 -6
  16. package/dist/components/Breadcrumb/Breadcrumb_module.css +7 -7
  17. package/dist/components/Button/Button.d.ts +40 -4
  18. package/dist/components/Button/Button.js +48 -11
  19. package/dist/components/Button/Button.module.js +6 -2
  20. package/dist/components/Button/Button_module.css +143 -17
  21. package/dist/components/Button/LinkButton.d.ts +10 -3
  22. package/dist/components/Button/LinkButton.js +16 -5
  23. package/dist/components/Card/Card.module.js +5 -5
  24. package/dist/components/Card/Card_module.css +15 -9
  25. package/dist/components/CardList/CardList.module.js +3 -3
  26. package/dist/components/CardList/CardList_module.css +5 -3
  27. package/dist/components/Checkbox/Checkbox.module.js +2 -2
  28. package/dist/components/Checkbox/Checkbox_module.css +3 -3
  29. package/dist/components/ChoiceCard/ChoiceCard.d.ts +34 -0
  30. package/dist/components/ChoiceCard/ChoiceCard.js +81 -0
  31. package/dist/components/ChoiceCard/ChoiceCard.module.js +12 -0
  32. package/dist/components/ChoiceCard/ChoiceCard_module.css +161 -0
  33. package/dist/components/Collapsible/Collapsible.d.ts +39 -0
  34. package/dist/components/Collapsible/Collapsible.js +63 -0
  35. package/dist/components/Collapsible/Collapsible.module.js +10 -0
  36. package/dist/components/Collapsible/Collapsible_module.css +80 -0
  37. package/dist/components/DataGrid/DataGrid.module.js +32 -32
  38. package/dist/components/DataGrid/DataGrid_module.css +67 -62
  39. package/dist/components/DataTable/DataTable.module.js +9 -9
  40. package/dist/components/DataTable/DataTable_module.css +24 -21
  41. package/dist/components/DatePicker/DatePicker.d.ts +15 -1
  42. package/dist/components/DatePicker/DatePicker.js +33 -5
  43. package/dist/components/DatePicker/DatePicker.module.js +10 -10
  44. package/dist/components/DatePicker/DatePicker_module.css +22 -21
  45. package/dist/components/Descriptions/Descriptions.module.js +4 -4
  46. package/dist/components/Descriptions/Descriptions_module.css +12 -8
  47. package/dist/components/Dialog/Dialog.d.ts +30 -2
  48. package/dist/components/Dialog/Dialog.js +53 -11
  49. package/dist/components/Dialog/Dialog.module.js +8 -6
  50. package/dist/components/Dialog/Dialog_module.css +60 -13
  51. package/dist/components/EmptyState/EmptyState.d.ts +41 -0
  52. package/dist/components/EmptyState/EmptyState.js +39 -0
  53. package/dist/components/EmptyState/EmptyState.module.js +9 -0
  54. package/dist/components/EmptyState/EmptyState_module.css +65 -0
  55. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +5 -2
  56. package/dist/components/ErrorBoundary/ErrorBoundary.module.js +1 -1
  57. package/dist/components/ErrorBoundary/ErrorBoundary_module.css +1 -1
  58. package/dist/components/Field/AffixInput.d.ts +28 -0
  59. package/dist/components/Field/AffixInput.js +50 -0
  60. package/dist/components/Field/GroupFrame.d.ts +19 -0
  61. package/dist/components/Field/GroupFrame.js +31 -0
  62. package/dist/components/Field/PickerField.d.ts +8 -2
  63. package/dist/components/Field/PickerField.js +12 -8
  64. package/dist/components/Field/PickerField.module.js +4 -4
  65. package/dist/components/Field/PickerField_module.css +11 -6
  66. package/dist/components/FilterBar/FilterBar.module.js +9 -9
  67. package/dist/components/FilterBar/FilterBar_module.css +13 -13
  68. package/dist/components/Form/Form.d.ts +9 -7
  69. package/dist/components/Form/Form.module.js +1 -1
  70. package/dist/components/Form/Form_module.css +1 -1
  71. package/dist/components/IconButton/IconButton.d.ts +1 -1
  72. package/dist/components/IconButton/IconButton.module.js +2 -2
  73. package/dist/components/IconButton/IconButton_module.css +28 -17
  74. package/dist/components/Menu/Menu.js +3 -0
  75. package/dist/components/Menu/Menu.module.js +2 -2
  76. package/dist/components/Menu/Menu_module.css +5 -4
  77. package/dist/components/NavMenu/NavMenu.d.ts +27 -4
  78. package/dist/components/NavMenu/NavMenu.js +10 -8
  79. package/dist/components/NavMenu/NavMenu.module.js +6 -6
  80. package/dist/components/NavMenu/NavMenu_module.css +37 -19
  81. package/dist/components/NavMenu/currentPath.d.ts +9 -0
  82. package/dist/components/NavMenu/currentPath.js +5 -0
  83. package/dist/components/PageHeading/PageHeading.module.js +3 -3
  84. package/dist/components/PageHeading/PageHeading_module.css +12 -9
  85. package/dist/components/PageShell/PageShell.module.js +5 -5
  86. package/dist/components/PageShell/PageShell_module.css +9 -9
  87. package/dist/components/Popover/Popover.js +3 -0
  88. package/dist/components/Popover/Popover.module.js +2 -2
  89. package/dist/components/Popover/Popover_module.css +6 -3
  90. package/dist/components/ProgressBar/ProgressBar.d.ts +55 -0
  91. package/dist/components/ProgressBar/ProgressBar.js +76 -0
  92. package/dist/components/ProgressBar/ProgressBar.module.js +12 -0
  93. package/dist/components/ProgressBar/ProgressBar_module.css +120 -0
  94. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  95. package/dist/components/RadioGroup/RadioGroup.js +35 -49
  96. package/dist/components/RadioGroup/RadioGroup.module.js +2 -2
  97. package/dist/components/RadioGroup/RadioGroup_module.css +2 -2
  98. package/dist/components/SearchField/SearchField.d.ts +32 -0
  99. package/dist/components/SearchField/SearchField.js +100 -0
  100. package/dist/components/SearchField/SearchField.module.js +8 -0
  101. package/dist/components/SearchField/SearchField_module.css +34 -0
  102. package/dist/components/Segmented/Segmented.d.ts +23 -6
  103. package/dist/components/Segmented/Segmented.js +37 -20
  104. package/dist/components/Segmented/Segmented.module.js +4 -3
  105. package/dist/components/Segmented/Segmented_module.css +46 -20
  106. package/dist/components/Select/Select.js +3 -0
  107. package/dist/components/Select/Select.module.js +5 -5
  108. package/dist/components/Select/Select_module.css +12 -11
  109. package/dist/components/Skeleton/Skeleton.module.js +3 -3
  110. package/dist/components/Skeleton/Skeleton_module.css +9 -9
  111. package/dist/components/SkipLink/SkipLink.module.js +1 -1
  112. package/dist/components/SkipLink/SkipLink_module.css +4 -4
  113. package/dist/components/Spinner/Spinner.module.js +3 -3
  114. package/dist/components/Spinner/Spinner_module.css +7 -7
  115. package/dist/components/StatusDot/StatusDot.module.js +5 -5
  116. package/dist/components/StatusDot/StatusDot_module.css +11 -11
  117. package/dist/components/Steps/Steps.module.js +6 -6
  118. package/dist/components/Steps/Steps_module.css +19 -19
  119. package/dist/components/Switch/Switch.module.js +2 -2
  120. package/dist/components/Switch/Switch_module.css +5 -5
  121. package/dist/components/TabBar/TabBar.d.ts +26 -0
  122. package/dist/components/TabBar/TabBar.js +52 -0
  123. package/dist/components/TabBar/TabBar.module.js +11 -0
  124. package/dist/components/TabBar/TabBar_module.css +100 -0
  125. package/dist/components/Tabs/Tabs.module.js +4 -4
  126. package/dist/components/Tabs/Tabs_module.css +9 -8
  127. package/dist/components/Tag/Tag.module.js +1 -1
  128. package/dist/components/Tag/Tag_module.css +3 -2
  129. package/dist/components/TextArea/TextArea.module.js +1 -1
  130. package/dist/components/TextArea/TextArea_module.css +6 -2
  131. package/dist/components/TextInput/TextInput.d.ts +14 -2
  132. package/dist/components/TextInput/TextInput.js +4 -5
  133. package/dist/components/ThemeScope/PortalContainerContext.d.ts +17 -0
  134. package/dist/components/ThemeScope/PortalContainerContext.js +6 -0
  135. package/dist/components/ThemeScope/ThemeScope.d.ts +23 -0
  136. package/dist/components/ThemeScope/ThemeScope.js +29 -0
  137. package/dist/components/ThemeScope/ThemeScope.module.js +6 -0
  138. package/dist/components/ThemeScope/ThemeScope_module.css +10 -0
  139. package/dist/components/TimePicker/TimePicker.d.ts +15 -2
  140. package/dist/components/TimePicker/TimePicker.js +5 -5
  141. package/dist/components/Timeline/Timeline.module.js +8 -8
  142. package/dist/components/Timeline/Timeline_module.css +15 -13
  143. package/dist/components/ToastRegion/ToastRegion.js +3 -0
  144. package/dist/components/ToastRegion/ToastRegion.module.js +6 -6
  145. package/dist/components/ToastRegion/ToastRegion_module.css +23 -19
  146. package/dist/components/ToggleChip/ToggleChip.d.ts +49 -0
  147. package/dist/components/ToggleChip/ToggleChip.js +45 -0
  148. package/dist/components/ToggleChip/ToggleChip.module.js +9 -0
  149. package/dist/components/ToggleChip/ToggleChipGroup.d.ts +57 -0
  150. package/dist/components/ToggleChip/ToggleChipGroup.js +93 -0
  151. package/dist/components/ToggleChip/ToggleChip_module.css +97 -0
  152. package/dist/components/Toolbar/Toolbar.module.js +3 -3
  153. package/dist/components/Toolbar/Toolbar_module.css +5 -5
  154. package/dist/components/Tooltip/Tooltip.js +3 -0
  155. package/dist/components/Tree/Tree.module.js +8 -8
  156. package/dist/components/Tree/Tree_module.css +20 -20
  157. package/dist/components/TreeSelect/TreeSelect.js +3 -0
  158. package/dist/components/TreeSelect/TreeSelect.module.js +3 -3
  159. package/dist/components/TreeSelect/TreeSelect_module.css +4 -4
  160. package/dist/components/Upload/Upload.module.js +8 -8
  161. package/dist/components/Upload/Upload_module.css +16 -16
  162. package/dist/components/ViewField/ViewField.module.js +2 -2
  163. package/dist/components/ViewField/ViewField_module.css +3 -3
  164. package/dist/hooks/useControllable.d.ts +11 -0
  165. package/dist/hooks/useControllable.js +13 -0
  166. package/dist/hooks/useIndexedToggleGroup.d.ts +30 -0
  167. package/dist/hooks/useIndexedToggleGroup.js +26 -0
  168. package/dist/hooks/useOverflowFocusable.d.ts +17 -0
  169. package/dist/hooks/useOverflowFocusable.js +36 -0
  170. package/dist/icons/SearchIcon.d.ts +9 -0
  171. package/dist/icons/SearchIcon.js +23 -0
  172. package/dist/index.d.ts +26 -0
  173. package/dist/index.js +12 -0
  174. package/dist/styles/a11y.module.js +1 -1
  175. package/dist/styles/a11y_module.css +1 -1
  176. package/dist/styles/base.css +17 -0
  177. package/dist/styles/closeCircle.module.js +5 -0
  178. package/dist/styles/closeCircle_module.css +12 -0
  179. package/dist/styles/field.module.js +14 -11
  180. package/dist/styles/field_module.css +94 -25
  181. package/dist/styles/pair.module.js +2 -2
  182. package/dist/styles/pair_module.css +5 -3
  183. package/dist/styles/popup.module.js +5 -5
  184. package/dist/styles/popup_module.css +35 -28
  185. package/dist/utils/focusInputFromPill.d.ts +12 -0
  186. package/dist/utils/focusInputFromPill.js +7 -0
  187. package/dist/utils/hasContent.d.ts +8 -0
  188. package/dist/utils/hasContent.js +4 -0
  189. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  import "./ToastRegion_module.css";
2
2
  const ToastRegion_module = {
3
- viewport: "viewport-v4Y5F",
4
- toast: "toast-G4ytY",
5
- content: "content-tQIoA",
6
- heading: "heading-BAZ9J",
7
- description: "description-a9oJ4",
8
- action: "action-NmziC"
3
+ viewport: "ui0-8-0-viewport-v4Y5F",
4
+ toast: "ui0-8-0-toast-G4ytY",
5
+ content: "ui0-8-0-content-tQIoA",
6
+ heading: "ui0-8-0-heading-BAZ9J",
7
+ description: "ui0-8-0-description-a9oJ4",
8
+ action: "ui0-8-0-action-NmziC"
9
9
  };
10
10
  export default ToastRegion_module;
@@ -1,22 +1,22 @@
1
- .viewport-v4Y5F {
1
+ .ui0-8-0-viewport-v4Y5F {
2
2
  right: var(--space-5);
3
3
  bottom: var(--space-5);
4
- width: min(22rem, calc(100vw - var(--space-6)));
4
+ width: min(22rem, calc(100% - var(--space-6)));
5
5
  position: fixed;
6
6
  left: auto;
7
7
  }
8
8
 
9
- .toast-G4ytY {
9
+ .ui0-8-0-toast-G4ytY {
10
10
  align-items: flex-start;
11
11
  gap: var(--space-3);
12
12
  width: 100%;
13
13
  padding: var(--space-3) var(--space-4);
14
14
  border: 1px solid var(--color-border);
15
15
  border-inline-start: var(--border-width-strong) solid var(--color-neutral);
16
- border-radius: var(--radius-lg);
16
+ border-radius: var(--radius-popup);
17
17
  background: var(--color-surface-raised);
18
18
  color: var(--color-text);
19
- box-shadow: var(--elevation-2);
19
+ box-shadow: var(--shadow-raised);
20
20
  transition-property: transform, opacity;
21
21
  transition-duration: var(--motion-duration-3);
22
22
  transition-timing-function: var(--motion-ease);
@@ -30,40 +30,40 @@
30
30
  right: 0;
31
31
  }
32
32
 
33
- .toast-G4ytY[data-expanded] {
33
+ .ui0-8-0-toast-G4ytY[data-expanded] {
34
34
  transform: translateY(calc((var(--toast-offset-y) + var(--toast-index) * var(--space-2)) * -1));
35
35
  }
36
36
 
37
- .toast-G4ytY[data-limited] {
37
+ .ui0-8-0-toast-G4ytY[data-limited] {
38
38
  opacity: 0;
39
39
  }
40
40
 
41
- .toast-G4ytY[data-starting-style] {
41
+ .ui0-8-0-toast-G4ytY[data-starting-style] {
42
42
  opacity: 0;
43
43
  transform: translateY(100%);
44
44
  }
45
45
 
46
- .toast-G4ytY[data-ending-style] {
46
+ .ui0-8-0-toast-G4ytY[data-ending-style] {
47
47
  opacity: 0;
48
48
  }
49
49
 
50
- .toast-G4ytY[data-type="info"] {
50
+ .ui0-8-0-toast-G4ytY[data-type="info"] {
51
51
  border-inline-start-color: var(--color-accent);
52
52
  }
53
53
 
54
- .toast-G4ytY[data-type="success"] {
54
+ .ui0-8-0-toast-G4ytY[data-type="success"] {
55
55
  border-inline-start-color: var(--color-success);
56
56
  }
57
57
 
58
- .toast-G4ytY[data-type="warning"] {
58
+ .ui0-8-0-toast-G4ytY[data-type="warning"] {
59
59
  border-inline-start-color: var(--color-warning);
60
60
  }
61
61
 
62
- .toast-G4ytY[data-type="danger"] {
62
+ .ui0-8-0-toast-G4ytY[data-type="danger"] {
63
63
  border-inline-start-color: var(--color-danger);
64
64
  }
65
65
 
66
- .content-tQIoA {
66
+ .ui0-8-0-content-tQIoA {
67
67
  gap: var(--space-1);
68
68
  flex-direction: column;
69
69
  flex: auto;
@@ -71,24 +71,28 @@
71
71
  display: flex;
72
72
  }
73
73
 
74
- .heading-BAZ9J {
74
+ .ui0-8-0-heading-BAZ9J {
75
75
  color: var(--color-text);
76
+ font-family: var(--font-sans);
76
77
  font-size: var(--text-sm);
77
- font-weight: 600;
78
+ font-weight: var(--font-weight-heading);
78
79
  line-height: var(--leading-snug);
79
80
  }
80
81
 
81
- .description-a9oJ4 {
82
+ .ui0-8-0-description-a9oJ4 {
82
83
  color: var(--color-text-muted);
84
+ font-family: var(--font-body);
85
+ font-weight: var(--font-weight-body);
83
86
  font-size: var(--text-sm);
84
87
  line-height: var(--leading-prose);
85
88
  }
86
89
 
87
- .action-NmziC {
90
+ .ui0-8-0-action-NmziC {
88
91
  padding: var(--space-1) var(--space-3);
89
92
  border: 1px solid var(--color-border-strong);
90
93
  border-radius: var(--radius-md);
91
94
  color: var(--color-text);
95
+ font-family: var(--font-sans);
92
96
  font-size: var(--text-sm);
93
97
  cursor: pointer;
94
98
  background: none;
@@ -97,7 +101,7 @@
97
101
  }
98
102
 
99
103
  @media (hover: hover) {
100
- .action-NmziC:hover {
104
+ .ui0-8-0-action-NmziC:hover {
101
105
  background: var(--color-surface-2);
102
106
  }
103
107
  }
@@ -0,0 +1,49 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ToggleChipProps {
3
+ /** Controlled. Pair it with `onPressedChange`; use `defaultPressed` for an uncontrolled chip. */
4
+ pressed?: boolean;
5
+ defaultPressed?: boolean;
6
+ /**
7
+ * The chip's new state. One argument, as on every other control in the library: Base UI calls
8
+ * its own callback `(pressed, eventDetails)` and this wrapper drops the second.
9
+ */
10
+ onPressedChange?: (pressed: boolean) => void;
11
+ /**
12
+ * Sits at the chip's start, rounded to a 26 px disc. Decorative, so it stays out of the
13
+ * accessible name.
14
+ */
15
+ icon?: ReactNode;
16
+ disabled?: boolean;
17
+ /** The label, and the chip's accessible name. */
18
+ children: ReactNode;
19
+ className?: string;
20
+ }
21
+ interface ChipToggleProps extends ToggleChipProps {
22
+ /**
23
+ * What the chip is inside a `ToggleChipGroup`. Left out, the chip stands alone. The group
24
+ * hands the option's index, not its value: Base UI's `Toggle` takes `''` for no value at all.
25
+ */
26
+ value?: string;
27
+ /** Draws a check after the label. The group asks for it on a pressed chip of a multiple group. */
28
+ showCheck: boolean;
29
+ /**
30
+ * The group's tab stop (`useIndexedToggleGroup`). A lone chip leaves both out, and so does a
31
+ * group chip whose stop is Base UI's: they are spread only when present, so an absent one never
32
+ * overrides the `tabIndex` Base UI roves.
33
+ */
34
+ tabIndex?: number;
35
+ onFocus?: () => void;
36
+ }
37
+ /**
38
+ * The one chip both components draw. Internal: `ToggleChipGroup` imports it from here and the
39
+ * barrel does not export it, so `ToggleChipProps` stays exactly what a consumer of a lone chip
40
+ * can set.
41
+ */
42
+ export declare function ChipToggle({ value, showCheck, icon, disabled, pressed, defaultPressed, onPressedChange, children, className, ...tabStopProps }: ChipToggleProps): import("react").JSX.Element;
43
+ /**
44
+ * A pill that is pressed or not: a toggle button, `aria-pressed` for assistive technology, and in
45
+ * the selected colour while pressed. Alone it draws no check; a pressed chip of a multiple
46
+ * `ToggleChipGroup` does.
47
+ */
48
+ export declare function ToggleChip({ pressed, defaultPressed, onPressedChange, icon, disabled, children, className, }: ToggleChipProps): import("react").JSX.Element;
49
+ export {};
@@ -0,0 +1,45 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Toggle } from "@base-ui/react/toggle";
3
+ import { CheckIcon } from "../../icons/CheckIcon.js";
4
+ import ToggleChip_module from "./ToggleChip.module.js";
5
+ function ChipToggle({ value, showCheck, icon, disabled, pressed, defaultPressed, onPressedChange, children, className, ...tabStopProps }) {
6
+ return /*#__PURE__*/ jsxs(Toggle, {
7
+ className: [
8
+ ToggleChip_module.chip,
9
+ className
10
+ ].filter(Boolean).join(' '),
11
+ "data-with-icon": icon ? '' : void 0,
12
+ value: value,
13
+ disabled: disabled,
14
+ pressed: pressed,
15
+ defaultPressed: defaultPressed,
16
+ ...tabStopProps,
17
+ onPressedChange: onPressedChange ? (nextPressed)=>onPressedChange(nextPressed) : void 0,
18
+ children: [
19
+ icon ? /*#__PURE__*/ jsx("span", {
20
+ className: ToggleChip_module.icon,
21
+ "aria-hidden": "true",
22
+ children: icon
23
+ }) : null,
24
+ children,
25
+ showCheck ? /*#__PURE__*/ jsx("span", {
26
+ className: ToggleChip_module.check,
27
+ "aria-hidden": "true",
28
+ children: /*#__PURE__*/ jsx(CheckIcon, {})
29
+ }) : null
30
+ ]
31
+ });
32
+ }
33
+ function ToggleChip({ pressed, defaultPressed, onPressedChange, icon, disabled, children, className }) {
34
+ return /*#__PURE__*/ jsx(ChipToggle, {
35
+ showCheck: false,
36
+ pressed: pressed,
37
+ defaultPressed: defaultPressed,
38
+ onPressedChange: onPressedChange,
39
+ icon: icon,
40
+ disabled: disabled,
41
+ className: className,
42
+ children: children
43
+ });
44
+ }
45
+ export { ChipToggle, ToggleChip };
@@ -0,0 +1,9 @@
1
+ import "./ToggleChip_module.css";
2
+ const ToggleChip_module = {
3
+ chip: "ui0-8-0-chip-kDewo",
4
+ group: "ui0-8-0-group-I9_LT",
5
+ icon: "ui0-8-0-icon-SvaT_",
6
+ check: "ui0-8-0-check-j5mIP",
7
+ row: "ui0-8-0-row-osGwz"
8
+ };
9
+ export default ToggleChip_module;
@@ -0,0 +1,57 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { FieldFrameProps } from '../Field/Field.js';
3
+ export interface ToggleChipOption {
4
+ /** What `value` and `onValueChange` speak in. The empty string is a value like any other. */
5
+ value: string;
6
+ /** The visible text, and the chip's accessible name. */
7
+ label: string;
8
+ /** Sits at the chip's start. Decorative: it stays out of the accessible name. */
9
+ icon?: ReactNode;
10
+ disabled?: boolean;
11
+ }
12
+ interface ToggleChipGroupBaseProps extends FieldFrameProps {
13
+ /** Names the group. Rendered as a plain element, not a `<label>`, as `RadioGroup` does. */
14
+ label: string;
15
+ options: readonly ToggleChipOption[];
16
+ /**
17
+ * Draws the required mark after the label, and nothing more. A group of toggle buttons has no
18
+ * `required` attribute to carry the requirement to assistive technology, and the browser cannot
19
+ * check one, so a form that needs a chip pressed says so with `error`.
20
+ */
21
+ required?: boolean;
22
+ /** Called when the focus leaves a chip, as `RadioGroup`'s `onBlur` is. */
23
+ onBlur?: () => void;
24
+ }
25
+ export interface ToggleChipGroupSingleProps extends ToggleChipGroupBaseProps {
26
+ selectionMode: 'single';
27
+ /** Controlled; `null` presses nothing. Pair it with `onValueChange`, or use `defaultValue`. */
28
+ value?: string | null;
29
+ defaultValue?: string | null;
30
+ /**
31
+ * The newly pressed chip's value. One argument, as on every other control in the library. It
32
+ * fires only for a change: pressing the pressed chip again reports nothing and leaves it pressed.
33
+ */
34
+ onValueChange?: (value: string) => void;
35
+ }
36
+ export interface ToggleChipGroupMultipleProps extends ToggleChipGroupBaseProps {
37
+ selectionMode: 'multiple';
38
+ /** Controlled. Pair it with `onValueChange`, or use `defaultValue`. */
39
+ value?: readonly string[];
40
+ defaultValue?: readonly string[];
41
+ /** Every pressed value, in the options' order and not the order they were pressed in. */
42
+ onValueChange?: (value: string[]) => void;
43
+ }
44
+ export type ToggleChipGroupProps = ToggleChipGroupSingleProps | ToggleChipGroupMultipleProps;
45
+ /**
46
+ * A row of chips that choose one value (`selectionMode="single"`) or any number (`"multiple"`).
47
+ * Each chip is a toggle button, and the group is one tab stop whose arrow keys move focus without
48
+ * pressing anything. A pressed chip of a multiple group draws a check. Tab lands on the pressed chip
49
+ * of a single group, or the first enabled chip while none is pressed (`useIndexedToggleGroup`
50
+ * records how); a multiple group's stop is Base UI's, the first enabled chip.
51
+ *
52
+ * Base UI's `ToggleGroup` and `Toggle`, unlike its `RadioGroup`, read no `Field` context. The group
53
+ * therefore renders a `Field.Control` itself (see below), which is what makes it a field to a
54
+ * `Form`, and passes the frame's `disabled` on to the `ToggleGroup` by hand.
55
+ */
56
+ export declare function ToggleChipGroup(props: ToggleChipGroupProps): import("react").JSX.Element;
57
+ export {};
@@ -0,0 +1,93 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Field } from "@base-ui/react/field";
3
+ import { ToggleGroup } from "@base-ui/react/toggle-group";
4
+ import { useId } from "react";
5
+ import { useControllable } from "../../hooks/useControllable.js";
6
+ import { useIndexedToggleGroup } from "../../hooks/useIndexedToggleGroup.js";
7
+ import { GroupFrame } from "../Field/GroupFrame.js";
8
+ import { useFormValue } from "../Form/FormContext.js";
9
+ import { ChipToggle } from "./ToggleChip.js";
10
+ import ToggleChip_module from "./ToggleChip.module.js";
11
+ function valuesOf(value) {
12
+ if (null == value) return [];
13
+ return 'string' == typeof value ? [
14
+ value
15
+ ] : value;
16
+ }
17
+ function ToggleChipGroup(props) {
18
+ const { label, options, name, description, error, onBlur, required = false, disabled = false } = props;
19
+ const labelId = useId();
20
+ const [pressedValues, setPressedValues] = useControllable(void 0 === props.value ? void 0 : valuesOf(props.value), valuesOf(props.defaultValue));
21
+ const multiple = 'multiple' === props.selectionMode;
22
+ const pressedChips = options.flatMap((option, index)=>pressedValues.includes(option.value) ? [
23
+ {
24
+ option,
25
+ index
26
+ }
27
+ ] : []);
28
+ const singleStopIndex = pressedChips[0]?.index ?? options.findIndex((option)=>!option.disabled);
29
+ const toggleGroup = useIndexedToggleGroup(options, multiple || disabled ? -1 : singleStopIndex);
30
+ const submittedValue = multiple ? pressedChips.map(({ option })=>option.value) : pressedChips[0]?.option.value ?? null;
31
+ useFormValue(disabled ? void 0 : name, submittedValue);
32
+ return /*#__PURE__*/ jsxs(GroupFrame, {
33
+ labelId: labelId,
34
+ label: label,
35
+ name: name,
36
+ description: description,
37
+ error: error,
38
+ required: required,
39
+ disabled: disabled,
40
+ children: [
41
+ /*#__PURE__*/ jsx(Field.Control, {
42
+ value: 0 === pressedChips.length ? '' : JSON.stringify(submittedValue),
43
+ onBlur: onBlur,
44
+ render: (controlProps)=>{
45
+ const { value: _signature, defaultValue: _defaultValue, onChange: _onChange, name: _name, ...groupProps } = controlProps;
46
+ return /*#__PURE__*/ jsx(ToggleGroup, {
47
+ ...groupProps,
48
+ render: /*#__PURE__*/ jsx("fieldset", {}),
49
+ className: ToggleChip_module.group,
50
+ "aria-labelledby": labelId,
51
+ tabIndex: -1,
52
+ disabled: disabled,
53
+ multiple: multiple,
54
+ value: toggleGroup.groupValue(pressedChips.map(({ index })=>index)),
55
+ onValueChange: (nextIndexes)=>{
56
+ const nextValues = toggleGroup.optionsAt(nextIndexes).map(({ value })=>value);
57
+ if ('multiple' === props.selectionMode) {
58
+ setPressedValues(nextValues);
59
+ props.onValueChange?.(nextValues);
60
+ return;
61
+ }
62
+ const [chosenValue] = nextValues;
63
+ if (void 0 === chosenValue) return;
64
+ setPressedValues([
65
+ chosenValue
66
+ ]);
67
+ props.onValueChange?.(chosenValue);
68
+ },
69
+ children: /*#__PURE__*/ jsx("div", {
70
+ className: ToggleChip_module.row,
71
+ onBlur: toggleGroup.onGroupBlur,
72
+ children: options.map((option, index)=>/*#__PURE__*/ jsx(ChipToggle, {
73
+ value: String(index),
74
+ ...toggleGroup.itemProps(option, index),
75
+ showCheck: multiple && pressedValues.includes(option.value),
76
+ icon: option.icon,
77
+ disabled: option.disabled,
78
+ children: option.label
79
+ }, option.value))
80
+ })
81
+ });
82
+ }
83
+ }),
84
+ void 0 === name ? null : pressedChips.map(({ option })=>/*#__PURE__*/ jsx("input", {
85
+ type: "hidden",
86
+ name: name,
87
+ value: option.value,
88
+ disabled: disabled
89
+ }, option.value))
90
+ ]
91
+ });
92
+ }
93
+ export { ToggleChipGroup };
@@ -0,0 +1,97 @@
1
+ .ui0-8-0-chip-kDewo {
2
+ align-items: center;
3
+ gap: var(--space-1);
4
+ max-width: 100%;
5
+ padding: var(--space-2) var(--space-3);
6
+ border-radius: var(--radius-full);
7
+ background: var(--color-surface-2);
8
+ color: var(--color-text);
9
+ font-family: var(--font-sans);
10
+ font-weight: var(--font-weight-label);
11
+ font-size: var(--text-sm);
12
+ line-height: var(--leading-tight);
13
+ overflow-wrap: anywhere;
14
+ cursor: pointer;
15
+ transition-property: background-color, color;
16
+ transition-duration: var(--motion-duration-1);
17
+ transition-timing-function: var(--motion-ease);
18
+ -webkit-tap-highlight-color: transparent;
19
+ border: 0;
20
+ display: inline-flex;
21
+ }
22
+
23
+ .ui0-8-0-chip-kDewo[data-with-icon] {
24
+ padding-inline-start: var(--space-1);
25
+ }
26
+
27
+ @media (hover: hover) {
28
+ .ui0-8-0-chip-kDewo:hover:not([data-disabled], [data-pressed]) {
29
+ background: var(--color-surface-3);
30
+ }
31
+ }
32
+
33
+ .ui0-8-0-chip-kDewo[data-pressed] {
34
+ background: var(--color-selected);
35
+ color: var(--color-selected-text);
36
+ box-shadow: var(--toggle-chip-pressed-ring, none);
37
+ }
38
+
39
+ .ui0-8-0-group-I9_LT[data-invalid] .ui0-8-0-chip-kDewo:not([data-pressed]) {
40
+ --toggle-chip-invalid-ring: inset 0 0 0 var(--border-width-emphasis) var(--color-danger-border);
41
+ box-shadow: var(--toggle-chip-invalid-ring);
42
+ }
43
+
44
+ @media (forced-colors: active) {
45
+ .ui0-8-0-chip-kDewo {
46
+ border: 1px solid #0000;
47
+ }
48
+
49
+ .ui0-8-0-chip-kDewo[data-pressed] {
50
+ forced-color-adjust: none;
51
+ color: highlighttext;
52
+ background: highlight;
53
+ outline-color: canvastext;
54
+ }
55
+ }
56
+
57
+ .ui0-8-0-chip-kDewo[data-disabled] {
58
+ cursor: not-allowed;
59
+ opacity: .45;
60
+ }
61
+
62
+ .ui0-8-0-icon-SvaT_ {
63
+ flex: none;
64
+ display: inline-flex;
65
+ }
66
+
67
+ .ui0-8-0-icon-SvaT_ > * {
68
+ border-radius: var(--radius-full);
69
+ flex: none;
70
+ width: 1.625rem;
71
+ height: 1.625rem;
72
+ overflow: hidden;
73
+ }
74
+
75
+ .ui0-8-0-check-j5mIP {
76
+ flex: none;
77
+ display: inline-flex;
78
+ }
79
+
80
+ .ui0-8-0-check-j5mIP > svg {
81
+ width: .75rem;
82
+ height: .75rem;
83
+ }
84
+
85
+ .ui0-8-0-group-I9_LT {
86
+ border: 0;
87
+ min-width: 0;
88
+ margin: 0;
89
+ padding: 0;
90
+ }
91
+
92
+ .ui0-8-0-row-osGwz {
93
+ gap: var(--space-2);
94
+ flex-wrap: wrap;
95
+ display: flex;
96
+ }
97
+
@@ -1,7 +1,7 @@
1
1
  import "./Toolbar_module.css";
2
2
  const Toolbar_module = {
3
- root: "root-TasA5",
4
- group: "group-gw9JG",
5
- separator: "separator-pZlgb"
3
+ root: "ui0-8-0-root-TasA5",
4
+ group: "ui0-8-0-group-gw9JG",
5
+ separator: "ui0-8-0-separator-pZlgb"
6
6
  };
7
7
  export default Toolbar_module;
@@ -1,26 +1,26 @@
1
- .root-TasA5, .group-gw9JG {
1
+ .ui0-8-0-root-TasA5, .ui0-8-0-group-gw9JG {
2
2
  align-items: center;
3
3
  gap: var(--space-2);
4
4
  flex-wrap: wrap;
5
5
  display: flex;
6
6
  }
7
7
 
8
- .root-TasA5[data-orientation="vertical"], .group-gw9JG[data-orientation="vertical"] {
8
+ .ui0-8-0-root-TasA5[data-orientation="vertical"], .ui0-8-0-group-gw9JG[data-orientation="vertical"] {
9
9
  flex-direction: column;
10
10
  align-items: stretch;
11
11
  }
12
12
 
13
- .separator-pZlgb {
13
+ .ui0-8-0-separator-pZlgb {
14
14
  background: var(--color-border-strong);
15
15
  flex: none;
16
16
  }
17
17
 
18
- .separator-pZlgb[data-orientation="vertical"] {
18
+ .ui0-8-0-separator-pZlgb[data-orientation="vertical"] {
19
19
  align-self: stretch;
20
20
  width: 1px;
21
21
  }
22
22
 
23
- .separator-pZlgb[data-orientation="horizontal"] {
23
+ .ui0-8-0-separator-pZlgb[data-orientation="horizontal"] {
24
24
  height: 1px;
25
25
  }
26
26
 
@@ -1,7 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Tooltip } from "@base-ui/react/tooltip";
3
+ import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
3
4
  import popup_module from "../../styles/popup.module.js";
4
5
  function Tooltip_Tooltip({ trigger, label, side = 'top', align = 'center', sideOffset = 8, delay }) {
6
+ const container = usePortalContainer();
5
7
  return /*#__PURE__*/ jsxs(Tooltip.Root, {
6
8
  children: [
7
9
  /*#__PURE__*/ jsx(Tooltip.Trigger, {
@@ -10,6 +12,7 @@ function Tooltip_Tooltip({ trigger, label, side = 'top', align = 'center', sideO
10
12
  delay: delay
11
13
  }),
12
14
  /*#__PURE__*/ jsx(Tooltip.Portal, {
15
+ container: container,
13
16
  children: /*#__PURE__*/ jsx(Tooltip.Positioner, {
14
17
  className: popup_module.layer,
15
18
  side: side,
@@ -1,12 +1,12 @@
1
1
  import "./Tree_module.css";
2
2
  const Tree_module = {
3
- root: "root-dqkRl",
4
- group: "group-nEZG3",
5
- row: "row-Idt69",
6
- item: "item-ZpP2D",
7
- icon: "icon-Vc8zg",
8
- check: "check-Ccwtp",
9
- toggle: "toggle-Dv2Gv",
10
- label: "label-u_zOq"
3
+ root: "ui0-8-0-root-dqkRl",
4
+ group: "ui0-8-0-group-nEZG3",
5
+ row: "ui0-8-0-row-Idt69",
6
+ item: "ui0-8-0-item-ZpP2D",
7
+ icon: "ui0-8-0-icon-Vc8zg",
8
+ check: "ui0-8-0-check-Ccwtp",
9
+ toggle: "ui0-8-0-toggle-Dv2Gv",
10
+ label: "ui0-8-0-label-u_zOq"
11
11
  };
12
12
  export default Tree_module;