@solibo/solibo-ui 1.0.14 → 1.0.16
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/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +0 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -0
- package/dist/assets/index22.css +1 -1
- package/dist/assets/index23.css +1 -1
- package/dist/assets/index24.css +1 -1
- package/dist/assets/index25.css +1 -1
- package/dist/assets/index26.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +1 -1
- package/dist/assets/menu-popover.css +1 -0
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.js +8 -8
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +11 -11
- package/dist/components/avatar/index.cjs +1 -1
- package/dist/components/avatar/index.cjs.map +1 -1
- package/dist/components/avatar/index.js +58 -58
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +27 -27
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +14 -14
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +18 -18
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.js +46 -46
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +7 -7
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.cjs.map +1 -1
- package/dist/components/chip/index.js +27 -26
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.cjs.map +1 -1
- package/dist/components/collapsible/index.js +18 -37
- package/dist/components/collapsible/index.js.map +1 -1
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.cjs.map +1 -1
- package/dist/components/controls/index.js +128 -36
- package/dist/components/controls/index.js.map +1 -1
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +181 -181
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +31 -31
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.cjs.map +1 -1
- package/dist/components/dropdown/index.js +113 -110
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +16 -16
- package/dist/components/editor/index.cjs.map +1 -1
- package/dist/components/editor/index.js +197 -197
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.js +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.cjs.map +1 -1
- package/dist/components/file/index.js +38 -34
- package/dist/components/file/index.js.map +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +1 -1
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +1 -1
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +1 -1
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.cjs.map +1 -1
- package/dist/components/header/index.js +14 -14
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +20 -20
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.js +1 -1
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +3 -3
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.cjs.map +1 -1
- package/dist/components/list/index.js +39 -36
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +11 -11
- package/dist/components/menu/index.cjs +1 -1
- package/dist/components/menu/index.cjs.map +1 -1
- package/dist/components/menu/index.js +37 -87
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.cjs.map +1 -1
- package/dist/components/message/index.js +26 -26
- package/dist/components/messages/index.cjs +1 -1
- package/dist/components/messages/index.js +20 -20
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +25 -25
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.cjs.map +1 -1
- package/dist/components/popover/index.js +56 -60
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/portal/index.cjs +1 -1
- package/dist/components/portal/index.js +7 -7
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.cjs.map +1 -1
- package/dist/components/search/index.js +43 -45
- package/dist/components/search/index.js.map +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +3 -3
- package/dist/components/sortable/index.cjs +1 -1
- package/dist/components/sortable/index.js +74 -74
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.cjs.map +1 -1
- package/dist/components/textarea/index.js +24 -20
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/toasts/index.cjs +1 -1
- package/dist/components/toasts/index.js +4 -4
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +6 -6
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +1 -1
- package/dist/components/tooltip/index.cjs +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/icons-DaZGJzI0.cjs +2 -0
- package/dist/icons-DaZGJzI0.cjs.map +1 -0
- package/dist/{icons-Bq3diTRm.js → icons-Dj0vEOCB.js} +2 -1
- package/dist/icons-Dj0vEOCB.js.map +1 -0
- package/dist/index-BIV5OwVJ.js +76 -0
- package/dist/index-BIV5OwVJ.js.map +1 -0
- package/dist/index-CQNlYa2P.cjs +2 -0
- package/dist/index-CQNlYa2P.cjs.map +1 -0
- package/dist/{index-DwzLUapm.js → index-CgA0NUMD.js} +35 -33
- package/dist/index-CgA0NUMD.js.map +1 -0
- package/dist/index-Dn1v0qm6.cjs +2 -0
- package/dist/index-Dn1v0qm6.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +32 -9
- package/dist/index.js +2 -2
- package/dist/menu-popover-D1ALaiV5.cjs +2 -0
- package/dist/menu-popover-D1ALaiV5.cjs.map +1 -0
- package/dist/menu-popover-DQHDIw-8.js +74 -0
- package/dist/menu-popover-DQHDIw-8.js.map +1 -0
- package/dist/tokens.json +1 -1
- package/dist/use-touched-B999bBr8.js +20 -0
- package/dist/use-touched-B999bBr8.js.map +1 -0
- package/dist/use-touched-Bq5Gjbpz.cjs +2 -0
- package/dist/use-touched-Bq5Gjbpz.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/assets/index52.css +0 -1
- package/dist/icons-Bq3diTRm.js.map +0 -1
- package/dist/icons-ovA21Oao.cjs +0 -2
- package/dist/icons-ovA21Oao.cjs.map +0 -1
- package/dist/index-BcY9DZZ8.cjs +0 -2
- package/dist/index-BcY9DZZ8.cjs.map +0 -1
- package/dist/index-CjI8oRpS.cjs +0 -2
- package/dist/index-CjI8oRpS.cjs.map +0 -1
- package/dist/index-ClZkChEh.js +0 -73
- package/dist/index-ClZkChEh.js.map +0 -1
- package/dist/index-DwzLUapm.js.map +0 -1
- package/dist/use-touched-DXIJVVzz.js +0 -14
- package/dist/use-touched-DXIJVVzz.js.map +0 -1
- package/dist/use-touched-D_TJ8wDc.cjs +0 -2
- package/dist/use-touched-D_TJ8wDc.cjs.map +0 -1
|
@@ -1,72 +1,74 @@
|
|
|
1
1
|
import { jsxs as m, jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import { t as
|
|
3
|
-
import { i as
|
|
4
|
-
import { u as
|
|
5
|
-
import './assets/
|
|
6
|
-
function
|
|
7
|
-
return Object.fromEntries(Object.entries(n).filter(([e]) => e.startsWith("data-") || e.startsWith("aria-") ||
|
|
2
|
+
import { t as v } from "./classix-DG18itHa.js";
|
|
3
|
+
import { i as w } from "./icons-Dj0vEOCB.js";
|
|
4
|
+
import { u as C, c as S } from "./use-touched-B999bBr8.js";
|
|
5
|
+
import './assets/index50.css';const P = /* @__PURE__ */ new Set(["aria-activedescendant", "aria-autocomplete", "aria-busy", "aria-controls", "aria-describedby", "aria-details", "aria-disabled", "aria-errormessage", "aria-expanded", "aria-haspopup", "aria-hidden", "aria-invalid", "aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-live", "aria-owns", "aria-required", "aria-roledescription", "autoComplete", "autoFocus", "className", "defaultValue", "dir", "disabled", "form", "id", "multiple", "name", "onBlur", "onChange", "onClick", "onFocus", "onInput", "onInvalid", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", "required", "role", "size", "style", "tabIndex", "title", "value"]);
|
|
6
|
+
function _(n) {
|
|
7
|
+
return Object.fromEntries(Object.entries(n).filter(([e]) => e.startsWith("data-") || e.startsWith("aria-") || P.has(e)));
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const x = /^--[\w-]+$/, V = /^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/, g = /* @__PURE__ */ new Set(["currentcolor", "inherit", "initial", "revert", "revert-layer", "unset"]), l = typeof document < "u" ? document.createElement("span") : null;
|
|
10
10
|
function h(n) {
|
|
11
11
|
const e = n.trim();
|
|
12
|
-
if (!e || !l ||
|
|
12
|
+
if (!e || !l || g.has(e.toLowerCase()))
|
|
13
13
|
return e;
|
|
14
14
|
const a = document.body ?? document.documentElement;
|
|
15
15
|
if (!a || (l.style.color = e, !l.style.color))
|
|
16
16
|
return e;
|
|
17
17
|
a.appendChild(l);
|
|
18
|
-
const
|
|
19
|
-
return l.remove(),
|
|
18
|
+
const o = getComputedStyle(l).color.trim();
|
|
19
|
+
return l.remove(), o || e;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function E(n, e = "currentColor") {
|
|
22
22
|
var i;
|
|
23
23
|
if (typeof document > "u")
|
|
24
24
|
return e;
|
|
25
|
-
const a = getComputedStyle(document.documentElement),
|
|
25
|
+
const a = getComputedStyle(document.documentElement), o = /* @__PURE__ */ new Set();
|
|
26
26
|
let t = n.trim();
|
|
27
27
|
for (; t; ) {
|
|
28
|
-
const
|
|
28
|
+
const r = t.match(V), s = (r == null ? void 0 : r[1]) ?? (x.test(t) ? t : null), c = (i = r == null ? void 0 : r[2]) == null ? void 0 : i.trim();
|
|
29
29
|
if (!s)
|
|
30
30
|
return h(t);
|
|
31
|
-
if (
|
|
31
|
+
if (o.has(s)) {
|
|
32
32
|
t = c ?? "";
|
|
33
33
|
continue;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
o.add(s), t = a.getPropertyValue(s).trim() || c || "";
|
|
36
36
|
}
|
|
37
37
|
return h(e);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
select:
|
|
41
|
-
touched:
|
|
42
|
-
label:
|
|
43
|
-
},
|
|
39
|
+
const N = "_select_1n2ax_3", B = "_touched_1n2ax_23", j = "_label_1n2ax_28", u = {
|
|
40
|
+
select: N,
|
|
41
|
+
touched: B,
|
|
42
|
+
label: j
|
|
43
|
+
}, F = ({
|
|
44
44
|
children: n,
|
|
45
45
|
label: e,
|
|
46
46
|
placeholder: a,
|
|
47
|
-
...
|
|
47
|
+
...o
|
|
48
48
|
}) => {
|
|
49
49
|
const {
|
|
50
50
|
touched: t,
|
|
51
51
|
onBlur: i
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
...
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
} = C(o.value === ""), r = _(o), {
|
|
53
|
+
className: s,
|
|
54
|
+
onBlur: c,
|
|
55
|
+
style: f,
|
|
56
|
+
...y
|
|
57
|
+
} = r, b = {
|
|
58
|
+
...f,
|
|
59
|
+
"--icon-svg": w("chevron").replace("currentColor", E("--colors-semantic-content-secondary"))
|
|
60
|
+
}, d = /* @__PURE__ */ m("select", { className: v(u.select, s, t && u.touched), onBlur: S(i, c), style: b, ...y, children: [
|
|
59
61
|
a && /* @__PURE__ */ p("option", { value: "", hidden: !0, children: a }, "placeholder"),
|
|
60
62
|
n
|
|
61
63
|
] });
|
|
62
64
|
return e ? /* @__PURE__ */ m("label", { "data-component": "select", children: [
|
|
63
|
-
/* @__PURE__ */ p("span", { className: u.label, "data-required":
|
|
65
|
+
/* @__PURE__ */ p("span", { className: u.label, "data-required": o.required || void 0, children: e }),
|
|
64
66
|
d
|
|
65
67
|
] }) : d;
|
|
66
68
|
};
|
|
67
69
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
F as S,
|
|
71
|
+
E as r,
|
|
72
|
+
_ as s
|
|
71
73
|
};
|
|
72
|
-
//# sourceMappingURL=index-
|
|
74
|
+
//# sourceMappingURL=index-CgA0NUMD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CgA0NUMD.js","sources":["../src/components/select/sanitize-select-props.ts","../src/lib/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { composeEventHandlers } from '@/lib/compose-event-handlers';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { className, onBlur: onBlurProp, style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, className, touched && styles.touched)}\n onBlur={composeEventHandlers(onBlur, onBlurProp)}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","className","onBlurProp","restSelectProps","withVars","iconSVG","replace","selectElement","cx","select","composeEventHandlers","jsxs","jsx","required","undefined"],"mappings":";;;;AAAA,MAAMA,IAAa,oBAAIC,IAAI,CACzB,yBACA,qBACA,aACA,iBACA,oBACA,gBACA,iBACA,qBACA,iBACA,iBACA,eACA,gBACA,qBACA,cACA,mBACA,aACA,aACA,iBACA,wBACA,gBACA,aACA,aACA,gBACA,OACA,YACA,QACA,MACA,YACA,QACA,UACA,YACA,WACA,WACA,WACA,aACA,aACA,WACA,eACA,aACA,iBACA,eACA,YACA,QACA,QACA,SACA,YACA,SACA,OAAO,CACR;AAEM,SAASC,EAAuDC,GAAU;AAC/E,SAAOC,OAAOC,YACZD,OAAOE,QAAQH,CAAK,EAAEI,OACpB,CAAC,CAACC,CAAG,MAAMA,EAAIC,WAAW,OAAO,KAAKD,EAAIC,WAAW,OAAO,KAAKT,EAAWU,IAAIF,CAAG,CACrF,CACF;AACF;ACzDA,MA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A,EAC9E;AAEA,SAAOtB,EAAoBe,CAAQ;AACrC;;;;;GClDaU,IAASA,CAAC;AAAA,EAAEC,UAAAA;AAAAA,EAAUC,OAAAA;AAAAA,EAAOC,aAAAA;AAAAA,EAAa,GAAG1C;AAAmB,MAAM;AACjF,QAAM;AAAA,IAAE2C,SAAAA;AAAAA,IAASC,QAAAA;AAAAA,EAAAA,IAAWC,EAAW7C,EAAMgB,UAAU,EAAE,GACnD8B,IAAc/C,EAAoBC,CAAK,GACvC;AAAA,IAAE+C,WAAAA;AAAAA,IAAWH,QAAQI;AAAAA,IAAY1B,OAAAA;AAAAA,IAAO,GAAG2B;AAAAA,EAAAA,IAAoBH,GAC/DI,IAAW;AAAA,IACf,GAAG5B;AAAAA,IACH,cAAc6B,EAAQ,SAAS,EAAEC,QAC/B,gBACAxB,EAAa,qCAAqC,CACpD;AAAA,EAAA,GAGIyB,sBACH,UAAA,EACC,WAAWC,EAAGxB,EAAOyB,QAAQR,GAAWJ,KAAWb,EAAOa,OAAO,GACjE,QAAQa,EAAqBZ,GAAQI,CAAU,GAC/C,OAAOE,GACP,GAAID,GAEHP,UAAAA;AAAAA,IAAAA,uBACE,UAAA,EAEC,OAAO,IACP,QAAM,IAELA,eAJG,aAKN;AAAA,IAEDF;AAAAA,EAAAA,GACH;AAGF,SAAKC,IAKH,gBAAAgB,EAAC,SAAA,EAAK,kBAAA,UACJ,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EACC,WAAW5B,EAAOW,OAClB,iBAAezC,EAAM2D,YAAYC,QAEhCnB,UAAAA,EAAAA,CACH;AAAA,IACCY;AAAAA,EAAAA,GACH,IAZOA;AAcX;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";require('./assets/index50.css');const u=require("react/jsx-runtime"),C=require("./classix-5H4IWnMA.cjs"),x=require("./icons-DaZGJzI0.cjs"),p=require("./use-touched-Bq5Gjbpz.cjs"),S=new Set(["aria-activedescendant","aria-autocomplete","aria-busy","aria-controls","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-required","aria-roledescription","autoComplete","autoFocus","className","defaultValue","dir","disabled","form","id","multiple","name","onBlur","onChange","onClick","onFocus","onInput","onInvalid","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onPointerDown","onPointerUp","required","role","size","style","tabIndex","title","value"]);function y(o){return Object.fromEntries(Object.entries(o).filter(([e])=>e.startsWith("data-")||e.startsWith("aria-")||S.has(e)))}const P=/^--[\w-]+$/,_=/^var\(\s*(--[\w-]+)\s*(?:,\s*(.+))?\)$/,q=new Set(["currentcolor","inherit","initial","revert","revert-layer","unset"]),l=typeof document<"u"?document.createElement("span"):null;function h(o){const e=o.trim();if(!e||!l||q.has(e.toLowerCase()))return e;const s=document.body??document.documentElement;if(!s||(l.style.color=e,!l.style.color))return e;s.appendChild(l);const n=getComputedStyle(l).color.trim();return l.remove(),n||e}function b(o,e="currentColor"){var c;if(typeof document>"u")return e;const s=getComputedStyle(document.documentElement),n=new Set;let t=o.trim();for(;t;){const r=t.match(_),a=(r==null?void 0:r[1])??(P.test(t)?t:null),i=(c=r==null?void 0:r[2])==null?void 0:c.trim();if(!a)return h(t);if(n.has(a)){t=i??"";continue}n.add(a),t=s.getPropertyValue(a).trim()||i||""}return h(e)}const j="_select_1n2ax_3",V="_touched_1n2ax_23",g="_label_1n2ax_28",d={select:j,touched:V,label:g},E=({children:o,label:e,placeholder:s,...n})=>{const{touched:t,onBlur:c}=p.useTouched(n.value===""),r=y(n),{className:a,onBlur:i,style:v,...f}=r,w={...v,"--icon-svg":x.iconSVG("chevron").replace("currentColor",b("--colors-semantic-content-secondary"))},m=u.jsxs("select",{className:C.t(d.select,a,t&&d.touched),onBlur:p.composeEventHandlers(c,i),style:w,...f,children:[s&&u.jsx("option",{value:"",hidden:!0,children:s},"placeholder"),o]});return e?u.jsxs("label",{"data-component":"select",children:[u.jsx("span",{className:d.label,"data-required":n.required||void 0,children:e}),m]}):m};exports.Select=E;exports.resolveColor=b;exports.sanitizeSelectProps=y;
|
|
2
|
+
//# sourceMappingURL=index-Dn1v0qm6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Dn1v0qm6.cjs","sources":["../src/components/select/sanitize-select-props.ts","../src/lib/color.ts","../src/components/select/index.tsx"],"sourcesContent":["const selectKeys = new Set([\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-busy',\n 'aria-controls',\n 'aria-describedby',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-live',\n 'aria-owns',\n 'aria-required',\n 'aria-roledescription',\n 'autoComplete',\n 'autoFocus',\n 'className',\n 'defaultValue',\n 'dir',\n 'disabled',\n 'form',\n 'id',\n 'multiple',\n 'name',\n 'onBlur',\n 'onChange',\n 'onClick',\n 'onFocus',\n 'onInput',\n 'onInvalid',\n 'onKeyDown',\n 'onKeyUp',\n 'onMouseDown',\n 'onMouseUp',\n 'onPointerDown',\n 'onPointerUp',\n 'required',\n 'role',\n 'size',\n 'style',\n 'tabIndex',\n 'title',\n 'value',\n]);\n\nexport function sanitizeSelectProps<T extends Record<string, unknown>>(props: T) {\n return Object.fromEntries(\n Object.entries(props).filter(\n ([key]) => key.startsWith('data-') || key.startsWith('aria-') || selectKeys.has(key)\n )\n ) as Partial<T>;\n}\n","const cssVariablePattern = /^--[\\w-]+$/;\nconst cssVariableReferencePattern = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*(.+))?\\)$/;\n\nconst unresolvedColorKeywords = new Set([\n 'currentcolor',\n 'inherit',\n 'initial',\n 'revert',\n 'revert-layer',\n 'unset',\n]);\n\nconst probe = typeof document !== 'undefined' ? document.createElement('span') : null;\n\nfunction normalizeColorValue(input: string): string {\n const value = input.trim();\n\n if (!value || !probe || unresolvedColorKeywords.has(value.toLowerCase())) {\n return value;\n }\n\n const mountNode = document.body ?? document.documentElement;\n\n if (!mountNode) {\n return value;\n }\n\n probe.style.color = value;\n\n if (!probe.style.color) {\n return value;\n }\n\n mountNode.appendChild(probe);\n\n const normalized = getComputedStyle(probe).color.trim();\n probe.remove();\n\n return normalized || value;\n}\n\nexport function resolveColor(input: `--${string}` | string, fallback = 'currentColor'): string {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const styles = getComputedStyle(document.documentElement);\n const seen = new Set<string>();\n let current = input.trim();\n\n while (current) {\n const match = current.match(cssVariableReferencePattern);\n const variableName = match?.[1] ?? (cssVariablePattern.test(current) ? current : null);\n const nestedFallback = match?.[2]?.trim();\n\n if (!variableName) {\n return normalizeColorValue(current);\n }\n\n if (seen.has(variableName)) {\n current = nestedFallback ?? '';\n continue;\n }\n\n seen.add(variableName);\n\n current = styles.getPropertyValue(variableName).trim() || nestedFallback || '';\n }\n\n return normalizeColorValue(fallback);\n}\n","import cx from 'classix';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { resolveColor } from '@/lib/color';\nimport { composeEventHandlers } from '@/lib/compose-event-handlers';\nimport { useTouched } from '@/lib/use-touched';\n\nimport { sanitizeSelectProps } from './sanitize-select-props';\nimport styles from './styles.module.css';\n\nexport type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\ntype withVars = React.CSSProperties & {\n '--icon-svg'?: string;\n};\n\nexport const Select = ({ children, label, placeholder, ...props }: SelectProps) => {\n const { touched, onBlur } = useTouched(props.value === '');\n const selectProps = sanitizeSelectProps(props);\n const { className, onBlur: onBlurProp, style, ...restSelectProps } = selectProps;\n const withVars = {\n ...style,\n '--icon-svg': iconSVG('chevron').replace(\n 'currentColor',\n resolveColor('--colors-semantic-content-secondary')\n ),\n } satisfies withVars;\n\n const selectElement = (\n <select\n className={cx(styles.select, className, touched && styles.touched)}\n onBlur={composeEventHandlers(onBlur, onBlurProp)}\n style={withVars}\n {...restSelectProps}\n >\n {placeholder && (\n <option\n key='placeholder'\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label>\n <span\n className={styles.label}\n data-required={props.required || undefined}\n >\n {label}\n </span>\n {selectElement}\n </label>\n );\n};\n"],"names":["selectKeys","Set","sanitizeSelectProps","props","Object","fromEntries","entries","filter","key","startsWith","has","cssVariablePattern","cssVariableReferencePattern","unresolvedColorKeywords","probe","document","createElement","normalizeColorValue","input","value","trim","toLowerCase","mountNode","body","documentElement","style","color","appendChild","normalized","getComputedStyle","remove","resolveColor","fallback","styles","seen","current","match","variableName","test","nestedFallback","add","getPropertyValue","Select","children","label","placeholder","touched","onBlur","useTouched","selectProps","className","onBlurProp","restSelectProps","withVars","iconSVG","replace","selectElement","cx","select","composeEventHandlers","jsxs","jsx","required","undefined"],"mappings":"gKAAMA,EAAa,IAAIC,IAAI,CACzB,wBACA,oBACA,YACA,gBACA,mBACA,eACA,gBACA,oBACA,gBACA,gBACA,cACA,eACA,oBACA,aACA,kBACA,YACA,YACA,gBACA,uBACA,eACA,YACA,YACA,eACA,MACA,WACA,OACA,KACA,WACA,OACA,SACA,WACA,UACA,UACA,UACA,YACA,YACA,UACA,cACA,YACA,gBACA,cACA,WACA,OACA,OACA,QACA,WACA,QACA,OAAO,CACR,EAEM,SAASC,EAAuDC,EAAU,CAC/E,OAAOC,OAAOC,YACZD,OAAOE,QAAQH,CAAK,EAAEI,OACpB,CAAC,CAACC,CAAG,IAAMA,EAAIC,WAAW,OAAO,GAAKD,EAAIC,WAAW,OAAO,GAAKT,EAAWU,IAAIF,CAAG,CACrF,CACF,CACF,CCzDA,MAAMG,EAAqB,aACrBC,EAA8B,yCAE9BC,EAA0B,IAAIZ,IAAI,CACtC,eACA,UACA,UACA,SACA,eACA,OAAO,CACR,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CAAE2C,QAAAA,EAASC,OAAAA,CAAAA,EAAWC,aAAW7C,EAAMgB,QAAU,EAAE,EACnD8B,EAAc/C,EAAoBC,CAAK,EACvC,CAAE+C,UAAAA,EAAWH,OAAQI,EAAY1B,MAAAA,EAAO,GAAG2B,CAAAA,EAAoBH,EAC/DI,EAAW,CACf,GAAG5B,EACH,aAAc6B,EAAAA,QAAQ,SAAS,EAAEC,QAC/B,eACAxB,EAAa,qCAAqC,CACpD,CAAA,EAGIyB,SACH,SAAA,CACC,UAAWC,EAAAA,EAAGxB,EAAOyB,OAAQR,EAAWJ,GAAWb,EAAOa,OAAO,EACjE,OAAQa,EAAAA,qBAAqBZ,EAAQI,CAAU,EAC/C,MAAOE,EACP,GAAID,EAEHP,SAAAA,CAAAA,SACE,SAAA,CAEC,MAAO,GACP,OAAM,GAELA,YAJG,aAKN,EAEDF,CAAAA,EACH,EAGF,OAAKC,EAKHgB,EAAAA,KAAC,QAAA,CAAK,iBAAA,SACJ,SAAA,CAAAC,EAAAA,IAAC,OAAA,CACC,UAAW5B,EAAOW,MAClB,gBAAezC,EAAM2D,UAAYC,OAEhCnB,SAAAA,CAAAA,CACH,EACCY,CAAAA,EACH,EAZOA,CAcX"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const o=require("./components/app-link/index.cjs"),t=require("./components/aside/index.cjs"),r=require("./components/avatar/index.cjs"),i=require("./components/badge/index.cjs"),s=require("./components/banner/index.cjs"),c=require("./components/branding/index.cjs"),_=require("./components/button/index.cjs"),p=require("./components/card/index.cjs"),a=require("./components/checkbox/index.cjs"),d=require("./components/chip/index.cjs"),u=require("./components/collapsible/index.cjs"),m=require("./components/controls/index.cjs"),l=require("./components/croppable/index.cjs"),x=require("./components/dialog/index.cjs"),q=require("./components/dropdown/index.cjs"),g=require("./components/dropzone/index.cjs"),b=require("./components/editor/index.cjs"),T=require("./components/empty-state/index.cjs"),h=require("./components/fieldset/index.cjs"),S=require("./components/figure/index.cjs"),v=require("./components/file/index.cjs"),C=require("./components/footer/index.cjs"),L=require("./components/form/index.cjs"),F=require("./components/graph/index.cjs"),I=require("./components/group/index.cjs"),f=require("./components/header/index.cjs"),k=require("./components/icon/index.cjs"),B=require("./components/iframe/index.cjs"),M=require("./components/image/index.cjs"),A=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./assets/index.css');const o=require("./components/app-link/index.cjs"),t=require("./components/aside/index.cjs"),r=require("./components/avatar/index.cjs"),i=require("./components/badge/index.cjs"),s=require("./components/banner/index.cjs"),c=require("./components/branding/index.cjs"),_=require("./components/button/index.cjs"),p=require("./components/card/index.cjs"),a=require("./components/checkbox/index.cjs"),d=require("./components/chip/index.cjs"),u=require("./components/collapsible/index.cjs"),m=require("./components/controls/index.cjs"),l=require("./components/croppable/index.cjs"),x=require("./components/dialog/index.cjs"),q=require("./components/dropdown/index.cjs"),g=require("./components/dropzone/index.cjs"),b=require("./components/editor/index.cjs"),T=require("./components/empty-state/index.cjs"),h=require("./components/fieldset/index.cjs"),S=require("./components/figure/index.cjs"),v=require("./components/file/index.cjs"),C=require("./components/footer/index.cjs"),L=require("./components/form/index.cjs"),F=require("./components/graph/index.cjs"),I=require("./components/group/index.cjs"),f=require("./components/header/index.cjs"),k=require("./components/icon/index.cjs"),B=require("./components/iframe/index.cjs"),M=require("./components/image/index.cjs"),A=require("./index-CQNlYa2P.cjs"),D=require("./components/link/index.cjs"),y=require("./components/list/index.cjs"),O=require("./components/loading/index.cjs"),P=require("./components/menu/index.cjs"),j=require("./components/message/index.cjs"),w=require("./components/messages/index.cjs"),e=require("./components/nav/index.cjs"),E=require("./components/object/index.cjs"),G=require("./components/popover/index.cjs"),N=require("./components/portal/index.cjs"),z=require("./components/search/index.cjs"),H=require("./index-Dn1v0qm6.cjs"),n=require("./components/sortable/index.cjs"),W=require("./components/table/index.cjs"),J=require("./components/textarea/index.cjs"),K=require("./components/toast/index.cjs"),Q=require("./components/toasts/index.cjs"),R=require("./components/toggle/index.cjs"),U=require("./components/toolbar/index.cjs"),V=require("./components/tooltip/index.cjs"),X=require("./components/widget/index.cjs");exports.AppLink=o.AppLink;exports.Aside=t.Aside;exports.Avatar=r.Avatar;exports.Badge=i.Badge;exports.Banner=s.Banner;exports.Branding=c.Branding;exports.Button=_.Button;exports.Card=p.Card;exports.Checkbox=a.Checkbox;exports.Chip=d.Chip;exports.Collapsible=u.Collapsible;exports.Controls=m.Controls;exports.Croppable=l.Croppable;exports.Dialog=x.Dialog;exports.Dropdown=q.Dropdown;exports.Dropzone=g.Dropzone;exports.Editor=b.Editor;exports.EmptyState=T.EmptyState;exports.Fieldset=h.Fieldset;exports.Figure=S.Figure;exports.File=v.File;exports.Footer=C.Footer;exports.Form=L.Form;exports.Graph=F.Graph;exports.Group=I.Group;exports.Header=f.Header;exports.Icon=k.Icon;exports.Iframe=B.Iframe;exports.Image=M.Image;exports.Input=A.Input;exports.Link=D.Link;exports.List=y.List;exports.Loading=O.Loading;exports.Menu=P.Menu;exports.Message=j.Message;exports.Messages=w.Messages;exports.Nav=e.Nav;exports.NavLabel=e.NavLabel;exports.Object=E.Object;exports.Popover=G.Popover;exports.Portal=N.Portal;exports.Search=z.Search;exports.Select=H.Select;exports.Sortable=n.Sortable;exports.useOptionalSortableItem=n.useOptionalSortableItem;exports.Table=W.Table;exports.Textarea=J.Textarea;exports.Toast=K.Toast;exports.Toasts=Q.Toasts;exports.Toggle=R.Toggle;exports.Toolbar=U.Toolbar;exports.Tooltip=V.Tooltip;exports.Widget=X.Widget;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -115,12 +115,13 @@ declare type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
115
115
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
export declare const Chip: ({ accessibleLabel, label, link, onDelete, ...props }: ChipProps) => JSX.Element;
|
|
118
|
+
export declare const Chip: ({ accessibleLabel, className, label, link, onDelete, ...props }: ChipProps) => JSX.Element;
|
|
119
119
|
|
|
120
|
-
declare type ChipProps =
|
|
120
|
+
declare type ChipProps = LinkedChipProps | UnlinkedChipProps;
|
|
121
|
+
|
|
122
|
+
declare type ChipSharedProps = {
|
|
121
123
|
accessibleLabel?: string;
|
|
122
124
|
label: string;
|
|
123
|
-
link?: string;
|
|
124
125
|
onDelete: () => void;
|
|
125
126
|
};
|
|
126
127
|
|
|
@@ -133,10 +134,13 @@ export declare type CollapsibleProps = {
|
|
|
133
134
|
summary: ReactNode;
|
|
134
135
|
};
|
|
135
136
|
|
|
136
|
-
export declare const Controls: ({ children, className, variant, ...props }: ControlsProps) => JSX.Element | null;
|
|
137
|
+
export declare const Controls: ({ children, className, maxVisibleButtons, overflow, overflowAccessibleLabel, variant, ...props }: ControlsProps) => JSX.Element | null;
|
|
137
138
|
|
|
138
|
-
declare type ControlsProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
139
|
+
export declare type ControlsProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
139
140
|
children?: React.ReactNode;
|
|
141
|
+
maxVisibleButtons?: number;
|
|
142
|
+
overflow?: 'menu';
|
|
143
|
+
overflowAccessibleLabel?: string;
|
|
140
144
|
variant?: keyof typeof variants_6;
|
|
141
145
|
};
|
|
142
146
|
|
|
@@ -347,6 +351,7 @@ declare const iconPaths: {
|
|
|
347
351
|
outline: string;
|
|
348
352
|
};
|
|
349
353
|
'arrow-up': string;
|
|
354
|
+
'arrow-updown': string;
|
|
350
355
|
back: {
|
|
351
356
|
filled: string;
|
|
352
357
|
};
|
|
@@ -527,7 +532,7 @@ declare type ImageProps = ImgHTMLAttributes<HTMLImageElement> & {
|
|
|
527
532
|
showOnError?: boolean;
|
|
528
533
|
};
|
|
529
534
|
|
|
530
|
-
export declare function Input({ className, defaultCountryCode, disabled, icon, label, placeholder, ref, required, type, variant, ...props }: InputProps): JSX.Element;
|
|
535
|
+
export declare function Input({ className, defaultCountryCode, disabled, icon, label, onBlur: onBlurProp, placeholder, ref, required, style, type, variant, ...props }: InputProps): JSX.Element;
|
|
531
536
|
|
|
532
537
|
declare type InputProps = React.ComponentPropsWithRef<'input'> & {
|
|
533
538
|
defaultCountryCode?: string;
|
|
@@ -542,6 +547,10 @@ declare type InputProps = React.ComponentPropsWithRef<'input'> & {
|
|
|
542
547
|
|
|
543
548
|
export declare const Link: ({ children, className, to, variant, ...props }: LinkProps) => JSX.Element;
|
|
544
549
|
|
|
550
|
+
declare type LinkedChipProps = Omit<ComponentPropsWithoutRef<'span'>, 'children'> & ChipSharedProps & {
|
|
551
|
+
link: string;
|
|
552
|
+
};
|
|
553
|
+
|
|
545
554
|
declare type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
546
555
|
children: React.ReactNode;
|
|
547
556
|
className?: string;
|
|
@@ -549,13 +558,16 @@ declare type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
|
549
558
|
variant?: 'danger' | 'minimal' | 'primary';
|
|
550
559
|
};
|
|
551
560
|
|
|
552
|
-
export declare function List({ children, className, columns, controls, horizontal, ordered, style, ...props }: ListProps): JSX.Element;
|
|
561
|
+
export declare function List({ children, className, columns, controls, horizontal, ordered, ref, style, ...props }: ListProps): JSX.Element;
|
|
562
|
+
|
|
563
|
+
declare type ListElement = HTMLUListElement | HTMLOListElement;
|
|
553
564
|
|
|
554
565
|
export declare type ListProps = React.ComponentPropsWithoutRef<'ul'> & {
|
|
555
566
|
columns?: number;
|
|
556
567
|
controls?: React.ReactNode;
|
|
557
568
|
horizontal?: boolean;
|
|
558
569
|
ordered?: boolean;
|
|
570
|
+
ref?: React.Ref<ListElement>;
|
|
559
571
|
};
|
|
560
572
|
|
|
561
573
|
export declare const Loading: ({ variant, size, sticky, ...props }: LoadingProps) => JSX.Element;
|
|
@@ -566,7 +578,7 @@ declare type LoadingProps = {
|
|
|
566
578
|
variant?: 'default' | 'ping';
|
|
567
579
|
};
|
|
568
580
|
|
|
569
|
-
export declare const Menu: ({ inline, items, menuAccessibleLabel, onItemSelect, triggerAccessibleLabel, variant, }: MenuProps) => JSX.Element;
|
|
581
|
+
export declare const Menu: ({ inline, items, menuAccessibleLabel, onItemSelect, triggerAccessibleLabel, triggerIcon, triggerLabel, variant, }: MenuProps) => JSX.Element;
|
|
570
582
|
|
|
571
583
|
export declare type MenuItem = {
|
|
572
584
|
accessibleLabel?: string;
|
|
@@ -674,6 +686,8 @@ declare type PopoverInitialFocus = 'first' | 'last';
|
|
|
674
686
|
declare type PopoverMenuProps = {
|
|
675
687
|
inline?: boolean;
|
|
676
688
|
triggerAccessibleLabel?: string;
|
|
689
|
+
triggerIcon?: IconName;
|
|
690
|
+
triggerLabel?: React.ReactNode;
|
|
677
691
|
variant?: 'popover';
|
|
678
692
|
};
|
|
679
693
|
|
|
@@ -749,6 +763,8 @@ declare type SelectProps = React.SelectHTMLAttributes<HTMLSelectElement> & {
|
|
|
749
763
|
declare type SimpleMenuProps = {
|
|
750
764
|
inline?: never;
|
|
751
765
|
triggerAccessibleLabel?: never;
|
|
766
|
+
triggerIcon?: never;
|
|
767
|
+
triggerLabel?: never;
|
|
752
768
|
variant: 'simple';
|
|
753
769
|
};
|
|
754
770
|
|
|
@@ -789,7 +805,7 @@ declare type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {
|
|
|
789
805
|
locale?: string | string[];
|
|
790
806
|
};
|
|
791
807
|
|
|
792
|
-
export declare const Textarea: ({ label, maxRows, minRows, required, value, ...props }: TextareaProps) => JSX.Element;
|
|
808
|
+
export declare const Textarea: ({ className, label, maxRows, minRows, onBlur: onBlurProp, required, style, value, ...props }: TextareaProps) => JSX.Element;
|
|
793
809
|
|
|
794
810
|
declare type TextareaProps = Omit<React.ComponentPropsWithoutRef<'textarea'>, 'children'> & {
|
|
795
811
|
label?: string;
|
|
@@ -848,6 +864,12 @@ declare type TooltipProps = {
|
|
|
848
864
|
variant?: keyof typeof variants_9;
|
|
849
865
|
};
|
|
850
866
|
|
|
867
|
+
declare type UnlinkedChipAttributes = Omit<ComponentPropsWithoutRef<'button'>, 'children' | 'onClick'>;
|
|
868
|
+
|
|
869
|
+
declare type UnlinkedChipProps = UnlinkedChipAttributes & ChipSharedProps & {
|
|
870
|
+
link?: undefined;
|
|
871
|
+
};
|
|
872
|
+
|
|
851
873
|
export declare function useOptionalSortableItem(): SortableItemContextValue | null;
|
|
852
874
|
|
|
853
875
|
declare const variants: {
|
|
@@ -883,6 +905,7 @@ declare const variants_5: {
|
|
|
883
905
|
|
|
884
906
|
declare const variants_6: {
|
|
885
907
|
default: string;
|
|
908
|
+
embedded: string;
|
|
886
909
|
fixed: string;
|
|
887
910
|
inline: string;
|
|
888
911
|
};
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { Header as _ } from "./components/header/index.js";
|
|
|
27
27
|
import { Icon as oo } from "./components/icon/index.js";
|
|
28
28
|
import { Iframe as eo } from "./components/iframe/index.js";
|
|
29
29
|
import { Image as po } from "./components/image/index.js";
|
|
30
|
-
import { I as xo } from "./index-
|
|
30
|
+
import { I as xo } from "./index-BIV5OwVJ.js";
|
|
31
31
|
import { Link as ao } from "./components/link/index.js";
|
|
32
32
|
import { List as io } from "./components/list/index.js";
|
|
33
33
|
import { Loading as no } from "./components/loading/index.js";
|
|
@@ -39,7 +39,7 @@ import { Object as ho } from "./components/object/index.js";
|
|
|
39
39
|
import { Popover as Bo } from "./components/popover/index.js";
|
|
40
40
|
import { Portal as Ao } from "./components/portal/index.js";
|
|
41
41
|
import { Search as Mo } from "./components/search/index.js";
|
|
42
|
-
import { S as Go } from "./index-
|
|
42
|
+
import { S as Go } from "./index-CgA0NUMD.js";
|
|
43
43
|
import { Sortable as Oo, useOptionalSortableItem as Po } from "./components/sortable/index.js";
|
|
44
44
|
import { Table as wo } from "./components/table/index.js";
|
|
45
45
|
import { Textarea as zo } from "./components/textarea/index.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";require('./assets/menu-popover.css');const i=require("react/jsx-runtime"),h=require("./classix-5H4IWnMA.cjs"),c=require("react"),k=require("./components/list/index.cjs"),y=require("./components/icon/index.cjs"),j=require("./components/popover/index.cjs"),A="_list_25aqk_3",w="_item_25aqk_15",I="_active_25aqk_38",C="_danger_25aqk_47",a={list:A,item:w,active:I,danger:C},D=o=>Array.from((o==null?void 0:o.querySelectorAll('[role="menuitem"]'))??[]).filter(s=>!s.disabled);function E({actions:o,initialFocus:s,menuAccessibleLabel:l,onSelect:m,usesMenuSemantics:t=!1}){const d=c.useRef(null),u=c.useCallback(e=>{const n=D(d.current);if(n.length===0)return;if(e==="first"||e==="last"){n[e==="first"?0:n.length-1].focus();return}const r=n.indexOf(document.activeElement),p=e==="next"?(r+1)%n.length:(r-1+n.length)%n.length;n[p].focus()},[]);c.useEffect(()=>{t&&u(s??"first")},[u,s,t]);const g=e=>{if(!t)return;const r={ArrowDown:"next",ArrowUp:"previous",End:"last",Home:"first"}[e.key];r&&(e.preventDefault(),u(r))};return i.jsx(k.List,{"aria-label":l,className:a.list,onKeyDown:g,ref:d,role:t?"menu":void 0,"data-component":"menuactionlist",children:o.map(({button:e,id:n,isActive:r,isDanger:p,value:v},q)=>i.jsx("li",{role:t?"none":void 0,children:c.cloneElement(e,{"aria-current":r?"true":e.props["aria-current"],className:h.t(e.props.className,a.item,r&&a.active,p&&a.danger),onClick:f=>{var _,x;(x=(_=e.props).onClick)==null||x.call(_,f),m(v,f)},role:t?"menuitem":e.props.role,variant:"tertiary"})},n??e.key??q))})}const P=({children:o,inline:s,triggerAccessibleLabel:l,triggerIcon:m="dots",triggerLabel:t})=>i.jsx(j.Popover,{inline:s,triggerAccessibleLabel:l,triggerAriaHasPopup:"menu",triggerButtonContent:i.jsxs(i.Fragment,{children:[t,i.jsx(y.Icon,{gap:t?"left":"none",name:m,size:"medium"})]}),"data-component":"menupopover",children:o});exports.MenuActionList=E;exports.MenuPopover=P;
|
|
2
|
+
//# sourceMappingURL=menu-popover-D1ALaiV5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-popover-D1ALaiV5.cjs","sources":["../src/components/menu/action-list.tsx","../src/components/menu/menu-popover.tsx"],"sourcesContent":["import cx from 'classix';\nimport { cloneElement, useCallback, useEffect, useRef } from 'react';\n\nimport { type ButtonProps } from '../button';\nimport { List } from '../list';\nimport { type PopoverInitialFocus } from '../popover';\nimport styles from './styles.module.css';\n\nexport type MenuAction<T> = {\n button: React.ReactElement<ButtonProps>;\n id?: React.Key;\n isActive?: boolean;\n isDanger?: boolean;\n value: T;\n};\n\ntype MenuFocusTarget = 'first' | 'last' | 'next' | 'previous';\n\nconst getFocusableItems = (list: HTMLUListElement | HTMLOListElement | null) =>\n Array.from(list?.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]') ?? []).filter(\n (item) => !item.disabled\n );\n\nexport function MenuActionList<T>({\n actions,\n initialFocus,\n menuAccessibleLabel,\n onSelect,\n usesMenuSemantics = false,\n}: {\n actions: MenuAction<T>[];\n initialFocus?: PopoverInitialFocus;\n menuAccessibleLabel?: string;\n onSelect: (value: T, event: React.MouseEvent<HTMLButtonElement>) => void;\n usesMenuSemantics?: boolean;\n}) {\n const listRef = useRef<HTMLUListElement | HTMLOListElement>(null);\n\n const focusItem = useCallback((target: MenuFocusTarget) => {\n const items = getFocusableItems(listRef.current);\n if (items.length === 0) return;\n\n if (target === 'first' || target === 'last') {\n items[target === 'first' ? 0 : items.length - 1].focus();\n return;\n }\n\n const currentIndex = items.indexOf(document.activeElement as HTMLButtonElement);\n const nextIndex =\n target === 'next'\n ? (currentIndex + 1) % items.length\n : (currentIndex - 1 + items.length) % items.length;\n items[nextIndex].focus();\n }, []);\n\n useEffect(() => {\n if (usesMenuSemantics) focusItem(initialFocus ?? 'first');\n }, [focusItem, initialFocus, usesMenuSemantics]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (!usesMenuSemantics) return;\n\n const targets = {\n ArrowDown: 'next',\n ArrowUp: 'previous',\n End: 'last',\n Home: 'first',\n } as const;\n const target = targets[event.key as keyof typeof targets];\n if (!target) return;\n\n event.preventDefault();\n focusItem(target);\n };\n\n return (\n <List\n aria-label={menuAccessibleLabel}\n className={styles.list}\n onKeyDown={handleKeyDown}\n ref={listRef}\n role={usesMenuSemantics ? 'menu' : undefined}\n >\n {actions.map(({ button, id, isActive, isDanger, value }, index) => (\n <li\n key={id ?? button.key ?? index}\n role={usesMenuSemantics ? 'none' : undefined}\n >\n {cloneElement(button, {\n 'aria-current': isActive ? 'true' : button.props['aria-current'],\n className: cx(\n button.props.className,\n styles.item,\n isActive && styles.active,\n isDanger && styles.danger\n ),\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n button.props.onClick?.(event);\n onSelect(value, event);\n },\n role: usesMenuSemantics ? 'menuitem' : button.props.role,\n variant: 'tertiary',\n })}\n </li>\n ))}\n </List>\n );\n}\n","import { Icon } from '../icon';\nimport { type IconName } from '../icon/icons';\nimport { Popover, type PopoverProps } from '../popover';\n\nexport const MenuPopover = ({\n children,\n inline,\n triggerAccessibleLabel,\n triggerIcon = 'dots',\n triggerLabel,\n}: Pick<PopoverProps, 'children' | 'inline' | 'triggerAccessibleLabel'> & {\n triggerIcon?: IconName;\n triggerLabel?: React.ReactNode;\n}) => (\n <Popover\n inline={inline}\n triggerAccessibleLabel={triggerAccessibleLabel}\n triggerAriaHasPopup='menu'\n triggerButtonContent={\n <>\n {triggerLabel}\n <Icon\n gap={triggerLabel ? 'left' : 'none'}\n name={triggerIcon}\n size='medium'\n />\n </>\n }\n >\n {children}\n </Popover>\n);\n"],"names":["getFocusableItems","list","Array","from","querySelectorAll","filter","item","disabled","MenuActionList","actions","initialFocus","menuAccessibleLabel","onSelect","usesMenuSemantics","listRef","useRef","focusItem","useCallback","target","items","current","length","focus","currentIndex","indexOf","document","activeElement","nextIndex","useEffect","handleKeyDown","event","ArrowDown","ArrowUp","End","Home","key","preventDefault","List","styles","undefined","map","button","id","isActive","isDanger","value","index","jsx","cloneElement","props","className","cx","active","danger","onClick","role","variant","MenuPopover","children","inline","triggerAccessibleLabel","triggerIcon","triggerLabel","Popover","jsxs","Fragment","Icon"],"mappings":"0VAkBMA,EAAqBC,GACzBC,MAAMC,MAAKF,GAAAA,YAAAA,EAAMG,iBAAoC,uBAAwB,CAAA,CAAE,EAAEC,OAC9EC,GAAS,CAACA,EAAKC,QAClB,EAEK,SAASC,EAAkB,CAChCC,QAAAA,EACAC,aAAAA,EACAC,oBAAAA,EACAC,SAAAA,EACAC,kBAAAA,EAAoB,EAOtB,EAAG,CACD,MAAMC,EAAUC,EAAAA,OAA4C,IAAI,EAE1DC,EAAYC,cAAaC,GAA4B,CACzD,MAAMC,EAAQnB,EAAkBc,EAAQM,OAAO,EAC/C,GAAID,EAAME,SAAW,EAAG,OAExB,GAAIH,IAAW,SAAWA,IAAW,OAAQ,CAC3CC,EAAMD,IAAW,QAAU,EAAIC,EAAME,OAAS,CAAC,EAAEC,MAAAA,EACjD,MACF,CAEA,MAAMC,EAAeJ,EAAMK,QAAQC,SAASC,aAAkC,EACxEC,EACJT,IAAW,QACNK,EAAe,GAAKJ,EAAME,QAC1BE,EAAe,EAAIJ,EAAME,QAAUF,EAAME,OAChDF,EAAMQ,CAAS,EAAEL,MAAAA,CACnB,EAAG,CAAA,CAAE,EAELM,EAAAA,UAAU,IAAM,CACVf,GAAmBG,EAAUN,GAAgB,OAAO,CAC1D,EAAG,CAACM,EAAWN,EAAcG,CAAiB,CAAC,EAE/C,MAAMgB,EAAiBC,GAAiD,CACtE,GAAI,CAACjB,EAAmB,OAQxB,MAAMK,EANU,CACda,UAAW,OACXC,QAAS,WACTC,IAAK,OACLC,KAAM,OAAA,EAEeJ,EAAMK,GAA2B,EACnDjB,IAELY,EAAMM,eAAAA,EACNpB,EAA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ime";
|
|
2
|
+
import { t as y } from "./classix-DG18itHa.js";
|
|
3
|
+
import { useRef as q, useCallback as w, useEffect as A, cloneElement as I } from "react";
|
|
4
|
+
import { List as C } from "./components/list/index.js";
|
|
5
|
+
import { Icon as D } from "./components/icon/index.js";
|
|
6
|
+
import { Popover as E } from "./components/popover/index.js";
|
|
7
|
+
import './assets/menu-popover.css';const N = "_list_25aqk_3", P = "_item_25aqk_15", j = "_active_25aqk_38", H = "_danger_25aqk_47", i = {
|
|
8
|
+
list: N,
|
|
9
|
+
item: P,
|
|
10
|
+
active: j,
|
|
11
|
+
danger: H
|
|
12
|
+
}, K = (n) => Array.from((n == null ? void 0 : n.querySelectorAll('[role="menuitem"]')) ?? []).filter((a) => !a.disabled);
|
|
13
|
+
function U({
|
|
14
|
+
actions: n,
|
|
15
|
+
initialFocus: a,
|
|
16
|
+
menuAccessibleLabel: l,
|
|
17
|
+
onSelect: c,
|
|
18
|
+
usesMenuSemantics: t = !1
|
|
19
|
+
}) {
|
|
20
|
+
const p = q(null), m = w((e) => {
|
|
21
|
+
const r = K(p.current);
|
|
22
|
+
if (r.length === 0) return;
|
|
23
|
+
if (e === "first" || e === "last") {
|
|
24
|
+
r[e === "first" ? 0 : r.length - 1].focus();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const o = r.indexOf(document.activeElement), f = e === "next" ? (o + 1) % r.length : (o - 1 + r.length) % r.length;
|
|
28
|
+
r[f].focus();
|
|
29
|
+
}, []);
|
|
30
|
+
A(() => {
|
|
31
|
+
t && m(a ?? "first");
|
|
32
|
+
}, [m, a, t]);
|
|
33
|
+
const _ = (e) => {
|
|
34
|
+
if (!t) return;
|
|
35
|
+
const o = {
|
|
36
|
+
ArrowDown: "next",
|
|
37
|
+
ArrowUp: "previous",
|
|
38
|
+
End: "last",
|
|
39
|
+
Home: "first"
|
|
40
|
+
}[e.key];
|
|
41
|
+
o && (e.preventDefault(), m(o));
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ s(C, { "aria-label": l, className: i.list, onKeyDown: _, ref: p, role: t ? "menu" : void 0, "data-component": "menuactionlist", children: n.map(({
|
|
44
|
+
button: e,
|
|
45
|
+
id: r,
|
|
46
|
+
isActive: o,
|
|
47
|
+
isDanger: f,
|
|
48
|
+
value: v
|
|
49
|
+
}, h) => /* @__PURE__ */ s("li", { role: t ? "none" : void 0, children: I(e, {
|
|
50
|
+
"aria-current": o ? "true" : e.props["aria-current"],
|
|
51
|
+
className: y(e.props.className, i.item, o && i.active, f && i.danger),
|
|
52
|
+
onClick: (d) => {
|
|
53
|
+
var u, g;
|
|
54
|
+
(g = (u = e.props).onClick) == null || g.call(u, d), c(v, d);
|
|
55
|
+
},
|
|
56
|
+
role: t ? "menuitem" : e.props.role,
|
|
57
|
+
variant: "tertiary"
|
|
58
|
+
}) }, r ?? e.key ?? h)) });
|
|
59
|
+
}
|
|
60
|
+
const G = ({
|
|
61
|
+
children: n,
|
|
62
|
+
inline: a,
|
|
63
|
+
triggerAccessibleLabel: l,
|
|
64
|
+
triggerIcon: c = "dots",
|
|
65
|
+
triggerLabel: t
|
|
66
|
+
}) => /* @__PURE__ */ s(E, { inline: a, triggerAccessibleLabel: l, triggerAriaHasPopup: "menu", triggerButtonContent: /* @__PURE__ */ k(x, { children: [
|
|
67
|
+
t,
|
|
68
|
+
/* @__PURE__ */ s(D, { gap: t ? "left" : "none", name: c, size: "medium" })
|
|
69
|
+
] }), "data-component": "menupopover", children: n });
|
|
70
|
+
export {
|
|
71
|
+
U as M,
|
|
72
|
+
G as a
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=menu-popover-DQHDIw-8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-popover-DQHDIw-8.js","sources":["../src/components/menu/action-list.tsx","../src/components/menu/menu-popover.tsx"],"sourcesContent":["import cx from 'classix';\nimport { cloneElement, useCallback, useEffect, useRef } from 'react';\n\nimport { type ButtonProps } from '../button';\nimport { List } from '../list';\nimport { type PopoverInitialFocus } from '../popover';\nimport styles from './styles.module.css';\n\nexport type MenuAction<T> = {\n button: React.ReactElement<ButtonProps>;\n id?: React.Key;\n isActive?: boolean;\n isDanger?: boolean;\n value: T;\n};\n\ntype MenuFocusTarget = 'first' | 'last' | 'next' | 'previous';\n\nconst getFocusableItems = (list: HTMLUListElement | HTMLOListElement | null) =>\n Array.from(list?.querySelectorAll<HTMLButtonElement>('[role=\"menuitem\"]') ?? []).filter(\n (item) => !item.disabled\n );\n\nexport function MenuActionList<T>({\n actions,\n initialFocus,\n menuAccessibleLabel,\n onSelect,\n usesMenuSemantics = false,\n}: {\n actions: MenuAction<T>[];\n initialFocus?: PopoverInitialFocus;\n menuAccessibleLabel?: string;\n onSelect: (value: T, event: React.MouseEvent<HTMLButtonElement>) => void;\n usesMenuSemantics?: boolean;\n}) {\n const listRef = useRef<HTMLUListElement | HTMLOListElement>(null);\n\n const focusItem = useCallback((target: MenuFocusTarget) => {\n const items = getFocusableItems(listRef.current);\n if (items.length === 0) return;\n\n if (target === 'first' || target === 'last') {\n items[target === 'first' ? 0 : items.length - 1].focus();\n return;\n }\n\n const currentIndex = items.indexOf(document.activeElement as HTMLButtonElement);\n const nextIndex =\n target === 'next'\n ? (currentIndex + 1) % items.length\n : (currentIndex - 1 + items.length) % items.length;\n items[nextIndex].focus();\n }, []);\n\n useEffect(() => {\n if (usesMenuSemantics) focusItem(initialFocus ?? 'first');\n }, [focusItem, initialFocus, usesMenuSemantics]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (!usesMenuSemantics) return;\n\n const targets = {\n ArrowDown: 'next',\n ArrowUp: 'previous',\n End: 'last',\n Home: 'first',\n } as const;\n const target = targets[event.key as keyof typeof targets];\n if (!target) return;\n\n event.preventDefault();\n focusItem(target);\n };\n\n return (\n <List\n aria-label={menuAccessibleLabel}\n className={styles.list}\n onKeyDown={handleKeyDown}\n ref={listRef}\n role={usesMenuSemantics ? 'menu' : undefined}\n >\n {actions.map(({ button, id, isActive, isDanger, value }, index) => (\n <li\n key={id ?? button.key ?? index}\n role={usesMenuSemantics ? 'none' : undefined}\n >\n {cloneElement(button, {\n 'aria-current': isActive ? 'true' : button.props['aria-current'],\n className: cx(\n button.props.className,\n styles.item,\n isActive && styles.active,\n isDanger && styles.danger\n ),\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n button.props.onClick?.(event);\n onSelect(value, event);\n },\n role: usesMenuSemantics ? 'menuitem' : button.props.role,\n variant: 'tertiary',\n })}\n </li>\n ))}\n </List>\n );\n}\n","import { Icon } from '../icon';\nimport { type IconName } from '../icon/icons';\nimport { Popover, type PopoverProps } from '../popover';\n\nexport const MenuPopover = ({\n children,\n inline,\n triggerAccessibleLabel,\n triggerIcon = 'dots',\n triggerLabel,\n}: Pick<PopoverProps, 'children' | 'inline' | 'triggerAccessibleLabel'> & {\n triggerIcon?: IconName;\n triggerLabel?: React.ReactNode;\n}) => (\n <Popover\n inline={inline}\n triggerAccessibleLabel={triggerAccessibleLabel}\n triggerAriaHasPopup='menu'\n triggerButtonContent={\n <>\n {triggerLabel}\n <Icon\n gap={triggerLabel ? 'left' : 'none'}\n name={triggerIcon}\n size='medium'\n />\n </>\n }\n >\n {children}\n </Popover>\n);\n"],"names":["getFocusableItems","list","Array","from","querySelectorAll","filter","item","disabled","MenuActionList","actions","initialFocus","menuAccessibleLabel","onSelect","usesMenuSemantics","listRef","useRef","focusItem","useCallback","target","items","current","length","focus","currentIndex","indexOf","document","activeElement","nextIndex","useEffect","handleKeyDown","event","ArrowDown","ArrowUp","End","Home","key","preventDefault","List","styles","undefined","map","button","id","isActive","isDanger","value","index","jsx","cloneElement","props","className","cx","active","danger","onClick","role","variant","MenuPopover","children","inline","triggerAccessibleLabel","triggerIcon","triggerLabel","Popover","jsxs","Fragment","Icon"],"mappings":";;;;;;;;;;;GAkBMA,IAAoBA,CAACC,MACzBC,MAAMC,MAAKF,KAAAA,gBAAAA,EAAMG,iBAAoC,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AAC;AAAA,IAAEC,QAAAA;AAAAA,IAAQC,IAAAA;AAAAA,IAAIC,UAAAA;AAAAA,IAAUC,UAAAA;AAAAA,IAAUC,OAAAA;AAAAA,EAAAA,GAASC,MACvD,gBAAAC,EAAC,MAAA,EAEC,MAAMlC,IAAoB,SAAS0B,QAElCS,UAAAA,EAAaP,GAAQ;AAAA,IACpB,gBAAgBE,IAAW,SAASF,EAAOQ,MAAM,cAAc;AAAA,IAC/DC,WAAWC,EACTV,EAAOQ,MAAMC,WACbZ,EAAOhC,MACPqC,KAAYL,EAAOc,QACnBR,KAAYN,EAAOe,MACrB;AAAA,IACAC,SAASA,CAACxB,MAA+C;;AACvDW,OAAAA,KAAAA,IAAAA,EAAOQ,OAAMK,YAAbb,QAAAA,EAAAA,KAAAA,GAAuBX,IACvBlB,EAASiC,GAAOf,CAAK;AAAA,IACvB;AAAA,IACAyB,MAAM1C,IAAoB,aAAa4B,EAAOQ,MAAMM;AAAAA,IACpDC,SAAS;AAAA,EAAA,CACV,EAAA,GAjBId,KAAMD,EAAON,OAAOW,CAkB3B,CACD,GACH;AAEJ;ACvGO,MAAMW,IAAcA,CAAC;AAAA,EAC1BC,UAAAA;AAAAA,EACAC,QAAAA;AAAAA,EACAC,wBAAAA;AAAAA,EACAC,aAAAA,IAAc;AAAA,EACdC,cAAAA;AAIF,wBACGC,GAAA,EACC,QAAAJ,GACA,wBAAAC,GACA,qBAAoB,QACpB,sBACE,gBAAAI,EAAAC,GAAA,EACGH,UAAAA;AAAAA,EAAAA;AAAAA,EACD,gBAAAf,EAACmB,KACC,KAAKJ,IAAe,SAAS,QAC7B,MAAMD,GACN,MAAK,SAAA,CAAQ;AAAA,EAAA,CAEjB,GACD,kBAAA,eAEAH,UAAAA,EAAAA,CACH;"}
|
package/dist/tokens.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useState as s, useCallback as c, useEffect as f } from "react";
|
|
2
|
+
function r(...t) {
|
|
3
|
+
return (o) => {
|
|
4
|
+
t.forEach((e) => e == null ? void 0 : e(o));
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function a(t) {
|
|
8
|
+
const [o, e] = s(!1), u = c(() => e(!0), []);
|
|
9
|
+
return f(() => {
|
|
10
|
+
e(!1);
|
|
11
|
+
}, [t]), {
|
|
12
|
+
touched: o,
|
|
13
|
+
onBlur: u
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
r as c,
|
|
18
|
+
a as u
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=use-touched-B999bBr8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-touched-B999bBr8.js","sources":["../src/lib/compose-event-handlers.ts","../src/lib/use-touched.ts"],"sourcesContent":["export function composeEventHandlers<Event>(\n ...handlers: Array<((event: Event) => void) | undefined>\n) {\n return (event: Event) => {\n handlers.forEach((handler) => handler?.(event));\n };\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["composeEventHandlers","handlers","event","forEach","handler","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":";AAAO,SAASA,KACXC,GACH;AACA,SAAO,CAACC,MAAiB;AACvBD,IAAAA,EAASE,QAASC,CAAAA,MAAYA,KAAAA,gBAAAA,EAAUF,EAAM;AAAA,EAChD;AACF;ACJO,SAASG,EAAWC,GAAoB;AAC7C,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAASC,EAAY,MAAMH,EAAW,EAAI,GAAG,CAAA,CAAE;AAErDI,SAAAA,EAAU,MAAM;AACdJ,IAAAA,EAAW,EAAK;AAAA,EAClB,GAAG,CAACF,CAAQ,CAAC,GAEN;AAAA,IAAEC,SAAAA;AAAAA,IAASG,QAAAA;AAAAA,EAAAA;AACpB;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const u=require("react");function o(...t){return s=>{t.forEach(e=>e==null?void 0:e(s))}}function n(t){const[s,e]=u.useState(!1),c=u.useCallback(()=>e(!0),[]);return u.useEffect(()=>{e(!1)},[t]),{touched:s,onBlur:c}}exports.composeEventHandlers=o;exports.useTouched=n;
|
|
2
|
+
//# sourceMappingURL=use-touched-Bq5Gjbpz.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-touched-Bq5Gjbpz.cjs","sources":["../src/lib/compose-event-handlers.ts","../src/lib/use-touched.ts"],"sourcesContent":["export function composeEventHandlers<Event>(\n ...handlers: Array<((event: Event) => void) | undefined>\n) {\n return (event: Event) => {\n handlers.forEach((handler) => handler?.(event));\n };\n}\n","import { useCallback, useEffect, useState } from 'react';\n\nexport function useTouched(resetKey?: unknown) {\n const [touched, setTouched] = useState(false);\n const onBlur = useCallback(() => setTouched(true), []);\n\n useEffect(() => {\n setTouched(false);\n }, [resetKey]);\n\n return { touched, onBlur };\n}\n"],"names":["composeEventHandlers","handlers","event","forEach","handler","useTouched","resetKey","touched","setTouched","useState","onBlur","useCallback","useEffect"],"mappings":"sCAAO,SAASA,KACXC,EACH,CACA,OAAQC,GAAiB,CACvBD,EAASE,QAASC,GAAYA,GAAAA,YAAAA,EAAUF,EAAM,CAChD,CACF,CCJO,SAASG,EAAWC,EAAoB,CAC7C,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAASC,EAAAA,YAAY,IAAMH,EAAW,EAAI,EAAG,CAAA,CAAE,EAErDI,OAAAA,EAAAA,UAAU,IAAM,CACdJ,EAAW,EAAK,CAClB,EAAG,CAACF,CAAQ,CAAC,EAEN,CAAEC,QAAAA,EAASG,OAAAA,CAAAA,CACpB"}
|
package/package.json
CHANGED
package/dist/assets/index52.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._toolbar_p4e6w_1{-webkit-backdrop-filter:blur(var(--scale-4));backdrop-filter:blur(var(--scale-4));background-color:var(--colors-translucent);border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);position:absolute;right:var(--scale-4);top:var(--scale-4)}._toolbar_p4e6w_1 [data-component=button][data-active=true]{background-color:var(--colors-semantic-interactive-selected);box-shadow:inset 0 0 var(--scale-2) var(--colors-semantic-primary-primary-active)}._toolbar_p4e6w_1 [data-component=button][data-active=true] [data-component=icon]{background-color:var(--colors-semantic-primary-primary-active)}._toolbar_p4e6w_1 [data-component=button]:not([disabled]):hover{background-color:var(--colors-semantic-interactive-selected)}._default_p4e6w_26 button{border-radius:var(--shape-border-radius-radius-md);display:inline-block}._editor_p4e6w_33{align-items:center;background-color:var(--colors-semantic-bg-page);border:none;border-bottom:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md) 0 0;display:flex;flex-wrap:wrap;overflow:hidden;position:initial;right:0;top:0}._editor_p4e6w_33 button{display:inline-block}._editor_p4e6w_33 button:first-child{border-top-left-radius:var(--shape-border-radius-radius-md)}
|