@syware/jlib 0.12.1 → 0.14.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 (155) hide show
  1. package/dist/atoms/jl-avatar.css.js +1 -1
  2. package/dist/atoms/jl-avatar.js +1 -8
  3. package/dist/atoms/jl-button.css.js +1 -1
  4. package/dist/atoms/jl-button.js +4 -6
  5. package/dist/atoms/jl-checkbox.css.js +1 -1
  6. package/dist/atoms/jl-checkbox.js +8 -10
  7. package/dist/atoms/jl-chip.css.js +1 -1
  8. package/dist/atoms/jl-chip.js +3 -11
  9. package/dist/atoms/jl-divider.css.js +1 -1
  10. package/dist/atoms/jl-divider.js +1 -5
  11. package/dist/atoms/jl-icon.css.js +1 -1
  12. package/dist/atoms/jl-icon.d.ts +2 -0
  13. package/dist/atoms/jl-icon.js +5 -1
  14. package/dist/atoms/jl-input.d.ts +7 -2
  15. package/dist/atoms/jl-input.js +36 -31
  16. package/dist/atoms/jl-link.css.js +1 -1
  17. package/dist/atoms/jl-link.js +3 -6
  18. package/dist/atoms/jl-progress-ring.js +3 -2
  19. package/dist/atoms/jl-progress.js +3 -2
  20. package/dist/atoms/jl-rating.css.js +1 -1
  21. package/dist/atoms/jl-rating.d.ts +2 -2
  22. package/dist/atoms/jl-rating.js +17 -35
  23. package/dist/atoms/jl-select.d.ts +8 -3
  24. package/dist/atoms/jl-select.js +26 -13
  25. package/dist/atoms/jl-skeleton.d.ts +1 -0
  26. package/dist/atoms/jl-skeleton.js +4 -1
  27. package/dist/atoms/jl-slider.d.ts +4 -0
  28. package/dist/atoms/jl-slider.js +29 -15
  29. package/dist/atoms/jl-switch.css.js +1 -1
  30. package/dist/atoms/jl-switch.js +2 -8
  31. package/dist/atoms/jl-textarea.css.js +1 -1
  32. package/dist/atoms/jl-textarea.d.ts +4 -5
  33. package/dist/atoms/jl-textarea.js +15 -30
  34. package/dist/index.d.ts +1 -1
  35. package/dist/lib/calendar.js +3 -2
  36. package/dist/lib/floating.d.ts +10 -0
  37. package/dist/lib/floating.js +27 -8
  38. package/dist/lib/flow.d.ts +7 -3
  39. package/dist/lib/flow.js +19 -8
  40. package/dist/lib/hotkey.d.ts +13 -0
  41. package/dist/lib/hotkey.js +2 -1
  42. package/dist/lib/indicator.d.ts +16 -0
  43. package/dist/lib/indicator.js +32 -6
  44. package/dist/lib/intl.d.ts +6 -0
  45. package/dist/lib/intl.js +19 -0
  46. package/dist/lib/key-shortcut.js +11 -29
  47. package/dist/lib/palette.js +1 -6
  48. package/dist/lib/progress.d.ts +0 -5
  49. package/dist/lib/progress.js +1 -9
  50. package/dist/lib/roving.d.ts +6 -0
  51. package/dist/lib/roving.js +14 -1
  52. package/dist/lib/table.d.ts +14 -2
  53. package/dist/lib/table.js +50 -39
  54. package/dist/molecules/jl-accordion-item.css.js +1 -1
  55. package/dist/molecules/jl-accordion-item.js +1 -5
  56. package/dist/molecules/jl-account-button.css.js +1 -1
  57. package/dist/molecules/jl-account-button.js +1 -5
  58. package/dist/molecules/jl-alert.css.js +1 -1
  59. package/dist/molecules/jl-alert.d.ts +5 -5
  60. package/dist/molecules/jl-alert.js +4 -13
  61. package/dist/molecules/jl-avatar-group.d.ts +7 -5
  62. package/dist/molecules/jl-avatar-group.js +15 -5
  63. package/dist/molecules/jl-breadcrumb.d.ts +7 -4
  64. package/dist/molecules/jl-breadcrumb.js +32 -8
  65. package/dist/molecules/jl-calendar.d.ts +12 -3
  66. package/dist/molecules/jl-calendar.js +79 -48
  67. package/dist/molecules/jl-card.css.js +1 -1
  68. package/dist/molecules/jl-card.js +2 -8
  69. package/dist/molecules/jl-chip-group.css.js +1 -1
  70. package/dist/molecules/jl-chip-group.d.ts +6 -2
  71. package/dist/molecules/jl-chip-group.js +14 -19
  72. package/dist/molecules/jl-code-block.css.js +1 -1
  73. package/dist/molecules/jl-code-block.d.ts +7 -5
  74. package/dist/molecules/jl-code-block.js +19 -22
  75. package/dist/molecules/jl-combobox.css.js +1 -1
  76. package/dist/molecules/jl-combobox.d.ts +4 -0
  77. package/dist/molecules/jl-combobox.js +33 -19
  78. package/dist/molecules/jl-date-picker.d.ts +6 -0
  79. package/dist/molecules/jl-date-picker.js +29 -9
  80. package/dist/molecules/jl-empty.css.js +1 -1
  81. package/dist/molecules/jl-empty.js +4 -19
  82. package/dist/molecules/jl-field.css.js +1 -1
  83. package/dist/molecules/jl-field.d.ts +7 -1
  84. package/dist/molecules/jl-field.js +35 -23
  85. package/dist/molecules/jl-file-drop.css.js +1 -1
  86. package/dist/molecules/jl-file-drop.js +1 -3
  87. package/dist/molecules/jl-input-list.css.js +1 -1
  88. package/dist/molecules/jl-input-list.d.ts +12 -1
  89. package/dist/molecules/jl-input-list.js +81 -51
  90. package/dist/molecules/jl-list-item.css.js +1 -1
  91. package/dist/molecules/jl-list-item.d.ts +3 -1
  92. package/dist/molecules/jl-list-item.js +26 -27
  93. package/dist/molecules/jl-load-state.css.js +1 -1
  94. package/dist/molecules/jl-load-state.d.ts +6 -1
  95. package/dist/molecules/jl-load-state.js +15 -18
  96. package/dist/molecules/jl-menu.d.ts +1 -0
  97. package/dist/molecules/jl-menu.js +9 -2
  98. package/dist/molecules/jl-pagination.css.js +1 -1
  99. package/dist/molecules/jl-pagination.d.ts +7 -1
  100. package/dist/molecules/jl-pagination.js +43 -35
  101. package/dist/molecules/jl-radio-group.js +1 -1
  102. package/dist/molecules/jl-search.css.js +1 -1
  103. package/dist/molecules/jl-search.js +4 -12
  104. package/dist/molecules/jl-segmented.css.js +1 -1
  105. package/dist/molecules/jl-segmented.d.ts +4 -2
  106. package/dist/molecules/jl-segmented.js +19 -26
  107. package/dist/molecules/jl-stat.css.js +1 -1
  108. package/dist/molecules/jl-stat.js +2 -8
  109. package/dist/molecules/jl-steps.d.ts +10 -3
  110. package/dist/molecules/jl-steps.js +82 -49
  111. package/dist/molecules/jl-tabs.d.ts +5 -2
  112. package/dist/molecules/jl-tabs.js +31 -25
  113. package/dist/molecules/jl-tag-input.css.js +1 -1
  114. package/dist/molecules/jl-tag-input.d.ts +13 -1
  115. package/dist/molecules/jl-tag-input.js +57 -30
  116. package/dist/molecules/jl-timeline.css.js +1 -1
  117. package/dist/molecules/jl-timeline.d.ts +3 -1
  118. package/dist/molecules/jl-timeline.js +9 -14
  119. package/dist/molecules/jl-toast.css.js +1 -1
  120. package/dist/molecules/jl-toast.js +4 -12
  121. package/dist/molecules/jl-tooltip.d.ts +2 -1
  122. package/dist/molecules/jl-tooltip.js +11 -15
  123. package/dist/organisms/jl-command-palette.css.js +1 -1
  124. package/dist/organisms/jl-command-palette.d.ts +8 -1
  125. package/dist/organisms/jl-command-palette.js +74 -43
  126. package/dist/organisms/jl-confirm.css.js +1 -1
  127. package/dist/organisms/jl-confirm.js +1 -5
  128. package/dist/organisms/jl-dialog.css.js +1 -1
  129. package/dist/organisms/jl-dialog.js +1 -5
  130. package/dist/organisms/jl-drawer.css.js +1 -1
  131. package/dist/organisms/jl-drawer.js +1 -3
  132. package/dist/organisms/jl-flow.d.ts +18 -2
  133. package/dist/organisms/jl-flow.js +128 -44
  134. package/dist/organisms/jl-navbar.css.js +1 -1
  135. package/dist/organisms/jl-navbar.d.ts +1 -1
  136. package/dist/organisms/jl-navbar.js +3 -5
  137. package/dist/organisms/jl-page-header.css.js +1 -1
  138. package/dist/organisms/jl-page-header.js +1 -5
  139. package/dist/organisms/jl-page-outlet.d.ts +4 -3
  140. package/dist/organisms/jl-page-outlet.js +7 -8
  141. package/dist/organisms/jl-side-nav.css.js +1 -1
  142. package/dist/organisms/jl-side-nav.d.ts +9 -2
  143. package/dist/organisms/jl-side-nav.js +44 -16
  144. package/dist/organisms/jl-tab-bar.css.js +1 -1
  145. package/dist/organisms/jl-tab-bar.js +0 -2
  146. package/dist/organisms/jl-table.css.js +1 -1
  147. package/dist/organisms/jl-table.d.ts +19 -7
  148. package/dist/organisms/jl-table.js +97 -59
  149. package/dist/organisms/jl-tree.css.js +1 -1
  150. package/dist/organisms/jl-tree.d.ts +16 -13
  151. package/dist/organisms/jl-tree.js +72 -70
  152. package/package.json +4 -2
  153. package/dist/lib/roving-index.d.ts +0 -10
  154. package/dist/lib/roving-index.js +0 -32
  155. /package/dist/types/{roving-index.types.d.ts → roving.types.d.ts} +0 -0
@@ -10,6 +10,11 @@ export declare class JlAlert extends JlElement {
10
10
  readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
11
11
  dismiss: undefined;
12
12
  }>>;
13
+ /** An icon name in place of the tone's own; `none` shows no icon. */
14
+ readonly icon: Readonly<Readonly<{
15
+ get(): string;
16
+ set(setter: string | ((prevState: string) => string)): void;
17
+ }>>;
13
18
  readonly tone: Readonly<Readonly<{
14
19
  get(): Tone;
15
20
  set(setter: ((prevState: Tone) => Tone) | Tone): void;
@@ -23,11 +28,6 @@ export declare class JlAlert extends JlElement {
23
28
  get(): string;
24
29
  set(setter: string | ((prevState: string) => string)): void;
25
30
  }>>;
26
- /** An icon name in place of the tone's own; `none` shows no icon. */
27
- readonly icon: Readonly<Readonly<{
28
- get(): string;
29
- set(setter: string | ((prevState: string) => string)): void;
30
- }>>;
31
31
  /** Shows an × that hides the alert and fires `dismiss`. */
32
32
  readonly dismissible: Readonly<Readonly<{
33
33
  get(): boolean;
@@ -39,6 +39,8 @@ var TONE_ROLES = {
39
39
  var JlAlert = class extends JlElement {
40
40
  static selector = "jl-alert";
41
41
  events = this.useEvents();
42
+ /** An icon name in place of the tone's own; `none` shows no icon. */
43
+ icon = this.useChange("", () => this.renderIcon(), { attribute: "icon" });
42
44
  tone = this.useChange("info", (value) => {
43
45
  this.reflect("tone", value);
44
46
  this._refs.alert.setAttribute("role", TONE_ROLES[value]);
@@ -49,15 +51,11 @@ var JlAlert = class extends JlElement {
49
51
  });
50
52
  heading = this.useChange("", (value) => {
51
53
  this._refs.heading.textContent = value;
52
- this._refs.heading.hidden = value === "";
53
54
  }, { attribute: "heading" });
54
55
  /** The message as plain text, for pages that set it from code; richer content goes in the default slot. */
55
56
  description = this.useChange("", (value) => {
56
57
  this._refs.description.textContent = value;
57
- this._refs.description.hidden = value === "";
58
58
  }, { attribute: "description" });
59
- /** An icon name in place of the tone's own; `none` shows no icon. */
60
- icon = this.useChange("", () => this.renderIcon(), { attribute: "icon" });
61
59
  /** Shows an × that hides the alert and fires `dismiss`. */
62
60
  dismissible = this.useChange(false, (value) => {
63
61
  this._refs.close.hidden = !value;
@@ -92,14 +90,8 @@ var JlAlert = class extends JlElement {
92
90
  /* @__PURE__ */ jsxs("div", {
93
91
  class: "content",
94
92
  children: [
95
- /* @__PURE__ */ jsx("p", {
96
- class: "heading",
97
- hidden: true
98
- }),
99
- /* @__PURE__ */ jsx("p", {
100
- class: "description",
101
- hidden: true
102
- }),
93
+ /* @__PURE__ */ jsx("p", { class: "heading" }),
94
+ /* @__PURE__ */ jsx("p", { class: "description" }),
103
95
  /* @__PURE__ */ jsx("div", {
104
96
  class: "text",
105
97
  hidden: true,
@@ -145,7 +137,6 @@ var JlAlert = class extends JlElement {
145
137
  const name = own === "" ? TONE_ICONS[this.tone.get()] : own;
146
138
  this._refs.icon.name.set(name === NO_ICON ? "" : name);
147
139
  this._refs.icon.filled.set(own === "" && TONE_ICON_FILLED[this.tone.get()]);
148
- this._refs.icon.hidden = name === NO_ICON;
149
140
  this.reflect("has-icon", name !== NO_ICON);
150
141
  }
151
142
  };
@@ -6,20 +6,22 @@ import type { AvatarItem, AvatarSize } from '../types/jl-avatar.types';
6
6
  */
7
7
  export declare class JlAvatarGroup extends JlElement {
8
8
  static readonly selector = "jl-avatar-group";
9
- /** The people, in order: `[{ "name": "Ada Lovelace", "src": "/ada.jpg" }]`. */
10
- readonly items: Readonly<Readonly<{
11
- get(): AvatarItem[];
12
- set(setter: AvatarItem[] | ((prevState: AvatarItem[]) => AvatarItem[])): void;
13
- }>>;
14
9
  /** How many avatars show before the count; 0 shows them all. */
15
10
  readonly max: Readonly<Readonly<{
16
11
  get(): number;
17
12
  set(setter: number | ((prevState: number) => number)): void;
18
13
  }>>;
14
+ /** The people, in order: `[{ "name": "Ada Lovelace", "src": "/ada.jpg" }]`. */
15
+ readonly items: Readonly<Readonly<{
16
+ get(): AvatarItem[];
17
+ set(setter: AvatarItem[] | ((prevState: AvatarItem[]) => AvatarItem[])): void;
18
+ }>>;
19
19
  readonly size: Readonly<Readonly<{
20
20
  get(): AvatarSize;
21
21
  set(setter: ((prevState: AvatarSize) => AvatarSize) | AvatarSize): void;
22
22
  }>>;
23
+ /** What the avatars were made from: the inputs call back with what they hold as the group connects. */
24
+ private readonly _drawn;
23
25
  private readonly _refs;
24
26
  templateHtml(): Node;
25
27
  templateCss(): string;
@@ -14,20 +14,25 @@ var NAME_SEPARATOR = ", ";
14
14
  */
15
15
  var JlAvatarGroup = class extends JlElement {
16
16
  static selector = "jl-avatar-group";
17
+ /** How many avatars show before the count; 0 shows them all. */
18
+ max = this.useChange(0, () => this.render(), { attribute: "max" });
17
19
  /** The people, in order: `[{ "name": "Ada Lovelace", "src": "/ada.jpg" }]`. */
18
20
  items = this.useChange([], () => this.render(), {
19
21
  attribute: "items",
20
22
  parse: jsonOf([])
21
23
  });
22
- /** How many avatars show before the count; 0 shows them all. */
23
- max = this.useChange(0, () => this.render(), { attribute: "max" });
24
24
  size = this.useChange("md", (value) => {
25
25
  this.reflect("size", value);
26
- this.render();
26
+ for (const avatar of this._refs.group.querySelectorAll(JlAvatar.selector)) avatar.size.set(value);
27
27
  }, {
28
28
  attribute: "size",
29
29
  parse: oneOf(AVATAR_SIZES, "md")
30
30
  });
31
+ /** What the avatars were made from: the inputs call back with what they hold as the group connects. */
32
+ _drawn = {
33
+ items: null,
34
+ max: 0
35
+ };
31
36
  _refs = this.useRefs((ref) => ({ group: ref(".group") }));
32
37
  templateHtml() {
33
38
  return /* @__PURE__ */ jsx("div", {
@@ -40,8 +45,13 @@ var JlAvatarGroup = class extends JlElement {
40
45
  return css`${BASE_STYLES}${jl_avatar_group_default}`;
41
46
  }
42
47
  render() {
43
- const items = this.items.get().filter((item) => typeof item?.name === "string");
44
- const { shown, hidden } = splitVisible(items, this.max.get());
48
+ const all = this.items.get();
49
+ const max = this.max.get();
50
+ if (all === this._drawn.items && max === this._drawn.max) return;
51
+ this._drawn.items = all;
52
+ this._drawn.max = max;
53
+ const items = all.filter((item) => typeof item?.name === "string");
54
+ const { shown, hidden } = splitVisible(items, max);
45
55
  const size = this.size.get();
46
56
  const avatars = shown.map((item) => /* @__PURE__ */ jsx(JlAvatar, {
47
57
  name: item.name,
@@ -10,20 +10,21 @@ export declare class JlBreadcrumb<Id extends string = string> extends JlElement
10
10
  readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
11
11
  select: Id;
12
12
  }>>;
13
- readonly items: Readonly<Readonly<{
14
- get(): BreadcrumbItem<Id>[];
15
- set(setter: BreadcrumbItem<Id>[] | ((prevState: BreadcrumbItem<Id>[]) => BreadcrumbItem<Id>[])): void;
16
- }>>;
17
13
  /** The most items shown before the middle folds; 0 never folds. */
18
14
  readonly max: Readonly<Readonly<{
19
15
  get(): number;
20
16
  set(setter: number | ((prevState: number) => number)): void;
21
17
  }>>;
18
+ readonly items: Readonly<Readonly<{
19
+ get(): BreadcrumbItem<Id>[];
20
+ set(setter: BreadcrumbItem<Id>[] | ((prevState: BreadcrumbItem<Id>[]) => BreadcrumbItem<Id>[])): void;
21
+ }>>;
22
22
  /** The trail's name for screen readers. */
23
23
  readonly label: Readonly<Readonly<{
24
24
  get(): string;
25
25
  set(setter: string | ((prevState: string) => string)): void;
26
26
  }>>;
27
+ /** `drawn` is what the trail was made from: the inputs call back with what they hold as the trail connects. */
27
28
  private readonly _state;
28
29
  private readonly _refs;
29
30
  templateHtml(): Node;
@@ -34,6 +35,8 @@ export declare class JlBreadcrumb<Id extends string = string> extends JlElement
34
35
  /** A new trail starts folded. */
35
36
  private renderTrail;
36
37
  private render;
38
+ /** The folding button says how many items it holds, in jlib's language. */
39
+ private renderMoreLabel;
37
40
  /** An item the app follows, found among the items by the id its button carries. */
38
41
  private follow;
39
42
  private crumb;
@@ -38,15 +38,23 @@ function visibleCrumbs(items, max, expanded) {
38
38
  var JlBreadcrumb = class extends JlElement {
39
39
  static selector = "jl-breadcrumb";
40
40
  events = this.useEvents();
41
+ /** The most items shown before the middle folds; 0 never folds. */
42
+ max = this.useChange(0, () => this.render(), { attribute: "max" });
41
43
  items = this.useChange([], () => this.renderTrail(), {
42
44
  attribute: "items",
43
45
  parse: jsonOf([])
44
46
  });
45
- /** The most items shown before the middle folds; 0 never folds. */
46
- max = this.useChange(0, () => this.render(), { attribute: "max" });
47
47
  /** The trail's name for screen readers. */
48
48
  label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
49
- _state = { expanded: false };
49
+ /** `drawn` is what the trail was made from: the inputs call back with what they hold as the trail connects. */
50
+ _state = {
51
+ drawn: {
52
+ expanded: false,
53
+ items: null,
54
+ max: 0
55
+ },
56
+ expanded: false
57
+ };
50
58
  _refs = this.useRefs((ref) => ({
51
59
  list: ref("ol"),
52
60
  nav: ref("nav")
@@ -72,7 +80,7 @@ var JlBreadcrumb = class extends JlElement {
72
80
  }
73
81
  drawTexts() {
74
82
  this.renderLabel();
75
- this.render();
83
+ this.renderMoreLabel();
76
84
  }
77
85
  renderLabel() {
78
86
  this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("breadcrumb"));
@@ -84,13 +92,31 @@ var JlBreadcrumb = class extends JlElement {
84
92
  }
85
93
  render() {
86
94
  const items = this.items.get();
87
- const crumbs = visibleCrumbs(items, this.max.get(), this._state.expanded);
95
+ const max = this.max.get();
96
+ const expanded = this._state.expanded;
97
+ const drawn = this._state.drawn;
98
+ if (items === drawn.items && max === drawn.max && expanded === drawn.expanded) return;
99
+ this._state.drawn = {
100
+ expanded,
101
+ items,
102
+ max
103
+ };
104
+ const crumbs = visibleCrumbs(items, max, expanded);
88
105
  const lastIndex = items.length - 1;
89
106
  this._refs.list.replaceChildren(...crumbs.map((crumb, position) => /* @__PURE__ */ jsxs("li", { children: [position > 0 ? /* @__PURE__ */ jsx(JlIcon, {
90
107
  class: "separator",
91
108
  name: "chevron-right",
92
109
  size: SEPARATOR_SIZE
93
110
  }) : "", "hidden" in crumb ? this.moreButton(crumb.hidden) : this.crumb(crumb.item, crumb.index === lastIndex)] })));
111
+ this.renderMoreLabel();
112
+ }
113
+ /** The folding button says how many items it holds, in jlib's language. */
114
+ renderMoreLabel() {
115
+ const more = this._refs.list.querySelector(".more");
116
+ if (more === null) return;
117
+ const label = jlText("showMoreCount", { count: Number(more.dataset.count) });
118
+ more.setAttribute("aria-label", label);
119
+ more.title = label;
94
120
  }
95
121
  /** An item the app follows, found among the items by the id its button carries. */
96
122
  follow(id) {
@@ -129,12 +155,10 @@ var JlBreadcrumb = class extends JlElement {
129
155
  });
130
156
  }
131
157
  moreButton(hidden) {
132
- const label = jlText("showMoreCount", { count: hidden });
133
158
  return /* @__PURE__ */ jsx("button", {
134
159
  type: "button",
135
160
  class: "more",
136
- "aria-label": label,
137
- title: label,
161
+ "data-count": String(hidden),
138
162
  children: /* @__PURE__ */ jsx(JlIcon, {
139
163
  name: "ellipsis",
140
164
  size: ICON_SIZE
@@ -61,7 +61,11 @@ export declare class JlCalendar extends JlFormControl {
61
61
  set(setter: ((prevState: ControlSize) => ControlSize) | ControlSize): void;
62
62
  }>>;
63
63
  private readonly _titleId;
64
- /** The month shown, and the day the arrows move from (the one focusable cell of the grid). */
64
+ /**
65
+ * The month shown, the day the arrows move from (the one focusable cell of the grid), and the dates the cells show.
66
+ * `drawn` holds what the cells and the weekdays were written for: every input calls back as the calendar connects,
67
+ * and choosing a day changes only two cells.
68
+ */
65
69
  private readonly _state;
66
70
  private readonly _refs;
67
71
  /** Focuses the day the arrows move from: the chosen one, or today, or the first of the month. */
@@ -92,9 +96,14 @@ export declare class JlCalendar extends JlFormControl {
92
96
  /** The title is a live region: written only when the month changes, so it is announced once. */
93
97
  private renderTitle;
94
98
  private renderWeekdays;
99
+ /** Writes the page's dates in the cells: only for another month, language, first day, or today. */
100
+ private renderDays;
101
+ private writeDay;
102
+ /** The chosen day, the days out of bounds, and the one in the tab order (the arrows reach the others). */
103
+ private renderStates;
104
+ private forEachDay;
105
+ /** A day of the grid, made once: the page's dates are written in it. */
95
106
  private dayCell;
96
- /** Only the remembered day is in the tab order: the arrows reach the others. */
97
- private renderFocus;
98
107
  /** The arrows of the header stop where no day of the next month could be chosen. */
99
108
  private renderNavigation;
100
109
  private renderValidity;
@@ -21,10 +21,16 @@ var NAV_ICON_SIZE = 16;
21
21
  var MONDAY = 1;
22
22
  var SUNDAY = 0;
23
23
  var SATURDAY = 6;
24
+ var DAYS_PER_WEEK = 7;
24
25
  var SELECT_KEYS = ["Enter", " "];
25
26
  var FULL_DATE = { dateStyle: "full" };
26
27
  /** The first day of the week from its attribute: 0 (Sunday) to 6 (Saturday), Monday when absent. */
27
28
  var parseWeekday = (value) => Math.round(clampedNumber(MONDAY, SUNDAY, SATURDAY)(value));
29
+ /** Writes an attribute only when it changes: the same value written again is still a change, styles checked again. */
30
+ function setAttributeIfChanged(element, name, value) {
31
+ if (element.getAttribute(name) === value) return;
32
+ value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
33
+ }
28
34
  /**
29
35
  * A month to pick a day from. Arrows move by day and week, Page Up and Page Down by month (by year with Shift),
30
36
  * Home and End to the ends of the week, Enter chooses. Month and weekday names follow the `locale`; days outside
@@ -58,10 +64,19 @@ var JlCalendar = class extends JlFormControl {
58
64
  parse: oneOf(CONTROL_SIZES, "md")
59
65
  });
60
66
  _titleId = uniqueId("jl-calendar-title");
61
- /** The month shown, and the day the arrows move from (the one focusable cell of the grid). */
67
+ /**
68
+ * The month shown, the day the arrows move from (the one focusable cell of the grid), and the dates the cells show.
69
+ * `drawn` holds what the cells and the weekdays were written for: every input calls back as the calendar connects,
70
+ * and choosing a day changes only two cells.
71
+ */
62
72
  _state = {
73
+ drawn: {
74
+ days: "",
75
+ weekdays: ""
76
+ },
63
77
  focus: null,
64
78
  formDisabled: false,
79
+ page: [],
65
80
  view: calendarDateOf(/* @__PURE__ */ new Date())
66
81
  };
67
82
  _refs = this.useRefs((ref) => ({
@@ -116,7 +131,7 @@ var JlCalendar = class extends JlFormControl {
116
131
  ] }), /* @__PURE__ */ jsxs("table", {
117
132
  role: "grid",
118
133
  "aria-labelledby": this._titleId,
119
- children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", {}) }), /* @__PURE__ */ jsx("tbody", {})]
134
+ children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: Array.from({ length: DAYS_PER_WEEK }, () => /* @__PURE__ */ jsx("th", { scope: "col" })) }) }), /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: 6 }, () => /* @__PURE__ */ jsx("tr", { children: Array.from({ length: DAYS_PER_WEEK }, () => this.dayCell()) })) })]
120
135
  })]
121
136
  });
122
137
  }
@@ -171,12 +186,9 @@ var JlCalendar = class extends JlFormControl {
171
186
  }
172
187
  /** Moves the focus to a day, turning the page when it is in another month. */
173
188
  moveFocus(date) {
174
- const turn = !isSameMonth(date, this._state.view);
175
189
  this._state.focus = date;
176
- if (turn) {
177
- this._state.view = date;
178
- this.renderPage();
179
- } else this.renderFocus();
190
+ this._state.view = date;
191
+ this.renderPage();
180
192
  this.focus();
181
193
  }
182
194
  turnPage(months) {
@@ -229,22 +241,11 @@ var JlCalendar = class extends JlFormControl {
229
241
  renderPage() {
230
242
  const { min, max } = this.bounds();
231
243
  this._state.view = this.viewWithin(min, max);
232
- const { year, month } = this._state.view;
244
+ this._state.focus = this.rovingDate(min, max);
233
245
  const locale = pageLocale(this.locale.get());
234
- const firstDay = this.firstDay.get();
235
- const context = {
236
- focus: this.rovingDate(min, max),
237
- label: dateFormatter(locale, FULL_DATE),
238
- max,
239
- min,
240
- month,
241
- selected: parseIsoDate(this.value.get()),
242
- today: calendarDateOf(/* @__PURE__ */ new Date())
243
- };
244
- this._state.focus = context.focus;
245
- this.renderTitle(formatMonthTitle(year, month, locale));
246
- this.renderWeekdays(locale, firstDay);
247
- this._refs.days.replaceChildren(...monthGrid(year, month, firstDay).map((week) => /* @__PURE__ */ jsx("tr", { children: week.map((date) => this.dayCell(date, context)) })));
246
+ this.renderWeekdays(locale, this.firstDay.get());
247
+ this.renderDays(locale);
248
+ this.renderStates(min, max);
248
249
  this.renderNavigation(min, max);
249
250
  }
250
251
  /** The title is a live region: written only when the month changes, so it is announced once. */
@@ -253,38 +254,68 @@ var JlCalendar = class extends JlFormControl {
253
254
  if (title.textContent !== text) title.textContent = text;
254
255
  }
255
256
  renderWeekdays(locale, firstDay) {
256
- const short = weekdayNames(locale, firstDay, "short");
257
+ const drawn = `${locale}|${firstDay}`;
258
+ if (drawn === this._state.drawn.weekdays) return;
259
+ this._state.drawn.weekdays = drawn;
257
260
  const long = weekdayNames(locale, firstDay, "long");
258
- this._refs.weekdays.replaceChildren(...short.map((name, index) => /* @__PURE__ */ jsx("th", {
259
- scope: "col",
260
- abbr: long[index] ?? name,
261
- children: name
262
- })));
261
+ const headers = this._refs.weekdays.querySelectorAll("th");
262
+ weekdayNames(locale, firstDay, "short").forEach((name, index) => {
263
+ const header = headers.item(index);
264
+ header.textContent = name;
265
+ header.abbr = long[index] ?? name;
266
+ });
267
+ }
268
+ /** Writes the page's dates in the cells: only for another month, language, first day, or today. */
269
+ renderDays(locale) {
270
+ const { year, month } = this._state.view;
271
+ const firstDay = this.firstDay.get();
272
+ const today = calendarDateOf(/* @__PURE__ */ new Date());
273
+ const drawn = `${locale}|${firstDay}|${year}-${month}|${toIsoDate(today)}`;
274
+ if (drawn === this._state.drawn.days) return;
275
+ this._state.drawn.days = drawn;
276
+ this._state.page = monthGrid(year, month, firstDay).flat();
277
+ this.renderTitle(formatMonthTitle(year, month, locale));
278
+ const context = {
279
+ label: dateFormatter(locale, FULL_DATE),
280
+ month,
281
+ today
282
+ };
283
+ this.forEachDay((cell, date) => this.writeDay(cell, date, context));
284
+ }
285
+ writeDay(cell, date, context) {
286
+ cell.dataset.date = toIsoDate(date);
287
+ cell.setAttribute("aria-label", context.label(date));
288
+ cell.classList.toggle("outside", date.month !== context.month);
289
+ setAttributeIfChanged(cell, "aria-current", isSameDate(date, context.today) ? "date" : null);
290
+ const number = cell.firstElementChild;
291
+ if (number !== null) number.textContent = String(date.day);
263
292
  }
264
- dayCell(date, context) {
265
- const outside = date.month !== context.month;
266
- const enabled = isWithin(date, context.min, context.max);
293
+ /** The chosen day, the days out of bounds, and the one in the tab order (the arrows reach the others). */
294
+ renderStates(min, max) {
295
+ const selected = parseIsoDate(this.value.get());
296
+ const focus = this.isOff() ? null : this._state.focus;
297
+ this.forEachDay((cell, date) => {
298
+ setAttributeIfChanged(cell, "aria-selected", String(isSameDate(date, selected)));
299
+ setAttributeIfChanged(cell, "aria-disabled", isWithin(date, min, max) ? null : "true");
300
+ setAttributeIfChanged(cell, "tabindex", isSameDate(date, focus) ? "0" : "-1");
301
+ });
302
+ }
303
+ forEachDay(write) {
304
+ const cells = this._refs.days.querySelectorAll("td");
305
+ this._state.page.forEach((date, index) => {
306
+ write(cells.item(index), date);
307
+ });
308
+ }
309
+ /** A day of the grid, made once: the page's dates are written in it. */
310
+ dayCell() {
267
311
  return /* @__PURE__ */ jsx("td", {
268
- class: outside ? "day outside" : "day",
312
+ class: "day",
269
313
  role: "gridcell",
270
- tabIndex: isSameDate(date, context.focus) && !this.isOff() ? 0 : -1,
271
- "data-date": toIsoDate(date),
272
- "aria-label": context.label(date),
273
- "aria-selected": String(isSameDate(date, context.selected)),
274
- "aria-disabled": enabled ? void 0 : "true",
275
- "aria-current": isSameDate(date, context.today) ? "date" : void 0,
276
- children: /* @__PURE__ */ jsx("span", {
277
- class: "number",
278
- children: String(date.day)
279
- })
314
+ tabIndex: -1,
315
+ "aria-selected": "false",
316
+ children: /* @__PURE__ */ jsx("span", { class: "number" })
280
317
  });
281
318
  }
282
- /** Only the remembered day is in the tab order: the arrows reach the others. */
283
- renderFocus() {
284
- const focus = this._state.focus;
285
- const iso = focus === null ? "" : toIsoDate(focus);
286
- for (const cell of this._refs.days.querySelectorAll("[data-date]")) cell.tabIndex = cell.dataset.date === iso && !this.isOff() ? 0 : -1;
287
- }
288
319
  /** The arrows of the header stop where no day of the next month could be chosen. */
289
320
  renderNavigation(min, max) {
290
321
  const view = this._state.view;
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-card.css?inline
2
- var jl_card_default = ":host{--pad:20px;--edge:20px;--gap:12px;--radius:var(--jl-radius-lg);display:block}:host([padding=none]){--pad:0px;--edge:16px}:host([padding=sm]){--pad:12px;--edge:12px;--gap:8px}:host([padding=lg]){--pad:28px;--edge:28px;--gap:16px}.card{border:1px solid var(--jl-line);border-radius:var(--radius);background:var(--jl-surface);height:100%;color:var(--jl-text);font-size:var(--jl-font-md);transition:border-color var(--jl-fast) var(--jl-ease);flex-direction:column;line-height:1.55;display:flex;position:relative;overflow:hidden}:host([clickable]) .card{cursor:pointer}:host([clickable]) .card:hover{border-color:var(--jl-accent-line)}.link{z-index:1;border-radius:inherit;position:absolute;inset:0}.link:focus-visible{box-shadow:none}.card:has(.link:focus-visible){box-shadow:var(--jl-focus-ring)}.actions,footer{z-index:2;position:relative}.media ::slotted(*){width:100%;display:block}.media ::slotted(img){object-fit:cover}header{padding:var(--edge) var(--edge) 0;align-items:flex-start;gap:12px;display:flex}:host([floating-actions]) header{z-index:2;position:absolute;top:0;right:0}:host([has-header]:not([has-body])) header{padding-bottom:var(--edge)}.titles{flex:1;gap:2px;min-width:0;display:grid}h3{font-size:var(--jl-font-lg);letter-spacing:-.01em;font-weight:650;line-height:1.35}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}.actions{flex:none;align-items:center;gap:6px;margin:-4px -6px -4px 0;display:flex}.body{padding:var(--pad);flex:1}:host([has-header]) .body{padding-top:var(--gap)}:host([has-header][padding=none]) .body{margin-top:var(--gap);border-top:1px solid var(--jl-line);padding-top:0}footer{padding:12px var(--edge);border-top:1px solid var(--jl-line);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;display:flex}:host(:not([has-body]):not([has-header])) footer{border-top:0}";
2
+ var jl_card_default = ":host{--pad:20px;--edge:20px;--gap:12px;--radius:var(--jl-radius-lg);display:block}:host([padding=none]){--pad:0px;--edge:16px}:host([padding=sm]){--pad:12px;--edge:12px;--gap:8px}:host([padding=lg]){--pad:28px;--edge:28px;--gap:16px}.card{border:1px solid var(--jl-line);border-radius:var(--radius);background:var(--jl-surface);height:100%;color:var(--jl-text);font-size:var(--jl-font-md);transition:border-color var(--jl-fast) var(--jl-ease);flex-direction:column;line-height:1.55;display:flex;position:relative;overflow:hidden}:host([clickable]) .card{cursor:pointer}:host([clickable]) .card:hover{border-color:var(--jl-accent-line)}.link{z-index:1;border-radius:inherit;position:absolute;inset:0}.link:focus-visible{box-shadow:none}.card:has(.link:focus-visible){box-shadow:var(--jl-focus-ring)}.actions,footer{z-index:2;position:relative}.media ::slotted(*){width:100%;display:block}.media ::slotted(img){object-fit:cover}header{padding:var(--edge) var(--edge) 0;align-items:flex-start;gap:12px;display:flex}:host([floating-actions]) header{z-index:2;position:absolute;top:0;right:0}:host([has-header]:not([has-body])) header{padding-bottom:var(--edge)}.titles{flex:1;gap:2px;min-width:0;display:grid}h3{font-size:var(--jl-font-lg);letter-spacing:-.01em;font-weight:650;line-height:1.35}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:1.5}h3:empty,.description:empty{display:none}.actions{flex:none;align-items:center;gap:6px;margin:-4px -6px -4px 0;display:flex}.body{padding:var(--pad);flex:1}:host([has-header]) .body{padding-top:var(--gap)}:host([has-header][padding=none]) .body{margin-top:var(--gap);border-top:1px solid var(--jl-line);padding-top:0}footer{padding:12px var(--edge);border-top:1px solid var(--jl-line);flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px;display:flex}:host(:not([has-body]):not([has-header])) footer{border-top:0}";
3
3
  export { jl_card_default as default };
@@ -24,13 +24,11 @@ var JlCard = class extends JlElement {
24
24
  events = this.useEvents();
25
25
  heading = this.useChange("", (value) => {
26
26
  this._refs.heading.textContent = value;
27
- this._refs.heading.hidden = value === "";
28
27
  this._refs.linkName.textContent = value || DEFAULT_LINK_NAME;
29
28
  this.renderSections();
30
29
  }, { attribute: "heading" });
31
30
  description = this.useChange("", (value) => {
32
31
  this._refs.description.textContent = value;
33
- this._refs.description.hidden = value === "";
34
32
  this.renderSections();
35
33
  }, { attribute: "description" });
36
34
  /** The room around the content; `none` leaves the body edge to edge, for a list or a table. */
@@ -81,13 +79,9 @@ var JlCard = class extends JlElement {
81
79
  hidden: true,
82
80
  children: [/* @__PURE__ */ jsxs("div", {
83
81
  class: "titles",
84
- children: [/* @__PURE__ */ jsx("h3", {
85
- id: "heading",
86
- hidden: true
87
- }), /* @__PURE__ */ jsx("p", {
82
+ children: [/* @__PURE__ */ jsx("h3", { id: "heading" }), /* @__PURE__ */ jsx("p", {
88
83
  class: "description",
89
- id: "description",
90
- hidden: true
84
+ id: "description"
91
85
  })]
92
86
  }), /* @__PURE__ */ jsx("div", {
93
87
  class: "actions",
@@ -1,3 +1,3 @@
1
1
  // src/molecules/jl-chip-group.css?inline
2
- var jl_chip_group_default = ":host{--height:28px;--pad:10px;--font-size:var(--jl-font-sm);min-width:0;display:block}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:36px;--pad:14px;--font-size:var(--jl-font-md)}.group{scrollbar-width:none;contain:inline-size;gap:8px;min-width:0;margin:-3px;padding:3px;display:flex;overflow-x:auto}.group::-webkit-scrollbar{display:none}:host([wrap]) .group{contain:none;flex-wrap:wrap;overflow:visible}.chip{max-width:100%;height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:none;align-items:center;gap:6px;font-weight:600;line-height:1;display:inline-flex}.chip:hover:not(:disabled){background:var(--jl-surface-2)}.chip.selected,.chip.selected:hover:not(:disabled){border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.chip:disabled{cursor:not-allowed;opacity:.5}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.badge{border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);min-width:18px;color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;text-align:center;margin-right:-4px;padding:0 6px;font-weight:650;line-height:18px}.chip.selected .badge{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent)}";
2
+ var jl_chip_group_default = ":host{--height:28px;--pad:10px;--font-size:var(--jl-font-sm);min-width:0;display:block}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:36px;--pad:14px;--font-size:var(--jl-font-md)}.group{scrollbar-width:none;contain:inline-size;gap:8px;min-width:0;margin:-3px;padding:3px;display:flex;overflow-x:auto}.group::-webkit-scrollbar{display:none}:host([wrap]) .group{contain:none;flex-wrap:wrap;overflow:visible}.chip{max-width:100%;height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:none;align-items:center;gap:6px;font-weight:600;line-height:1;display:inline-flex}.chip:hover:not(:disabled){background:var(--jl-surface-2)}.chip:is([aria-checked=true],[aria-pressed=true]),.chip:is([aria-checked=true],[aria-pressed=true]):hover:not(:disabled){border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.chip:not([data-icon],[aria-checked=true],[aria-pressed=true]) .icon{display:none}.chip:disabled{cursor:not-allowed;opacity:.5}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.badge{border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);min-width:18px;color:var(--jl-muted);font-size:var(--jl-font-xs);font-variant-numeric:tabular-nums;text-align:center;margin-right:-4px;padding:0 6px;font-weight:650;line-height:18px}.chip:is([aria-checked=true],[aria-pressed=true]) .badge{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent)}jl-icon{--icon-size:14px}:host([size=sm]) jl-icon{--icon-size:12px}:host([size=lg]) jl-icon{--icon-size:16px}";
3
3
  export { jl_chip_group_default as default };
@@ -49,7 +49,10 @@ export declare class JlChipGroup<Value extends string = string> extends JlFormCo
49
49
  get(): boolean;
50
50
  set(setter: boolean | ((prevState: boolean) => boolean)): void;
51
51
  }>>;
52
- /** The chip that holds the Tab stop with several choices: the last one people reached. */
52
+ /**
53
+ * The chip that holds the Tab stop with several choices: the last one people reached. `drawn` is the list the chips
54
+ * were made from: the options call back with the same list as the group connects.
55
+ */
53
56
  private readonly _state;
54
57
  private readonly _nameWatch;
55
58
  private readonly _refs;
@@ -71,8 +74,9 @@ export declare class JlChipGroup<Value extends string = string> extends JlFormCo
71
74
  private commit;
72
75
  private onKeydown;
73
76
  private renderOptions;
77
+ /** A chip without an icon of its own has a check, which the CSS shows while it is chosen. */
74
78
  private chip;
75
- /** Radios with one choice, toggle buttons with several; each chosen chip shows its icon or a check. */
79
+ /** Radios with one choice, toggle buttons with several. */
76
80
  private renderValue;
77
81
  /** Tab reaches one chip: the chosen one with one choice, the last one reached with several, else the first. */
78
82
  private renderTabStop;
@@ -6,18 +6,13 @@ import { registerIcons } from "../lib/icons.js";
6
6
  import { CONTROL_SIZES } from "../lib/options.js";
7
7
  import { JlIcon } from "../atoms/jl-icon.js";
8
8
  import { setOrRemove } from "../lib/dom.js";
9
- import { rovingIndex } from "../lib/roving-index.js";
9
+ import { rovingIndex } from "../lib/roving.js";
10
10
  import jl_chip_group_default from "./jl-chip-group.css.js";
11
11
  import { css } from "@jadis/core";
12
12
  import { Check } from "lucide";
13
13
  import { jsx, jsxs } from "@jadis/core/jsx-runtime";
14
14
  // src/molecules/jl-chip-group.tsx
15
15
  registerIcons({ check: Check });
16
- var ICON_SIZES = {
17
- lg: 16,
18
- md: 14,
19
- sm: 12
20
- };
21
16
  var SELECTED_ICON = "check";
22
17
  var CHIP_SELECTOR = ".chip";
23
18
  /** The keys that move between the chips; with one choice, the choice moves too, as with native radios. */
@@ -61,7 +56,6 @@ var JlChipGroup = class extends JlFormControl {
61
56
  wrap = this.useChange(false, (value) => this.reflect("wrap", value), { attribute: "wrap" });
62
57
  size = this.useChange("md", (value) => {
63
58
  this.reflect("size", value);
64
- this.renderOptions();
65
59
  }, {
66
60
  attribute: "size",
67
61
  parse: oneOf(CONTROL_SIZES, "md")
@@ -78,9 +72,13 @@ var JlChipGroup = class extends JlFormControl {
78
72
  this.reflect("disabled", value);
79
73
  this.renderValue();
80
74
  }, { attribute: "disabled" });
81
- /** The chip that holds the Tab stop with several choices: the last one people reached. */
75
+ /**
76
+ * The chip that holds the Tab stop with several choices: the last one people reached. `drawn` is the list the chips
77
+ * were made from: the options call back with the same list as the group connects.
78
+ */
82
79
  _state = {
83
80
  disabledByForm: false,
81
+ drawn: null,
84
82
  stop: ""
85
83
  };
86
84
  _nameWatch = new MutationObserver(() => this.renderFormValue());
@@ -173,11 +171,14 @@ var JlChipGroup = class extends JlFormControl {
173
171
  this.press(target);
174
172
  }
175
173
  renderOptions() {
176
- const iconSize = ICON_SIZES[this.size.get()];
177
- this._refs.group.replaceChildren(...this.options.get().map((option) => this.chip(option, iconSize)));
174
+ const options = this.options.get();
175
+ if (options === this._state.drawn) return;
176
+ this._state.drawn = options;
177
+ this._refs.group.replaceChildren(...options.map((option) => this.chip(option)));
178
178
  this.renderValue();
179
179
  }
180
- chip(option, iconSize) {
180
+ /** A chip without an icon of its own has a check, which the CSS shows while it is chosen. */
181
+ chip(option) {
181
182
  const badge = option.badge === void 0 ? "" : String(option.badge);
182
183
  return /* @__PURE__ */ jsxs("button", {
183
184
  type: "button",
@@ -189,8 +190,7 @@ var JlChipGroup = class extends JlFormControl {
189
190
  children: [
190
191
  /* @__PURE__ */ jsx(JlIcon, {
191
192
  class: "icon",
192
- size: iconSize,
193
- hidden: true
193
+ name: option.icon ?? SELECTED_ICON
194
194
  }),
195
195
  /* @__PURE__ */ jsx("span", {
196
196
  class: "label",
@@ -203,7 +203,7 @@ var JlChipGroup = class extends JlFormControl {
203
203
  ]
204
204
  });
205
205
  }
206
- /** Radios with one choice, toggle buttons with several; each chosen chip shows its icon or a check. */
206
+ /** Radios with one choice, toggle buttons with several. */
207
207
  renderValue() {
208
208
  const chosen = new Set(this.chosen());
209
209
  const multiple = this.multiple.get();
@@ -216,11 +216,6 @@ var JlChipGroup = class extends JlFormControl {
216
216
  setOrRemove(chip, "role", multiple ? "" : "radio");
217
217
  setOrRemove(chip, "aria-checked", multiple ? "" : String(selected));
218
218
  setOrRemove(chip, "aria-pressed", multiple ? String(selected) : "");
219
- chip.classList.toggle("selected", selected);
220
- const icon = chip.querySelector(".icon");
221
- const name = chip.dataset.icon ?? (selected ? SELECTED_ICON : "");
222
- icon?.name.set(name);
223
- if (icon !== null) icon.hidden = name === "";
224
219
  }
225
220
  this.renderTabStop();
226
221
  this.renderFormValue();