@mortenbrudvik/waveui 0.11.0 → 0.13.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.
- package/README.md +157 -13
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.colors.cjs +2 -0
- package/dist/components/data-display/Avatar.colors.cjs.map +1 -0
- package/dist/components/data-display/Avatar.colors.mjs +45 -0
- package/dist/components/data-display/Avatar.colors.mjs.map +1 -0
- package/dist/components/data-display/Avatar.context.cjs +1 -1
- package/dist/components/data-display/Avatar.context.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.mjs +4 -2
- package/dist/components/data-display/Avatar.context.mjs.map +1 -1
- package/dist/components/data-display/Avatar.mjs +103 -96
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/Avatar.sizes.cjs +2 -0
- package/dist/components/data-display/Avatar.sizes.cjs.map +1 -0
- package/dist/components/data-display/Avatar.sizes.mjs +41 -0
- package/dist/components/data-display/Avatar.sizes.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.context.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.context.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.context.mjs +9 -0
- package/dist/components/data-display/AvatarGroup.context.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.mjs +65 -122
- package/dist/components/data-display/AvatarGroup.mjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.partition.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.partition.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs +14 -0
- package/dist/components/data-display/AvatarGroup.partition.mjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs +2 -0
- package/dist/components/data-display/AvatarGroup.parts.cjs.map +1 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs +178 -0
- package/dist/components/data-display/AvatarGroup.parts.mjs.map +1 -0
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/data-display/InteractionTag.cjs +1 -1
- package/dist/components/data-display/InteractionTag.cjs.map +1 -1
- package/dist/components/data-display/InteractionTag.mjs +36 -33
- package/dist/components/data-display/InteractionTag.mjs.map +1 -1
- package/dist/components/data-display/Persona.cjs +1 -1
- package/dist/components/data-display/Persona.cjs.map +1 -1
- package/dist/components/data-display/Persona.mjs +96 -37
- package/dist/components/data-display/Persona.mjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.cjs +1 -1
- package/dist/components/data-display/PresenceBadge.cjs.map +1 -1
- package/dist/components/data-display/PresenceBadge.mjs +42 -28
- package/dist/components/data-display/PresenceBadge.mjs.map +1 -1
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +111 -108
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +235 -235
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +176 -175
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +188 -187
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +89 -87
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/TagPicker.root.cjs +1 -1
- package/dist/components/input/TagPicker.root.cjs.map +1 -1
- package/dist/components/input/TagPicker.root.mjs +136 -135
- package/dist/components/input/TagPicker.root.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +156 -154
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/layout/Card.cjs +1 -1
- package/dist/components/layout/Card.cjs.map +1 -1
- package/dist/components/layout/Card.context.cjs +2 -0
- package/dist/components/layout/Card.context.cjs.map +1 -0
- package/dist/components/layout/Card.context.mjs +14 -0
- package/dist/components/layout/Card.context.mjs.map +1 -0
- package/dist/components/layout/Card.mjs +138 -92
- package/dist/components/layout/Card.mjs.map +1 -1
- package/dist/components/layout/Card.preview.cjs +2 -0
- package/dist/components/layout/Card.preview.cjs.map +1 -0
- package/dist/components/layout/Card.preview.mjs +22 -0
- package/dist/components/layout/Card.preview.mjs.map +1 -0
- package/dist/components/layout/Carousel.button.cjs +2 -0
- package/dist/components/layout/Carousel.button.cjs.map +1 -0
- package/dist/components/layout/Carousel.button.mjs +34 -0
- package/dist/components/layout/Carousel.button.mjs.map +1 -0
- package/dist/components/layout/Carousel.cjs +1 -1
- package/dist/components/layout/Carousel.cjs.map +1 -1
- package/dist/components/layout/Carousel.context.cjs +2 -0
- package/dist/components/layout/Carousel.context.cjs.map +1 -0
- package/dist/components/layout/Carousel.context.mjs +24 -0
- package/dist/components/layout/Carousel.context.mjs.map +1 -0
- package/dist/components/layout/Carousel.drag.cjs +2 -0
- package/dist/components/layout/Carousel.drag.cjs.map +1 -0
- package/dist/components/layout/Carousel.drag.mjs +79 -0
- package/dist/components/layout/Carousel.drag.mjs.map +1 -0
- package/dist/components/layout/Carousel.groups.cjs +2 -0
- package/dist/components/layout/Carousel.groups.cjs.map +1 -0
- package/dist/components/layout/Carousel.groups.mjs +23 -0
- package/dist/components/layout/Carousel.groups.mjs.map +1 -0
- package/dist/components/layout/Carousel.mjs +288 -150
- package/dist/components/layout/Carousel.mjs.map +1 -1
- package/dist/components/layout/Carousel.styles.cjs +2 -0
- package/dist/components/layout/Carousel.styles.cjs.map +1 -0
- package/dist/components/layout/Carousel.styles.mjs +30 -0
- package/dist/components/layout/Carousel.styles.mjs.map +1 -0
- package/dist/components/layout/TabList.cjs +1 -1
- package/dist/components/layout/TabList.cjs.map +1 -1
- package/dist/components/layout/TabList.mjs +163 -124
- package/dist/components/layout/TabList.mjs.map +1 -1
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +4 -4
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +123 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +12 -12
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +4 -4
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +142 -107
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1364 -66
- package/dist/index.d.ts +1364 -66
- package/dist/index.mjs +132 -115
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +112 -92
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/initials.cjs +2 -0
- package/dist/lib/initials.cjs.map +1 -0
- package/dist/lib/initials.mjs +21 -0
- package/dist/lib/initials.mjs.map +1 -0
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +112 -109
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- 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
|
|
16
|
-
import { hasRenderedTextLabel as
|
|
17
|
-
import { isEditableTarget as
|
|
18
|
-
import { TagHostContext as
|
|
19
|
-
import { AvatarSizeContext as
|
|
20
|
-
import { TAG_AVATAR_SIZE as
|
|
21
|
-
import * as
|
|
22
|
-
import { jsx as
|
|
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
|
|
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
|
-
]),
|
|
37
|
-
function
|
|
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))
|
|
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
|
|
46
|
-
function
|
|
47
|
-
if (typeof e != "object" || !e ||
|
|
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
|
|
52
|
-
return /* @__PURE__ */
|
|
51
|
+
function F(e, t) {
|
|
52
|
+
return /* @__PURE__ */ k(x, {
|
|
53
53
|
size: e,
|
|
54
54
|
className: t
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Oe(n, r) {
|
|
58
58
|
if (!c(n)) return {
|
|
59
59
|
buttonProps: null,
|
|
60
|
-
content:
|
|
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 (
|
|
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 } =
|
|
75
|
-
className:
|
|
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) :
|
|
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:
|
|
84
|
+
literalTextLabel: C(y),
|
|
85
85
|
disabledFocusable: u && !!l.disabledFocusable
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
let t = n.as === _, i = n.as === "button" || t || Object.keys(n).some((e) =>
|
|
90
|
-
for (let [e, r] of Object.entries(n)) e === "as" ? r !== "button" && !t && (u.as = r) : t && v.has(e) ? f[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,
|
|
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,
|
|
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,
|
|
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
|
|
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
|
-
]),
|
|
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
|
-
]),
|
|
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
|
|
136
|
+
function L(e, t) {
|
|
137
137
|
return typeof e == "string" && Object.hasOwn(t, e);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function je(e) {
|
|
140
140
|
e.preventDefault(), e.stopPropagation();
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
let d = p("tag-dismiss"), f = p("tag-dismiss-text"), { ref: h, ...g } = e, _ =
|
|
144
|
-
|
|
145
|
-
let [b, x] =
|
|
146
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
151
|
-
"aria-label":
|
|
152
|
-
"aria-labelledby":
|
|
153
|
-
onFocus: u(g.onFocus,
|
|
154
|
-
onBlur: u(g.onBlur,
|
|
155
|
-
children: [!
|
|
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__ */
|
|
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
|
-
|
|
168
|
-
var
|
|
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
|
-
]),
|
|
176
|
-
function
|
|
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
|
|
181
|
-
let { as: l, appearance: _, size: v, shape: y, disabled: b, selected: x = !1, value:
|
|
182
|
-
|
|
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 =
|
|
186
|
-
|
|
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]),
|
|
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]),
|
|
190
|
+
}, [et]), O.useEffect(() => {
|
|
191
191
|
if (!K || !r || n("Tag:nested-button")) return;
|
|
192
|
-
let e =
|
|
193
|
-
e === "button" ? a("Tag:nested-button",
|
|
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 =
|
|
196
|
-
|
|
195
|
+
let it = B?.mode === "list";
|
|
196
|
+
O.useEffect(() => {
|
|
197
197
|
if (!it || !r || n("TagGroup:list-item")) return;
|
|
198
|
-
let e =
|
|
199
|
-
e && !
|
|
198
|
+
let e = V.current;
|
|
199
|
+
e && !Le(e) && a("TagGroup:list-item", Ie);
|
|
200
200
|
});
|
|
201
|
-
let at = c(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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,
|
|
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
|
-
|
|
215
|
-
], h,
|
|
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 (
|
|
221
|
+
if (ne(e)) {
|
|
219
222
|
e.preventDefault();
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
222
|
-
|
|
225
|
+
D(e) && (e.preventDefault(), e.currentTarget.click());
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
228
|
};
|
|
226
|
-
(
|
|
227
|
-
|
|
229
|
+
(M || B) && ($.onClick = (e) => {
|
|
230
|
+
T(e) && (M?.(), B?.dismiss(Je));
|
|
228
231
|
});
|
|
229
|
-
let ht = Qe ?
|
|
230
|
-
id:
|
|
231
|
-
ref:
|
|
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:
|
|
236
|
+
children: P
|
|
234
237
|
});
|
|
235
|
-
return /* @__PURE__ */
|
|
236
|
-
"data-size":
|
|
237
|
-
"data-appearance":
|
|
238
|
-
"data-shape":
|
|
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:
|
|
243
|
-
hidden: ft ||
|
|
244
|
-
...
|
|
245
|
+
role: De ?? dt,
|
|
246
|
+
hidden: ft || F,
|
|
247
|
+
...Ve,
|
|
245
248
|
...Q,
|
|
246
|
-
ref:
|
|
247
|
-
className: e(d.root,
|
|
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(
|
|
250
|
-
onFocus: u(
|
|
251
|
-
onBlur: u(
|
|
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__ */
|
|
256
|
+
at && /* @__PURE__ */ k(se.Provider, {
|
|
254
257
|
value: lt,
|
|
255
|
-
children: s(
|
|
258
|
+
children: s(C, "span", e(d.media, xe[H]))
|
|
256
259
|
}),
|
|
257
|
-
ot && s(
|
|
258
|
-
ct ? /* @__PURE__ */
|
|
259
|
-
className:
|
|
260
|
-
children: [gt, /* @__PURE__ */
|
|
261
|
-
className: e(d.secondaryText,
|
|
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__ */
|
|
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:
|
|
273
|
-
contentId:
|
|
274
|
-
dismissName:
|
|
275
|
-
buttonRef:
|
|
275
|
+
dismissLabel: Te,
|
|
276
|
+
contentId: He,
|
|
277
|
+
dismissName: Ue?.dismissName,
|
|
278
|
+
buttonRef: Ke
|
|
276
279
|
})
|
|
277
280
|
]
|
|
278
281
|
});
|
|
279
282
|
};
|
|
280
|
-
|
|
283
|
+
R.displayName = "Tag";
|
|
281
284
|
//#endregion
|
|
282
|
-
export {
|
|
285
|
+
export { R as Tag };
|
|
283
286
|
|
|
284
287
|
//# sourceMappingURL=Tag.mjs.map
|