@retalia/pos-components 0.0.3 → 0.0.4

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 (45) hide show
  1. package/eslint.config.js +32 -0
  2. package/ng-package.json +14 -0
  3. package/package.json +17 -31
  4. package/src/lib/basket/pos-basket.html +124 -0
  5. package/src/lib/basket/pos-basket.scss +285 -0
  6. package/src/lib/basket/pos-basket.spec.ts +198 -0
  7. package/src/lib/basket/pos-basket.stories.ts +114 -0
  8. package/src/lib/basket/pos-basket.ts +142 -0
  9. package/src/lib/item-entry/pos-item-entry.html +41 -0
  10. package/src/lib/item-entry/pos-item-entry.scss +145 -0
  11. package/src/lib/item-entry/pos-item-entry.spec.ts +123 -0
  12. package/src/lib/item-entry/pos-item-entry.stories.ts +31 -0
  13. package/src/lib/item-entry/pos-item-entry.ts +81 -0
  14. package/src/lib/login/pos-login.html +82 -0
  15. package/src/lib/login/pos-login.scss +238 -0
  16. package/src/lib/login/pos-login.spec.ts +89 -0
  17. package/src/lib/login/pos-login.stories.ts +36 -0
  18. package/src/lib/login/pos-login.ts +150 -0
  19. package/src/lib/receipt/pos-receipt.html +116 -0
  20. package/src/lib/receipt/pos-receipt.scss +367 -0
  21. package/src/lib/receipt/pos-receipt.spec.ts +188 -0
  22. package/src/lib/receipt/pos-receipt.stories.ts +163 -0
  23. package/src/lib/receipt/pos-receipt.ts +129 -0
  24. package/src/lib/tender/pos-tender.html +79 -0
  25. package/src/lib/tender/pos-tender.scss +318 -0
  26. package/src/lib/tender/pos-tender.spec.ts +150 -0
  27. package/src/lib/tender/pos-tender.stories.ts +47 -0
  28. package/src/lib/tender/pos-tender.ts +154 -0
  29. package/src/lib/tokens/pos-theme-css.spec.ts +75 -0
  30. package/src/lib/tokens/pos-theme-css.ts +123 -0
  31. package/src/lib/tokens/pos-token-catalog.ts +514 -0
  32. package/src/lib/tokens/pos-tokens.html +351 -0
  33. package/src/lib/tokens/pos-tokens.scss +437 -0
  34. package/src/lib/tokens/pos-tokens.spec.ts +164 -0
  35. package/src/lib/tokens/pos-tokens.stories.ts +22 -0
  36. package/src/lib/tokens/pos-tokens.ts +208 -0
  37. package/src/public-api.ts +37 -0
  38. package/tsconfig.lib.json +14 -0
  39. package/tsconfig.lib.prod.json +11 -0
  40. package/tsconfig.spec.json +11 -0
  41. package/fesm2022/retalia-pos-components.mjs +0 -1089
  42. package/fesm2022/retalia-pos-components.mjs.map +0 -1
  43. package/types/retalia-pos-components.d.ts +0 -300
  44. /package/{styles → src/styles}/styles.css +0 -0
  45. /package/{styles → src/styles}/tokens.css +0 -0
@@ -0,0 +1,514 @@
1
+ /**
2
+ * Theme-lab catalog. Default values must stay in sync with `styles/tokens.css`.
3
+ * The lab never writes that file; edits are live overrides only.
4
+ */
5
+ export type PosTokenKind =
6
+ | 'color'
7
+ | 'length'
8
+ | 'font-family'
9
+ | 'font-weight'
10
+ | 'other';
11
+
12
+ export type PosTokenGroup = 'color' | 'radius' | 'space' | 'type' | 'control';
13
+
14
+ export type PosTokenPreview =
15
+ | 'color'
16
+ | 'radius'
17
+ | 'space'
18
+ | 'font-size'
19
+ | 'font-family'
20
+ | 'font-weight'
21
+ | 'letter-spacing'
22
+ | 'size';
23
+
24
+ export interface PosTokenSwatch {
25
+ readonly name: string;
26
+ readonly variable: string;
27
+ }
28
+
29
+ export interface PosTokenDefinition extends PosTokenSwatch {
30
+ readonly kind: PosTokenKind;
31
+ readonly group: PosTokenGroup;
32
+ readonly preview: PosTokenPreview;
33
+ readonly defaultValue: string;
34
+ }
35
+
36
+ export interface PosTokenSample {
37
+ readonly id: string;
38
+ readonly label: string;
39
+ readonly variables: readonly string[];
40
+ }
41
+
42
+ export const POS_TOKEN_CATALOG: readonly PosTokenDefinition[] = [
43
+ {
44
+ name: 'Primary',
45
+ variable: '--pos-color-primary',
46
+ kind: 'color',
47
+ group: 'color',
48
+ preview: 'color',
49
+ defaultValue: '#c9b5f0',
50
+ },
51
+ {
52
+ name: 'On primary',
53
+ variable: '--pos-color-on-primary',
54
+ kind: 'color',
55
+ group: 'color',
56
+ preview: 'color',
57
+ defaultValue: '#333333',
58
+ },
59
+ {
60
+ name: 'Success',
61
+ variable: '--pos-color-success',
62
+ kind: 'color',
63
+ group: 'color',
64
+ preview: 'color',
65
+ defaultValue: '#16dbcc',
66
+ },
67
+ {
68
+ name: 'On success',
69
+ variable: '--pos-color-on-success',
70
+ kind: 'color',
71
+ group: 'color',
72
+ preview: 'color',
73
+ defaultValue: '#333333',
74
+ },
75
+ {
76
+ name: 'Danger',
77
+ variable: '--pos-color-danger',
78
+ kind: 'color',
79
+ group: 'color',
80
+ preview: 'color',
81
+ defaultValue: '#fe5c73',
82
+ },
83
+ {
84
+ name: 'On danger',
85
+ variable: '--pos-color-on-danger',
86
+ kind: 'color',
87
+ group: 'color',
88
+ preview: 'color',
89
+ defaultValue: '#ffffff',
90
+ },
91
+ {
92
+ name: 'Secondary',
93
+ variable: '--pos-color-secondary',
94
+ kind: 'color',
95
+ group: 'color',
96
+ preview: 'color',
97
+ defaultValue: '#16dbcc',
98
+ },
99
+ {
100
+ name: 'Warning',
101
+ variable: '--pos-color-warning',
102
+ kind: 'color',
103
+ group: 'color',
104
+ preview: 'color',
105
+ defaultValue: '#f0ad4e',
106
+ },
107
+ {
108
+ name: 'Text',
109
+ variable: '--pos-color-text',
110
+ kind: 'color',
111
+ group: 'color',
112
+ preview: 'color',
113
+ defaultValue: '#333333',
114
+ },
115
+ {
116
+ name: 'Text muted',
117
+ variable: '--pos-color-text-muted',
118
+ kind: 'color',
119
+ group: 'color',
120
+ preview: 'color',
121
+ defaultValue: '#999999',
122
+ },
123
+ {
124
+ name: 'Surface',
125
+ variable: '--pos-color-surface',
126
+ kind: 'color',
127
+ group: 'color',
128
+ preview: 'color',
129
+ defaultValue: '#ffffff',
130
+ },
131
+ {
132
+ name: 'Surface muted',
133
+ variable: '--pos-color-surface-muted',
134
+ kind: 'color',
135
+ group: 'color',
136
+ preview: 'color',
137
+ defaultValue: '#f5f5f5',
138
+ },
139
+ {
140
+ name: 'Panel',
141
+ variable: '--pos-color-panel',
142
+ kind: 'color',
143
+ group: 'color',
144
+ preview: 'color',
145
+ defaultValue: '#f5f5f5',
146
+ },
147
+ {
148
+ name: 'Panel elevated',
149
+ variable: '--pos-color-panel-elevated',
150
+ kind: 'color',
151
+ group: 'color',
152
+ preview: 'color',
153
+ defaultValue: '#ffffff',
154
+ },
155
+ {
156
+ name: 'Ink',
157
+ variable: '--pos-color-ink',
158
+ kind: 'color',
159
+ group: 'color',
160
+ preview: 'color',
161
+ defaultValue: '#333333',
162
+ },
163
+ {
164
+ name: 'Border',
165
+ variable: '--pos-color-border',
166
+ kind: 'color',
167
+ group: 'color',
168
+ preview: 'color',
169
+ defaultValue: '#dddddd',
170
+ },
171
+ {
172
+ name: 'Disabled',
173
+ variable: '--pos-color-disabled',
174
+ kind: 'color',
175
+ group: 'color',
176
+ preview: 'color',
177
+ defaultValue: '#dddddd',
178
+ },
179
+ {
180
+ name: 'On disabled',
181
+ variable: '--pos-color-on-disabled',
182
+ kind: 'color',
183
+ group: 'color',
184
+ preview: 'color',
185
+ defaultValue: '#999999',
186
+ },
187
+ {
188
+ name: 'Display',
189
+ variable: '--pos-color-display',
190
+ kind: 'color',
191
+ group: 'color',
192
+ preview: 'color',
193
+ defaultValue: '#333333',
194
+ },
195
+ {
196
+ name: 'On display',
197
+ variable: '--pos-color-on-display',
198
+ kind: 'color',
199
+ group: 'color',
200
+ preview: 'color',
201
+ defaultValue: '#ffffff',
202
+ },
203
+ {
204
+ name: 'Key',
205
+ variable: '--pos-color-key',
206
+ kind: 'color',
207
+ group: 'color',
208
+ preview: 'color',
209
+ defaultValue: '#ffffff',
210
+ },
211
+ {
212
+ name: 'Key border',
213
+ variable: '--pos-color-key-border',
214
+ kind: 'color',
215
+ group: 'color',
216
+ preview: 'color',
217
+ defaultValue: '#dddddd',
218
+ },
219
+ {
220
+ name: 'Key active',
221
+ variable: '--pos-color-key-active',
222
+ kind: 'color',
223
+ group: 'color',
224
+ preview: 'color',
225
+ defaultValue: '#c9b5f0',
226
+ },
227
+ {
228
+ name: 'On key active',
229
+ variable: '--pos-color-on-key-active',
230
+ kind: 'color',
231
+ group: 'color',
232
+ preview: 'color',
233
+ defaultValue: '#333333',
234
+ },
235
+ {
236
+ name: 'Radius sm',
237
+ variable: '--pos-radius-sm',
238
+ kind: 'length',
239
+ group: 'radius',
240
+ preview: 'radius',
241
+ defaultValue: '4px',
242
+ },
243
+ {
244
+ name: 'Radius md',
245
+ variable: '--pos-radius-md',
246
+ kind: 'length',
247
+ group: 'radius',
248
+ preview: 'radius',
249
+ defaultValue: '8px',
250
+ },
251
+ {
252
+ name: 'Radius lg',
253
+ variable: '--pos-radius-lg',
254
+ kind: 'length',
255
+ group: 'radius',
256
+ preview: 'radius',
257
+ defaultValue: '12px',
258
+ },
259
+ {
260
+ name: 'Radius pill',
261
+ variable: '--pos-radius-pill',
262
+ kind: 'length',
263
+ group: 'radius',
264
+ preview: 'radius',
265
+ defaultValue: '9999px',
266
+ },
267
+ {
268
+ name: 'Space xs',
269
+ variable: '--pos-space-xs',
270
+ kind: 'length',
271
+ group: 'space',
272
+ preview: 'space',
273
+ defaultValue: '4px',
274
+ },
275
+ {
276
+ name: 'Space sm',
277
+ variable: '--pos-space-sm',
278
+ kind: 'length',
279
+ group: 'space',
280
+ preview: 'space',
281
+ defaultValue: '8px',
282
+ },
283
+ {
284
+ name: 'Space md',
285
+ variable: '--pos-space-md',
286
+ kind: 'length',
287
+ group: 'space',
288
+ preview: 'space',
289
+ defaultValue: '12px',
290
+ },
291
+ {
292
+ name: 'Space lg',
293
+ variable: '--pos-space-lg',
294
+ kind: 'length',
295
+ group: 'space',
296
+ preview: 'space',
297
+ defaultValue: '16px',
298
+ },
299
+ {
300
+ name: 'Space xl',
301
+ variable: '--pos-space-xl',
302
+ kind: 'length',
303
+ group: 'space',
304
+ preview: 'space',
305
+ defaultValue: '24px',
306
+ },
307
+ {
308
+ name: 'Space 2xl',
309
+ variable: '--pos-space-2xl',
310
+ kind: 'length',
311
+ group: 'space',
312
+ preview: 'space',
313
+ defaultValue: '40px',
314
+ },
315
+ {
316
+ name: 'Space 3xl',
317
+ variable: '--pos-space-3xl',
318
+ kind: 'length',
319
+ group: 'space',
320
+ preview: 'space',
321
+ defaultValue: '56px',
322
+ },
323
+ {
324
+ name: 'Font family',
325
+ variable: '--pos-font-family',
326
+ kind: 'font-family',
327
+ group: 'type',
328
+ preview: 'font-family',
329
+ defaultValue:
330
+ "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif",
331
+ },
332
+ {
333
+ name: 'Font family display',
334
+ variable: '--pos-font-family-display',
335
+ kind: 'font-family',
336
+ group: 'type',
337
+ preview: 'font-family',
338
+ defaultValue:
339
+ "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif",
340
+ },
341
+ {
342
+ name: 'Font size sm',
343
+ variable: '--pos-font-size-sm',
344
+ kind: 'length',
345
+ group: 'type',
346
+ preview: 'font-size',
347
+ defaultValue: '0.8125rem',
348
+ },
349
+ {
350
+ name: 'Font size md',
351
+ variable: '--pos-font-size-md',
352
+ kind: 'length',
353
+ group: 'type',
354
+ preview: 'font-size',
355
+ defaultValue: '0.875rem',
356
+ },
357
+ {
358
+ name: 'Font size lg',
359
+ variable: '--pos-font-size-lg',
360
+ kind: 'length',
361
+ group: 'type',
362
+ preview: 'font-size',
363
+ defaultValue: '1.125rem',
364
+ },
365
+ {
366
+ name: 'Font size xl',
367
+ variable: '--pos-font-size-xl',
368
+ kind: 'length',
369
+ group: 'type',
370
+ preview: 'font-size',
371
+ defaultValue: '1.375rem',
372
+ },
373
+ {
374
+ name: 'Font weight semibold',
375
+ variable: '--pos-font-weight-semibold',
376
+ kind: 'font-weight',
377
+ group: 'type',
378
+ preview: 'font-weight',
379
+ defaultValue: '600',
380
+ },
381
+ {
382
+ name: 'Font weight bold',
383
+ variable: '--pos-font-weight-bold',
384
+ kind: 'font-weight',
385
+ group: 'type',
386
+ preview: 'font-weight',
387
+ defaultValue: '700',
388
+ },
389
+ {
390
+ name: 'Letter spacing display',
391
+ variable: '--pos-letter-spacing-display',
392
+ kind: 'length',
393
+ group: 'type',
394
+ preview: 'letter-spacing',
395
+ defaultValue: '0.28em',
396
+ },
397
+ {
398
+ name: 'Button min height',
399
+ variable: '--pos-button-min-height',
400
+ kind: 'length',
401
+ group: 'control',
402
+ preview: 'size',
403
+ defaultValue: '48px',
404
+ },
405
+ {
406
+ name: 'Keypad size',
407
+ variable: '--pos-keypad-size',
408
+ kind: 'length',
409
+ group: 'control',
410
+ preview: 'size',
411
+ defaultValue: '3.25rem',
412
+ },
413
+ {
414
+ name: 'Keypad size md',
415
+ variable: '--pos-keypad-size-md',
416
+ kind: 'length',
417
+ group: 'control',
418
+ preview: 'size',
419
+ defaultValue: '3.75rem',
420
+ },
421
+ {
422
+ name: 'Keypad size lg',
423
+ variable: '--pos-keypad-size-lg',
424
+ kind: 'length',
425
+ group: 'control',
426
+ preview: 'size',
427
+ defaultValue: '4.25rem',
428
+ },
429
+ ];
430
+
431
+ export const POS_TOKEN_DEFAULTS: Readonly<Record<string, string>> = Object.freeze(
432
+ Object.fromEntries(
433
+ POS_TOKEN_CATALOG.map((token) => [token.variable, token.defaultValue]),
434
+ ),
435
+ );
436
+
437
+ export const POS_TOKEN_BY_VARIABLE: ReadonlyMap<string, PosTokenDefinition> =
438
+ new Map(POS_TOKEN_CATALOG.map((token) => [token.variable, token]));
439
+
440
+ export const POS_TOKEN_SAMPLES: readonly PosTokenSample[] = [
441
+ {
442
+ id: 'primary',
443
+ label: 'Primary',
444
+ variables: [
445
+ '--pos-color-primary',
446
+ '--pos-color-on-primary',
447
+ '--pos-radius-md',
448
+ '--pos-button-min-height',
449
+ '--pos-font-weight-bold',
450
+ ],
451
+ },
452
+ {
453
+ id: 'success',
454
+ label: 'Success',
455
+ variables: [
456
+ '--pos-color-success',
457
+ '--pos-color-on-success',
458
+ '--pos-radius-md',
459
+ '--pos-button-min-height',
460
+ '--pos-font-weight-bold',
461
+ ],
462
+ },
463
+ {
464
+ id: 'danger',
465
+ label: 'Danger',
466
+ variables: [
467
+ '--pos-color-danger',
468
+ '--pos-color-on-danger',
469
+ '--pos-radius-md',
470
+ '--pos-button-min-height',
471
+ '--pos-font-weight-bold',
472
+ ],
473
+ },
474
+ {
475
+ id: 'disabled',
476
+ label: 'Disabled',
477
+ variables: [
478
+ '--pos-color-disabled',
479
+ '--pos-color-on-disabled',
480
+ '--pos-radius-md',
481
+ '--pos-button-min-height',
482
+ ],
483
+ },
484
+ {
485
+ id: 'text',
486
+ label: 'Body text',
487
+ variables: [
488
+ '--pos-color-text',
489
+ '--pos-color-text-muted',
490
+ '--pos-font-family',
491
+ '--pos-font-size-md',
492
+ ],
493
+ },
494
+ {
495
+ id: 'error',
496
+ label: 'Danger / error message',
497
+ variables: ['--pos-color-danger', '--pos-font-weight-semibold'],
498
+ },
499
+ ];
500
+
501
+ export function tokensInGroup(
502
+ group: PosTokenGroup,
503
+ ): readonly PosTokenDefinition[] {
504
+ return POS_TOKEN_CATALOG.filter((token) => token.group === group);
505
+ }
506
+
507
+ export function lookupPosTokens(
508
+ variables: readonly string[],
509
+ ): readonly PosTokenDefinition[] {
510
+ return variables.flatMap((variable) => {
511
+ const token = POS_TOKEN_BY_VARIABLE.get(variable);
512
+ return token ? [token] : [];
513
+ });
514
+ }