shirkasoft-ui-components 2.0.0 → 2.1.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 (34) hide show
  1. package/README.md +209 -53
  2. package/fesm2022/shirkasoft-ui-components-config.mjs +610 -72
  3. package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -1
  4. package/fesm2022/shirkasoft-ui-components-date-picker.mjs +79 -6
  5. package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
  6. package/fesm2022/shirkasoft-ui-components-file-upload.mjs +74 -3
  7. package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
  8. package/fesm2022/shirkasoft-ui-components-icons.mjs +6 -6
  9. package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -1
  10. package/fesm2022/shirkasoft-ui-components-price-input.mjs +70 -2
  11. package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
  12. package/fesm2022/shirkasoft-ui-components-select.mjs +76 -14
  13. package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
  14. package/fesm2022/shirkasoft-ui-components-table.mjs +11 -0
  15. package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
  16. package/fesm2022/shirkasoft-ui-components-text-field.mjs +80 -18
  17. package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
  18. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +262 -165
  19. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -1
  20. package/fesm2022/shirkasoft-ui-components-theme.mjs +2 -24
  21. package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -1
  22. package/fesm2022/shirkasoft-ui-components-utils.mjs +36 -1
  23. package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
  24. package/package.json +1 -1
  25. package/types/shirkasoft-ui-components-config.d.ts +246 -20
  26. package/types/shirkasoft-ui-components-date-picker.d.ts +35 -1
  27. package/types/shirkasoft-ui-components-file-upload.d.ts +35 -1
  28. package/types/shirkasoft-ui-components-icons.d.ts +6 -6
  29. package/types/shirkasoft-ui-components-price-input.d.ts +36 -2
  30. package/types/shirkasoft-ui-components-select.d.ts +36 -2
  31. package/types/shirkasoft-ui-components-text-field.d.ts +36 -4
  32. package/types/shirkasoft-ui-components-theme-picker.d.ts +40 -12
  33. package/types/shirkasoft-ui-components-theme.d.ts +17 -9
  34. package/types/shirkasoft-ui-components-utils.d.ts +34 -1
@@ -1,87 +1,106 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { ChangeDetectionStrategy, Component, ElementRef, computed, inject, input, signal, viewChild } from "@angular/core";
3
- import { SHK_THEME_PRESETS, SURFACE_PALETTES, ShkConfigService } from "shirkasoft-ui-components/config";
3
+ import { NgTemplateOutlet } from "@angular/common";
4
+ import { SHK_THEME_PRESETS, SURFACE_PALETTES, ShkConfigService, ShkLabels } from "shirkasoft-ui-components/config";
4
5
  import { ShkIconDirective } from "shirkasoft-ui-components/icons";
5
6
  import { getIcon } from "shirkasoft-ui-components/utils";
6
7
  const DEFAULT_PRIMARY_COLORS = [
7
8
  {
8
9
  color: "#334155",
9
- label: "Noir"
10
+ label: "Noir",
11
+ labelKey: "theme.colors.noir"
10
12
  },
11
13
  {
12
14
  color: "#059669",
13
- label: "Emerald"
15
+ label: "Emerald",
16
+ labelKey: "theme.colors.emerald"
14
17
  },
15
18
  {
16
19
  color: "#16a34a",
17
- label: "Green"
20
+ label: "Green",
21
+ labelKey: "theme.colors.green"
18
22
  },
19
23
  {
20
24
  color: "#65a30d",
21
- label: "Lime"
25
+ label: "Lime",
26
+ labelKey: "theme.colors.lime"
22
27
  },
23
28
  {
24
29
  color: "#ea580c",
25
- label: "Orange"
30
+ label: "Orange",
31
+ labelKey: "theme.colors.orange"
26
32
  },
27
33
  {
28
34
  color: "#d97706",
29
- label: "Amber"
35
+ label: "Amber",
36
+ labelKey: "theme.colors.amber"
30
37
  },
31
38
  {
32
39
  color: "#ca8a04",
33
- label: "Yellow"
40
+ label: "Yellow",
41
+ labelKey: "theme.colors.yellow"
34
42
  },
35
43
  {
36
44
  color: "#0d9488",
37
- label: "Teal"
45
+ label: "Teal",
46
+ labelKey: "theme.colors.teal"
38
47
  },
39
48
  {
40
49
  color: "#0891b2",
41
- label: "Cyan"
50
+ label: "Cyan",
51
+ labelKey: "theme.colors.cyan"
42
52
  },
43
53
  {
44
54
  color: "#0284c7",
45
- label: "Sky"
55
+ label: "Sky",
56
+ labelKey: "theme.colors.sky"
46
57
  },
47
58
  {
48
59
  color: "#2563eb",
49
- label: "Blue"
60
+ label: "Blue",
61
+ labelKey: "theme.colors.blue"
50
62
  },
51
63
  {
52
64
  color: "#4f46e5",
53
- label: "Indigo"
65
+ label: "Indigo",
66
+ labelKey: "theme.colors.indigo"
54
67
  },
55
68
  {
56
69
  color: "#7c3aed",
57
- label: "Violet"
70
+ label: "Violet",
71
+ labelKey: "theme.colors.violet"
58
72
  },
59
73
  {
60
74
  color: "#9333ea",
61
- label: "Purple"
75
+ label: "Purple",
76
+ labelKey: "theme.colors.purple"
62
77
  },
63
78
  {
64
79
  color: "#c026d3",
65
- label: "Fuchsia"
80
+ label: "Fuchsia",
81
+ labelKey: "theme.colors.fuchsia"
66
82
  },
67
83
  {
68
84
  color: "#db2777",
69
- label: "Pink"
85
+ label: "Pink",
86
+ labelKey: "theme.colors.pink"
70
87
  }
71
88
  ];
72
89
  let pickerCounter = 0;
73
90
  var ThemePickerComponent = class ThemePickerComponent {
74
91
  constructor() {
75
92
  this.config = inject(ShkConfigService);
93
+ this.labels = inject(ShkLabels);
76
94
  this.host = inject(ElementRef);
77
95
  this.trigger = viewChild("trigger", ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
78
96
  this.primaryColors = input(DEFAULT_PRIMARY_COLORS, ...ngDevMode ? [{ debugName: "primaryColors" }] : /* istanbul ignore next */ []);
79
97
  this.showSurface = input(true, ...ngDevMode ? [{ debugName: "showSurface" }] : /* istanbul ignore next */ []);
80
98
  this.showPresets = input(true, ...ngDevMode ? [{ debugName: "showPresets" }] : /* istanbul ignore next */ []);
81
- this.triggerLabel = input("Personalizar tema", ...ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []);
82
- this.primaryLabel = input("Primario", ...ngDevMode ? [{ debugName: "primaryLabel" }] : /* istanbul ignore next */ []);
83
- this.surfaceLabel = input("Superficie", ...ngDevMode ? [{ debugName: "surfaceLabel" }] : /* istanbul ignore next */ []);
84
- this.presetsLabel = input("Temas", ...ngDevMode ? [{ debugName: "presetsLabel" }] : /* istanbul ignore next */ []);
99
+ this.inline = input(false, ...ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []);
100
+ this.triggerLabel = input(void 0, ...ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []);
101
+ this.primaryLabel = input(void 0, ...ngDevMode ? [{ debugName: "primaryLabel" }] : /* istanbul ignore next */ []);
102
+ this.surfaceLabel = input(void 0, ...ngDevMode ? [{ debugName: "surfaceLabel" }] : /* istanbul ignore next */ []);
103
+ this.presetsLabel = input(void 0, ...ngDevMode ? [{ debugName: "presetsLabel" }] : /* istanbul ignore next */ []);
85
104
  this.available = this.config.has("theme.primary") && this.config.has("theme.surface");
86
105
  this.open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
87
106
  this.panelId = `shk-theme-picker-${++pickerCounter}`;
@@ -92,6 +111,10 @@ var ThemePickerComponent = class ThemePickerComponent {
92
111
  label: palette.label,
93
112
  color: palette.scale[5]
94
113
  }));
114
+ this.triggerText = computed(() => this.triggerLabel() ?? this.labels.get("theme.picker.trigger", "Customize theme"), ...ngDevMode ? [{ debugName: "triggerText" }] : /* istanbul ignore next */ []);
115
+ this.primaryText = computed(() => this.primaryLabel() ?? this.labels.get("theme.picker.primary", "Primary"), ...ngDevMode ? [{ debugName: "primaryText" }] : /* istanbul ignore next */ []);
116
+ this.surfaceText = computed(() => this.surfaceLabel() ?? this.labels.get("theme.picker.surface", "Surface"), ...ngDevMode ? [{ debugName: "surfaceText" }] : /* istanbul ignore next */ []);
117
+ this.presetsText = computed(() => this.presetsLabel() ?? this.labels.get("theme.picker.presets", "Themes"), ...ngDevMode ? [{ debugName: "presetsText" }] : /* istanbul ignore next */ []);
95
118
  this.themeName = computed(() => this.available ? this.config.get("theme.name")() : "", ...ngDevMode ? [{ debugName: "themeName" }] : /* istanbul ignore next */ []);
96
119
  this.currentPreset = computed(() => this.presets.find((preset) => preset.name === this.themeName()), ...ngDevMode ? [{ debugName: "currentPreset" }] : /* istanbul ignore next */ []);
97
120
  this.primaryOverride = computed(() => this.available ? this.config.get("theme.primary")() : "", ...ngDevMode ? [{ debugName: "primaryOverride" }] : /* istanbul ignore next */ []);
@@ -100,20 +123,30 @@ var ThemePickerComponent = class ThemePickerComponent {
100
123
  this.activeSurface = computed(() => this.surfaceOverride() || this.currentPreset()?.surface || "", ...ngDevMode ? [{ debugName: "activeSurface" }] : /* istanbul ignore next */ []);
101
124
  this.isPresetPure = computed(() => !this.primaryOverride() && !this.surfaceOverride(), ...ngDevMode ? [{ debugName: "isPresetPure" }] : /* istanbul ignore next */ []);
102
125
  }
126
+ presetLabel(preset) {
127
+ return this.labels.get(preset.labelKey, preset.label);
128
+ }
129
+ colorLabel(item) {
130
+ return this.labels.get(item.labelKey, item.label);
131
+ }
132
+ surfaceName(name) {
133
+ const palette = SURFACE_PALETTES[name];
134
+ return this.labels.get(`theme.surfaces.${name}`, palette?.label ?? name);
135
+ }
103
136
  toggle() {
104
137
  this.open.update((open) => !open);
105
138
  }
106
139
  setPrimary(color) {
107
140
  const own = this.currentPreset()?.primary.toLowerCase();
108
- this.config.set("theme.primary", color.toLowerCase() === own ? "" : color);
141
+ this.config.set("theme.primary", color.toLowerCase() === own ? "" : color, "device");
109
142
  }
110
143
  setSurface(name) {
111
- this.config.set("theme.surface", name === this.currentPreset()?.surface ? "" : name);
144
+ this.config.set("theme.surface", name === this.currentPreset()?.surface ? "" : name, "device");
112
145
  }
113
146
  setPreset(name) {
114
- this.config.set("theme.name", name);
115
- this.config.set("theme.primary", "");
116
- this.config.set("theme.surface", "");
147
+ this.config.set("theme.name", name, "device");
148
+ this.config.set("theme.primary", "", "device");
149
+ this.config.set("theme.surface", "", "device");
117
150
  }
118
151
  onDocumentPointerDown(event) {
119
152
  if (this.open() && !this.host.nativeElement.contains(event.target)) this.open.set(false);
@@ -162,6 +195,13 @@ var ThemePickerComponent = class ThemePickerComponent {
162
195
  isRequired: false,
163
196
  transformFunction: null
164
197
  },
198
+ inline: {
199
+ classPropertyName: "inline",
200
+ publicName: "inline",
201
+ isSignal: true,
202
+ isRequired: false,
203
+ transformFunction: null
204
+ },
165
205
  triggerLabel: {
166
206
  classPropertyName: "triggerLabel",
167
207
  publicName: "triggerLabel",
@@ -196,6 +236,7 @@ var ThemePickerComponent = class ThemePickerComponent {
196
236
  "document:pointerdown": "onDocumentPointerDown($event)",
197
237
  "document:keydown.escape": "onEscape()"
198
238
  },
239
+ properties: { "class.is-inline": "inline()" },
199
240
  classAttribute: "shk-theme-picker"
200
241
  },
201
242
  viewQueries: [{
@@ -208,84 +249,103 @@ var ThemePickerComponent = class ThemePickerComponent {
208
249
  ngImport: i0,
209
250
  template: `
210
251
  @if (available) {
211
- <button
212
- #trigger
213
- type="button"
214
- class="shk-tp-trigger"
215
- aria-haspopup="dialog"
216
- [attr.aria-expanded]="open()"
217
- [attr.aria-controls]="panelId"
218
- [attr.aria-label]="triggerLabel()"
219
- [attr.title]="triggerLabel()"
220
- (click)="toggle()"
221
- >
222
- <svg [shkIcon]="paletteIcon" class="shk-tp-trigger-icon"></svg>
223
- </button>
252
+ @if (inline()) {
253
+ <div
254
+ class="shk-tp-panel is-inline"
255
+ role="group"
256
+ [attr.aria-label]="triggerText()"
257
+ >
258
+ <ng-container *ngTemplateOutlet="sections" />
259
+ </div>
260
+ } @else {
261
+ <button
262
+ #trigger
263
+ type="button"
264
+ class="shk-tp-trigger"
265
+ aria-haspopup="dialog"
266
+ [attr.aria-expanded]="open()"
267
+ [attr.aria-controls]="panelId"
268
+ [attr.aria-label]="triggerText()"
269
+ [attr.title]="triggerText()"
270
+ (click)="toggle()"
271
+ >
272
+ <svg [shkIcon]="paletteIcon" class="shk-tp-trigger-icon"></svg>
273
+ </button>
224
274
 
225
- @if (open()) {
226
- <div class="shk-tp-panel _shk-bg-panel-raised" role="dialog" [id]="panelId" [attr.aria-label]="triggerLabel()">
227
- <div class="shk-tp-section">
228
- <span class="shk-tp-title" [id]="panelId + '-primary'">{{ primaryLabel() }}</span>
229
- <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-primary'">
230
- @for (item of primaryColors(); track item.color) {
231
- <button
232
- type="button"
233
- class="shk-tp-swatch"
234
- [style.background-color]="item.color"
235
- [class.is-selected]="item.color.toLowerCase() === activePrimary()"
236
- [attr.aria-pressed]="item.color.toLowerCase() === activePrimary()"
237
- [attr.aria-label]="item.label"
238
- [attr.title]="item.label"
239
- (click)="setPrimary(item.color)"
240
- ></button>
241
- }
242
- </div>
275
+ @if (open()) {
276
+ <div
277
+ class="shk-tp-panel _shk-bg-panel-raised"
278
+ role="dialog"
279
+ [id]="panelId"
280
+ [attr.aria-label]="triggerText()"
281
+ >
282
+ <ng-container *ngTemplateOutlet="sections" />
243
283
  </div>
284
+ }
285
+ }
286
+ }
244
287
 
245
- @if (showSurface()) {
246
- <div class="shk-tp-section">
247
- <span class="shk-tp-title" [id]="panelId + '-surface'">{{ surfaceLabel() }}</span>
248
- <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-surface'">
249
- @for (item of surfaces; track item.name) {
250
- <button
251
- type="button"
252
- class="shk-tp-swatch"
253
- [style.background-color]="item.color"
254
- [class.is-selected]="item.name === activeSurface()"
255
- [attr.aria-pressed]="item.name === activeSurface()"
256
- [attr.aria-label]="item.label"
257
- [attr.title]="item.label"
258
- (click)="setSurface(item.name)"
259
- ></button>
260
- }
261
- </div>
262
- </div>
263
- }
288
+ <ng-template #sections>
289
+ @if (showPresets() && presets.length > 1) {
290
+ <div class="shk-tp-section">
291
+ <span class="shk-tp-title" [id]="panelId + '-presets'">{{ presetsText() }}</span>
292
+ <div class="shk-tp-segmented" role="group" [attr.aria-labelledby]="panelId + '-presets'">
293
+ @for (preset of presets; track preset.name) {
294
+ <button
295
+ type="button"
296
+ class="shk-tp-segment"
297
+ [class.is-active]="preset.name === themeName() && isPresetPure()"
298
+ [attr.aria-pressed]="preset.name === themeName() && isPresetPure()"
299
+ (click)="setPreset(preset.name)"
300
+ >
301
+ {{ presetLabel(preset) }}
302
+ </button>
303
+ }
304
+ </div>
305
+ </div>
306
+ }
264
307
 
265
- @if (showPresets() && presets.length > 1) {
266
- <div class="shk-tp-section">
267
- <span class="shk-tp-title" [id]="panelId + '-presets'">{{ presetsLabel() }}</span>
268
- <div class="shk-tp-segmented" role="group" [attr.aria-labelledby]="panelId + '-presets'">
269
- @for (preset of presets; track preset.name) {
270
- <button
271
- type="button"
272
- class="shk-tp-segment"
273
- [class.is-active]="preset.name === themeName() && isPresetPure()"
274
- [attr.aria-pressed]="preset.name === themeName() && isPresetPure()"
275
- (click)="setPreset(preset.name)"
276
- >
277
- {{ preset.label }}
278
- </button>
279
- }
280
- </div>
281
- </div>
308
+ <div class="shk-tp-section">
309
+ <span class="shk-tp-title" [id]="panelId + '-primary'">{{ primaryText() }}</span>
310
+ <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-primary'">
311
+ @for (item of primaryColors(); track item.color) {
312
+ <button
313
+ type="button"
314
+ class="shk-tp-swatch"
315
+ [style.background-color]="item.color"
316
+ [class.is-selected]="item.color.toLowerCase() === activePrimary()"
317
+ [attr.aria-pressed]="item.color.toLowerCase() === activePrimary()"
318
+ [attr.aria-label]="colorLabel(item)"
319
+ [attr.title]="colorLabel(item)"
320
+ (click)="setPrimary(item.color)"
321
+ ></button>
282
322
  }
283
323
  </div>
324
+ </div>
325
+
326
+ @if (showSurface()) {
327
+ <div class="shk-tp-section">
328
+ <span class="shk-tp-title" [id]="panelId + '-surface'">{{ surfaceText() }}</span>
329
+ <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-surface'">
330
+ @for (item of surfaces; track item.name) {
331
+ <button
332
+ type="button"
333
+ class="shk-tp-swatch"
334
+ [style.background-color]="item.color"
335
+ [class.is-selected]="item.name === activeSurface()"
336
+ [attr.aria-pressed]="item.name === activeSurface()"
337
+ [attr.aria-label]="surfaceName(item.name)"
338
+ [attr.title]="surfaceName(item.name)"
339
+ (click)="setSurface(item.name)"
340
+ ></button>
341
+ }
342
+ </div>
343
+ </div>
284
344
  }
285
- }
345
+ </ng-template>
286
346
  `,
287
347
  isInline: true,
288
- styles: [":host{position:relative;display:inline-flex}.shk-tp-trigger{display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:9999px;cursor:pointer;color:#fff;background-color:var(--shk-primary-600);transition:filter .15s ease}.shk-tp-trigger:hover{filter:brightness(1.1)}.shk-tp-trigger:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:2px}.shk-tp-trigger-icon{width:1.15rem;height:1.15rem}.shk-tp-panel{position:absolute;top:calc(100% + .5rem);right:0;z-index:70;width:max-content;max-width:min(19rem,calc(100vw - 1.5rem));padding:.875rem 1rem 1rem;border-radius:.75rem;border:1px solid var(--shk-surface-200);box-shadow:0 10px 30px #00000024;display:grid;gap:.875rem;text-align:left}.shk-tp-title{display:block;margin-bottom:.5rem;font-size:.8125rem;font-weight:600;color:var(--shk-surface-600)}.shk-tp-swatches{display:grid;grid-template-columns:repeat(8,1.375rem);gap:.5rem}.shk-tp-swatch{width:1.375rem;height:1.375rem;padding:0;border:0;border-radius:9999px;cursor:pointer;transition:transform .12s ease}.shk-tp-swatch:hover{transform:scale(1.12)}.shk-tp-swatch:focus-visible,.shk-tp-swatch.is-selected{outline:2px solid var(--shk-surface-800);outline-offset:2px}.shk-tp-segmented{display:flex;flex-wrap:wrap;gap:.25rem;padding:.25rem;border-radius:.5rem;background-color:var(--shk-surface-100)}.shk-tp-segment{padding:.3rem .65rem;border:0;border-radius:.375rem;background:transparent;font-size:.8125rem;color:var(--shk-surface-600);cursor:pointer}.shk-tp-segment:hover{color:var(--shk-surface-800)}.shk-tp-segment:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:1px}.shk-tp-segment.is-active{background-color:var(--shk-surface-50);color:var(--shk-surface-900);font-weight:600;box-shadow:0 1px 2px #0000001f}\n"],
348
+ styles: [":host{position:relative;display:inline-flex}:host(.is-inline){display:block;width:100%}.shk-tp-trigger{display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:9999px;cursor:pointer;color:#fff;background-color:var(--shk-primary-600);transition:filter .15s ease}.shk-tp-trigger:hover{filter:brightness(1.1)}.shk-tp-trigger:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:2px}.shk-tp-trigger-icon{width:1.15rem;height:1.15rem}.shk-tp-panel{position:absolute;top:calc(100% + .5rem);right:0;z-index:70;width:max-content;max-width:min(19rem,calc(100vw - 1.5rem));padding:.875rem 1rem 1rem;border-radius:.75rem;border:1px solid var(--shk-surface-200);box-shadow:0 10px 30px #00000024;display:grid;gap:.875rem;text-align:left}.shk-tp-panel.is-inline{position:static;width:100%;max-width:none;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent}.shk-tp-title{display:block;margin-bottom:.5rem;font-size:.8125rem;font-weight:600;color:var(--shk-surface-600)}.shk-tp-swatches{display:grid;grid-template-columns:repeat(8,1.375rem);gap:.5rem}.shk-tp-swatch{width:1.375rem;height:1.375rem;padding:0;border:0;border-radius:9999px;cursor:pointer;transition:transform .12s ease}.shk-tp-swatch:hover{transform:scale(1.12)}.shk-tp-swatch:focus-visible,.shk-tp-swatch.is-selected{outline:2px solid var(--shk-surface-800);outline-offset:2px}.shk-tp-segmented{display:flex;flex-wrap:wrap;gap:.25rem;padding:.25rem;border-radius:.5rem;background-color:var(--shk-surface-100)}.shk-tp-segment{padding:.3rem .65rem;border:0;border-radius:.375rem;background:transparent;font-size:.8125rem;color:var(--shk-surface-600);cursor:pointer}.shk-tp-segment:hover{color:var(--shk-surface-800)}.shk-tp-segment:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:1px}.shk-tp-segment.is-active{background-color:var(--shk-surface-50);color:var(--shk-surface-900);font-weight:600;box-shadow:0 1px 2px #0000001f}\n"],
289
349
  dependencies: [{
290
350
  kind: "directive",
291
351
  type: ShkIconDirective,
@@ -296,6 +356,15 @@ var ThemePickerComponent = class ThemePickerComponent {
296
356
  "strokeWidth",
297
357
  "color"
298
358
  ]
359
+ }, {
360
+ kind: "directive",
361
+ type: NgTemplateOutlet,
362
+ selector: "[ngTemplateOutlet]",
363
+ inputs: [
364
+ "ngTemplateOutletContext",
365
+ "ngTemplateOutlet",
366
+ "ngTemplateOutletInjector"
367
+ ]
299
368
  }],
300
369
  changeDetection: i0.ChangeDetectionStrategy.OnPush
301
370
  });
@@ -311,91 +380,111 @@ i0.ɵɵngDeclareClassMetadata({
311
380
  args: [{
312
381
  selector: "shk-theme-picker",
313
382
  changeDetection: ChangeDetectionStrategy.OnPush,
314
- imports: [ShkIconDirective],
383
+ imports: [ShkIconDirective, NgTemplateOutlet],
315
384
  host: {
316
385
  class: "shk-theme-picker",
386
+ "[class.is-inline]": "inline()",
317
387
  "(document:pointerdown)": "onDocumentPointerDown($event)",
318
388
  "(document:keydown.escape)": "onEscape()"
319
389
  },
320
390
  template: `
321
391
  @if (available) {
322
- <button
323
- #trigger
324
- type="button"
325
- class="shk-tp-trigger"
326
- aria-haspopup="dialog"
327
- [attr.aria-expanded]="open()"
328
- [attr.aria-controls]="panelId"
329
- [attr.aria-label]="triggerLabel()"
330
- [attr.title]="triggerLabel()"
331
- (click)="toggle()"
332
- >
333
- <svg [shkIcon]="paletteIcon" class="shk-tp-trigger-icon"></svg>
334
- </button>
392
+ @if (inline()) {
393
+ <div
394
+ class="shk-tp-panel is-inline"
395
+ role="group"
396
+ [attr.aria-label]="triggerText()"
397
+ >
398
+ <ng-container *ngTemplateOutlet="sections" />
399
+ </div>
400
+ } @else {
401
+ <button
402
+ #trigger
403
+ type="button"
404
+ class="shk-tp-trigger"
405
+ aria-haspopup="dialog"
406
+ [attr.aria-expanded]="open()"
407
+ [attr.aria-controls]="panelId"
408
+ [attr.aria-label]="triggerText()"
409
+ [attr.title]="triggerText()"
410
+ (click)="toggle()"
411
+ >
412
+ <svg [shkIcon]="paletteIcon" class="shk-tp-trigger-icon"></svg>
413
+ </button>
335
414
 
336
- @if (open()) {
337
- <div class="shk-tp-panel _shk-bg-panel-raised" role="dialog" [id]="panelId" [attr.aria-label]="triggerLabel()">
338
- <div class="shk-tp-section">
339
- <span class="shk-tp-title" [id]="panelId + '-primary'">{{ primaryLabel() }}</span>
340
- <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-primary'">
341
- @for (item of primaryColors(); track item.color) {
342
- <button
343
- type="button"
344
- class="shk-tp-swatch"
345
- [style.background-color]="item.color"
346
- [class.is-selected]="item.color.toLowerCase() === activePrimary()"
347
- [attr.aria-pressed]="item.color.toLowerCase() === activePrimary()"
348
- [attr.aria-label]="item.label"
349
- [attr.title]="item.label"
350
- (click)="setPrimary(item.color)"
351
- ></button>
352
- }
353
- </div>
415
+ @if (open()) {
416
+ <div
417
+ class="shk-tp-panel _shk-bg-panel-raised"
418
+ role="dialog"
419
+ [id]="panelId"
420
+ [attr.aria-label]="triggerText()"
421
+ >
422
+ <ng-container *ngTemplateOutlet="sections" />
354
423
  </div>
424
+ }
425
+ }
426
+ }
355
427
 
356
- @if (showSurface()) {
357
- <div class="shk-tp-section">
358
- <span class="shk-tp-title" [id]="panelId + '-surface'">{{ surfaceLabel() }}</span>
359
- <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-surface'">
360
- @for (item of surfaces; track item.name) {
361
- <button
362
- type="button"
363
- class="shk-tp-swatch"
364
- [style.background-color]="item.color"
365
- [class.is-selected]="item.name === activeSurface()"
366
- [attr.aria-pressed]="item.name === activeSurface()"
367
- [attr.aria-label]="item.label"
368
- [attr.title]="item.label"
369
- (click)="setSurface(item.name)"
370
- ></button>
371
- }
372
- </div>
373
- </div>
374
- }
428
+ <ng-template #sections>
429
+ @if (showPresets() && presets.length > 1) {
430
+ <div class="shk-tp-section">
431
+ <span class="shk-tp-title" [id]="panelId + '-presets'">{{ presetsText() }}</span>
432
+ <div class="shk-tp-segmented" role="group" [attr.aria-labelledby]="panelId + '-presets'">
433
+ @for (preset of presets; track preset.name) {
434
+ <button
435
+ type="button"
436
+ class="shk-tp-segment"
437
+ [class.is-active]="preset.name === themeName() && isPresetPure()"
438
+ [attr.aria-pressed]="preset.name === themeName() && isPresetPure()"
439
+ (click)="setPreset(preset.name)"
440
+ >
441
+ {{ presetLabel(preset) }}
442
+ </button>
443
+ }
444
+ </div>
445
+ </div>
446
+ }
375
447
 
376
- @if (showPresets() && presets.length > 1) {
377
- <div class="shk-tp-section">
378
- <span class="shk-tp-title" [id]="panelId + '-presets'">{{ presetsLabel() }}</span>
379
- <div class="shk-tp-segmented" role="group" [attr.aria-labelledby]="panelId + '-presets'">
380
- @for (preset of presets; track preset.name) {
381
- <button
382
- type="button"
383
- class="shk-tp-segment"
384
- [class.is-active]="preset.name === themeName() && isPresetPure()"
385
- [attr.aria-pressed]="preset.name === themeName() && isPresetPure()"
386
- (click)="setPreset(preset.name)"
387
- >
388
- {{ preset.label }}
389
- </button>
390
- }
391
- </div>
392
- </div>
448
+ <div class="shk-tp-section">
449
+ <span class="shk-tp-title" [id]="panelId + '-primary'">{{ primaryText() }}</span>
450
+ <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-primary'">
451
+ @for (item of primaryColors(); track item.color) {
452
+ <button
453
+ type="button"
454
+ class="shk-tp-swatch"
455
+ [style.background-color]="item.color"
456
+ [class.is-selected]="item.color.toLowerCase() === activePrimary()"
457
+ [attr.aria-pressed]="item.color.toLowerCase() === activePrimary()"
458
+ [attr.aria-label]="colorLabel(item)"
459
+ [attr.title]="colorLabel(item)"
460
+ (click)="setPrimary(item.color)"
461
+ ></button>
393
462
  }
394
463
  </div>
464
+ </div>
465
+
466
+ @if (showSurface()) {
467
+ <div class="shk-tp-section">
468
+ <span class="shk-tp-title" [id]="panelId + '-surface'">{{ surfaceText() }}</span>
469
+ <div class="shk-tp-swatches" role="group" [attr.aria-labelledby]="panelId + '-surface'">
470
+ @for (item of surfaces; track item.name) {
471
+ <button
472
+ type="button"
473
+ class="shk-tp-swatch"
474
+ [style.background-color]="item.color"
475
+ [class.is-selected]="item.name === activeSurface()"
476
+ [attr.aria-pressed]="item.name === activeSurface()"
477
+ [attr.aria-label]="surfaceName(item.name)"
478
+ [attr.title]="surfaceName(item.name)"
479
+ (click)="setSurface(item.name)"
480
+ ></button>
481
+ }
482
+ </div>
483
+ </div>
395
484
  }
396
- }
485
+ </ng-template>
397
486
  `,
398
- styles: [":host{position:relative;display:inline-flex}.shk-tp-trigger{display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:9999px;cursor:pointer;color:#fff;background-color:var(--shk-primary-600);transition:filter .15s ease}.shk-tp-trigger:hover{filter:brightness(1.1)}.shk-tp-trigger:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:2px}.shk-tp-trigger-icon{width:1.15rem;height:1.15rem}.shk-tp-panel{position:absolute;top:calc(100% + .5rem);right:0;z-index:70;width:max-content;max-width:min(19rem,calc(100vw - 1.5rem));padding:.875rem 1rem 1rem;border-radius:.75rem;border:1px solid var(--shk-surface-200);box-shadow:0 10px 30px #00000024;display:grid;gap:.875rem;text-align:left}.shk-tp-title{display:block;margin-bottom:.5rem;font-size:.8125rem;font-weight:600;color:var(--shk-surface-600)}.shk-tp-swatches{display:grid;grid-template-columns:repeat(8,1.375rem);gap:.5rem}.shk-tp-swatch{width:1.375rem;height:1.375rem;padding:0;border:0;border-radius:9999px;cursor:pointer;transition:transform .12s ease}.shk-tp-swatch:hover{transform:scale(1.12)}.shk-tp-swatch:focus-visible,.shk-tp-swatch.is-selected{outline:2px solid var(--shk-surface-800);outline-offset:2px}.shk-tp-segmented{display:flex;flex-wrap:wrap;gap:.25rem;padding:.25rem;border-radius:.5rem;background-color:var(--shk-surface-100)}.shk-tp-segment{padding:.3rem .65rem;border:0;border-radius:.375rem;background:transparent;font-size:.8125rem;color:var(--shk-surface-600);cursor:pointer}.shk-tp-segment:hover{color:var(--shk-surface-800)}.shk-tp-segment:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:1px}.shk-tp-segment.is-active{background-color:var(--shk-surface-50);color:var(--shk-surface-900);font-weight:600;box-shadow:0 1px 2px #0000001f}\n"]
487
+ styles: [":host{position:relative;display:inline-flex}:host(.is-inline){display:block;width:100%}.shk-tp-trigger{display:grid;place-items:center;width:2.25rem;height:2.25rem;border:0;border-radius:9999px;cursor:pointer;color:#fff;background-color:var(--shk-primary-600);transition:filter .15s ease}.shk-tp-trigger:hover{filter:brightness(1.1)}.shk-tp-trigger:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:2px}.shk-tp-trigger-icon{width:1.15rem;height:1.15rem}.shk-tp-panel{position:absolute;top:calc(100% + .5rem);right:0;z-index:70;width:max-content;max-width:min(19rem,calc(100vw - 1.5rem));padding:.875rem 1rem 1rem;border-radius:.75rem;border:1px solid var(--shk-surface-200);box-shadow:0 10px 30px #00000024;display:grid;gap:.875rem;text-align:left}.shk-tp-panel.is-inline{position:static;width:100%;max-width:none;padding:0;border:0;border-radius:0;box-shadow:none;background:transparent}.shk-tp-title{display:block;margin-bottom:.5rem;font-size:.8125rem;font-weight:600;color:var(--shk-surface-600)}.shk-tp-swatches{display:grid;grid-template-columns:repeat(8,1.375rem);gap:.5rem}.shk-tp-swatch{width:1.375rem;height:1.375rem;padding:0;border:0;border-radius:9999px;cursor:pointer;transition:transform .12s ease}.shk-tp-swatch:hover{transform:scale(1.12)}.shk-tp-swatch:focus-visible,.shk-tp-swatch.is-selected{outline:2px solid var(--shk-surface-800);outline-offset:2px}.shk-tp-segmented{display:flex;flex-wrap:wrap;gap:.25rem;padding:.25rem;border-radius:.5rem;background-color:var(--shk-surface-100)}.shk-tp-segment{padding:.3rem .65rem;border:0;border-radius:.375rem;background:transparent;font-size:.8125rem;color:var(--shk-surface-600);cursor:pointer}.shk-tp-segment:hover{color:var(--shk-surface-800)}.shk-tp-segment:focus-visible{outline:2px solid var(--shk-primary-600);outline-offset:1px}.shk-tp-segment.is-active{background-color:var(--shk-surface-50);color:var(--shk-surface-900);font-weight:600;box-shadow:0 1px 2px #0000001f}\n"]
399
488
  }]
400
489
  }],
401
490
  propDecorators: {
@@ -427,6 +516,14 @@ i0.ɵɵngDeclareClassMetadata({
427
516
  required: false
428
517
  }]
429
518
  }],
519
+ inline: [{
520
+ type: i0.Input,
521
+ args: [{
522
+ isSignal: true,
523
+ alias: "inline",
524
+ required: false
525
+ }]
526
+ }],
430
527
  triggerLabel: [{
431
528
  type: i0.Input,
432
529
  args: [{