@purpurds/listbox 5.27.3 → 5.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LICENSE.txt +2 -2
- package/dist/listbox.cjs.js +4 -4
- package/dist/listbox.cjs.js.map +1 -1
- package/dist/listbox.es.js +54 -45
- package/dist/listbox.es.js.map +1 -1
- package/package.json +4 -4
- package/src/listbox.stories.tsx +1 -0
package/dist/listbox.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { forwardRef as g, isValidElement as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as s, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as g, isValidElement as S, Children as I } from "react";
|
|
3
|
+
function L(t) {
|
|
4
4
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
5
5
|
}
|
|
6
6
|
var f = { exports: {} };
|
|
@@ -39,8 +39,8 @@ var f = { exports: {} };
|
|
|
39
39
|
t.exports ? (a.default = a, t.exports = a) : window.classNames = a;
|
|
40
40
|
})();
|
|
41
41
|
})(f);
|
|
42
|
-
var
|
|
43
|
-
const v = /* @__PURE__ */
|
|
42
|
+
var R = f.exports;
|
|
43
|
+
const v = /* @__PURE__ */ L(R), b = {
|
|
44
44
|
"purpur-listbox": "_purpur-listbox_qhoi7_1",
|
|
45
45
|
"purpur-listbox-item": "_purpur-listbox-item_qhoi7_15",
|
|
46
46
|
"purpur-listbox-item--hovered": "_purpur-listbox-item--hovered_qhoi7_29",
|
|
@@ -49,7 +49,7 @@ const v = /* @__PURE__ */ P(L), b = {
|
|
|
49
49
|
"purpur-listbox-item--disabled": "_purpur-listbox-item--disabled_qhoi7_44",
|
|
50
50
|
"purpur-listbox-item__icon": "_purpur-listbox-item__icon_qhoi7_51"
|
|
51
51
|
};
|
|
52
|
-
function
|
|
52
|
+
function j(t) {
|
|
53
53
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
54
54
|
}
|
|
55
55
|
var x = { exports: {} };
|
|
@@ -88,8 +88,8 @@ var x = { exports: {} };
|
|
|
88
88
|
t.exports ? (a.default = a, t.exports = a) : window.classNames = a;
|
|
89
89
|
})();
|
|
90
90
|
})(x);
|
|
91
|
-
var
|
|
92
|
-
const
|
|
91
|
+
var q = x.exports;
|
|
92
|
+
const E = /* @__PURE__ */ j(q), M = {
|
|
93
93
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
94
94
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
95
95
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -97,28 +97,28 @@ const k = /* @__PURE__ */ I(C), H = {
|
|
|
97
97
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
98
98
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
99
99
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
100
|
-
},
|
|
100
|
+
}, D = {
|
|
101
101
|
name: "checkmark",
|
|
102
102
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M21.06 3.795a.9.9 0 0 1 .145 1.264l-11.5 14.5a.9.9 0 0 1-1.341.077l-6-6a.9.9 0 0 1 1.272-1.272l5.286 5.286L19.795 3.94a.9.9 0 0 1 1.264-.145Z" clip-rule="evenodd"/></svg>',
|
|
103
103
|
keywords: ["checkmark"],
|
|
104
104
|
category: "utility"
|
|
105
105
|
}, y = (t) => /* @__PURE__ */ s(
|
|
106
|
-
|
|
106
|
+
A,
|
|
107
107
|
{
|
|
108
108
|
...t,
|
|
109
|
-
svg:
|
|
109
|
+
svg: D
|
|
110
110
|
}
|
|
111
111
|
);
|
|
112
112
|
y.displayName = "IconCheckmark";
|
|
113
|
-
const
|
|
113
|
+
const H = E.bind(M), _ = "purpur-icon", B = "md", C = (t) => t.filter((i) => Object.keys(i).length >= 1).map((i) => `${i.name}="${i.value}"`).join(" "), k = ({ content: t = "", title: i } = {}) => {
|
|
114
114
|
const a = [
|
|
115
115
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
116
116
|
{ name: "fill", value: "currentColor" },
|
|
117
117
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
118
118
|
i ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
119
119
|
], u = i ? `<title>${i}</title>` : "";
|
|
120
|
-
return `<svg ${
|
|
121
|
-
}, G = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(),
|
|
120
|
+
return `<svg ${C(a)}>${u}${t}</svg>`;
|
|
121
|
+
}, G = (t) => t.replace(/<(\/?)svg([^>]*)>/g, "").trim(), A = ({
|
|
122
122
|
["data-testid"]: t,
|
|
123
123
|
svg: i,
|
|
124
124
|
allyTitle: a,
|
|
@@ -126,10 +126,10 @@ const R = k.bind(H), _ = "purpur-icon", B = "md", E = (t) => t.filter((i) => Obj
|
|
|
126
126
|
size: n = B,
|
|
127
127
|
...r
|
|
128
128
|
}) => {
|
|
129
|
-
const e =
|
|
129
|
+
const e = k({
|
|
130
130
|
content: G(i.svg),
|
|
131
131
|
title: a
|
|
132
|
-
}), p =
|
|
132
|
+
}), p = H(u, _, `${_}--${n}`);
|
|
133
133
|
return /* @__PURE__ */ s(
|
|
134
134
|
"span",
|
|
135
135
|
{
|
|
@@ -141,11 +141,11 @@ const R = k.bind(H), _ = "purpur-icon", B = "md", E = (t) => t.filter((i) => Obj
|
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
143
|
};
|
|
144
|
-
|
|
144
|
+
A.displayName = "Icon";
|
|
145
145
|
function T(t) {
|
|
146
146
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
147
147
|
}
|
|
148
|
-
var
|
|
148
|
+
var N = { exports: {} };
|
|
149
149
|
/*!
|
|
150
150
|
Copyright (c) 2018 Jed Watson.
|
|
151
151
|
Licensed under the MIT License (MIT), see
|
|
@@ -180,9 +180,9 @@ var w = { exports: {} };
|
|
|
180
180
|
}
|
|
181
181
|
t.exports ? (a.default = a, t.exports = a) : window.classNames = a;
|
|
182
182
|
})();
|
|
183
|
-
})(
|
|
184
|
-
var V =
|
|
185
|
-
const
|
|
183
|
+
})(N);
|
|
184
|
+
var V = N.exports;
|
|
185
|
+
const z = /* @__PURE__ */ T(V), l = {
|
|
186
186
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
187
187
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
188
188
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -197,73 +197,82 @@ const D = /* @__PURE__ */ T(V), l = {
|
|
|
197
197
|
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_1rh57_60",
|
|
198
198
|
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_1rh57_67",
|
|
199
199
|
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_1rh57_75"
|
|
200
|
-
},
|
|
201
|
-
PARAGRAPH100: "paragraph-100"
|
|
202
|
-
|
|
200
|
+
}, U = {
|
|
201
|
+
PARAGRAPH100: "paragraph-100",
|
|
202
|
+
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
203
|
+
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
204
|
+
PARAGRAPH200: "paragraph-200",
|
|
205
|
+
PREAMBLE100: "preamble-100",
|
|
206
|
+
PREAMBLE200: "preamble-200",
|
|
207
|
+
ADDITIONAL100: "additional-100",
|
|
208
|
+
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
209
|
+
OVERLINE100: "overline-100",
|
|
210
|
+
OVERLINE200: "overline-200"
|
|
211
|
+
}, h = "purpur-paragraph", $ = ({
|
|
203
212
|
["data-testid"]: t,
|
|
204
213
|
children: i,
|
|
205
214
|
className: a,
|
|
206
215
|
disabled: u,
|
|
207
216
|
enableHyphenation: n = !1,
|
|
208
217
|
negative: r = !1,
|
|
209
|
-
variant: e =
|
|
218
|
+
variant: e = U.PARAGRAPH100,
|
|
210
219
|
...p
|
|
211
220
|
}) => {
|
|
212
|
-
const
|
|
221
|
+
const c = z([
|
|
213
222
|
a,
|
|
214
|
-
l[
|
|
215
|
-
l[`${
|
|
223
|
+
l[h],
|
|
224
|
+
l[`${h}--${e}`],
|
|
216
225
|
{
|
|
217
|
-
[l[`${
|
|
218
|
-
[l[`${
|
|
219
|
-
[l[`${
|
|
226
|
+
[l[`${h}--hyphens`]]: n,
|
|
227
|
+
[l[`${h}--disabled`]]: u,
|
|
228
|
+
[l[`${h}--negative`]]: r
|
|
220
229
|
}
|
|
221
230
|
]);
|
|
222
|
-
return /* @__PURE__ */ s("p", { ...p, className:
|
|
231
|
+
return /* @__PURE__ */ s("p", { ...p, className: c, "data-testid": t, children: i });
|
|
223
232
|
};
|
|
224
|
-
|
|
233
|
+
$.displayName = "Paragraph";
|
|
225
234
|
const m = v.bind(b), o = "purpur-listbox", d = g(
|
|
226
235
|
(t, i) => {
|
|
227
|
-
const { disabled: a, highlighted: u, hovered: n, selected: r, children: e, noninteractive: p, ...
|
|
236
|
+
const { disabled: a, highlighted: u, hovered: n, selected: r, children: e, noninteractive: p, ...c } = t, O = m(`${o}-item`, c.className, {
|
|
228
237
|
[`${o}-item--highlighted`]: u,
|
|
229
238
|
[`${o}-item--selected`]: r,
|
|
230
239
|
[`${o}-item--hovered`]: n,
|
|
231
240
|
[`${o}-item--disabled`]: a,
|
|
232
241
|
[`${o}-item--noninteractive`]: p
|
|
233
242
|
});
|
|
234
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ P(
|
|
235
244
|
"li",
|
|
236
245
|
{
|
|
237
|
-
...
|
|
246
|
+
...c,
|
|
238
247
|
ref: i,
|
|
239
|
-
className:
|
|
248
|
+
className: O,
|
|
240
249
|
"aria-selected": !!r,
|
|
241
250
|
role: "option",
|
|
242
251
|
"aria-disabled": !!a,
|
|
243
252
|
children: [
|
|
244
|
-
typeof e == "string" ? /* @__PURE__ */ s(
|
|
253
|
+
typeof e == "string" ? /* @__PURE__ */ s($, { children: e }) : e,
|
|
245
254
|
r && /* @__PURE__ */ s(y, { size: "xs", className: m(`${o}-item__icon`) })
|
|
246
255
|
]
|
|
247
256
|
}
|
|
248
257
|
);
|
|
249
258
|
}
|
|
250
|
-
),
|
|
259
|
+
), F = (t) => S(t) && (t == null ? void 0 : t.type) === d;
|
|
251
260
|
d.displayName = "ListBoxItem";
|
|
252
|
-
const
|
|
261
|
+
const J = v.bind(b), X = "purpur-listbox", w = g(
|
|
253
262
|
({ children: t, ...i }, a) => /* @__PURE__ */ s(
|
|
254
263
|
"ul",
|
|
255
264
|
{
|
|
256
265
|
...i,
|
|
257
266
|
ref: a,
|
|
258
|
-
className: X
|
|
267
|
+
className: J(X, i.className),
|
|
259
268
|
role: "listbox",
|
|
260
|
-
children:
|
|
269
|
+
children: I.toArray(t).filter(F)
|
|
261
270
|
}
|
|
262
271
|
)
|
|
263
272
|
);
|
|
264
|
-
|
|
265
|
-
|
|
273
|
+
w.Item = d;
|
|
274
|
+
w.displayName = "ListBox";
|
|
266
275
|
export {
|
|
267
|
-
|
|
276
|
+
w as Listbox
|
|
268
277
|
};
|
|
269
278
|
//# sourceMappingURL=listbox.es.js.map
|