@nanahoshi/mona-ui 0.45.1 → 0.47.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 (78) hide show
  1. package/THIRD_PARTY_NOTICES.md +34 -0
  2. package/docs/api/button.json +1 -1
  3. package/docs/api/button.md +1 -0
  4. package/docs/api/check-box.json +1 -1
  5. package/docs/api/check-box.md +1 -0
  6. package/docs/api/chip.json +1 -1
  7. package/docs/api/chip.md +1 -0
  8. package/docs/api/common.json +1 -1
  9. package/docs/api/common.md +1 -1
  10. package/docs/api/index.json +1 -1
  11. package/docs/api/radio-button.json +1 -1
  12. package/docs/api/radio-button.md +1 -0
  13. package/docs/api/ripple.json +1 -0
  14. package/docs/api/ripple.md +75 -0
  15. package/docs/api/sidebar.json +1 -1
  16. package/docs/api/sidebar.md +1 -0
  17. package/docs/api/switch.json +1 -1
  18. package/docs/api/switch.md +1 -0
  19. package/docs/api/theme.json +1 -1
  20. package/docs/api/theme.md +14 -6
  21. package/docs/installation.md +1 -1
  22. package/docs/manifest.json +1 -1
  23. package/docs/ripple.md +360 -0
  24. package/docs/sidebar-menus.md +8 -0
  25. package/docs/theming-built-in-themes.md +25 -12
  26. package/docs/theming-custom-themes.md +19 -0
  27. package/docs/theming.md +2 -1
  28. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +6 -6
  29. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
  30. package/fesm2022/nanahoshi-mona-ui-button.mjs +20 -2
  31. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +15 -7
  32. package/fesm2022/nanahoshi-mona-ui-chat.mjs +1 -1
  33. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +36 -11
  34. package/fesm2022/nanahoshi-mona-ui-chip.mjs +13 -0
  35. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1 -1
  36. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1 -1
  37. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +5 -5
  38. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +4 -4
  39. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +5 -5
  40. package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +5 -5
  41. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +5 -5
  42. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +4 -4
  43. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -3
  44. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
  45. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +9 -1
  46. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +9 -3
  47. package/fesm2022/nanahoshi-mona-ui-masked-text-box.mjs +3 -3
  48. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +12 -4
  49. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +4 -4
  50. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +4 -4
  51. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +3 -3
  52. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +105 -19
  53. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +33 -9
  54. package/fesm2022/nanahoshi-mona-ui-ripple.mjs +196 -0
  55. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +10 -4
  56. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +21 -1
  57. package/fesm2022/nanahoshi-mona-ui-slider.mjs +4 -4
  58. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +5 -1
  59. package/fesm2022/nanahoshi-mona-ui-switch.mjs +31 -6
  60. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +7 -1
  61. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +3 -3
  62. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +6 -6
  63. package/fesm2022/nanahoshi-mona-ui-theme.mjs +295 -51
  64. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +5 -5
  65. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1 -1
  66. package/llms.txt +4 -2
  67. package/package.json +5 -1
  68. package/ripple/package.json +5 -0
  69. package/types/nanahoshi-mona-ui-button.d.ts +8 -1
  70. package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
  71. package/types/nanahoshi-mona-ui-chat.d.ts +1 -1
  72. package/types/nanahoshi-mona-ui-check-box.d.ts +10 -1
  73. package/types/nanahoshi-mona-ui-chip.d.ts +8 -1
  74. package/types/nanahoshi-mona-ui-radio-button.d.ts +9 -1
  75. package/types/nanahoshi-mona-ui-ripple.d.ts +72 -0
  76. package/types/nanahoshi-mona-ui-sidebar.d.ts +12 -0
  77. package/types/nanahoshi-mona-ui-switch.d.ts +10 -2
  78. package/types/nanahoshi-mona-ui-theme.d.ts +71 -1
package/docs/ripple.md ADDED
@@ -0,0 +1,360 @@
1
+ # Ripple
2
+
3
+ > Turn on a ripple that spreads from where a button is pressed, and add it to your own elements.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/ripple`
6
+
7
+ A ripple is a wave that spreads from where a button is pressed, in the button's text color, and fades once it's let go. Ripples are off until you turn them on: `provideRipple()` gives one to Mona UI's buttons and the other components people press, from chips and menus to calendars, and the `monaRipple` directive adds one to elements of your own. Check boxes, radio buttons and switches draw a halo around the control instead.
8
+
9
+ ## Try It
10
+
11
+ Press a button and hold it, then let go. The rest of this site has no ripples, so this example turns them on for itself.
12
+
13
+ `buttons-example.component.ts`
14
+
15
+ ```typescript
16
+ import { Component } from "@angular/core";
17
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
18
+ import { ButtonGroupComponent } from "@nanahoshi/mona-ui/button-group";
19
+ import { RIPPLE_OPTIONS } from "@nanahoshi/mona-ui/ripple";
20
+
21
+ @Component({
22
+ selector: "app-ripple-buttons-example",
23
+ imports: [ButtonDirective, ButtonGroupComponent],
24
+ // Turns ripples on for this example only. An application turns them on everywhere with provideRipple().
25
+ providers: [{ provide: RIPPLE_OPTIONS, useValue: { enabled: true } }],
26
+ templateUrl: "./buttons-example.component.html"
27
+ })
28
+ export class RippleButtonsExampleComponent {}
29
+ ```
30
+
31
+ `buttons-example.component.html`
32
+
33
+ ```html
34
+ <div class="flex flex-col items-start gap-4">
35
+ <div class="flex flex-wrap items-center gap-3">
36
+ <button monaButton type="button">Default</button>
37
+ <button monaButton look="primary" type="button">Primary</button>
38
+ <button monaButton look="secondary" type="button">Secondary</button>
39
+ <button monaButton look="ghost" type="button">Ghost</button>
40
+ <button monaButton look="error" rounded="full" type="button">Delete</button>
41
+ </div>
42
+ <mona-button-group aria-label="Clipboard">
43
+ <button monaButton type="button" [toggleable]="false">Cut</button>
44
+ <button monaButton type="button" [toggleable]="false">Copy</button>
45
+ <button monaButton type="button" [toggleable]="false">Paste</button>
46
+ </mona-button-group>
47
+ <div class="flex flex-wrap items-center gap-3">
48
+ <button monaButton look="link" type="button">Link, without a ripple</button>
49
+ <button monaButton monaRippleDisabled type="button">Turned off</button>
50
+ </div>
51
+ </div>
52
+ ```
53
+
54
+ Chips that toggle, tabs and list items ripple too:
55
+
56
+ `components-example.component.ts`
57
+
58
+ ```typescript
59
+ import { Component, signal } from "@angular/core";
60
+ import { ChipComponent } from "@nanahoshi/mona-ui/chip";
61
+ import { ListBoxComponent } from "@nanahoshi/mona-ui/list-box";
62
+ import { RIPPLE_OPTIONS } from "@nanahoshi/mona-ui/ripple";
63
+ import { TabComponent, TabContentTemplateDirective, TabsComponent } from "@nanahoshi/mona-ui/tabs";
64
+
65
+ @Component({
66
+ selector: "app-ripple-components-example",
67
+ imports: [ChipComponent, ListBoxComponent, TabComponent, TabContentTemplateDirective, TabsComponent],
68
+ // Turns ripples on for this example only. An application turns them on everywhere with provideRipple().
69
+ providers: [{ provide: RIPPLE_OPTIONS, useValue: { enabled: true } }],
70
+ templateUrl: "./components-example.component.html"
71
+ })
72
+ export class RippleComponentsExampleComponent {
73
+ protected readonly fruits = [
74
+ { id: 1, name: "Apple" },
75
+ { id: 2, name: "Banana" },
76
+ { id: 3, name: "Cherry" },
77
+ { id: 4, name: "Grape" }
78
+ ];
79
+ protected readonly open = signal(true);
80
+ protected readonly selectedIds = signal<number[]>([2]);
81
+ protected readonly urgent = signal(false);
82
+ }
83
+ ```
84
+
85
+ `components-example.component.html`
86
+
87
+ ```html
88
+ <div class="flex flex-col gap-5">
89
+ <div class="flex flex-wrap gap-2" role="group" aria-label="Filter issues">
90
+ <mona-chip label="Open" [toggleable]="true" [(selected)]="open"></mona-chip>
91
+ <mona-chip label="Urgent" look="error" [toggleable]="true" [(selected)]="urgent"></mona-chip>
92
+ <mona-chip label="Removable" [toggleable]="true" [removable]="true"></mona-chip>
93
+ </div>
94
+ <mona-tabs aria-label="Account">
95
+ <mona-tab title="Account">
96
+ <ng-template monaTabContentTemplate>
97
+ <p class="p-4 text-sm">Name, email and language.</p>
98
+ </ng-template>
99
+ </mona-tab>
100
+ <mona-tab title="Security">
101
+ <ng-template monaTabContentTemplate>
102
+ <p class="p-4 text-sm">Password and two-factor sign-in.</p>
103
+ </ng-template>
104
+ </mona-tab>
105
+ <mona-tab title="Billing">
106
+ <ng-template monaTabContentTemplate>
107
+ <p class="p-4 text-sm">Plan and invoices.</p>
108
+ </ng-template>
109
+ </mona-tab>
110
+ </mona-tabs>
111
+ <mona-list-box
112
+ class="max-w-xs"
113
+ aria-label="Fruits"
114
+ height="160px"
115
+ selectBy="id"
116
+ selectionMode="multiple"
117
+ textField="name"
118
+ [items]="fruits"
119
+ [toolbar]="false"
120
+ [(selectedKeys)]="selectedIds" />
121
+ </div>
122
+ ```
123
+
124
+ Check boxes, radio buttons and switches are too small for a wave inside them, so they draw a halo around the box, the circle or the handle. The switch's halo slides across with its handle:
125
+
126
+ `controls-example.component.ts`
127
+
128
+ ```typescript
129
+ import { Component, signal } from "@angular/core";
130
+ import { CheckBoxComponent } from "@nanahoshi/mona-ui/check-box";
131
+ import { LabelComponent } from "@nanahoshi/mona-ui/label";
132
+ import { RadioButtonComponent, RadioGroupComponent } from "@nanahoshi/mona-ui/radio-button";
133
+ import { RIPPLE_OPTIONS } from "@nanahoshi/mona-ui/ripple";
134
+ import { type SegmentedOption, SegmentedComponent } from "@nanahoshi/mona-ui/segmented";
135
+ import { SwitchComponent } from "@nanahoshi/mona-ui/switch";
136
+
137
+ @Component({
138
+ selector: "app-ripple-controls-example",
139
+ imports: [
140
+ CheckBoxComponent,
141
+ LabelComponent,
142
+ RadioButtonComponent,
143
+ RadioGroupComponent,
144
+ SegmentedComponent,
145
+ SwitchComponent
146
+ ],
147
+ // Turns ripples on for this example only. An application turns them on everywhere with provideRipple().
148
+ providers: [{ provide: RIPPLE_OPTIONS, useValue: { enabled: true } }],
149
+ templateUrl: "./controls-example.component.html"
150
+ })
151
+ export class RippleControlsExampleComponent {
152
+ protected readonly digest = signal("daily");
153
+ protected readonly mentions = signal(false);
154
+ protected readonly paused = signal(false);
155
+ protected readonly replies = signal(true);
156
+ protected readonly theme = signal("system");
157
+ protected readonly themes: SegmentedOption<string>[] = [
158
+ { label: "Light", value: "light" },
159
+ { label: "Dark", value: "dark" },
160
+ { label: "System", value: "system" }
161
+ ];
162
+ }
163
+ ```
164
+
165
+ `controls-example.component.html`
166
+
167
+ ```html
168
+ <div class="flex flex-col items-start gap-5">
169
+ <div class="flex flex-col gap-2">
170
+ <mona-check-box label="Email me about replies" [(checked)]="replies"></mona-check-box>
171
+ <mona-check-box label="Email me about mentions" [(checked)]="mentions"></mona-check-box>
172
+ </div>
173
+ <div class="flex flex-col items-start gap-2">
174
+ <mona-label text="Digest" [for]="digestGroup" />
175
+ <mona-radio-group #digestGroup [(value)]="digest">
176
+ <mona-radio-button label="Daily" radioValue="daily" />
177
+ <mona-radio-button label="Weekly" radioValue="weekly" />
178
+ </mona-radio-group>
179
+ </div>
180
+ <mona-label text="Pause notifications">
181
+ <mona-switch [(checked)]="paused" />
182
+ </mona-label>
183
+ <mona-segmented aria-label="Theme" [options]="themes" [(value)]="theme" />
184
+ </div>
185
+ ```
186
+
187
+ ## Turn Ripples On
188
+
189
+ Add `provideRipple()` to your application's providers:
190
+
191
+ ```typescript
192
+ import { ApplicationConfig } from "@angular/core";
193
+ import { provideRipple } from "@nanahoshi/mona-ui/ripple";
194
+
195
+ export const appConfig: ApplicationConfig = {
196
+ providers: [
197
+ // ...your existing providers
198
+ provideRipple()
199
+ ]
200
+ };
201
+ ```
202
+
203
+ These then draw one when pressed:
204
+
205
+ | Component | Ripples |
206
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
207
+ | Buttons | Every look but `link` and `clear`, which have no surface to draw it on. That includes the buttons of button groups, dropdown buttons and split buttons. |
208
+ | Chips | A chip that toggles or is a link. A chip that only shows a value does nothing when pressed, so it doesn't ripple. |
209
+ | Tabs | Every tab but a disabled one. |
210
+ | List items | The items of List Box, List View, and the popups of Dropdown List, Combo Box, Auto Complete and Multi Select, when they can be selected or navigated. |
211
+ | Menus | The items of popup menus, context menus and menubars, and the menus of a menubar. |
212
+ | Tree View | Every node but a disabled one. |
213
+ | Calendar | The days, months and years of Calendar and of the date pickers' calendars, except the dates that can't be picked. |
214
+ | Stepper | The indicator of every step that can be reached. A step drawn by `monaStepperStepTemplate` looks as the template draws it, so it doesn't ripple. |
215
+ | Segmented | Every option but a disabled one. |
216
+ | Check boxes, radio buttons and switches | A halo around the box, the circle or the handle, unless the control is disabled or read-only. The `monaCheckbox` and `monaRadioButton` directives style a native input, which can't hold a ripple, so they have none. |
217
+
218
+ A press on a control inside one of these, such as a chip's remove button, a tab's close button, or a button in a list item's template, belongs to that control, so the item around it doesn't ripple. `provideRipple({ enabled: false })` keeps ripples off, for example behind a setting.
219
+
220
+ ### Part of an Application
221
+
222
+ Provide `RIPPLE_OPTIONS` on a component to turn ripples on or off for everything inside it:
223
+
224
+ ```typescript
225
+ import { Component } from "@angular/core";
226
+ import { RIPPLE_OPTIONS } from "@nanahoshi/mona-ui/ripple";
227
+
228
+ @Component({
229
+ selector: "app-toolbar",
230
+ providers: [{ provide: RIPPLE_OPTIONS, useValue: { enabled: true } }],
231
+ templateUrl: "./toolbar.component.html"
232
+ })
233
+ export class ToolbarComponent {}
234
+ ```
235
+
236
+ ### One Component
237
+
238
+ `monaRippleDisabled` turns the ripple off for one button, chip, check box, radio button or switch:
239
+
240
+ ```html
241
+ <button monaButton monaRippleDisabled>Save</button>
242
+ <mona-chip label="Archived" toggleable monaRippleDisabled></mona-chip>
243
+ <mona-switch aria-label="Sync" monaRippleDisabled></mona-switch>
244
+ ```
245
+
246
+ ## Your Own Elements
247
+
248
+ Import `RippleDirective` and add `monaRipple` to anything else people press, such as a tile:
249
+
250
+ `custom-element-example.component.ts`
251
+
252
+ ```typescript
253
+ import { Component, signal } from "@angular/core";
254
+ import { RIPPLE_OPTIONS, RippleDirective } from "@nanahoshi/mona-ui/ripple";
255
+
256
+ interface Destination {
257
+ readonly description: string;
258
+ readonly name: string;
259
+ }
260
+
261
+ @Component({
262
+ selector: "app-ripple-custom-element-example",
263
+ imports: [RippleDirective],
264
+ // Turns ripples on for this example only. An application turns them on everywhere with provideRipple().
265
+ providers: [{ provide: RIPPLE_OPTIONS, useValue: { enabled: true } }],
266
+ templateUrl: "./custom-element-example.component.html"
267
+ })
268
+ export class RippleCustomElementExampleComponent {
269
+ protected readonly destinations: readonly Destination[] = [
270
+ { name: "Projects", description: "Everything your team is working on." },
271
+ { name: "Reports", description: "Weekly numbers and trends." },
272
+ { name: "Settings", description: "Members, billing and integrations." }
273
+ ];
274
+ protected readonly opened = signal("none");
275
+ }
276
+ ```
277
+
278
+ `custom-element-example.component.html`
279
+
280
+ ```html
281
+ <div class="flex flex-col gap-3">
282
+ <div class="grid gap-3 sm:grid-cols-3">
283
+ @for (destination of destinations; track destination.name) {
284
+ <button
285
+ monaRipple
286
+ type="button"
287
+ class="relative flex cursor-pointer flex-col items-start gap-1 rounded-lg border border-border bg-surface p-4 text-start text-foreground transition-colors hover:bg-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator forced-colors:border-[ButtonBorder]"
288
+ (click)="opened.set(destination.name)">
289
+ <span class="text-sm font-medium">{{ destination.name }}</span>
290
+ <span class="text-sm text-muted-foreground">{{ destination.description }}</span>
291
+ </button>
292
+ }
293
+ </div>
294
+ <span aria-live="polite" class="text-sm">Opened: {{ opened() }}</span>
295
+ </div>
296
+ ```
297
+
298
+ The wave covers the element's padding box, in its corner radius, over its background and under its content. For that, the first press gives the element `isolation: isolate`, and makes it `relative` if its position is `static`. If the element's position can change later, set one with a class yourself, as the tiles above do with `relative`.
299
+
300
+ Mona UI's buttons, chips, check boxes, radio buttons and switches already have the directive. Don't add `monaRipple` to one: Angular doesn't allow a directive on an element twice. As on Mona UI's own components, a press on a button, link or form field inside the element doesn't make it ripple, unless the element is that field's `<label>`.
301
+
302
+ ## Customize It
303
+
304
+ Three tokens set how the ripple looks and moves. It has its own timing rather than the theme's motion tokens, which keep menus and popups brisk:
305
+
306
+ | Token | Default | Sets |
307
+ | ----------------------------- | ------- | ---------------------------------------------------------- |
308
+ | `--mona-ripple-opacity` | `12%` | How much of the element's text color the wave shows. |
309
+ | `--mona-ripple-duration` | `450ms` | How long the wave takes to spread. |
310
+ | `--mona-ripple-fade-duration` | `300ms` | How long it takes to fade, once it has finished spreading. |
311
+
312
+ The wave starts moving at once and slows as it spreads, so a press shows straight away even at a longer duration. A halo takes the same tokens, reaches 10px past its control's edges, and is drawn in the theme's text color, since a checked box's own color is the one on its fill. Set the tokens in your styles, for the whole page or for one element:
313
+
314
+ ```css
315
+ :root {
316
+ --mona-ripple-opacity: 16%;
317
+ --mona-ripple-duration: 600ms;
318
+ }
319
+ ```
320
+
321
+ ## Accessibility
322
+
323
+ The ripple is decoration, so nothing changes for assistive technology:
324
+
325
+ - Its layer is hidden from screen readers and takes no pointer events.
326
+ - There's no ripple with the system's reduced motion setting. The pressed background still shows the press.
327
+ - There's no ripple in forced colors, where it would paint as a solid block.
328
+ - Keyboard presses draw none. The focus indicator already shows where they act.
329
+ - Disabled and read-only components draw none, and neither do `aria-disabled` elements and loading buttons.
330
+
331
+ ## API
332
+
333
+ Everything below is imported from `@nanahoshi/mona-ui/ripple`.
334
+
335
+ ### `RippleDirective`
336
+
337
+ **Selector:** `[monaRipple]`
338
+
339
+ Draws a ripple when the element is pressed. Mona UI's buttons and the other components people press apply it themselves.
340
+
341
+ | Input | Type | Default | Description |
342
+ | -------------------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
343
+ | `monaRippleDisabled` | `boolean` | `false` | Turns the ripple off for this element while ripples are on. Buttons, chips, check boxes, radio buttons and switches take it as well. |
344
+
345
+ ### Providers
346
+
347
+ | Provider | Description |
348
+ | ------------------------ | -------------------------------------------------------------------------------------------- |
349
+ | `provideRipple(options)` | Turns ripples on for the application. `options` is optional; `{ enabled: false }` keeps them off. |
350
+
351
+ ### Tokens
352
+
353
+ | Token | Type | Default |
354
+ | ---------------- | --------------- | -------------------- |
355
+ | `RIPPLE_OPTIONS` | `RippleOptions` | `{ enabled: false }` |
356
+
357
+ ### Exported Types and Values
358
+
359
+ - **Types:** `RippleOptions`, with `enabled`.
360
+ - **Values:** `DEFAULT_RIPPLE_OPTIONS`, what `RIPPLE_OPTIONS` holds when nothing is provided.
@@ -360,6 +360,14 @@ A submenu cannot render in a rail one icon wide, and there's no flyout. While on
360
360
 
361
361
  `mona-sidebar-menu-skeleton` goes in an item in place of the row's control, laid out exactly like a real row, so the two animate as one. Vary `labelWidth` across a list so the placeholder doesn't look like a rigid grid, and set `[showIcon]="false"` for rows that have no icon.
362
362
 
363
+ If you resize the rows, resize the skeleton to match. Its `class` is merged over its own sizing, so the same classes that make a `monaSidebarMenuButton` denser fit the placeholder as well, and nothing shifts when the real rows replace it:
364
+
365
+ ```html
366
+ <li monaSidebarMenuItem>
367
+ <mona-sidebar-menu-skeleton class="h-7 px-2" />
368
+ </li>
369
+ ```
370
+
363
371
  The skeleton is hidden from assistive technology. Mark what's loading on its container instead, with `aria-busy="true"`, and remove it when the rows arrive.
364
372
 
365
373
  ## Accessibility
@@ -1,8 +1,8 @@
1
1
  # Built-in Themes
2
2
 
3
- > Mona, Luna and Anna side by side, and when to use each one.
3
+ > Mona, Luna, Anna and Rena side by side, and when to use each one.
4
4
 
5
- Mona UI comes with three themes: Mona, Luna and Anna. Each one is complete, from colors and shadows to corner radii, motion and materials, and is tested for WCAG AA contrast.
5
+ Mona UI comes with four themes: Mona, Luna, Anna and Rena. Each one is complete, from colors and shadows to corner radii, motion and materials, and is tested for WCAG AA contrast.
6
6
 
7
7
  The previews below are real components, each drawn in its own theme, whatever theme this site is in. Hover, click and tab through them to see each theme's states.
8
8
 
@@ -42,21 +42,34 @@ Anna Dark has charcoal surfaces, near-black borders and a solid violet for selec
42
42
 
43
43
  Anna Light has soft gray surfaces and off-white controls that darken gently on hover. Selection is a violet tint rather than a solid fill, so secondary text in a selected row stays readable. The deep violet stands out well on the light surface, so it draws slider ranges, switches and the rest as it is.
44
44
 
45
+ ## Rena
46
+
47
+ Rena takes its colors from Tailwind CSS's default palette: cool grays with an indigo primary. Rena Light puts white panels on a very light, cool gray page, and Rena Dark puts slightly lighter panels on a deep blue-gray page. Controls cast a small, crisp shadow, and menus and popups a larger, softer one. Animations are quick, at 150 ms and 200 ms.
48
+
49
+ ```typescript
50
+ provideThemeOptions({ initialTheme: { name: "rena", variant: "system" } });
51
+ ```
52
+
53
+ Where the other themes draw a soft, translucent halo around a focused or invalid control, Rena draws a solid line: the control's border takes the focus color, with a 1 px ring of the same color around it. [Custom Themes](theming-custom-themes.md#focus-rings) shows how a theme of your own can do the same.
54
+
55
+ Selection is an indigo tint in both variants. Main actions keep the same indigo in Rena Dark, under white text, but on its own it would be hard to see against the dark surface. So where a color alone shows a value, as in slider ranges, progress bars, switches, radio buttons, tabs and steps, and where the primary color is text, Rena Dark uses a lighter indigo instead.
56
+
45
57
  ## Compare the Themes
46
58
 
47
- | | Mona | Luna | Anna |
48
- | ------------- | --------------------------------------- | --------------------------------------- | ------------------------------------ |
49
- | Variants | Light, dark | Light, dark | Light, dark |
50
- | Primary color | Near-black in light, near-white in dark | Blue | Deep violet |
51
- | Selection | Gray tint | Blue tint | Violet tint in light, violet in dark |
52
- | Materials | Opaque | Translucent glass, or opaque if reduced | Opaque |
53
- | Shadows | Subtle | Soft and wide | None on controls |
54
- | Motion | 200 ms and 300 ms | 180 ms and 320 ms | 150 ms |
55
- | Corner radii | 4, 6 and 8 px | 4, 6 and 8 px | 4, 6 and 8 px |
59
+ | | Mona | Luna | Anna | Rena |
60
+ | ------------- | --------------------------------------- | --------------------------------------- | ------------------------------------ | ----------------- |
61
+ | Variants | Light, dark | Light, dark | Light, dark | Light, dark |
62
+ | Primary color | Near-black in light, near-white in dark | Blue | Deep violet | Indigo |
63
+ | Selection | Gray tint | Blue tint | Violet tint in light, violet in dark | Indigo tint |
64
+ | Materials | Opaque | Translucent glass, or opaque if reduced | Opaque | Opaque |
65
+ | Shadows | Subtle | Soft and wide | None on controls | Small and crisp |
66
+ | Focus ring | Soft halo | Soft halo | Soft halo | Solid line |
67
+ | Motion | 200 ms and 300 ms | 180 ms and 320 ms | 150 ms | 150 ms and 200 ms |
68
+ | Corner radii | 4, 6 and 8 px | 4, 6 and 8 px | 4, 6 and 8 px | 4, 6 and 8 px |
56
69
 
57
70
  ## Start from a Built-in Theme
58
71
 
59
- The themes are exported, as `monaTheme`, `lunaTheme` and `annaTheme`, and together as `builtInThemes`, so you can read their tokens or build on them:
72
+ The themes are exported, as `monaTheme`, `lunaTheme`, `annaTheme` and `renaTheme`, and together as `builtInThemes`, so you can read their tokens or build on them:
60
73
 
61
74
  ```typescript
62
75
  import { monaTheme } from "@nanahoshi/mona-ui/theme";
@@ -114,6 +114,24 @@ custom: {
114
114
  }
115
115
  ```
116
116
 
117
+ ### Focus Rings
118
+
119
+ A focused control's border takes `--color-focus-indicator`, with a ring of the same color around it. An invalid control does the same in `--color-error`. Two variables shape the ring, and a theme sets them in `custom`:
120
+
121
+ - `--mona-focus-ring-width` is how wide the ring is. It falls back to `2px`.
122
+ - `--mona-focus-ring-opacity` is how strong the ring's color is, as a percentage. It falls back to `35%`, a soft halo.
123
+
124
+ For a solid line, as Rena draws, make the ring narrower and opaque. With the border, it reads as one 2 px line:
125
+
126
+ ```typescript
127
+ custom: {
128
+ "--mona-focus-ring-width": "1px",
129
+ "--mona-focus-ring-opacity": "100%"
130
+ }
131
+ ```
132
+
133
+ The ring and a control's shadow are drawn together, as one `box-shadow`. So for no shadow, write `0 0 #0000`, as Anna does for its flat controls, not `none`: a shadow token set to `none` hides the ring of every control that uses it.
134
+
117
135
  ### Contrast Borders
118
136
 
119
137
  `--color-border-control-contrast` and `--color-border-control-contrast-hover` are the only optional colors. When the user asks for more contrast, the theme service uses them in place of `--color-border-control` and `--color-border-control-hover`, for fields, buttons, chips, chart gridlines and everything else that shares those borders. Give them at least 3:1 against `--color-input-background`. A theme without them keeps its usual borders.
@@ -133,6 +151,7 @@ In development, custom themes and overrides are also checked, and each problem l
133
151
 
134
152
  - A value that isn't a color.
135
153
  - A custom variable whose name doesn't start with `--`.
154
+ - A shadow set to `none`, which hides the [focus ring](#focus-rings). Use `0 0 #0000` for no shadow.
136
155
  - A pair below the contrast WCAG AA asks for:
137
156
  - 4.5:1 for `--color-foreground` and `--color-muted-foreground` on `--color-surface`, `--color-input-foreground` on `--color-input-background`, and `--color-primary-foreground` on `--color-primary`.
138
157
  - 3:1 for `--color-focus-indicator` and `--color-selected-border` on `--color-surface`, and for the contrast borders on `--color-input-background`, when the theme sets them.
package/docs/theming.md CHANGED
@@ -30,6 +30,7 @@ Most themes have a light and a dark variant. The theme and the variant together,
30
30
  | Mona | Light, dark | Neutral grays, with color kept for status. The default. |
31
31
  | Luna | Light, dark | Clean surfaces with a blue primary, and translucent glass on controls and overlays. |
32
32
  | Anna | Light, dark | Graphite grays with a deep violet primary, and flat controls a shade lighter. |
33
+ | Rena | Light, dark | Tailwind CSS's cool grays and indigo, with crisp shadows and a solid focus ring. |
33
34
 
34
35
  [Built-in Themes](theming-built-in-themes.md) shows each one side by side, with real components.
35
36
 
@@ -315,5 +316,5 @@ Provided in root. It's created by any theme provider at startup, or by the first
315
316
  - **Selections:** `ThemeName`, `ThemeVariant`, `ThemeVariantPreference`, `ThemePreference`, `ThemeSelection`, `ThemeAvailability`.
316
317
  - **Definitions:** `ThemeProfile`, `ThemeFamilyRegistration`, `ThemeOverrideRegistration`, `ThemeOptions`, `ThemeColorPaletteRegistration`, `ThemeColorPaletteSeeds`.
317
318
  - **Extending:** `ThemeStrategy`, `ThemeStorage`, `DefaultThemeStrategy`, `LocalStorageThemeStorage`.
318
- - **Built-in themes:** `monaTheme`, `lunaTheme`, `annaTheme`, `builtInThemes`.
319
+ - **Built-in themes:** `monaTheme`, `lunaTheme`, `annaTheme`, `renaTheme`, `builtInThemes`.
319
320
  - **Helpers:** `generateThemeColorPalette`, `flattenThemeProfile`, `createSidebarColorRoles`.
@@ -20,7 +20,7 @@ const autoCompleteBaseThemeVariants = cva(`
20
20
  border border-input-border shadow-(--shadow-control) outline-none focus-visible:outline-hidden
21
21
  transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
22
22
  data-[readonly='true']:cursor-default
23
- focus-within:border-focus-indicator focus-within:ring-2 focus-within:ring-focus-indicator/35
23
+ focus-within:border-focus-indicator focus-within:ring-(length:--mona-focus-ring-width,2px) focus-within:ring-focus-indicator/(--mona-focus-ring-opacity,35%)
24
24
  `, {
25
25
  variants: {
26
26
  disabled: { true: `
@@ -28,10 +28,10 @@ const autoCompleteBaseThemeVariants = cva(`
28
28
  bg-disabled-background text-disabled-foreground
29
29
  border-disabled-border shadow-none
30
30
  ` },
31
- expanded: { true: "border-focus-indicator ring-2 ring-focus-indicator/35" },
32
- focused: { true: "border-focus-indicator ring-2 ring-focus-indicator/35" },
31
+ expanded: { true: "border-focus-indicator ring-(length:--mona-focus-ring-width,2px) ring-focus-indicator/(--mona-focus-ring-opacity,35%)" },
32
+ focused: { true: "border-focus-indicator ring-(length:--mona-focus-ring-width,2px) ring-focus-indicator/(--mona-focus-ring-opacity,35%)" },
33
33
  invalid: {
34
- true: "border-error ring-2 ring-error/35 focus-within:border-error focus-within:ring-error/35",
34
+ true: "border-error ring-(length:--mona-focus-ring-width,2px) ring-error/(--mona-focus-ring-opacity,35%) focus-within:border-error focus-within:ring-error/(--mona-focus-ring-opacity,35%)",
35
35
  false: ""
36
36
  },
37
37
  rounded: {
@@ -50,11 +50,11 @@ const autoCompleteBaseThemeVariants = cva(`
50
50
  compoundVariants: [{
51
51
  expanded: true,
52
52
  invalid: true,
53
- class: "border-error ring-error/35"
53
+ class: "border-error ring-error/(--mona-focus-ring-opacity,35%)"
54
54
  }, {
55
55
  focused: true,
56
56
  invalid: true,
57
- class: "border-error ring-error/35"
57
+ class: "border-error ring-error/(--mona-focus-ring-opacity,35%)"
58
58
  }],
59
59
  defaultVariants: {
60
60
  disabled: false,
@@ -12,7 +12,7 @@ const buttonGroupThemeVariants = cva(`
12
12
  inline-flex items-center justify-center
13
13
  border border-input-border
14
14
  data-[invalid='true']:border-error
15
- data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
15
+ data-[invalid='true']:ring-(length:--mona-focus-ring-width,2px) data-[invalid='true']:ring-error/(--mona-focus-ring-opacity,35%)
16
16
  data-[readonly='true']:[&_button[aria-pressed]]:cursor-default
17
17
  [&>button]:border-0
18
18
  [&>button]:shadow-none
@@ -6,6 +6,8 @@ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
6
6
  import { themeControlSurfaceClasses, themeSelectionBorderClasses } from "@nanahoshi/mona-ui/internal";
7
7
  import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
8
8
  import { Subject, fromEvent, takeWhile } from "rxjs";
9
+ import * as i1 from "@nanahoshi/mona-ui/ripple";
10
+ import { RippleDirective } from "@nanahoshi/mona-ui/ripple";
9
11
  var ButtonService = class ButtonService {
10
12
  constructor() {
11
13
  this.#members = signal(null, ...ngDevMode ? [{ debugName: "#members" }] : /* istanbul ignore next */ []);
@@ -50,7 +52,7 @@ i0.ɵɵngDeclareClassMetadata({
50
52
  decorators: [{ type: Injectable }]
51
53
  });
52
54
  const buttonThemeVariants = cva(`
53
- inline-flex items-center justify-center gap-2
55
+ relative inline-flex items-center justify-center gap-2
54
56
  cursor-pointer whitespace-nowrap
55
57
  text-sm font-medium
56
58
  transition-colors duration-100 ease-in-out
@@ -287,6 +289,8 @@ var ButtonDirective = class ButtonDirective {
287
289
  #hostElementRef;
288
290
  #injector;
289
291
  #renderer;
292
+ #ripple;
293
+ #rippleSuppressed;
290
294
  #loaderComponentRef;
291
295
  #toggleSubscription;
292
296
  constructor() {
@@ -297,6 +301,11 @@ var ButtonDirective = class ButtonDirective {
297
301
  this.#hostElementRef = inject(ElementRef);
298
302
  this.#injector = inject(Injector);
299
303
  this.#renderer = inject(Renderer2);
304
+ this.#ripple = inject(RippleDirective, { self: true });
305
+ this.#rippleSuppressed = computed(() => {
306
+ const look = this.effectiveLook();
307
+ return look === "link" || look === "clear";
308
+ }, ...ngDevMode ? [{ debugName: "#rippleSuppressed" }] : /* istanbul ignore next */ []);
300
309
  this.#loaderComponentRef = null;
301
310
  this.#toggleSubscription = null;
302
311
  this.baseClass = computed(() => {
@@ -366,6 +375,7 @@ var ButtonDirective = class ButtonDirective {
366
375
  alias: "class"
367
376
  });
368
377
  this.value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
378
+ this.#ripple.setHostDisabled(this.#rippleSuppressed);
369
379
  effect(() => {
370
380
  if (this.effectiveToggleable()) untracked(() => this.#setToggleableEvent());
371
381
  });
@@ -580,6 +590,10 @@ var ButtonDirective = class ButtonDirective {
580
590
  "attr.type": "type()",
581
591
  "class": "baseClass()"
582
592
  } },
593
+ hostDirectives: [{
594
+ directive: i1.RippleDirective,
595
+ inputs: ["monaRippleDisabled", "monaRippleDisabled"]
596
+ }],
583
597
  ngImport: i0
584
598
  });
585
599
  }
@@ -604,7 +618,11 @@ i0.ɵɵngDeclareClassMetadata({
604
618
  "[attr.tabindex]": "effectiveDisabled() ? -1 : tabindex()",
605
619
  "[attr.type]": "type()",
606
620
  "[class]": "baseClass()"
607
- }
621
+ },
622
+ hostDirectives: [{
623
+ directive: RippleDirective,
624
+ inputs: ["monaRippleDisabled"]
625
+ }]
608
626
  }]
609
627
  }],
610
628
  ctorParameters: () => [],