@mortenbrudvik/waveui 0.12.0 → 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 (174) hide show
  1. package/README.md +362 -60
  2. package/dist/components/data-display/Avatar.cjs +1 -1
  3. package/dist/components/data-display/Avatar.cjs.map +1 -1
  4. package/dist/components/data-display/Avatar.colors.cjs +2 -0
  5. package/dist/components/data-display/Avatar.colors.cjs.map +1 -0
  6. package/dist/components/data-display/Avatar.colors.mjs +45 -0
  7. package/dist/components/data-display/Avatar.colors.mjs.map +1 -0
  8. package/dist/components/data-display/Avatar.context.cjs +1 -1
  9. package/dist/components/data-display/Avatar.context.cjs.map +1 -1
  10. package/dist/components/data-display/Avatar.context.mjs +4 -2
  11. package/dist/components/data-display/Avatar.context.mjs.map +1 -1
  12. package/dist/components/data-display/Avatar.mjs +103 -96
  13. package/dist/components/data-display/Avatar.mjs.map +1 -1
  14. package/dist/components/data-display/Avatar.sizes.cjs +2 -0
  15. package/dist/components/data-display/Avatar.sizes.cjs.map +1 -0
  16. package/dist/components/data-display/Avatar.sizes.mjs +41 -0
  17. package/dist/components/data-display/Avatar.sizes.mjs.map +1 -0
  18. package/dist/components/data-display/AvatarGroup.cjs +1 -1
  19. package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
  20. package/dist/components/data-display/AvatarGroup.context.cjs +2 -0
  21. package/dist/components/data-display/AvatarGroup.context.cjs.map +1 -0
  22. package/dist/components/data-display/AvatarGroup.context.mjs +9 -0
  23. package/dist/components/data-display/AvatarGroup.context.mjs.map +1 -0
  24. package/dist/components/data-display/AvatarGroup.mjs +65 -122
  25. package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
  26. package/dist/components/data-display/AvatarGroup.partition.cjs +2 -0
  27. package/dist/components/data-display/AvatarGroup.partition.cjs.map +1 -0
  28. package/dist/components/data-display/AvatarGroup.partition.mjs +14 -0
  29. package/dist/components/data-display/AvatarGroup.partition.mjs.map +1 -0
  30. package/dist/components/data-display/AvatarGroup.parts.cjs +2 -0
  31. package/dist/components/data-display/AvatarGroup.parts.cjs.map +1 -0
  32. package/dist/components/data-display/AvatarGroup.parts.mjs +178 -0
  33. package/dist/components/data-display/AvatarGroup.parts.mjs.map +1 -0
  34. package/dist/components/data-display/InteractionTag.cjs +1 -1
  35. package/dist/components/data-display/InteractionTag.cjs.map +1 -1
  36. package/dist/components/data-display/InteractionTag.mjs +36 -33
  37. package/dist/components/data-display/InteractionTag.mjs.map +1 -1
  38. package/dist/components/data-display/List.cjs +1 -1
  39. package/dist/components/data-display/List.cjs.map +1 -1
  40. package/dist/components/data-display/List.mjs +245 -195
  41. package/dist/components/data-display/List.mjs.map +1 -1
  42. package/dist/components/data-display/List.registry.cjs.map +1 -1
  43. package/dist/components/data-display/List.registry.mjs.map +1 -1
  44. package/dist/components/data-display/Persona.cjs +1 -1
  45. package/dist/components/data-display/Persona.cjs.map +1 -1
  46. package/dist/components/data-display/Persona.mjs +96 -37
  47. package/dist/components/data-display/Persona.mjs.map +1 -1
  48. package/dist/components/data-display/PresenceBadge.cjs +1 -1
  49. package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
  50. package/dist/components/data-display/PresenceBadge.mjs +42 -28
  51. package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
  52. package/dist/components/data-display/Tag.cjs +1 -1
  53. package/dist/components/data-display/Tag.cjs.map +1 -1
  54. package/dist/components/data-display/Tag.mjs +111 -108
  55. package/dist/components/data-display/Tag.mjs.map +1 -1
  56. package/dist/components/layout/Card.cjs +1 -1
  57. package/dist/components/layout/Card.cjs.map +1 -1
  58. package/dist/components/layout/Card.context.cjs +2 -0
  59. package/dist/components/layout/Card.context.cjs.map +1 -0
  60. package/dist/components/layout/Card.context.mjs +14 -0
  61. package/dist/components/layout/Card.context.mjs.map +1 -0
  62. package/dist/components/layout/Card.mjs +138 -92
  63. package/dist/components/layout/Card.mjs.map +1 -1
  64. package/dist/components/layout/Card.preview.cjs +2 -0
  65. package/dist/components/layout/Card.preview.cjs.map +1 -0
  66. package/dist/components/layout/Card.preview.mjs +22 -0
  67. package/dist/components/layout/Card.preview.mjs.map +1 -0
  68. package/dist/components/layout/Carousel.button.cjs +2 -0
  69. package/dist/components/layout/Carousel.button.cjs.map +1 -0
  70. package/dist/components/layout/Carousel.button.mjs +34 -0
  71. package/dist/components/layout/Carousel.button.mjs.map +1 -0
  72. package/dist/components/layout/Carousel.cjs +1 -1
  73. package/dist/components/layout/Carousel.cjs.map +1 -1
  74. package/dist/components/layout/Carousel.context.cjs +2 -0
  75. package/dist/components/layout/Carousel.context.cjs.map +1 -0
  76. package/dist/components/layout/Carousel.context.mjs +24 -0
  77. package/dist/components/layout/Carousel.context.mjs.map +1 -0
  78. package/dist/components/layout/Carousel.drag.cjs +2 -0
  79. package/dist/components/layout/Carousel.drag.cjs.map +1 -0
  80. package/dist/components/layout/Carousel.drag.mjs +79 -0
  81. package/dist/components/layout/Carousel.drag.mjs.map +1 -0
  82. package/dist/components/layout/Carousel.groups.cjs +2 -0
  83. package/dist/components/layout/Carousel.groups.cjs.map +1 -0
  84. package/dist/components/layout/Carousel.groups.mjs +23 -0
  85. package/dist/components/layout/Carousel.groups.mjs.map +1 -0
  86. package/dist/components/layout/Carousel.mjs +288 -150
  87. package/dist/components/layout/Carousel.mjs.map +1 -1
  88. package/dist/components/layout/Carousel.styles.cjs +2 -0
  89. package/dist/components/layout/Carousel.styles.cjs.map +1 -0
  90. package/dist/components/layout/Carousel.styles.mjs +30 -0
  91. package/dist/components/layout/Carousel.styles.mjs.map +1 -0
  92. package/dist/components/layout/Overflow.cjs +1 -1
  93. package/dist/components/layout/Overflow.cjs.map +1 -1
  94. package/dist/components/layout/Overflow.mjs +240 -192
  95. package/dist/components/layout/Overflow.mjs.map +1 -1
  96. package/dist/components/layout/Overflow.store.cjs +2 -0
  97. package/dist/components/layout/Overflow.store.cjs.map +1 -0
  98. package/dist/components/layout/Overflow.store.mjs +209 -0
  99. package/dist/components/layout/Overflow.store.mjs.map +1 -0
  100. package/dist/components/layout/TabList.cjs +1 -1
  101. package/dist/components/layout/TabList.cjs.map +1 -1
  102. package/dist/components/layout/TabList.mjs +163 -124
  103. package/dist/components/layout/TabList.mjs.map +1 -1
  104. package/dist/components/navigation/Breadcrumb.cjs +1 -1
  105. package/dist/components/navigation/Breadcrumb.cjs.map +1 -1
  106. package/dist/components/navigation/Breadcrumb.mjs +239 -84
  107. package/dist/components/navigation/Breadcrumb.mjs.map +1 -1
  108. package/dist/components/overlays/Dialog.slots.cjs +1 -1
  109. package/dist/components/overlays/Dialog.slots.cjs.map +1 -1
  110. package/dist/components/overlays/Dialog.slots.mjs +19 -15
  111. package/dist/components/overlays/Dialog.slots.mjs.map +1 -1
  112. package/dist/components/overlays/TeachingPopover.cjs +1 -1
  113. package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
  114. package/dist/components/overlays/TeachingPopover.context.cjs +2 -0
  115. package/dist/components/overlays/TeachingPopover.context.cjs.map +1 -0
  116. package/dist/components/overlays/TeachingPopover.context.mjs +51 -0
  117. package/dist/components/overlays/TeachingPopover.context.mjs.map +1 -0
  118. package/dist/components/overlays/TeachingPopover.mjs +15 -185
  119. package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
  120. package/dist/components/overlays/TeachingPopover.parts.cjs +2 -0
  121. package/dist/components/overlays/TeachingPopover.parts.cjs.map +1 -0
  122. package/dist/components/overlays/TeachingPopover.parts.mjs +398 -0
  123. package/dist/components/overlays/TeachingPopover.parts.mjs.map +1 -0
  124. package/dist/components/overlays/TeachingPopover.root.cjs +2 -0
  125. package/dist/components/overlays/TeachingPopover.root.cjs.map +1 -0
  126. package/dist/components/overlays/TeachingPopover.root.mjs +150 -0
  127. package/dist/components/overlays/TeachingPopover.root.mjs.map +1 -0
  128. package/dist/components/overlays/TeachingPopover.stack.cjs +2 -0
  129. package/dist/components/overlays/TeachingPopover.stack.cjs.map +1 -0
  130. package/dist/components/overlays/TeachingPopover.stack.mjs +86 -0
  131. package/dist/components/overlays/TeachingPopover.stack.mjs.map +1 -0
  132. package/dist/components/table/DataGrid.cjs +1 -1
  133. package/dist/components/table/DataGrid.cjs.map +1 -1
  134. package/dist/components/table/DataGrid.mjs +540 -311
  135. package/dist/components/table/DataGrid.mjs.map +1 -1
  136. package/dist/components/table/Table.cjs +1 -1
  137. package/dist/components/table/Table.cjs.map +1 -1
  138. package/dist/components/table/Table.mjs +183 -60
  139. package/dist/components/table/Table.mjs.map +1 -1
  140. package/dist/components/table/Table.shared.cjs +2 -0
  141. package/dist/components/table/Table.shared.cjs.map +1 -0
  142. package/dist/components/table/Table.shared.mjs +65 -0
  143. package/dist/components/table/Table.shared.mjs.map +1 -0
  144. package/dist/index.cjs +1 -1
  145. package/dist/index.d.cts +2299 -213
  146. package/dist/index.d.ts +2299 -213
  147. package/dist/index.mjs +135 -127
  148. package/dist/lib/breadcrumb.cjs +2 -0
  149. package/dist/lib/breadcrumb.cjs.map +1 -0
  150. package/dist/lib/breadcrumb.mjs +26 -0
  151. package/dist/lib/breadcrumb.mjs.map +1 -0
  152. package/dist/lib/classNames.cjs +1 -1
  153. package/dist/lib/classNames.cjs.map +1 -1
  154. package/dist/lib/classNames.mjs +143 -95
  155. package/dist/lib/classNames.mjs.map +1 -1
  156. package/dist/lib/events.cjs +1 -1
  157. package/dist/lib/events.cjs.map +1 -1
  158. package/dist/lib/events.mjs +35 -8
  159. package/dist/lib/events.mjs.map +1 -1
  160. package/dist/lib/icons.cjs +1 -1
  161. package/dist/lib/icons.cjs.map +1 -1
  162. package/dist/lib/icons.mjs +34 -20
  163. package/dist/lib/icons.mjs.map +1 -1
  164. package/dist/lib/initials.cjs +2 -0
  165. package/dist/lib/initials.cjs.map +1 -0
  166. package/dist/lib/initials.mjs +21 -0
  167. package/dist/lib/initials.mjs.map +1 -0
  168. package/dist/lib/table.cjs +2 -0
  169. package/dist/lib/table.cjs.map +1 -0
  170. package/dist/lib/table.mjs +16 -0
  171. package/dist/lib/table.mjs.map +1 -0
  172. package/dist/styles.css +1 -1
  173. package/package.json +1 -1
  174. package/src/styles/tokens.css +102 -0
@@ -12,16 +12,16 @@ import { focusRing as h, forcedColors as g } from "../../lib/styles.mjs";
12
12
  import { Button as _ } from "../button/Button.mjs";
13
13
  import { BUTTON_OWN_PROP_KEYS as v, MERGED_DISABLED_FOCUSABLE_PROPS as y, placeButtonIcon as b } from "../button/Button.slots.mjs";
14
14
  import { DismissIcon as x } from "../../lib/icons.mjs";
15
- import { mergeProps as S } from "../../lib/mergeProps.mjs";
16
- import { hasRenderedTextLabel as C, hasTextLabel as w, observeTextLabel as T } from "../../lib/labelInName.mjs";
17
- import { isEditableTarget as ee, isOwnEvent as E } from "../../lib/events.mjs";
18
- import { TagHostContext as D, isDismissKey as O, isRepeatedActivation as te, useDismissControlFocus as ne, useHeldFocus as re, useTagGroupContext as ie, useTagGroupItem as ae } from "./TagGroup.context.mjs";
19
- import { AvatarSizeContext as oe } from "./Avatar.context.mjs";
20
- import { TAG_AVATAR_SIZE as se, TAG_DISMISS_BASE_CLASSES as ce, TAG_DISMISS_GLYPH_SIZE as le, TAG_ROOT_BASE_CLASSES as ue, TAG_SECONDARY_TEXT_CLASSES as de, TAG_SELECTED_CLASSES as fe, TAG_TEXT_COLUMN_CLASSES as pe, tagAppearanceClasses as me, tagDismissRingClasses as he, tagDismissSizeClasses as ge, tagDismissStateClasses as _e, tagEndInsetClasses as ve, tagIconClasses as ye, tagMediaClasses as be, tagShapeClasses as xe, tagSizeClasses as Se, tagStartInsetClasses as Ce } from "./tagStyles.mjs";
21
- import * as k from "react";
22
- import { jsx as A, jsxs as j } from "react/jsx-runtime";
15
+ import { mergeProps as ee } from "../../lib/mergeProps.mjs";
16
+ import { hasRenderedTextLabel as S, hasTextLabel as C, observeTextLabel as w } from "../../lib/labelInName.mjs";
17
+ import { isEditableTarget as te, isOwnEvent as T } from "../../lib/events.mjs";
18
+ import { TagHostContext as E, isDismissKey as D, isRepeatedActivation as ne, useDismissControlFocus as re, useHeldFocus as ie, useTagGroupContext as ae, useTagGroupItem as oe } from "./TagGroup.context.mjs";
19
+ import { AvatarSizeContext as se } from "./Avatar.context.mjs";
20
+ import { TAG_AVATAR_SIZE as ce, TAG_DISMISS_BASE_CLASSES as le, TAG_DISMISS_GLYPH_SIZE as ue, TAG_ROOT_BASE_CLASSES as de, TAG_SECONDARY_TEXT_CLASSES as fe, TAG_SELECTED_CLASSES as pe, TAG_TEXT_COLUMN_CLASSES as me, tagAppearanceClasses as he, tagDismissRingClasses as ge, tagDismissSizeClasses as _e, tagDismissStateClasses as ve, tagEndInsetClasses as ye, tagIconClasses as be, tagMediaClasses as xe, tagShapeClasses as Se, tagSizeClasses as Ce, tagStartInsetClasses as we } from "./tagStyles.mjs";
21
+ import * as O from "react";
22
+ import { jsx as k, jsxs as A } from "react/jsx-runtime";
23
23
  //#region src/components/data-display/Tag.tsx
24
- var M = /* @__PURE__ */ new Set([
24
+ var j = /* @__PURE__ */ new Set([
25
25
  "type",
26
26
  "disabled",
27
27
  "autoFocus",
@@ -33,31 +33,31 @@ var M = /* @__PURE__ */ new Set([
33
33
  "formTarget",
34
34
  "name",
35
35
  "value"
36
- ]), N = /^on[A-Z]/, P = /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]), we = () => {};
37
- function Te(e) {
36
+ ]), M = /^on[A-Z]/, N = /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]), Te = () => {};
37
+ function Ee(e) {
38
38
  let t = {}, n = !1;
39
- for (let [r, i] of Object.entries(e)) P.has(r) ? i !== void 0 && (n = !0) : t[r] = i;
39
+ for (let [r, i] of Object.entries(e)) N.has(r) ? i !== void 0 && (n = !0) : t[r] = i;
40
40
  return {
41
41
  props: t,
42
42
  ignoredName: n
43
43
  };
44
44
  }
45
- var F = "inline-flex items-center justify-center";
46
- function Ee(e) {
47
- if (typeof e != "object" || !e || k.isValidElement(e) || Symbol.iterator in e) return !1;
45
+ var P = "inline-flex items-center justify-center";
46
+ function De(e) {
47
+ if (typeof e != "object" || !e || O.isValidElement(e) || Symbol.iterator in e) return !1;
48
48
  let t = Object.getPrototypeOf(e);
49
49
  return t === null || t === Object.prototype;
50
50
  }
51
- function I(e, t) {
52
- return /* @__PURE__ */ A(x, {
51
+ function F(e, t) {
52
+ return /* @__PURE__ */ k(x, {
53
53
  size: e,
54
54
  className: t
55
55
  });
56
56
  }
57
- function De(n, r) {
57
+ function Oe(n, r) {
58
58
  if (!c(n)) return {
59
59
  buttonProps: null,
60
- content: I(r, d.dismissIcon),
60
+ content: F(r, d.dismissIcon),
61
61
  warning: null,
62
62
  ignoredName: !1,
63
63
  contentMayName: !1,
@@ -65,33 +65,33 @@ function De(n, r) {
65
65
  disabledFocusable: !1
66
66
  };
67
67
  let i = t(n);
68
- if (k.isValidElement(n) && (i === "button" || i === _)) {
68
+ if (O.isValidElement(n) && (i === "button" || i === _)) {
69
69
  let { children: t, dangerouslySetInnerHTML: a, ...l } = n.props, u = i === _, f = l;
70
70
  if (u) {
71
71
  f = {};
72
72
  for (let [e, t] of Object.entries(l)) v.has(e) || (f[e] = t);
73
73
  }
74
- let p = u ? l.icon : void 0, { props: m, ignoredName: h } = Te(f), g = c(p) ? s(p, "span", e(d.dismissIcon, F), { "aria-hidden": !0 }) : null, y = a == null ? o(t) : /* @__PURE__ */ A("span", {
75
- className: F,
74
+ let p = u ? l.icon : void 0, { props: m, ignoredName: h } = Ee(f), g = c(p) ? s(p, "span", e(d.dismissIcon, P), { "aria-hidden": !0 }) : null, y = a == null ? o(t) : /* @__PURE__ */ k("span", {
75
+ className: P,
76
76
  dangerouslySetInnerHTML: a
77
77
  });
78
78
  return {
79
79
  buttonProps: m,
80
- content: g || c(y) ? b(g, y, u && l.iconPosition) : I(r, d.dismissIcon),
80
+ content: g || c(y) ? b(g, y, u && l.iconPosition) : F(r, d.dismissIcon),
81
81
  warning: "button-element",
82
82
  ignoredName: h,
83
83
  contentMayName: !0,
84
- literalTextLabel: w(y),
84
+ literalTextLabel: C(y),
85
85
  disabledFocusable: u && !!l.disabledFocusable
86
86
  };
87
87
  }
88
- if (Ee(n)) {
89
- let t = n.as === _, i = n.as === "button" || t || Object.keys(n).some((e) => M.has(e) || N.test(e)), a = {}, u = {}, f = {}, p = !1;
90
- for (let [e, r] of Object.entries(n)) e === "as" ? r !== "button" && !t && (u.as = r) : t && v.has(e) ? f[e] = r : P.has(e) ? r !== void 0 && (p = !0) : e === "children" || e === "dangerouslySetInnerHTML" ? u[e] = r : i || e.startsWith("aria-") && e !== "aria-hidden" ? a[e] = r : u[e] = r;
88
+ if (De(n)) {
89
+ let t = n.as === _, i = n.as === "button" || t || Object.keys(n).some((e) => j.has(e) || M.test(e)), a = {}, u = {}, f = {}, p = !1;
90
+ for (let [e, r] of Object.entries(n)) e === "as" ? r !== "button" && !t && (u.as = r) : t && v.has(e) ? f[e] = r : N.has(e) ? r !== void 0 && (p = !0) : e === "children" || e === "dangerouslySetInnerHTML" ? u[e] = r : i || e.startsWith("aria-") && e !== "aria-hidden" ? a[e] = r : u[e] = r;
91
91
  let m = c(f.icon);
92
- return m ? u.children = b(s(f.icon, "span", e(d.dismissIcon, F)), o(u.children), f.iconPosition) : l(u.as ?? "span", u) && (u.children = I(r)), {
92
+ return m ? u.children = b(s(f.icon, "span", e(d.dismissIcon, P)), o(u.children), f.iconPosition) : l(u.as ?? "span", u) && (u.children = F(r)), {
93
93
  buttonProps: i || Object.keys(a).length > 0 ? a : null,
94
- content: s(u, "span", e(!m && d.dismissIcon, F), { "aria-hidden": !0 }),
94
+ content: s(u, "span", e(!m && d.dismissIcon, P), { "aria-hidden": !0 }),
95
95
  warning: i ? "button-object" : null,
96
96
  ignoredName: p,
97
97
  contentMayName: !1,
@@ -101,7 +101,7 @@ function De(n, r) {
101
101
  }
102
102
  return {
103
103
  buttonProps: null,
104
- content: s(n, "span", e(d.dismissIcon, F), { "aria-hidden": !0 }),
104
+ content: s(n, "span", e(d.dismissIcon, P), { "aria-hidden": !0 }),
105
105
  warning: null,
106
106
  ignoredName: !1,
107
107
  contentMayName: !1,
@@ -109,7 +109,7 @@ function De(n, r) {
109
109
  disabledFocusable: !1
110
110
  };
111
111
  }
112
- var Oe = /* @__PURE__ */ new Set([
112
+ var ke = /* @__PURE__ */ new Set([
113
113
  "button",
114
114
  "fieldset",
115
115
  "input",
@@ -117,7 +117,7 @@ var Oe = /* @__PURE__ */ new Set([
117
117
  "option",
118
118
  "select",
119
119
  "textarea"
120
- ]), ke = /* @__PURE__ */ new Set([
120
+ ]), Ae = /* @__PURE__ */ new Set([
121
121
  "button",
122
122
  "data",
123
123
  "input",
@@ -127,36 +127,36 @@ var Oe = /* @__PURE__ */ new Set([
127
127
  "progress",
128
128
  "select",
129
129
  "textarea"
130
- ]), L = {
130
+ ]), I = {
131
131
  disabled: !0,
132
132
  "aria-disabled": void 0,
133
133
  "data-disabled": void 0,
134
134
  "data-disabled-focusable": void 0
135
135
  };
136
- function R(e, t) {
136
+ function L(e, t) {
137
137
  return typeof e == "string" && Object.hasOwn(t, e);
138
138
  }
139
- function Ae(e) {
139
+ function je(e) {
140
140
  e.preventDefault(), e.stopPropagation();
141
141
  }
142
- function je({ buttonProps: e, content: t, contentMayName: n, literalTextLabel: r, disabledFocusable: i, disabled: a, dismissLabel: o, contentId: s, dismissName: c, buttonRef: l }) {
143
- let d = p("tag-dismiss"), f = p("tag-dismiss-text"), { ref: h, ...g } = e, _ = k.useRef(null), v = m(_, l, h);
144
- ne(_);
145
- let [b, x] = k.useState(null), S = k.useCallback((e) => b ? T(b, e) : we, [b]), w = k.useSyncExternalStore(S, () => b ? C(b) : r, () => r), ee = n && w, E = re(a), D = a ? E.held ? y : L : i ? y : void 0, O = c !== void 0;
146
- return /* @__PURE__ */ j("button", {
142
+ function Me({ buttonProps: e, content: t, contentMayName: n, literalTextLabel: r, disabledFocusable: i, disabled: a, dismissLabel: o, contentId: s, dismissName: c, buttonRef: l }) {
143
+ let d = p("tag-dismiss"), f = p("tag-dismiss-text"), { ref: h, ...g } = e, _ = O.useRef(null), v = m(_, l, h);
144
+ re(_);
145
+ let [b, x] = O.useState(null), ee = O.useCallback((e) => b ? w(b, e) : Te, [b]), C = O.useSyncExternalStore(ee, () => b ? S(b) : r, () => r), te = n && C, T = ie(a), E = a ? T.held ? y : I : i ? y : void 0, D = c !== void 0;
146
+ return /* @__PURE__ */ A("button", {
147
147
  ...g,
148
148
  ref: v,
149
149
  type: g.type ?? "button",
150
- ...D,
151
- "aria-label": O ? c : void 0,
152
- "aria-labelledby": O ? void 0 : `${ee ? f : d} ${s}`,
153
- onFocus: u(g.onFocus, E.onFocus, { checkDefaultPrevented: !1 }),
154
- onBlur: u(g.onBlur, E.onBlur, { checkDefaultPrevented: !1 }),
155
- children: [!O && /* @__PURE__ */ A("span", {
150
+ ...E,
151
+ "aria-label": D ? c : void 0,
152
+ "aria-labelledby": D ? void 0 : `${te ? f : d} ${s}`,
153
+ onFocus: u(g.onFocus, T.onFocus, { checkDefaultPrevented: !1 }),
154
+ onBlur: u(g.onBlur, T.onBlur, { checkDefaultPrevented: !1 }),
155
+ children: [!D && /* @__PURE__ */ k("span", {
156
156
  id: d,
157
157
  className: "sr-only",
158
158
  children: o
159
- }), n ? /* @__PURE__ */ A("span", {
159
+ }), n ? /* @__PURE__ */ k("span", {
160
160
  id: f,
161
161
  ref: x,
162
162
  className: "inline-flex items-center justify-center gap-[inherit]",
@@ -164,121 +164,124 @@ function je({ buttonProps: e, content: t, contentMayName: n, literalTextLabel: r
164
164
  }) : t]
165
165
  });
166
166
  }
167
- je.displayName = "TagDismissButton";
168
- var Me = /* @__PURE__ */ new Set([
167
+ Me.displayName = "TagDismissButton";
168
+ var Ne = /* @__PURE__ */ new Set([
169
169
  "a",
170
170
  "button",
171
171
  "input",
172
172
  "select",
173
173
  "textarea",
174
174
  "li"
175
- ]), Ne = "Tag: `as=\"button\"` with `dismissible` puts the Dismiss button inside a button. Use InteractionTag instead: `InteractionTag.Primary` for the action, `InteractionTag.Secondary` for Dismiss.", Pe = "Tag: a dismissible tag rendered as a link (`as=\"a\"` or a link component) puts the Dismiss button inside the link. Put the link in the tag's content: `<Tag dismissible><a href>…</a></Tag>`.", Fe = "TagGroup: a tag in a `role=\"list\"` group is not a list item (its element is a link, a button or a component). Put a link in the tag's content (`<Tag><a href>…</a></Tag>`), or wrap the tag in an element with `role=\"listitem\"`.";
176
- function Ie(e) {
175
+ ]), Pe = "Tag: `as=\"button\"` with `dismissible` puts the Dismiss button inside a button. Use InteractionTag instead: `InteractionTag.Primary` for the action, `InteractionTag.Secondary` for Dismiss.", Fe = "Tag: a dismissible tag rendered as a link (`as=\"a\"` or a link component) puts the Dismiss button inside the link. Put the link in the tag's content: `<Tag dismissible><a href>…</a></Tag>`.", Ie = "TagGroup: a tag in a `role=\"list\"` group is not a list item (its element is a link, a button or a component). Put a link in the tag's content (`<Tag><a href>…</a></Tag>`), or wrap the tag in an element with `role=\"listitem\"`.";
176
+ function Le(e) {
177
177
  for (let t = e; t && !t.matches("[data-wave-tag-group]"); t = t.parentElement) if (t.getAttribute("role") === "listitem" || t.localName === "li") return !0;
178
178
  return !1;
179
179
  }
180
- var z = (t) => {
181
- let { as: l, appearance: _, size: v, shape: y, disabled: b, selected: x = !1, value: C, media: w, icon: T, secondaryText: ne, dismissible: M, onDismiss: N, dismissIcon: P, dismissLabel: we = "Dismiss", className: Te, children: F, role: Ee, hidden: I, onClick: L, onFocus: z, onBlur: Le, onKeyDown: Re, ref: ze, ...Be } = t, B = l ?? "span", Ve = p("tag-content"), V = ie(), He = k.useContext(D), H = k.useRef(null), Ue = m(H, ze), We = k.useRef(null), Ge = k.useRef(null), U = R(v, Se) ? v : V?.size ?? "medium", W = R(_, me) ? _ : V?.appearance ?? "filled", Ke = R(y, xe) ? y : V?.shape ?? "circular", G = (V?.disabled ?? !1) || b === !0, K = M ?? V?.dismissible ?? !1, q = x && !G ? "selected" : W, qe = V?.dimDisabled ?? !0, Je = ae(H, C, { reported: K && (V?.reportsDismissals ?? !1) }), Ye = B === "a", Xe = Ye && G, Ze = B === "button", J = re((Ye || Ze) && G), Y = Ze && J.held, { buttonProps: Qe, content: $e, warning: X, ignoredName: et, contentMayName: tt, literalTextLabel: nt, disabledFocusable: rt } = De(K ? P : void 0, le[U]);
182
- k.useEffect(() => {
180
+ var R = (t) => {
181
+ let { as: l, appearance: _, size: v, shape: y, disabled: b, selected: x = !1, value: S, media: C, icon: w, secondaryText: re, dismissible: j, onDismiss: M, dismissIcon: N, dismissLabel: Te = "Dismiss", className: Ee, children: P, role: De, hidden: F, onClick: I, onFocus: R, onBlur: Re, onKeyDown: ze, ref: Be, ...Ve } = t, z = l ?? "span", He = p("tag-content"), B = ae(), Ue = O.useContext(E), V = O.useRef(null), We = m(V, Be), Ge = O.useRef(null), Ke = O.useRef(null), H = L(v, Ce) ? v : B?.size ?? "medium", U = L(_, he) ? _ : B?.appearance ?? "filled", W = L(y, Se) ? y : B?.shape ?? "circular", G = (B?.disabled ?? !1) || b === !0, K = j ?? B?.dismissible ?? !1, q = x && !G ? "selected" : U, qe = B?.dimDisabled ?? !0, Je = oe(V, S, { reported: K && (B?.reportsDismissals ?? !1) }), Ye = z === "a", Xe = Ye && G, Ze = z === "button", J = ie((Ye || Ze) && G), Y = Ze && J.held, { buttonProps: Qe, content: $e, warning: X, ignoredName: et, contentMayName: tt, literalTextLabel: nt, disabledFocusable: rt } = Oe(K ? N : void 0, ue[H]);
182
+ O.useEffect(() => {
183
183
  X === "button-element" ? a("Tag:dismissIcon-button", "Tag: `dismissIcon` received a button. Its props were merged into the built-in dismiss button (a button cannot contain another button), which is named by its text label (or `dismissLabel`) and the tag content. Pass icon content instead, e.g. `dismissIcon={<CloseIcon />}`, and handle the dismissal in `onDismiss`.") : X === "button-object" && i("Tag", "dismissIcon={{ onClick, type, disabled, … }} (button props on the slot object)", "onDismiss and icon content in dismissIcon", "Its props are merged onto the built-in dismiss button, which is named by `dismissLabel` and the tag content.");
184
184
  }, [X]);
185
- let Z = M === void 0 && !(V?.dismissible ?? !1) && (N !== void 0 || P !== void 0);
186
- k.useEffect(() => {
185
+ let Z = j === void 0 && !(B?.dismissible ?? !1) && (M !== void 0 || N !== void 0);
186
+ O.useEffect(() => {
187
187
  Z && a("Tag:dismiss-without-dismissible", "Tag: `onDismiss` and `dismissIcon` take effect only with `dismissible`; no dismiss button was rendered. Add `dismissible` to render it.");
188
- }, [Z]), k.useEffect(() => {
188
+ }, [Z]), O.useEffect(() => {
189
189
  et && a("Tag:dismissIcon-name", "Tag: `aria-label`/`aria-labelledby` on `dismissIcon` are ignored. The dismiss button is named by `dismissLabel` (default \"Dismiss\") and the tag content, e.g. \"Dismiss Cherry\"; set `dismissLabel` to change or localise it.");
190
- }, [et]), k.useEffect(() => {
190
+ }, [et]), O.useEffect(() => {
191
191
  if (!K || !r || n("Tag:nested-button")) return;
192
- let e = H.current?.localName;
193
- e === "button" ? a("Tag:nested-button", Ne) : e === "a" && a("Tag:nested-button", Pe);
192
+ let e = V.current?.localName;
193
+ e === "button" ? a("Tag:nested-button", Pe) : e === "a" && a("Tag:nested-button", Fe);
194
194
  });
195
- let it = V?.mode === "list";
196
- k.useEffect(() => {
195
+ let it = B?.mode === "list";
196
+ O.useEffect(() => {
197
197
  if (!it || !r || n("TagGroup:list-item")) return;
198
- let e = H.current;
199
- e && !Ie(e) && a("TagGroup:list-item", Fe);
198
+ let e = V.current;
199
+ e && !Le(e) && a("TagGroup:list-item", Ie);
200
200
  });
201
- let at = c(w), ot = c(T), st = o(ne), ct = c(st), lt = k.useMemo(() => ({ size: se[U] }), [U]), ut = (e) => typeof B != "string" || e.has(B), Q = {};
202
- ut(Oe) && (G || b !== void 0) && (Q.disabled = G && !Y), Y && (Q["aria-disabled"] = !0, Q["data-disabled-focusable"] = ""), C !== void 0 && ut(ke) && (Q.value = C), Xe && (Q["aria-disabled"] = !0, J.held ? Q["data-disabled-focusable"] = "" : (Q.href = void 0, Q.role = "link"));
203
- let dt = it && typeof B == "string" && !Me.has(B) ? "listitem" : void 0, ft = C !== void 0 && (V?.hiddenValues?.has(C) ?? !1), pt = Xe || Y ? (e) => {
204
- E(e) ? Ae(e) : L?.(e);
205
- } : L, mt = f((e) => {
206
- let t = We.current, n = Ge.current;
207
- t && n && O(e) && t.contains(e.target) && !ee(e.target) && (e.preventDefault(), n.click());
201
+ let at = c(C), ot = c(w), st = o(re), ct = c(st), lt = O.useMemo(() => ({
202
+ size: ce[H],
203
+ shape: W === "rounded" ? "square" : "circular"
204
+ }), [H, W]), ut = (e) => typeof z != "string" || e.has(z), Q = {};
205
+ ut(ke) && (G || b !== void 0) && (Q.disabled = G && !Y), Y && (Q["aria-disabled"] = !0, Q["data-disabled-focusable"] = ""), S !== void 0 && ut(Ae) && (Q.value = S), Xe && (Q["aria-disabled"] = !0, J.held ? Q["data-disabled-focusable"] = "" : (Q.href = void 0, Q.role = "link"));
206
+ let dt = it && typeof z == "string" && !Ne.has(z) ? "listitem" : void 0, ft = S !== void 0 && (B?.hiddenValues?.has(S) ?? !1), pt = Xe || Y ? (e) => {
207
+ T(e) ? je(e) : I?.(e);
208
+ } : I, mt = f((e) => {
209
+ let t = Ge.current, n = Ke.current;
210
+ t && n && D(e) && t.contains(e.target) && !te(e.target) && (e.preventDefault(), n.click());
208
211
  }), $ = {
209
212
  type: "button",
210
213
  "data-wave-tag-dismiss": "",
211
- className: e(d.dismissButton, ce, ge[U], !G && [
214
+ className: e(d.dismissButton, le, _e[H], !G && [
212
215
  "disabled:opacity-50",
213
216
  "aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100",
214
- _e[q]
215
- ], h, he[U], q === "selected" && "focus-visible:outline-primary-foreground", He?.dismissButtonClassName),
217
+ ve[q]
218
+ ], h, ge[H], q === "selected" && "focus-visible:outline-primary-foreground", Ue?.dismissButtonClassName),
216
219
  onKeyDown: (e) => {
217
220
  if (e.target === e.currentTarget) {
218
- if (te(e)) {
221
+ if (ne(e)) {
219
222
  e.preventDefault();
220
223
  return;
221
224
  }
222
- O(e) && (e.preventDefault(), e.currentTarget.click());
225
+ D(e) && (e.preventDefault(), e.currentTarget.click());
223
226
  }
224
227
  }
225
228
  };
226
- (N || V) && ($.onClick = (e) => {
227
- E(e) && (N?.(), V?.dismiss(Je));
229
+ (M || B) && ($.onClick = (e) => {
230
+ T(e) && (M?.(), B?.dismiss(Je));
228
231
  });
229
- let ht = Qe ? S($, Qe) : $, gt = /* @__PURE__ */ A("span", {
230
- id: Ve,
231
- ref: We,
232
+ let ht = Qe ? ee($, Qe) : $, gt = /* @__PURE__ */ k("span", {
233
+ id: He,
234
+ ref: Ge,
232
235
  className: e(d.primaryText, "inline-flex items-center gap-1", ct && "text-caption-1 leading-3.5"),
233
- children: F
236
+ children: P
234
237
  });
235
- return /* @__PURE__ */ j(B, {
236
- "data-size": U,
237
- "data-appearance": W,
238
- "data-shape": Ke,
238
+ return /* @__PURE__ */ A(z, {
239
+ "data-size": H,
240
+ "data-appearance": U,
241
+ "data-shape": W,
239
242
  "data-selected": x ? "" : void 0,
240
243
  "data-disabled": G ? "" : void 0,
241
244
  "data-wave-tag-item": "",
242
- role: Ee ?? dt,
243
- hidden: ft || I,
244
- ...Be,
245
+ role: De ?? dt,
246
+ hidden: ft || F,
247
+ ...Ve,
245
248
  ...Q,
246
- ref: Ue,
247
- className: e(d.root, ue, Se[U], Ce[U][at ? "media" : ot ? "icon" : "text"], ve[U][K ? "dismiss" : "text"], q === "selected" ? [fe, g.selectedContainer] : me[W], G && [qe && "opacity-50 focus-visible:opacity-100 has-focus-visible:opacity-100", g.disabled], xe[Ke], Te),
249
+ ref: We,
250
+ className: e(d.root, de, Ce[H], we[H][at ? "media" : ot ? "icon" : "text"], ye[H][K ? "dismiss" : "text"], q === "selected" ? [pe, g.selectedContainer] : he[U], G && [qe && "opacity-50 focus-visible:opacity-100 has-focus-visible:opacity-100", g.disabled], Se[W], Ee),
248
251
  onClick: pt,
249
- onKeyDown: u(Re, mt),
250
- onFocus: u(z, J.onFocus, { checkDefaultPrevented: !1 }),
251
- onBlur: u(Le, J.onBlur, { checkDefaultPrevented: !1 }),
252
+ onKeyDown: u(ze, mt),
253
+ onFocus: u(R, J.onFocus, { checkDefaultPrevented: !1 }),
254
+ onBlur: u(Re, J.onBlur, { checkDefaultPrevented: !1 }),
252
255
  children: [
253
- at && /* @__PURE__ */ A(oe.Provider, {
256
+ at && /* @__PURE__ */ k(se.Provider, {
254
257
  value: lt,
255
- children: s(w, "span", e(d.media, be[U]))
258
+ children: s(C, "span", e(d.media, xe[H]))
256
259
  }),
257
- ot && s(T, "span", e(d.icon, ye[U]), { "aria-hidden": !0 }),
258
- ct ? /* @__PURE__ */ j("span", {
259
- className: pe,
260
- children: [gt, /* @__PURE__ */ A("span", {
261
- className: e(d.secondaryText, de),
260
+ ot && s(w, "span", e(d.icon, be[H]), { "aria-hidden": !0 }),
261
+ ct ? /* @__PURE__ */ A("span", {
262
+ className: me,
263
+ children: [gt, /* @__PURE__ */ k("span", {
264
+ className: e(d.secondaryText, fe),
262
265
  children: st
263
266
  })]
264
267
  }) : gt,
265
- K && /* @__PURE__ */ A(je, {
268
+ K && /* @__PURE__ */ k(Me, {
266
269
  buttonProps: ht,
267
270
  content: $e,
268
271
  contentMayName: tt,
269
272
  literalTextLabel: nt,
270
273
  disabledFocusable: rt,
271
274
  disabled: G,
272
- dismissLabel: we,
273
- contentId: Ve,
274
- dismissName: He?.dismissName,
275
- buttonRef: Ge
275
+ dismissLabel: Te,
276
+ contentId: He,
277
+ dismissName: Ue?.dismissName,
278
+ buttonRef: Ke
276
279
  })
277
280
  ]
278
281
  });
279
282
  };
280
- z.displayName = "Tag";
283
+ R.displayName = "Tag";
281
284
  //#endregion
282
- export { z as Tag };
285
+ export { R as Tag };
283
286
 
284
287
  //# sourceMappingURL=Tag.mjs.map