@xerios/design-system 0.1.1 → 0.1.3

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 (47) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/README.md +12 -8
  3. package/dist/components/Button.svelte +0 -7
  4. package/dist/components/Button.svelte.d.ts +1 -13
  5. package/dist/components/CollapsibleAdvanced.svelte +1 -1
  6. package/dist/components/Dialogs.svelte +12 -0
  7. package/dist/components/WorkingBorder.svelte +10 -8
  8. package/dist/components/empty/EmptyError.svelte +61 -12
  9. package/dist/components/empty/EmptyError.svelte.d.ts +2 -1
  10. package/dist/components/filters/FilterChip.svelte +2 -2
  11. package/dist/components/filters/OptionList.svelte +29 -13
  12. package/dist/components/filters/Panel.svelte +1 -1
  13. package/dist/components/icons.d.ts +3 -0
  14. package/dist/components/icons.js +3 -0
  15. package/dist/components/inputs/ButtonGroup.svelte +4 -1
  16. package/dist/components/inputs/Calendar.svelte +232 -172
  17. package/dist/components/inputs/Calendar.svelte.d.ts +2 -0
  18. package/dist/components/inputs/DateField.svelte +209 -92
  19. package/dist/components/inputs/DateField.svelte.d.ts +16 -10
  20. package/dist/components/inputs/DateInput.svelte +22 -9
  21. package/dist/components/inputs/DateInput.svelte.d.ts +3 -0
  22. package/dist/components/inputs/DatePicker.svelte +63 -38
  23. package/dist/components/inputs/DatePicker.svelte.d.ts +5 -2
  24. package/dist/components/inputs/DateRangePicker.svelte +69 -39
  25. package/dist/components/inputs/DateRangePicker.svelte.d.ts +5 -2
  26. package/dist/components/inputs/DateRangeSelect.svelte +26 -25
  27. package/dist/components/inputs/RadioGroup.svelte +3 -1
  28. package/dist/components/inputs/Segmented.svelte +4 -1
  29. package/dist/components/inputs/Select.svelte +18 -8
  30. package/dist/components/inputs/TextArea.svelte +1 -1
  31. package/dist/components/scroll/ScrollButton.svelte +260 -0
  32. package/dist/components/scroll/ScrollButton.svelte.d.ts +61 -0
  33. package/dist/components/scroll/ScrollMore.svelte +57 -0
  34. package/dist/components/scroll/ScrollMore.svelte.d.ts +28 -0
  35. package/dist/components/scroll/ScrollToTop.svelte +57 -0
  36. package/dist/components/scroll/ScrollToTop.svelte.d.ts +22 -0
  37. package/dist/css/atoms.css +13 -9
  38. package/dist/css/base.css +1 -2
  39. package/dist/css/effects.css +259 -16
  40. package/dist/css/tokens.css +99 -72
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.js +3 -0
  43. package/dist/lib/dates.d.ts +38 -5
  44. package/dist/lib/dates.js +88 -19
  45. package/dist/lib/edge-glow.d.ts +11 -0
  46. package/dist/lib/edge-glow.js +251 -0
  47. package/package.json +5 -3
@@ -2,7 +2,8 @@
2
2
  /**
3
3
  * A list to tick values in (several, or one with `multiple={false}`), drawn flat to sit inside a floating panel: the
4
4
  * value editor of a filter, the field list of FilterBar's add button, or any popover of your own. Each row has a check
5
- * box, an optional icon (in a tone's colour) and a muted hint on the right, such as how many items have that value.
5
+ * box (several) or, picking one, a solid brand fill on the picked row, an optional icon (in a tone's colour) and a
6
+ * muted hint on the right, such as how many items have that value.
6
7
  * The ticked values move to the top, above a rule, when the list opens; ticking while it is open leaves the rows where
7
8
  * they are, so the one under the pointer doesn't jump away.
8
9
  *
@@ -79,9 +80,6 @@
79
80
  const others = $derived(found.filter((o) => !pinned.has(o.value)))
80
81
  const shown = $derived([...top, ...others])
81
82
  const hasLead = $derived(!!lead || options.some((o) => o.icon))
82
- // A single list marks its pick with a tick; with nothing picked (a list of things to pick from, such as FilterBar's
83
- // fields), it has no tick column, so its rows don't start with an empty gap.
84
- const hasTick = $derived(multiple || options.some((o) => o.value === value))
85
83
  // The row holding the keyboard: back to the top whenever the search changes; on the picked one as a single list opens.
86
84
  let active = $derived.by(() => {
87
85
  void query
@@ -173,8 +171,6 @@
173
171
  >
174
172
  {#if multiple}
175
173
  <span class="box" aria-hidden="true"><Icon name="checkBold" size="sm" /></span>
176
- {:else if hasTick}
177
- <span class="tick" aria-hidden="true">{#if isOn(o.value)}<Icon name="check" size="sm" />{/if}</span>
178
174
  {/if}
179
175
  {#if hasLead}
180
176
  <span class="lead" data-tone={o.tone} aria-hidden="true">
@@ -186,7 +182,7 @@
186
182
  </li>
187
183
  {/snippet}
188
184
 
189
- <div class={['option-list', className]} {...rest}>
185
+ <div class={['option-list', !multiple && 'single', className]} {...rest}>
190
186
  {#if searchable}
191
187
  <ListSearch
192
188
  value={query}
@@ -204,7 +200,7 @@
204
200
  <ul
205
201
  id="{uid}-list"
206
202
  bind:this={list}
207
- class="list"
203
+ class={['list', !multiple && 'single']}
208
204
  role="listbox"
209
205
  aria-label={label}
210
206
  aria-multiselectable={multiple || undefined}
@@ -263,10 +259,30 @@
263
259
  .list:focus-visible .option.active {
264
260
  box-shadow: inset 0 0 0 2px var(--accent);
265
261
  }
262
+ /* Picking one, the picked row is solid brand (as Calendar's chosen day), its icon and hint in the same ink; with the
263
+ keyboard on it, a lighter brand line inside the edge keeps that visible. */
264
+ .single [aria-selected='true'],
265
+ .option-list.single:is(:focus-within, :hover) [aria-selected='true'].active {
266
+ background: var(--brand);
267
+ color: var(--accent-ink);
268
+ }
269
+ .single [aria-selected='true'] :is(.lead, .hint) {
270
+ color: inherit;
271
+ }
272
+ .single [aria-selected='true'] .hint {
273
+ opacity: 0.75;
274
+ }
275
+ .option-list.single:is(:focus-within, :hover) [aria-selected='true'].active {
276
+ box-shadow: inset 0 0 0 2px color-mix(in lch, var(--brand), var(--accent-ink) 45%);
277
+ }
278
+ .list.single:focus-visible [aria-selected='true'].active {
279
+ box-shadow:
280
+ inset 0 0 0 2px var(--accent),
281
+ inset 0 0 0 3px color-mix(in lch, var(--brand), var(--accent-ink) 45%);
282
+ }
266
283
  /* The check box (Tile's): hidden on rows that are neither ticked nor under the pointer or keyboard, so the column of
267
284
  empty boxes doesn't crowd the list; brand-filled with a tick once ticked. */
268
285
  .box,
269
- .tick,
270
286
  .lead {
271
287
  flex: none;
272
288
  width: 16px;
@@ -305,10 +321,6 @@
305
321
  opacity: 1;
306
322
  scale: 1;
307
323
  }
308
- .tick {
309
- display: inline-flex;
310
- color: var(--accent);
311
- }
312
324
  .lead {
313
325
  display: inline-flex;
314
326
  color: var(--muted);
@@ -348,5 +360,9 @@
348
360
  [aria-selected='true'] .box {
349
361
  background: Highlight;
350
362
  }
363
+ .single [aria-selected='true'] {
364
+ background: Highlight;
365
+ color: HighlightText;
366
+ }
351
367
  }
352
368
  </style>
@@ -41,7 +41,7 @@
41
41
  /** @param {PointerEvent} e */
42
42
  function outside(e) {
43
43
  const target = /** @type {Element} */ (e.target)
44
- if (panel?.contains(target) || anchor?.contains(target) || target.closest?.('.ctx-menu, .tooltip')) return
44
+ if (panel?.contains(target) || anchor?.contains(target) || target.closest?.('.ctx-menu, .tooltip, [data-floating]')) return
45
45
  onclose(false)
46
46
  }
47
47
 
@@ -17,6 +17,7 @@ declare const _default: {
17
17
  image: string;
18
18
  arrowLeft: string;
19
19
  arrowRight: string;
20
+ arrowUp: string;
20
21
  arrowDown: string;
21
22
  undo: string;
22
23
  plus: string;
@@ -40,6 +41,8 @@ declare const _default: {
40
41
  prohibit: string;
41
42
  checkBold: string;
42
43
  xBold: string;
44
+ arrowUpBold: string;
45
+ arrowDownBold: string;
43
46
  refresh: string;
44
47
  spinner: string;
45
48
  checkCircle: string;
@@ -21,6 +21,7 @@ export default {
21
21
  image: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm0,16V158.75l-26.07-26.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L40,149.37V56ZM40,172l52-52,80,80H40Zm176,28H194.63l-36-36,20-20L216,181.38V200ZM144,100a12,12,0,1,1,12,12A12,12,0,0,1,144,100Z"/></svg>',
22
22
  arrowLeft: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z"/></svg>',
23
23
  arrowRight: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"/></svg>',
24
+ arrowUp: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z"/></svg>',
24
25
  arrowDown: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z"/></svg>',
25
26
  undo: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"/></svg>',
26
27
  plus: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/></svg>',
@@ -44,6 +45,8 @@ export default {
44
45
  prohibit: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm88,104a87.56,87.56,0,0,1-20.41,56.28L71.72,60.4A88,88,0,0,1,216,128ZM40,128A87.56,87.56,0,0,1,60.41,71.72L184.28,195.6A88,88,0,0,1,40,128Z"/></svg>',
45
46
  checkBold: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"/></svg>',
46
47
  xBold: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/></svg>',
48
+ arrowUpBold: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z"/></svg>',
49
+ arrowDownBold: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z"/></svg>',
47
50
  refresh: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z"/></svg>',
48
51
  spinner: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M136,32V64a8,8,0,0,1-16,0V32a8,8,0,0,1,16,0Zm88,88H192a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16Zm-45.09,47.6a8,8,0,0,0-11.31,11.31l22.62,22.63a8,8,0,0,0,11.32-11.32ZM128,184a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V192A8,8,0,0,0,128,184ZM77.09,167.6,54.46,190.22a8,8,0,0,0,11.32,11.32L88.4,178.91A8,8,0,0,0,77.09,167.6ZM72,128a8,8,0,0,0-8-8H32a8,8,0,0,0,0,16H64A8,8,0,0,0,72,128ZM65.78,54.46A8,8,0,0,0,54.46,65.78L77.09,88.4A8,8,0,0,0,88.4,77.09Z"/></svg>',
49
52
  checkCircle: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"/></svg>',
@@ -63,7 +63,8 @@
63
63
  border: 0;
64
64
  border-radius: 0;
65
65
  background: none;
66
- color: var(--fg);
66
+ /* Unchosen options are dimmed until hovered; the chosen one is clear. */
67
+ color: var(--muted);
67
68
  font-size: 12px;
68
69
  line-height: 14px;
69
70
  font-weight: var(--w-medium);
@@ -89,8 +90,10 @@
89
90
  }
90
91
  button:not([aria-checked='true']):hover {
91
92
  background: var(--control-2);
93
+ color: var(--fg);
92
94
  }
93
95
  [aria-checked='true'] {
96
+ color: var(--fg);
94
97
  background: var(--control-4);
95
98
  box-shadow: var(--shadow-btn);
96
99
  }