@womp/kookie-ui 0.10.0 → 0.12.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 (113) hide show
  1. package/components.css +314 -218
  2. package/dist/cjs/components/app-bar.d.ts +49 -0
  3. package/dist/cjs/components/app-bar.d.ts.map +1 -0
  4. package/dist/cjs/components/app-bar.js +2 -0
  5. package/dist/cjs/components/app-bar.js.map +7 -0
  6. package/dist/cjs/components/chatbar.d.ts +26 -2
  7. package/dist/cjs/components/chatbar.d.ts.map +1 -1
  8. package/dist/cjs/components/chatbar.js +2 -2
  9. package/dist/cjs/components/chatbar.js.map +3 -3
  10. package/dist/cjs/components/index.d.ts +2 -1
  11. package/dist/cjs/components/index.d.ts.map +1 -1
  12. package/dist/cjs/components/index.js +5 -5
  13. package/dist/cjs/components/index.js.map +4 -4
  14. package/dist/cjs/components/toolbar.d.ts +88 -36
  15. package/dist/cjs/components/toolbar.d.ts.map +1 -1
  16. package/dist/cjs/components/toolbar.js +4 -1
  17. package/dist/cjs/components/toolbar.js.map +4 -4
  18. package/dist/cjs/components/toolbar.props.d.ts +28 -0
  19. package/dist/cjs/components/toolbar.props.d.ts.map +1 -0
  20. package/dist/cjs/components/toolbar.props.js +2 -0
  21. package/dist/cjs/components/toolbar.props.js.map +7 -0
  22. package/dist/cjs/index.js +5 -5
  23. package/dist/cjs/index.js.map +4 -4
  24. package/dist/esm/{chunk-73QGEY2I.js → chunk-3R4YLW4A.js} +2 -2
  25. package/dist/esm/{chunk-ZZLZGHZQ.js → chunk-4LDVSTXI.js} +2 -2
  26. package/dist/esm/chunk-54JFIP5S.js +2 -0
  27. package/dist/esm/chunk-54JFIP5S.js.map +7 -0
  28. package/dist/esm/{chunk-X3JM2565.js → chunk-6G3MPL4A.js} +2 -2
  29. package/dist/esm/{chunk-DSJY5RI3.js → chunk-7JJT42J2.js} +2 -2
  30. package/dist/esm/chunk-C7EVYSWK.js +1 -0
  31. package/dist/esm/{chunk-ERY5TH2M.js → chunk-CYU6BLZ5.js} +2 -2
  32. package/dist/esm/{chunk-25LBWKEV.js → chunk-D6PHTHF2.js} +2 -2
  33. package/dist/esm/chunk-EGMUQQRW.js +2 -0
  34. package/dist/esm/chunk-EGMUQQRW.js.map +7 -0
  35. package/dist/esm/{chunk-4XGGX2V2.js → chunk-ISOLUTZF.js} +2 -2
  36. package/dist/esm/{chunk-LXWPEDPZ.js → chunk-IYCPYN4Z.js} +2 -2
  37. package/dist/esm/{chunk-RJP5QUXO.js → chunk-L5PID6BU.js} +2 -2
  38. package/dist/esm/{chunk-BW5CO4PZ.js → chunk-METRW4HG.js} +2 -2
  39. package/dist/esm/{chunk-PYHEBG5I.js → chunk-MJOXEUBT.js} +2 -2
  40. package/dist/esm/{chunk-4D2OAD6I.js → chunk-OIUCV5HK.js} +2 -2
  41. package/dist/esm/{chunk-65GAANJD.js → chunk-UYCPDGWA.js} +2 -2
  42. package/dist/esm/chunk-XLMTTSRO.js +2 -0
  43. package/dist/esm/chunk-XLMTTSRO.js.map +7 -0
  44. package/dist/esm/{chunk-QWVU2TW4.js → chunk-ZK7A2MZZ.js} +2 -2
  45. package/dist/esm/chunk-ZUOK3KFY.js +2 -0
  46. package/dist/esm/chunk-ZUOK3KFY.js.map +7 -0
  47. package/dist/esm/components/_internal/base-button.js +1 -1
  48. package/dist/esm/components/alert-dialog.js +1 -1
  49. package/dist/esm/components/app-bar.d.ts +49 -0
  50. package/dist/esm/components/app-bar.d.ts.map +1 -0
  51. package/dist/esm/components/app-bar.js +2 -0
  52. package/dist/esm/components/app-bar.js.map +7 -0
  53. package/dist/esm/components/button.js +1 -1
  54. package/dist/esm/components/chatbar.d.ts +26 -2
  55. package/dist/esm/components/chatbar.d.ts.map +1 -1
  56. package/dist/esm/components/chatbar.js +1 -1
  57. package/dist/esm/components/checkbox-cards.js +1 -1
  58. package/dist/esm/components/dialog.js +1 -1
  59. package/dist/esm/components/icon-button.js +1 -1
  60. package/dist/esm/components/index.d.ts +2 -1
  61. package/dist/esm/components/index.d.ts.map +1 -1
  62. package/dist/esm/components/index.js +1 -1
  63. package/dist/esm/components/message-scroller.js +1 -1
  64. package/dist/esm/components/notice.js +1 -1
  65. package/dist/esm/components/sheet.js +1 -1
  66. package/dist/esm/components/shell.js +1 -1
  67. package/dist/esm/components/theme-panel.js +1 -1
  68. package/dist/esm/components/toggle-button.js +1 -1
  69. package/dist/esm/components/toggle-icon-button.js +1 -1
  70. package/dist/esm/components/toolbar.d.ts +88 -36
  71. package/dist/esm/components/toolbar.d.ts.map +1 -1
  72. package/dist/esm/components/toolbar.js +1 -1
  73. package/dist/esm/components/toolbar.props.d.ts +28 -0
  74. package/dist/esm/components/toolbar.props.d.ts.map +1 -0
  75. package/dist/esm/components/toolbar.props.js +2 -0
  76. package/dist/esm/components/toolbar.props.js.map +7 -0
  77. package/dist/esm/components/user-card.js +1 -1
  78. package/dist/esm/index.js +1 -1
  79. package/dist/esm/props/index.js +1 -1
  80. package/package.json +1 -1
  81. package/src/components/app-bar.css +204 -0
  82. package/src/components/app-bar.tsx +256 -0
  83. package/src/components/chatbar.css +75 -40
  84. package/src/components/chatbar.tsx +126 -49
  85. package/src/components/index.css +2 -0
  86. package/src/components/index.tsx +13 -1
  87. package/src/components/toolbar.css +87 -160
  88. package/src/components/toolbar.props.tsx +27 -0
  89. package/src/components/toolbar.tsx +259 -193
  90. package/src/styles/tokens/color.css +19 -0
  91. package/styles.css +328 -218
  92. package/tokens/base.css +14 -0
  93. package/tokens.css +14 -0
  94. package/dist/esm/chunk-47LMOIW3.js +0 -2
  95. package/dist/esm/chunk-47LMOIW3.js.map +0 -7
  96. package/dist/esm/chunk-JKS2YXMS.js +0 -1
  97. package/dist/esm/chunk-QK5RBHKV.js +0 -2
  98. package/dist/esm/chunk-QK5RBHKV.js.map +0 -7
  99. /package/dist/esm/{chunk-73QGEY2I.js.map → chunk-3R4YLW4A.js.map} +0 -0
  100. /package/dist/esm/{chunk-ZZLZGHZQ.js.map → chunk-4LDVSTXI.js.map} +0 -0
  101. /package/dist/esm/{chunk-X3JM2565.js.map → chunk-6G3MPL4A.js.map} +0 -0
  102. /package/dist/esm/{chunk-DSJY5RI3.js.map → chunk-7JJT42J2.js.map} +0 -0
  103. /package/dist/esm/{chunk-JKS2YXMS.js.map → chunk-C7EVYSWK.js.map} +0 -0
  104. /package/dist/esm/{chunk-ERY5TH2M.js.map → chunk-CYU6BLZ5.js.map} +0 -0
  105. /package/dist/esm/{chunk-25LBWKEV.js.map → chunk-D6PHTHF2.js.map} +0 -0
  106. /package/dist/esm/{chunk-4XGGX2V2.js.map → chunk-ISOLUTZF.js.map} +0 -0
  107. /package/dist/esm/{chunk-LXWPEDPZ.js.map → chunk-IYCPYN4Z.js.map} +0 -0
  108. /package/dist/esm/{chunk-RJP5QUXO.js.map → chunk-L5PID6BU.js.map} +0 -0
  109. /package/dist/esm/{chunk-BW5CO4PZ.js.map → chunk-METRW4HG.js.map} +0 -0
  110. /package/dist/esm/{chunk-PYHEBG5I.js.map → chunk-MJOXEUBT.js.map} +0 -0
  111. /package/dist/esm/{chunk-4D2OAD6I.js.map → chunk-OIUCV5HK.js.map} +0 -0
  112. /package/dist/esm/{chunk-65GAANJD.js.map → chunk-UYCPDGWA.js.map} +0 -0
  113. /package/dist/esm/{chunk-QWVU2TW4.js.map → chunk-ZK7A2MZZ.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  export { AccessibleIcon, type AccessibleIconProps } from './accessible-icon.js';
2
2
  export * as Accordion from './accordion.js';
3
3
  export * as AlertDialog from './alert-dialog.js';
4
+ export { AppBar } from './app-bar.js';
4
5
  export { AspectRatio, type AspectRatioProps } from './aspect-ratio.js';
5
6
  export { Avatar, type AvatarProps } from './avatar.js';
6
7
  export { Badge, type BadgeProps } from './badge.js';
@@ -71,7 +72,18 @@ export {
71
72
  export { Theme, ThemeContext, type ThemeContextValue, type ThemeProps, useThemeContext } from './theme.js';
72
73
  export { ToggleButton, type ToggleButtonProps } from './toggle-button.js';
73
74
  export { ToggleIconButton, type ToggleIconButtonProps } from './toggle-icon-button.js';
74
- export { Toolbar } from './toolbar.js';
75
+ export {
76
+ Toolbar,
77
+ ToolbarGroup,
78
+ ToolbarButton,
79
+ ToolbarSeparator,
80
+ ToolbarTitle,
81
+ type ToolbarProps,
82
+ type ToolbarGroupProps,
83
+ type ToolbarButtonProps,
84
+ type ToolbarSeparatorProps,
85
+ type ToolbarTitleProps,
86
+ } from './toolbar.js';
75
87
  export { Tooltip, type TooltipProps } from './tooltip.js';
76
88
  export { UserCard, type UserCardProps } from './user-card.js';
77
89
  export { VirtualMenu, type VirtualMenuProps, type VirtualMenuItemProps, type VirtualMenuRenderItemProps } from './virtual-menu.js';
@@ -1,203 +1,130 @@
1
- /* stylelint-disable selector-max-specificity */
2
- /* Toolbar Component */
1
+ /*
2
+ * Toolbar: a row of controls with one tab stop (role="toolbar").
3
+ *
4
+ * The row paints nothing. It is one control row tall at its size, it spaces its clusters with
5
+ * `space-between`, and its size reaches every ToolbarButton through context (not CSS).
6
+ * A ToolbarGroup is a quiet gray well, the same fill a segmented control's track wears,
7
+ * standing level with a button beside it. A ToolbarSeparator is a gray hairline.
8
+ */
3
9
 
4
10
  .rt-Toolbar {
5
- position: absolute;
6
- z-index: 1;
11
+ --toolbar-group-inset: calc(var(--space-1) / 2);
7
12
 
8
- /* --rt-toolbar-height and --rt-toolbar-width are set on parent element via JS */
9
- /* Use pt/pb/pl/pr="var(--rt-toolbar-height)" on content to avoid overlap */
10
- }
11
-
12
- /* Grid layout for true centering */
13
- .rt-ToolbarInner {
14
- display: grid;
15
- grid-template-columns: 1fr auto 1fr;
13
+ display: flex;
16
14
  align-items: center;
17
- width: 100%;
18
- height: 100%;
19
- gap: var(--space-2);
20
- }
15
+ justify-content: space-between;
16
+ gap: var(--toolbar-gap);
17
+ min-width: 0;
18
+ min-height: var(--toolbar-control-height);
19
+ box-sizing: border-box;
20
+
21
+ &:where([data-orientation='vertical']) {
22
+ flex-direction: column;
23
+ justify-content: flex-start;
24
+ min-height: 0;
25
+ min-width: var(--toolbar-control-height);
26
+ }
21
27
 
22
- /* Vertical toolbars use row-based grid */
23
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarInner {
24
- grid-template-columns: 1fr;
25
- grid-template-rows: 1fr auto 1fr;
26
- }
28
+ &:where(.rt-r-size-1) {
29
+ --toolbar-control-height: var(--space-5);
30
+ --toolbar-radius: max(var(--radius-1), var(--radius-full));
31
+ --toolbar-gap: var(--space-1);
32
+ --toolbar-title-gap: var(--space-2);
33
+ }
27
34
 
28
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarLeft {
29
- grid-column: 1;
30
- grid-row: 1;
31
- }
35
+ &:where(.rt-r-size-2) {
36
+ --toolbar-control-height: var(--space-6);
37
+ --toolbar-radius: max(var(--radius-2), var(--radius-full));
38
+ --toolbar-gap: var(--space-2);
39
+ --toolbar-title-gap: var(--space-3);
40
+ }
32
41
 
33
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarCenter {
34
- grid-column: 1;
35
- grid-row: 2;
36
- }
42
+ &:where(.rt-r-size-3) {
43
+ --toolbar-control-height: var(--space-7);
44
+ --toolbar-radius: max(var(--radius-3), var(--radius-full));
45
+ --toolbar-gap: var(--space-2);
46
+ --toolbar-title-gap: var(--space-4);
47
+ }
37
48
 
38
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarRight {
39
- grid-column: 1;
40
- grid-row: 3;
49
+ &:where(.rt-r-size-4) {
50
+ --toolbar-control-height: var(--space-8);
51
+ --toolbar-radius: max(var(--radius-4), var(--radius-full));
52
+ --toolbar-gap: var(--space-3);
53
+ --toolbar-title-gap: var(--space-5);
54
+ }
41
55
  }
42
56
 
43
57
  /* * * * * * * * * * * * * * * * * * * */
44
58
  /* */
45
- /* Anchor positions */
59
+ /* Group */
46
60
  /* */
47
61
  /* * * * * * * * * * * * * * * * * * * */
48
62
 
49
- .rt-Toolbar:where([data-anchor='top']) {
50
- top: 0;
51
- left: 0;
52
- right: 0;
53
- }
54
-
55
- .rt-Toolbar:where([data-anchor='bottom']) {
56
- bottom: 0;
57
- left: 0;
58
- right: 0;
59
- }
60
-
61
- .rt-Toolbar:where([data-anchor='left']) {
62
- top: 0;
63
- bottom: 0;
64
- left: 0;
63
+ .rt-ToolbarGroup {
64
+ display: inline-flex;
65
+ align-items: center;
66
+ flex-shrink: 0;
67
+ box-sizing: border-box;
68
+ height: var(--toolbar-control-height);
69
+ padding: var(--toolbar-group-inset);
70
+ border-radius: var(--toolbar-radius);
71
+ background-color: var(--gray-a3);
72
+
73
+ &:where([data-orientation='vertical']) {
74
+ flex-direction: column;
75
+ height: auto;
76
+ width: var(--toolbar-control-height);
77
+ }
65
78
  }
66
79
 
67
- .rt-Toolbar:where([data-anchor='right']) {
68
- top: 0;
69
- bottom: 0;
70
- right: 0;
80
+ /* A button in the group is hosted: the group's height minus the inset on both sides, and a
81
+ concentric corner. Overriding the height variable (not `height`) keeps an icon button square. */
82
+ .rt-ToolbarGroup > :where(.rt-BaseButton) {
83
+ --base-button-height: calc(var(--toolbar-control-height) - 2 * var(--toolbar-group-inset));
84
+ border-radius: max(0px, calc(var(--toolbar-radius) - var(--toolbar-group-inset)));
71
85
  }
72
86
 
73
87
  /* * * * * * * * * * * * * * * * * * * */
74
88
  /* */
75
- /* Inset mode (default) */
76
- /* Edge-to-edge positioning */
89
+ /* Separator */
77
90
  /* */
78
91
  /* * * * * * * * * * * * * * * * * * * */
79
92
 
80
- /* Remove border-radius in inset mode */
81
- .rt-Toolbar:where(:not([data-floating])) {
82
- --base-card-border-radius: 0;
83
- border-radius: 0;
84
- }
85
-
86
- /* Override Card's box-shadow to only show exposed edge */
87
- /* Top anchor: only show bottom border */
88
- .rt-Toolbar:where([data-anchor='top']:not([data-floating])) {
89
- &::after {
90
- box-shadow: inset 0 -1px 0 0 var(--gray-6);
91
- }
92
- :where([data-panel-background='translucent'], [data-material='translucent']) &::after,
93
- &:where([data-panel-background='translucent'], [data-material='translucent'])::after {
94
- box-shadow: inset 0 -1px 0 0 var(--gray-a6);
95
- }
96
- }
97
-
98
- /* Bottom anchor: only show top border */
99
- .rt-Toolbar:where([data-anchor='bottom']:not([data-floating])) {
100
- &::after {
101
- box-shadow: inset 0 1px 0 0 var(--gray-6);
102
- }
103
- :where([data-panel-background='translucent'], [data-material='translucent']) &::after,
104
- &:where([data-panel-background='translucent'], [data-material='translucent'])::after {
105
- box-shadow: inset 0 1px 0 0 var(--gray-a6);
106
- }
107
- }
93
+ /* The same gray a Separator draws, at the height of the glyphs beside it rather than the row. */
94
+ .rt-ToolbarSeparator {
95
+ flex-shrink: 0;
96
+ background-color: var(--gray-a5);
108
97
 
109
- /* Left anchor: only show right border */
110
- .rt-Toolbar:where([data-anchor='left']:not([data-floating])) {
111
- &::after {
112
- box-shadow: inset -1px 0 0 0 var(--gray-6);
113
- }
114
- :where([data-panel-background='translucent'], [data-material='translucent']) &::after,
115
- &:where([data-panel-background='translucent'], [data-material='translucent'])::after {
116
- box-shadow: inset -1px 0 0 0 var(--gray-a6);
98
+ &:where([data-orientation='vertical']) {
99
+ width: var(--border-width-standard);
100
+ height: calc(var(--toolbar-control-height) / 2);
117
101
  }
118
- }
119
102
 
120
- /* Right anchor: only show left border */
121
- .rt-Toolbar:where([data-anchor='right']:not([data-floating])) {
122
- &::after {
123
- box-shadow: inset 1px 0 0 0 var(--gray-6);
124
- }
125
- :where([data-panel-background='translucent'], [data-material='translucent']) &::after,
126
- &:where([data-panel-background='translucent'], [data-material='translucent'])::after {
127
- box-shadow: inset 1px 0 0 0 var(--gray-a6);
103
+ &:where([data-orientation='horizontal']) {
104
+ height: var(--border-width-standard);
105
+ width: calc(var(--toolbar-control-height) / 2);
128
106
  }
129
107
  }
130
108
 
131
- /* Ghost variant in normal mode has no border */
132
- .rt-Toolbar:where(.rt-variant-ghost:not([data-floating]))::after {
133
- box-shadow: none;
134
- }
135
-
136
- /* Soft variant in normal mode has no border */
137
- .rt-Toolbar:where(.rt-variant-soft:not([data-floating]))::after {
138
- box-shadow: none;
139
- }
140
-
141
- /* * * * * * * * * * * * * * * * * * * */
142
- /* */
143
- /* Floating mode */
144
- /* Full card treatment */
145
- /* */
146
- /* * * * * * * * * * * * * * * * * * * */
147
-
148
- /* Floating mode: margin controlled via offset prop in JS */
149
- /* Inherits Card's border-radius (not overridden like inset mode) */
150
-
151
109
  /* * * * * * * * * * * * * * * * * * * */
152
110
  /* */
153
- /* Title truncation */
111
+ /* Title */
154
112
  /* */
155
113
  /* * * * * * * * * * * * * * * * * * * */
156
114
 
115
+ /* One line; truncates rather than wrapping, so the row stays one control row tall. */
157
116
  .rt-ToolbarTitle {
158
- /* Ensure title can truncate within flex container */
159
117
  min-width: 0;
160
118
  flex-shrink: 1;
161
119
  }
162
120
 
163
- /* * * * * * * * * * * * * * * * * * * */
164
- /* */
165
- /* Section alignment */
166
- /* */
167
- /* * * * * * * * * * * * * * * * * * * */
168
-
169
- .rt-ToolbarSection {
170
- min-width: 0;
171
- }
172
-
173
- .rt-ToolbarLeft {
174
- grid-column: 1;
175
- justify-self: start;
176
- }
177
-
178
- .rt-ToolbarCenter {
179
- grid-column: 2;
180
- justify-self: center;
181
- }
182
-
183
- /* Ensure Right always stays in the right column */
184
- .rt-ToolbarRight {
185
- grid-column: 3;
186
- justify-self: end;
187
- }
188
-
189
- /* Vertical toolbar section alignment */
190
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarLeft {
191
- align-self: start;
192
- justify-self: center;
193
- }
194
-
195
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarCenter {
196
- align-self: center;
197
- justify-self: center;
121
+ /* A title is a different kind of thing from the controls beside it, so it takes more air than
122
+ they take from each other. It reaches inside a cluster, since a band is often written
123
+ <Flex>{back}{title}</Flex>. No air against the row's own ends. */
124
+ :where(.rt-Toolbar) .rt-ToolbarTitle:where(:not(:first-child)) {
125
+ margin-inline-start: calc(var(--toolbar-title-gap) - var(--toolbar-gap));
198
126
  }
199
127
 
200
- .rt-Toolbar:where([data-anchor='left'], [data-anchor='right']) .rt-ToolbarRight {
201
- align-self: end;
202
- justify-self: center;
128
+ :where(.rt-Toolbar) .rt-ToolbarTitle:where(:not(:last-child)) {
129
+ margin-inline-end: calc(var(--toolbar-title-gap) - var(--toolbar-gap));
203
130
  }
@@ -0,0 +1,27 @@
1
+ import type { PropDef } from '../props/prop-def.js';
2
+
3
+ const sizes = ['1', '2', '3', '4'] as const;
4
+ const orientations = ['horizontal', 'vertical'] as const;
5
+
6
+ /**
7
+ * Toolbar prop definitions.
8
+ *
9
+ * `size` is one value for the whole row (not responsive): the row hands it to every control
10
+ * inside it that does not state its own, through context, so it has to be a single index.
11
+ */
12
+ const toolbarRootPropDefs = {
13
+ /**
14
+ * Size step of the row and of every control in it that doesn't set its own `size`.
15
+ * Matches Button's sizes: 1 (24px) to 4 (48px).
16
+ */
17
+ size: { type: 'enum', className: 'rt-r-size', values: sizes, default: '2' },
18
+ /**
19
+ * Direction of the row and of the arrow keys. Use `vertical` for a strip of tools along an edge.
20
+ */
21
+ orientation: { type: 'enum', values: orientations, default: 'horizontal' },
22
+ } satisfies {
23
+ size: PropDef<(typeof sizes)[number]>;
24
+ orientation: PropDef<(typeof orientations)[number]>;
25
+ };
26
+
27
+ export { toolbarRootPropDefs };