@calcifer-design/ui 0.6.0 → 0.7.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 +30 -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 +52 -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 +92 -23
  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,14 +1,14 @@
1
1
  import "./DatePicker_module.css";
2
2
  const DatePicker_module = {
3
- popup: "popup-KehYf",
4
- header: "header-zwN0_",
5
- month: "month-kmJCd",
6
- previous: "previous-zWGPB",
7
- next: "next-caCSG",
8
- gridSlot: "gridSlot-XSqqc",
9
- grid: "grid-OEI6m",
10
- weekday: "weekday-BLI2K",
11
- day: "day-DOQIC",
12
- footer: "footer-rvxzg"
3
+ popup: "ui0-7-0-popup-KehYf",
4
+ header: "ui0-7-0-header-zwN0_",
5
+ month: "ui0-7-0-month-kmJCd",
6
+ previous: "ui0-7-0-previous-zWGPB",
7
+ next: "ui0-7-0-next-caCSG",
8
+ gridSlot: "ui0-7-0-gridSlot-XSqqc",
9
+ grid: "ui0-7-0-grid-OEI6m",
10
+ weekday: "ui0-7-0-weekday-BLI2K",
11
+ day: "ui0-7-0-day-DOQIC",
12
+ footer: "ui0-7-0-footer-rvxzg"
13
13
  };
14
14
  export default DatePicker_module;
@@ -1,52 +1,53 @@
1
- .popup-KehYf {
1
+ .ui0-7-0-popup-KehYf {
2
2
  width: 22rem;
3
3
  }
4
4
 
5
- .header-zwN0_ {
5
+ .ui0-7-0-header-zwN0_ {
6
6
  justify-content: space-between;
7
7
  align-items: center;
8
8
  gap: var(--space-2);
9
9
  display: flex;
10
10
  }
11
11
 
12
- .month-kmJCd {
12
+ .ui0-7-0-month-kmJCd {
13
13
  color: var(--color-text);
14
+ font-family: var(--font-sans);
14
15
  font-size: var(--text-md);
15
- font-weight: 500;
16
+ font-weight: var(--font-weight-label);
16
17
  line-height: var(--leading-snug);
17
18
  text-align: center;
18
19
  flex: 1;
19
20
  }
20
21
 
21
- .previous-zWGPB svg {
22
+ .ui0-7-0-previous-zWGPB svg {
22
23
  transform: rotate(90deg);
23
24
  }
24
25
 
25
- .next-caCSG svg, .header-zwN0_[data-direction="rtl"] .previous-zWGPB svg {
26
+ .ui0-7-0-next-caCSG svg, .ui0-7-0-header-zwN0_[data-direction="rtl"] .ui0-7-0-previous-zWGPB svg {
26
27
  transform: rotate(-90deg);
27
28
  }
28
29
 
29
- .header-zwN0_[data-direction="rtl"] .next-caCSG svg {
30
+ .ui0-7-0-header-zwN0_[data-direction="rtl"] .ui0-7-0-next-caCSG svg {
30
31
  transform: rotate(90deg);
31
32
  }
32
33
 
33
- .previous-zWGPB[aria-disabled="true"], .next-caCSG[aria-disabled="true"] {
34
+ .ui0-7-0-previous-zWGPB[aria-disabled="true"], .ui0-7-0-next-caCSG[aria-disabled="true"] {
34
35
  cursor: not-allowed;
35
36
  opacity: .45;
36
37
  }
37
38
 
38
- .gridSlot-XSqqc {
39
+ .ui0-7-0-gridSlot-XSqqc {
39
40
  min-height: calc(7 * var(--size-touch));
40
41
  }
41
42
 
42
- .grid-OEI6m {
43
+ .ui0-7-0-grid-OEI6m {
43
44
  border-collapse: separate;
44
45
  border-spacing: 0;
45
46
  table-layout: fixed;
46
47
  width: 100%;
47
48
  }
48
49
 
49
- .weekday-BLI2K {
50
+ .ui0-7-0-weekday-BLI2K {
50
51
  height: var(--size-touch);
51
52
  color: var(--color-text-muted);
52
53
  font-size: var(--text-sm);
@@ -55,7 +56,7 @@
55
56
  font-weight: 500;
56
57
  }
57
58
 
58
- .day-DOQIC {
59
+ .ui0-7-0-day-DOQIC {
59
60
  height: var(--size-touch);
60
61
  border-radius: var(--radius-md);
61
62
  color: var(--color-text);
@@ -70,42 +71,42 @@
70
71
  }
71
72
 
72
73
  @media (hover: hover) {
73
- .day-DOQIC:hover:not([aria-disabled="true"], [aria-selected="true"]) {
74
+ .ui0-7-0-day-DOQIC:hover:not([aria-disabled="true"], [aria-selected="true"]) {
74
75
  background: var(--color-surface-2);
75
76
  }
76
77
  }
77
78
 
78
- .day-DOQIC[aria-current="date"] {
79
+ .ui0-7-0-day-DOQIC[aria-current="date"] {
79
80
  border: 1px solid var(--color-accent);
80
81
  font-weight: 600;
81
82
  }
82
83
 
83
- .day-DOQIC[aria-selected="true"] {
84
- background: var(--color-accent);
85
- color: var(--color-accent-text);
84
+ .ui0-7-0-day-DOQIC[aria-selected="true"] {
85
+ background: var(--color-selected);
86
+ color: var(--color-selected-text);
86
87
  }
87
88
 
88
- .day-DOQIC[aria-disabled="true"] {
89
+ .ui0-7-0-day-DOQIC[aria-disabled="true"] {
89
90
  cursor: not-allowed;
90
91
  opacity: .45;
91
92
  text-decoration: line-through;
92
93
  }
93
94
 
94
95
  @media (forced-colors: active) {
95
- .day-DOQIC[aria-selected="true"] {
96
+ .ui0-7-0-day-DOQIC[aria-selected="true"] {
96
97
  forced-color-adjust: none;
97
98
  color: highlighttext;
98
99
  background: highlight;
99
100
  outline-color: canvastext;
100
101
  }
101
102
 
102
- .day-DOQIC[aria-disabled="true"] {
103
+ .ui0-7-0-day-DOQIC[aria-disabled="true"] {
103
104
  opacity: 1;
104
105
  color: graytext;
105
106
  }
106
107
  }
107
108
 
108
- .footer-rvxzg {
109
+ .ui0-7-0-footer-rvxzg {
109
110
  justify-content: flex-end;
110
111
  display: flex;
111
112
  }
@@ -1,8 +1,8 @@
1
1
  import "./Descriptions_module.css";
2
2
  const Descriptions_module = {
3
- root: "root-bQlQQ",
4
- heading: "heading-aHnDT",
5
- list: "list-Qwuyt",
6
- group: "group-fd_ih"
3
+ root: "ui0-7-0-root-bQlQQ",
4
+ heading: "ui0-7-0-heading-aHnDT",
5
+ list: "ui0-7-0-list-Qwuyt",
6
+ group: "ui0-7-0-group-fd_ih"
7
7
  };
8
8
  export default Descriptions_module;
@@ -1,25 +1,29 @@
1
- .root-bQlQQ {
1
+ .ui0-7-0-root-bQlQQ {
2
2
  gap: var(--space-3);
3
3
  flex-direction: column;
4
4
  display: flex;
5
5
  }
6
6
 
7
- .heading-aHnDT {
7
+ .ui0-7-0-heading-aHnDT {
8
8
  color: var(--color-text);
9
9
  font-size: var(--text-h3);
10
+ font-family: var(--font-display);
11
+ font-weight: var(--font-weight-display);
12
+ font-stretch: var(--font-stretch-display);
13
+ text-transform: var(--text-transform-display);
10
14
  line-height: var(--leading-snug);
11
15
  letter-spacing: var(--tracking-heading);
12
16
  margin: 0;
13
17
  }
14
18
 
15
- .list-Qwuyt {
19
+ .ui0-7-0-list-Qwuyt {
16
20
  gap: var(--space-4);
17
21
  grid-template-columns: minmax(0, 1fr);
18
22
  margin: 0;
19
23
  display: grid;
20
24
  }
21
25
 
22
- .group-fd_ih {
26
+ .ui0-7-0-group-fd_ih {
23
27
  gap: var(--space-1);
24
28
  overflow-wrap: anywhere;
25
29
  flex-direction: column;
@@ -28,19 +32,19 @@
28
32
  }
29
33
 
30
34
  @media (width >= 40rem) {
31
- .list-Qwuyt[data-columns="2"] {
35
+ .ui0-7-0-list-Qwuyt[data-columns="2"] {
32
36
  grid-template-columns: repeat(2, minmax(0, 1fr));
33
37
  }
34
38
 
35
- .list-Qwuyt[data-columns="3"] {
39
+ .ui0-7-0-list-Qwuyt[data-columns="3"] {
36
40
  grid-template-columns: repeat(3, minmax(0, 1fr));
37
41
  }
38
42
 
39
- .group-fd_ih[data-span="2"] {
43
+ .ui0-7-0-group-fd_ih[data-span="2"] {
40
44
  grid-column: span 2;
41
45
  }
42
46
 
43
- .group-fd_ih[data-span="3"] {
47
+ .ui0-7-0-group-fd_ih[data-span="3"] {
44
48
  grid-column: span 3;
45
49
  }
46
50
  }
@@ -1,4 +1,4 @@
1
- import type { ReactElement, ReactNode } from 'react';
1
+ import { type ReactElement, type ReactNode } from 'react';
2
2
  export type DialogVariant = 'center' | 'sheet';
3
3
  /** The edge a sheet docks to: `bottom` is the phone pattern, `end` a full-height side panel. */
4
4
  export type SheetSide = 'bottom' | 'end';
@@ -11,6 +11,22 @@ export interface DialogProps {
11
11
  /** Names the popup: it is both the visible heading and the popup's `aria-labelledby` target. */
12
12
  heading: string;
13
13
  headingLevel?: 2 | 3 | 4;
14
+ /**
15
+ * Hides the heading from view while it stays the popup's name (`aria-labelledby`), for a dialog
16
+ * whose own content already says what it is. The header's end group keeps its place at the end.
17
+ */
18
+ headingHidden?: boolean;
19
+ /**
20
+ * Content before the heading in the header row, such as a `Tag` naming the kind of thing the
21
+ * dialog is about.
22
+ */
23
+ headerStart?: ReactNode;
24
+ /**
25
+ * Controls grouped at the end of the header, before the close control, such as a "More" menu
26
+ * button. On open, focus lands on the close control, except with `closeHidden`, when it goes to
27
+ * the first tabbable control, which may be a `headerEnd` button.
28
+ */
29
+ headerEnd?: ReactNode;
14
30
  /** Sits under the heading and becomes the popup's `aria-describedby` target. */
15
31
  description?: ReactNode;
16
32
  children?: ReactNode;
@@ -30,6 +46,18 @@ export interface DialogProps {
30
46
  side?: SheetSide;
31
47
  /** The accessible name of the close control in the header. */
32
48
  closeLabel?: string;
49
+ /**
50
+ * `ghost` (the default) is the bare close; `soft` is the quiet filled circle the mock draws on a
51
+ * photo or a tinted header. The close is drawn as a 36 px circle in both, with a 44 px touch
52
+ * target, never a larger button.
53
+ */
54
+ closeVariant?: 'ghost' | 'soft';
55
+ /**
56
+ * Draws no close control. The caller renders its own visible way out (a "Cancel" in the footer);
57
+ * Escape and a press on the scrim still close the dialog, and `headerEnd` still renders. With no
58
+ * close control the opening focus goes to the first tabbable control in the popup.
59
+ */
60
+ closeHidden?: boolean;
33
61
  /**
34
62
  * Whether a press outside the popup closes it. Escape always does: Base UI has no prop for
35
63
  * that, and vetoing it means cancelling the event inside `onOpenChange`, which this wrapper
@@ -41,4 +69,4 @@ export interface DialogProps {
41
69
  /** Base UI calls this as `(open, eventDetails)`; the second argument is passed through. */
42
70
  onOpenChange?: (open: boolean, eventDetails: unknown) => void;
43
71
  }
44
- export declare function Dialog({ trigger, heading, headingLevel, description, children, footer, variant, side, closeLabel, dismissOnOutsidePress, open, defaultOpen, onOpenChange, }: DialogProps): import("react").JSX.Element;
72
+ export declare function Dialog({ trigger, heading, headingLevel, headingHidden, headerStart, headerEnd, description, children, footer, variant, side, closeLabel, closeVariant, closeHidden, dismissOnOutsidePress, open, defaultOpen, onOpenChange, }: DialogProps): import("react").JSX.Element;
@@ -1,17 +1,30 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Dialog } from "@base-ui/react/dialog";
3
+ import { useId, useRef } from "react";
3
4
  import { CloseIcon } from "../../icons/CloseIcon.js";
5
+ import { useOverflowFocusable } from "../../hooks/useOverflowFocusable.js";
4
6
  import { IconButton } from "../IconButton/IconButton.js";
7
+ import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
8
+ import a11y_module from "../../styles/a11y.module.js";
9
+ import closeCircle_module from "../../styles/closeCircle.module.js";
5
10
  import popup_module from "../../styles/popup.module.js";
11
+ import { hasContent } from "../../utils/hasContent.js";
6
12
  import Dialog_module from "./Dialog.module.js";
7
13
  const headingTags = {
8
14
  2: 'h2',
9
15
  3: 'h3',
10
16
  4: 'h4'
11
17
  };
12
- function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, children, footer, variant = 'center', side = 'bottom', closeLabel = 'Close', dismissOnOutsidePress = true, open, defaultOpen, onOpenChange }) {
18
+ function Dialog_Dialog({ trigger, heading, headingLevel = 2, headingHidden = false, headerStart, headerEnd, description, children, footer, variant = 'center', side = 'bottom', closeLabel = 'Close', closeVariant = 'ghost', closeHidden = false, dismissOnOutsidePress = true, open, defaultOpen, onOpenChange }) {
13
19
  const sheetSide = 'sheet' === variant ? side : void 0;
14
20
  const Heading = headingTags[headingLevel] ?? 'h2';
21
+ const container = usePortalContainer();
22
+ const popupRef = useRef(null);
23
+ const closeRef = useRef(null);
24
+ const initialFocus = (interactionType)=>'touch' === interactionType ? popupRef.current : closeRef.current ?? true;
25
+ const showEndGroup = hasContent(headerEnd) || !closeHidden;
26
+ const titleId = useId();
27
+ const [bodyRef, bodyOverflows] = useOverflowFocusable();
15
28
  return /*#__PURE__*/ jsxs(Dialog.Root, {
16
29
  open: open,
17
30
  defaultOpen: defaultOpen,
@@ -22,12 +35,15 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
22
35
  render: trigger
23
36
  }),
24
37
  /*#__PURE__*/ jsxs(Dialog.Portal, {
38
+ container: container,
25
39
  children: [
26
40
  /*#__PURE__*/ jsx(Dialog.Backdrop, {
27
41
  className: [
28
42
  popup_module.dialogLayer,
29
43
  popup_module.scrim
30
- ].join(' ')
44
+ ].join(' '),
45
+ "data-variant": variant,
46
+ "data-side": sheetSide
31
47
  }),
32
48
  /*#__PURE__*/ jsx(Dialog.Viewport, {
33
49
  className: [
@@ -37,26 +53,45 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
37
53
  "data-variant": variant,
38
54
  "data-side": sheetSide,
39
55
  children: /*#__PURE__*/ jsxs(Dialog.Popup, {
56
+ ref: popupRef,
40
57
  className: popup_module.surface,
41
58
  "data-popup": 'sheet' === variant ? 'sheet' : 'dialog',
42
59
  "data-side": sheetSide,
60
+ initialFocus: initialFocus,
43
61
  children: [
62
+ 'bottom' === sheetSide ? /*#__PURE__*/ jsx("div", {
63
+ className: Dialog_module.handle,
64
+ "aria-hidden": "true"
65
+ }) : null,
44
66
  /*#__PURE__*/ jsxs("div", {
45
67
  className: Dialog_module.header,
46
68
  children: [
69
+ headerStart,
47
70
  /*#__PURE__*/ jsx(Dialog.Title, {
48
- className: Dialog_module.heading,
71
+ id: titleId,
72
+ className: [
73
+ Dialog_module.heading,
74
+ headingHidden ? a11y_module.visuallyHidden : void 0
75
+ ].filter(Boolean).join(' '),
49
76
  render: /*#__PURE__*/ jsx(Heading, {}),
50
77
  children: heading
51
78
  }),
52
- /*#__PURE__*/ jsx(Dialog.Close, {
53
- render: /*#__PURE__*/ jsx(IconButton, {
54
- label: closeLabel,
55
- variant: "ghost",
56
- size: "sm",
57
- children: /*#__PURE__*/ jsx(CloseIcon, {})
58
- })
59
- })
79
+ showEndGroup ? /*#__PURE__*/ jsxs("div", {
80
+ className: Dialog_module.headerEnd,
81
+ children: [
82
+ headerEnd,
83
+ closeHidden ? null : /*#__PURE__*/ jsx(Dialog.Close, {
84
+ ref: closeRef,
85
+ render: /*#__PURE__*/ jsx(IconButton, {
86
+ label: closeLabel,
87
+ variant: closeVariant,
88
+ size: "sm",
89
+ className: closeCircle_module.close,
90
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
91
+ })
92
+ })
93
+ ]
94
+ }) : null
60
95
  ]
61
96
  }),
62
97
  void 0 === description ? null : /*#__PURE__*/ jsx(Dialog.Description, {
@@ -64,7 +99,13 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
64
99
  children: description
65
100
  }),
66
101
  void 0 === children ? null : /*#__PURE__*/ jsx("div", {
102
+ ref: bodyRef,
67
103
  className: Dialog_module.body,
104
+ ...bodyOverflows ? {
105
+ tabIndex: 0,
106
+ role: 'region',
107
+ 'aria-labelledby': titleId
108
+ } : void 0,
68
109
  children: children
69
110
  }),
70
111
  void 0 === footer ? null : /*#__PURE__*/ jsx("div", {
@@ -1,10 +1,12 @@
1
1
  import "./Dialog_module.css";
2
2
  const Dialog_module = {
3
- viewport: "viewport-nOzLZ",
4
- header: "header-KgP3n",
5
- heading: "heading-EfBAx",
6
- description: "description-ZV1a4",
7
- body: "body-mavCB",
8
- footer: "footer-CAuV7"
3
+ viewport: "ui0-7-0-viewport-nOzLZ",
4
+ header: "ui0-7-0-header-KgP3n",
5
+ heading: "ui0-7-0-heading-EfBAx",
6
+ headerEnd: "ui0-7-0-headerEnd-sEInd",
7
+ handle: "ui0-7-0-handle-z1dbF",
8
+ description: "ui0-7-0-description-ZV1a4",
9
+ body: "ui0-7-0-body-mavCB",
10
+ footer: "ui0-7-0-footer-CAuV7"
9
11
  };
10
12
  export default Dialog_module;
@@ -1,4 +1,4 @@
1
- .viewport-nOzLZ {
1
+ .ui0-7-0-viewport-nOzLZ {
2
2
  padding: var(--space-4);
3
3
  place-items: center;
4
4
  display: grid;
@@ -6,46 +6,93 @@
6
6
  inset: 0;
7
7
  }
8
8
 
9
- .viewport-nOzLZ[data-variant="sheet"] {
9
+ .ui0-7-0-viewport-nOzLZ[data-variant="sheet"] {
10
10
  place-items: end center;
11
11
  padding: 0;
12
12
  }
13
13
 
14
- .viewport-nOzLZ[data-side="end"] {
14
+ .ui0-7-0-viewport-nOzLZ[data-side="end"] {
15
15
  place-items: center end;
16
16
  }
17
17
 
18
- .header-KgP3n {
19
- align-items: flex-start;
18
+ .ui0-7-0-header-KgP3n {
19
+ align-items: center;
20
20
  gap: var(--space-3);
21
21
  display: flex;
22
22
  }
23
23
 
24
- .heading-EfBAx {
24
+ .ui0-7-0-heading-EfBAx {
25
25
  min-width: 0;
26
26
  color: var(--color-text);
27
- font-size: var(--text-h3);
28
- font-weight: 600;
29
- line-height: var(--leading-snug);
27
+ font-size: var(--dialog-heading-size, var(--text-h3));
28
+ font-family: var(--font-display);
29
+ font-weight: var(--font-weight-display);
30
+ font-stretch: var(--font-stretch-display);
31
+ text-transform: var(--text-transform-display);
32
+ letter-spacing: var(--dialog-heading-tracking, var(--tracking-heading));
33
+ line-height: var(--dialog-heading-leading, var(--leading-snug));
30
34
  flex: auto;
31
35
  }
32
36
 
33
- .description-ZV1a4 {
37
+ h4.ui0-7-0-heading-EfBAx {
38
+ letter-spacing: var(--dialog-heading-tracking, normal);
39
+ }
40
+
41
+ .ui0-7-0-headerEnd-sEInd {
42
+ align-items: center;
43
+ gap: var(--space-2);
44
+ margin-inline-start: auto;
45
+ display: flex;
46
+ }
47
+
48
+ .ui0-7-0-handle-z1dbF {
49
+ width: var(--sheet-handle-width, 2.5rem);
50
+ height: var(--sheet-handle-height, .3125rem);
51
+ border-radius: var(--radius-full);
52
+ background: var(--color-sheet-handle);
53
+ flex: none;
54
+ align-self: center;
55
+ }
56
+
57
+ .ui0-7-0-description-ZV1a4 {
34
58
  color: var(--color-text-muted);
59
+ font-family: var(--font-body);
60
+ font-weight: var(--font-weight-body);
35
61
  font-size: var(--text-sm);
36
62
  line-height: var(--leading-prose);
37
63
  }
38
64
 
39
- .body-mavCB {
40
- overscroll-behavior: contain;
65
+ .ui0-7-0-body-mavCB {
66
+ --dialog-body-ring-room: calc(var(--focus-ring-width) + var(--focus-ring-offset));
67
+ --dialog-body-ring-reach: calc(var(--dialog-body-ring-room) * -1);
41
68
  min-height: 0;
69
+ margin: var(--dialog-body-ring-reach);
70
+ padding: var(--dialog-body-ring-room);
71
+ overscroll-behavior: contain;
42
72
  overflow-y: auto;
43
73
  }
44
74
 
45
- .footer-CAuV7 {
75
+ .ui0-7-0-body-mavCB:focus-visible {
76
+ outline-offset: calc(-1 * var(--focus-ring-width));
77
+ }
78
+
79
+ .ui0-7-0-footer-CAuV7 {
46
80
  justify-content: flex-end;
47
81
  gap: var(--space-2);
48
82
  flex-wrap: wrap;
49
83
  display: flex;
50
84
  }
51
85
 
86
+ [data-popup="sheet"] > .ui0-7-0-header-KgP3n, [data-popup="sheet"] > .ui0-7-0-description-ZV1a4, [data-popup="sheet"] > .ui0-7-0-footer-CAuV7 {
87
+ flex: none;
88
+ }
89
+
90
+ [data-popup="sheet"] > .ui0-7-0-body-mavCB {
91
+ flex: auto;
92
+ min-height: 0;
93
+ }
94
+
95
+ [data-popup="sheet"] > .ui0-7-0-footer-CAuV7 {
96
+ margin-top: auto;
97
+ }
98
+
@@ -0,0 +1,41 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface EmptyStateProps {
3
+ /**
4
+ * A picture ahead of the heading. It is decorative and the slot is hidden from assistive
5
+ * technology, so anything that must be read or operated belongs in `heading`, `children` or
6
+ * `actions` instead. The slot lays several in-flow children out in a row, so pass one element
7
+ * or wrap them. The root is `position: relative`, so an absolutely positioned child is placed
8
+ * against the card and may spill over its edge.
9
+ *
10
+ * The slot keeps its place in the card's column even when its picture is positioned, so the
11
+ * heading still starts one gap (`--space-3`) below the padding: 36 px from the card's top at the
12
+ * default spacing, where a card with no illustration starts it at 24. To spill a picture over
13
+ * the card with the heading at the top, leave `illustration` out and position the picture from a
14
+ * wrapper of your own around the `EmptyState`, marked `aria-hidden` there.
15
+ */
16
+ illustration?: ReactNode;
17
+ /** The headline, on the display type. Its tag is `headingLevel`. */
18
+ heading: ReactNode;
19
+ /** The tag of the heading, `h2` unless the page's outline needs another. */
20
+ headingLevel?: 2 | 3 | 4;
21
+ /** The sentence or two under the heading. Nothing is drawn when it is empty. */
22
+ children?: ReactNode;
23
+ /** Buttons or links under the body, in a row that wraps. */
24
+ actions?: ReactNode;
25
+ /** `selected` paints the selected colour with its own text colour. */
26
+ tone?: 'neutral' | 'selected';
27
+ /** Where the content sits: the centre of the card, or its start edge. */
28
+ align?: 'center' | 'start';
29
+ /**
30
+ * A class for the root, joined after the component's own. It is how a consumer sets the one size
31
+ * hook, `--empty-state-heading-size`, which resizes the heading (default `--text-h3`). Like any
32
+ * custom property the hook inherits, so a wrapper that sets it resizes every empty state inside
33
+ * it.
34
+ */
35
+ className?: string;
36
+ }
37
+ /**
38
+ * What a list or a screen shows when it has nothing to list: an optional picture, a headline, a
39
+ * sentence and the next step. It is a plain box, not a landmark.
40
+ */
41
+ export declare function EmptyState({ illustration, heading, headingLevel, children, actions, tone, align, className, }: EmptyStateProps): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { hasContent } from "../../utils/hasContent.js";
3
+ import EmptyState_module from "./EmptyState.module.js";
4
+ const headingTags = {
5
+ 2: 'h2',
6
+ 3: 'h3',
7
+ 4: 'h4'
8
+ };
9
+ function EmptyState({ illustration, heading, headingLevel = 2, children, actions, tone = 'neutral', align = 'center', className }) {
10
+ const Heading = headingTags[headingLevel] ?? 'h2';
11
+ return /*#__PURE__*/ jsxs("div", {
12
+ className: [
13
+ EmptyState_module.root,
14
+ className
15
+ ].filter(Boolean).join(' '),
16
+ "data-tone": tone,
17
+ "data-align": align,
18
+ children: [
19
+ hasContent(illustration) ? /*#__PURE__*/ jsx("div", {
20
+ className: EmptyState_module.illustration,
21
+ "aria-hidden": "true",
22
+ children: illustration
23
+ }) : null,
24
+ /*#__PURE__*/ jsx(Heading, {
25
+ className: EmptyState_module.heading,
26
+ children: heading
27
+ }),
28
+ hasContent(children) ? /*#__PURE__*/ jsx("div", {
29
+ className: EmptyState_module.body,
30
+ children: children
31
+ }) : null,
32
+ hasContent(actions) ? /*#__PURE__*/ jsx("div", {
33
+ className: EmptyState_module.actions,
34
+ children: actions
35
+ }) : null
36
+ ]
37
+ });
38
+ }
39
+ export { EmptyState };
@@ -0,0 +1,9 @@
1
+ import "./EmptyState_module.css";
2
+ const EmptyState_module = {
3
+ root: "ui0-7-0-root-Gqpml",
4
+ illustration: "ui0-7-0-illustration-gt1N5",
5
+ heading: "ui0-7-0-heading-aF5X5",
6
+ body: "ui0-7-0-body-uj_Dd",
7
+ actions: "ui0-7-0-actions-AwsGn"
8
+ };
9
+ export default EmptyState_module;