@solibo/solibo-ui 0.4.10 → 0.5.3
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 +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.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 +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -1
- package/dist/assets/index21.css +1 -1
- 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/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/index5.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/styles.css +1 -1
- package/dist/components/_avatar/index.cjs +1 -1
- package/dist/components/_avatar/index.cjs.map +1 -1
- package/dist/components/_avatar/index.js +9 -9
- package/dist/components/_avatar/index.js.map +1 -1
- package/dist/components/_card/index.cjs +1 -1
- package/dist/components/_card/index.js +12 -12
- package/dist/components/_collapsible/index.cjs +1 -1
- package/dist/components/_collapsible/index.js +1 -1
- package/dist/components/_croppable/index.cjs +1 -1
- package/dist/components/_croppable/index.js +175 -175
- package/dist/components/_dropdown/index.cjs +1 -1
- package/dist/components/_dropdown/index.cjs.map +1 -1
- package/dist/components/_dropdown/index.js +87 -87
- package/dist/components/_dropdown/index.js.map +1 -1
- package/dist/components/_dropzone/index.cjs +1 -1
- package/dist/components/_dropzone/index.js +34 -34
- package/dist/components/_editor/index.cjs +16 -16
- package/dist/components/_editor/index.cjs.map +1 -1
- package/dist/components/_editor/index.js +19 -19
- package/dist/components/_editor/index.js.map +1 -1
- package/dist/components/_messages/index.cjs +1 -1
- package/dist/components/_messages/index.cjs.map +1 -1
- package/dist/components/_messages/index.js +15 -15
- package/dist/components/_messages/index.js.map +1 -1
- package/dist/components/_portal/index.cjs +1 -1
- package/dist/components/_portal/index.cjs.map +1 -1
- package/dist/components/_portal/index.js +17 -16
- package/dist/components/_portal/index.js.map +1 -1
- package/dist/components/_sortable/index.cjs +1 -1
- package/dist/components/_sortable/index.cjs.map +1 -1
- package/dist/components/_sortable/index.js +64 -33
- package/dist/components/_sortable/index.js.map +1 -1
- package/dist/components/_widget/index.cjs +1 -1
- package/dist/components/_widget/index.js +3 -3
- package/dist/components/accordion/index.cjs +1 -1
- package/dist/components/accordion/index.cjs.map +1 -1
- package/dist/components/accordion/index.js +16 -10
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/app-link/index.cjs +1 -1
- package/dist/components/app-link/index.cjs.map +1 -1
- package/dist/components/app-link/index.js +9 -9
- package/dist/components/app-link/index.js.map +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.js +6 -6
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.cjs.map +1 -1
- package/dist/components/badge/index.js +19 -18
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.js +9 -9
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +12 -12
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +12 -12
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +7 -7
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.cjs.map +1 -1
- package/dist/components/controls/index.js +21 -10
- package/dist/components/controls/index.js.map +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +3 -3
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.cjs.map +1 -1
- package/dist/components/figure/index.js +11 -11
- package/dist/components/figure/index.js.map +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 +14 -13
- package/dist/components/file/index.js.map +1 -1
- package/dist/components/footer/index.cjs +1 -1
- package/dist/components/footer/index.js +3 -3
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +11 -11
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.cjs.map +1 -1
- package/dist/components/graph/index.js +31 -31
- package/dist/components/graph/index.js.map +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.js +3 -3
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.cjs.map +1 -1
- package/dist/components/icon/index.js +26 -26
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image/index.cjs +1 -1
- package/dist/components/image/index.js +9 -9
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.cjs.map +1 -1
- package/dist/components/input/index.js +34 -33
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +11 -11
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +7 -7
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +13 -13
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.js +7 -7
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +23 -23
- package/dist/components/object/index.cjs +2 -0
- package/dist/components/object/index.cjs.map +1 -0
- package/dist/components/object/index.js +16 -0
- package/dist/components/object/index.js.map +1 -0
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/table/index.cjs +1 -1
- package/dist/components/table/index.cjs.map +1 -1
- package/dist/components/table/index.js +22 -22
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.cjs.map +1 -1
- package/dist/components/textarea/index.js +23 -23
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/toast/index.cjs +1 -1
- package/dist/components/toast/index.cjs.map +1 -1
- package/dist/components/toast/index.js +23 -24
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/toggle/index.cjs +1 -1
- package/dist/components/toggle/index.js +1 -1
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +9 -9
- package/dist/index-CiEbbnD6.js +42 -0
- package/dist/index-CiEbbnD6.js.map +1 -0
- package/dist/index-ClrKYsAQ.cjs +2 -0
- package/dist/index-ClrKYsAQ.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +28 -22
- package/dist/index.js +33 -33
- package/dist/styles.module-BOTEBJ0C.js +9 -0
- package/dist/styles.module-BOTEBJ0C.js.map +1 -0
- package/dist/styles.module-BPvMQa_x.cjs +2 -0
- package/dist/styles.module-BPvMQa_x.cjs.map +1 -0
- package/dist/tokens.css +44 -12
- package/dist/tokens.json +541 -68
- package/package.json +1 -1
- package/dist/components/layout/index.cjs +0 -2
- package/dist/components/layout/index.cjs.map +0 -1
- package/dist/components/layout/index.js +0 -18
- package/dist/components/layout/index.js.map +0 -1
- package/dist/index-BpUboRfJ.cjs +0 -2
- package/dist/index-BpUboRfJ.cjs.map +0 -1
- package/dist/index-ChKhFyp8.js +0 -40
- package/dist/index-ChKhFyp8.js.map +0 -1
- package/dist/styles.module-DZXAP_eP.js +0 -8
- package/dist/styles.module-DZXAP_eP.js.map +0 -1
- package/dist/styles.module-Vt6mmlsz.cjs +0 -2
- package/dist/styles.module-Vt6mmlsz.cjs.map +0 -1
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { t as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { i as
|
|
5
|
-
import { u as
|
|
6
|
-
import { i as
|
|
7
|
-
function
|
|
8
|
-
className:
|
|
1
|
+
import { jsxs as N, Fragment as w, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { t as j } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { useState as S, useEffect as I } from "react";
|
|
4
|
+
import { i as B } from "../../icons-DfmpRbxE.js";
|
|
5
|
+
import { u as E } from "../../utils--n2yqjCy.js";
|
|
6
|
+
import { i as a } from "../../styles.module-BOTEBJ0C.js";
|
|
7
|
+
function A({
|
|
8
|
+
className: L,
|
|
9
9
|
defaultCountryCode: c = "+47",
|
|
10
10
|
disabled: u = !1,
|
|
11
11
|
icon: i,
|
|
12
12
|
label: m,
|
|
13
13
|
placeholder: h,
|
|
14
|
-
ref:
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
ref: v,
|
|
15
|
+
required: l,
|
|
16
|
+
type: t = "text",
|
|
17
|
+
...e
|
|
17
18
|
}) {
|
|
18
|
-
const [
|
|
19
|
-
onChange:
|
|
19
|
+
const [s, d] = S(""), [r, g] = S(""), {
|
|
20
|
+
onChange: P,
|
|
20
21
|
value: f,
|
|
21
|
-
...
|
|
22
|
-
} =
|
|
22
|
+
...T
|
|
23
|
+
} = e, {
|
|
23
24
|
touched: p,
|
|
24
25
|
onBlur: x
|
|
25
|
-
} =
|
|
26
|
-
"--icon-svg":
|
|
26
|
+
} = E(f === ""), C = i && t !== "radio" && t !== "datetime-local" ? {
|
|
27
|
+
"--icon-svg": B(i, !0)
|
|
27
28
|
} : void 0;
|
|
28
|
-
|
|
29
|
-
if (typeof
|
|
29
|
+
I(() => {
|
|
30
|
+
if (typeof e.onChange == "function" && t === "tel") {
|
|
30
31
|
const n = {
|
|
31
|
-
name:
|
|
32
|
-
value: r ? (
|
|
32
|
+
name: e.name,
|
|
33
|
+
value: r ? (s || c).split(" ").join("") + r.split(" ").join("") : void 0
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
e.onChange({
|
|
35
36
|
target: n,
|
|
36
37
|
currentTarget: n
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
-
const
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
40
|
+
}, [s, r]), I(() => {
|
|
41
|
+
t === "tel" && !e.value && (g(""), d(""));
|
|
42
|
+
}, [e.value, t]);
|
|
43
|
+
const V = /* @__PURE__ */ N(w, { children: [
|
|
44
|
+
/* @__PURE__ */ o("input", { disabled: u, hidden: !0, onChange: P, pattern: void 0, placeholder: h, ref: v, type: t, value: f }),
|
|
45
|
+
/* @__PURE__ */ o("input", { type: "text", className: a.input, disabled: u, maxLength: 5, onChange: (n) => d(n.target.value), placeholder: c, value: s }),
|
|
46
|
+
/* @__PURE__ */ o("input", { type: "tel", className: j(a.input, p && a.touched), "data-icon": i ? "true" : void 0, disabled: u, maxLength: 14, name: void 0, onChange: (n) => g(n.target.value), onBlur: x, pattern: e.pattern, required: l, style: C, value: r, ...T })
|
|
46
47
|
] });
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
m && /* @__PURE__ */
|
|
49
|
-
|
|
48
|
+
return /* @__PURE__ */ N("label", { className: a.label, "data-component": "input", children: [
|
|
49
|
+
m && /* @__PURE__ */ o("span", { "data-required": l || void 0, children: m }),
|
|
50
|
+
t === "tel" ? V : /* @__PURE__ */ o("input", { ref: v, className: j(a.input, L, p && a.touched), "data-icon": i ? "true" : void 0, disabled: u, onBlur: x, placeholder: h, required: l, style: C, type: t, ...e })
|
|
50
51
|
] });
|
|
51
52
|
}
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
A as Input
|
|
54
55
|
};
|
|
55
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/input/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { useTouched } from '@/utils.ts';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n type = 'text',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { onChange, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars =\n icon && type !== 'radio' && type !== 'datetime-local'\n ? {\n '--icon-svg': iconSVG(icon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (typeof props.onChange === 'function' && type === 'tel') {\n const target = {\n name: props.name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n // eslint-disable-next-line\n (props.onChange as any)({ target, currentTarget: target });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [countryCode, phoneNumber]);\n\n useEffect(() => {\n if (type === 'tel' && !props.value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [props.value, type]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={styles.input}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched &&
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/input/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useEffect, useState } from 'react';\n\nimport { IconName, iconSVG } from '@/components/icon/icons.ts';\nimport { useTouched } from '@/utils.ts';\n\nimport styles from './styles.module.css';\n\nexport type InputProps = React.ComponentPropsWithRef<'input'> & {\n defaultCountryCode?: string;\n disabled?: boolean;\n icon?: IconName;\n label?: string;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n placeholder?: string;\n type?:\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'number'\n | 'password'\n | 'radio'\n | 'search'\n | 'tel'\n | 'text';\n};\n\nexport function Input({\n className,\n defaultCountryCode = '+47',\n disabled = false,\n icon,\n label,\n placeholder,\n ref,\n required,\n type = 'text',\n ...props\n}: InputProps) {\n const [countryCode, setCountryCode] = useState('');\n const [phoneNumber, setPhoneNumber] = useState('');\n const { onChange, value, ...restProps } = props;\n const { touched, onBlur } = useTouched(value === '');\n\n type withVars =\n | (React.CSSProperties & {\n '--icon-svg'?: string;\n })\n | undefined;\n\n const withVars: withVars =\n icon && type !== 'radio' && type !== 'datetime-local'\n ? {\n '--icon-svg': iconSVG(icon, true),\n }\n : undefined;\n\n useEffect(() => {\n if (typeof props.onChange === 'function' && type === 'tel') {\n const target = {\n name: props.name,\n value: phoneNumber\n ? (countryCode || defaultCountryCode).split(' ').join('') +\n phoneNumber.split(' ').join('')\n : undefined,\n } as unknown as HTMLInputElement;\n // eslint-disable-next-line\n (props.onChange as any)({ target, currentTarget: target });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [countryCode, phoneNumber]);\n\n useEffect(() => {\n if (type === 'tel' && !props.value) {\n setPhoneNumber('');\n setCountryCode('');\n }\n }, [props.value, type]);\n\n const telephoneInput = (\n <>\n <input\n disabled={disabled}\n hidden\n onChange={onChange}\n pattern={undefined}\n placeholder={placeholder}\n ref={ref}\n type={type}\n value={value}\n />\n <input\n type='text'\n className={styles.input}\n disabled={disabled}\n maxLength={5}\n onChange={(e) => setCountryCode(e.target.value)}\n placeholder={defaultCountryCode}\n value={countryCode}\n />\n <input\n type='tel'\n className={cx(styles.input, touched && styles.touched)}\n data-icon={icon ? 'true' : undefined}\n disabled={disabled}\n maxLength={14}\n name={undefined}\n onChange={(e) => setPhoneNumber(e.target.value)}\n onBlur={onBlur}\n pattern={props.pattern}\n required={required}\n style={withVars}\n value={phoneNumber}\n {...restProps}\n />\n </>\n );\n\n return (\n <label className={styles.label}>\n {label && <span data-required={required || undefined}>{label}</span>}\n {type === 'tel' ? (\n telephoneInput\n ) : (\n <input\n ref={ref}\n className={cx(styles.input, className, touched && styles.touched)}\n data-icon={icon ? 'true' : undefined}\n disabled={disabled}\n onBlur={onBlur}\n placeholder={placeholder}\n required={required}\n style={withVars}\n type={type}\n {...props}\n />\n )}\n </label>\n );\n}\n"],"names":["Input","className","defaultCountryCode","disabled","icon","label","placeholder","ref","required","type","props","countryCode","setCountryCode","useState","phoneNumber","setPhoneNumber","onChange","value","restProps","touched","onBlur","useTouched","withVars","iconSVG","undefined","useEffect","target","name","split","join","currentTarget","telephoneInput","jsxs","Fragment","jsx","styles","input","e","cx","pattern"],"mappings":";;;;;;AA2BO,SAASA,EAAM;AAAA,EACpBC,WAAAA;AAAAA,EACAC,oBAAAA,IAAqB;AAAA,EACrBC,UAAAA,IAAW;AAAA,EACXC,MAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,aAAAA;AAAAA,EACAC,K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AAAA,IAEf,gBAAAiB,EAAC,WACC,MAAK,QACL,WAAWC,EAAOC,OAClB,UAAAjC,GACA,WAAW,GACX,UAAWkC,CAAAA,MAAMzB,EAAeyB,EAAEX,OAAOT,KAAK,GAC9C,aAAaf,GACb,OAAOS,GAAY;AAAA,sBAEpB,SAAA,EACC,MAAK,OACL,WAAW2B,EAAGH,EAAOC,OAAOjB,KAAWgB,EAAOhB,OAAO,GACrD,aAAWf,IAAO,SAASoB,QAC3B,UAAArB,GACA,WAAW,IACX,MAAMqB,QACN,UAAWa,CAAAA,MAAMtB,EAAesB,EAAEX,OAAOT,KAAK,GAC9C,QAAAG,GACA,SAASV,EAAM6B,SACf,UAAA/B,GACA,OAAOc,GACP,OAAOR,GACP,GAAII,EAAAA,CAAU;AAAA,EAAA,GAElB;AAGF,2BACG,SAAA,EAAM,WAAWiB,EAAO9B,OAAM,kBAAA,SAC5BA,UAAAA;AAAAA,IAAAA,KAAS,gBAAA6B,EAAC,QAAA,EAAK,iBAAe1B,KAAYgB,QAAYnB,UAAAA,GAAM;AAAA,IAC5DI,MAAS,QACRsB,IAEA,gBAAAG,EAAC,SAAA,EACC,KAAA3B,GACA,WAAW+B,EAAGH,EAAOC,OAAOnC,GAAWkB,KAAWgB,EAAOhB,OAAO,GAChE,aAAWf,IAAO,SAASoB,QAC3B,UAAArB,GACA,QAAAiB,GACA,aAAAd,GACA,UAAAE,GACA,OAAOc,GACP,MAAAb,GACA,GAAIC,EAAAA,CAAM;AAAA,EAAA,GAGhB;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index37.css');const s=require("react/jsx-runtime"),l=require("../../classix-5H4IWnMA.cjs"),m="_link_xhd9q_1",o="_primary_xhd9q_7",c="_danger_xhd9q_13",_="_minimal_xhd9q_21",n={link:m,primary:o,danger:c,minimal:_},d=({children:i,className:r,to:e="#",variant:t="primary",...a})=>s.jsx("a",{className:l.t(r,n.link,n[t]),href:e,...a,"data-component":"link",children:i});exports.Link=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t as
|
|
3
|
-
import '../../assets/index37.css';const
|
|
4
|
-
link:
|
|
5
|
-
primary:
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { t as _ } from "../../classix-DG18itHa.js";
|
|
3
|
+
import '../../assets/index37.css';const s = "_link_xhd9q_1", l = "_primary_xhd9q_7", e = "_danger_xhd9q_13", c = "_minimal_xhd9q_21", n = {
|
|
4
|
+
link: s,
|
|
5
|
+
primary: l,
|
|
6
6
|
danger: e,
|
|
7
7
|
minimal: c
|
|
8
8
|
}, k = ({
|
|
9
|
-
children:
|
|
10
|
-
className:
|
|
11
|
-
to:
|
|
12
|
-
variant:
|
|
13
|
-
...
|
|
14
|
-
}) => /* @__PURE__ */
|
|
9
|
+
children: r,
|
|
10
|
+
className: i,
|
|
11
|
+
to: m = "#",
|
|
12
|
+
variant: a = "primary",
|
|
13
|
+
...t
|
|
14
|
+
}) => /* @__PURE__ */ o("a", { className: _(i, n.link, n[a]), href: m, ...t, "data-component": "link", children: r });
|
|
15
15
|
export {
|
|
16
16
|
k as Link
|
|
17
17
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index38.css');const c=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),r=require("../../helpers-BD5fFZi-.cjs"),d="_horizontal_1w5i6_1",w="_list_1w5i6_12",x="_columns_1w5i6_53",s={horizontal:d,list:w,columns:x};function y({children:t,className:a,columns:o=1,horizontal:u,ordered:m,style:h,...l}){const i=Number.isFinite(o)?Math.max(1,Math.floor(o)):1,n=_.t(a,s.list,i>1&&s.columns,u&&s.horizontal),e={...h,"--list-columns":i};return m?c.jsx("ol",{className:n,style:e,...l,"data-component":"list",children:r.wrapChildren(t)}):c.jsx("ul",{className:n,style:e,...l,"data-component":"list",children:r.wrapChildren(t)})}exports.List=y;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
2
|
import { t as u } from "../../classix-DG18itHa.js";
|
|
3
|
-
import { w as
|
|
4
|
-
import '../../assets/index38.css';const
|
|
5
|
-
horizontal:
|
|
3
|
+
import { w as r } from "../../helpers-D56OHkFI.js";
|
|
4
|
+
import '../../assets/index38.css';const w = "_horizontal_1w5i6_1", f = "_list_1w5i6_12", p = "_columns_1w5i6_53", t = {
|
|
5
|
+
horizontal: w,
|
|
6
6
|
list: f,
|
|
7
7
|
columns: p
|
|
8
8
|
};
|
|
9
9
|
function y({
|
|
10
10
|
children: o,
|
|
11
|
-
className:
|
|
11
|
+
className: m,
|
|
12
12
|
columns: s = 1,
|
|
13
13
|
horizontal: e,
|
|
14
14
|
ordered: h,
|
|
15
15
|
style: _,
|
|
16
16
|
...l
|
|
17
17
|
}) {
|
|
18
|
-
const
|
|
18
|
+
const i = Number.isFinite(s) ? Math.max(1, Math.floor(s)) : 1, n = u(m, t.list, i > 1 && t.columns, e && t.horizontal), a = {
|
|
19
19
|
..._,
|
|
20
|
-
"--list-columns":
|
|
20
|
+
"--list-columns": i
|
|
21
21
|
};
|
|
22
|
-
return h ? /* @__PURE__ */ c("ol", { className:
|
|
22
|
+
return h ? /* @__PURE__ */ c("ol", { className: n, style: a, ...l, "data-component": "list", children: r(o) }) : /* @__PURE__ */ c("ul", { className: n, style: a, ...l, "data-component": "list", children: r(o) });
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
25
|
y as List
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index14.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index14.css');const t=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),c="_loading_1nndz_23",l="_spin_1nndz_1",_="_ping_1nndz_39",r="_sticky_1nndz_65",s={loading:c,default:"_default_1nndz_28",spin:l,ping:_,sticky:r},g=({variant:o="default",size:n,sticky:d=!1,...a})=>{const e={"--border-size":n?n/8+"px":void 0,"--size":n?n+"px":void 0};return t.jsx("div",{className:i.t(s.loading,d&&s.sticky),"data-component":"loading",children:t.jsx("span",{className:i.t(s.loading,s[o]),style:e,...a})})};exports.Loading=g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t
|
|
3
|
-
import '../../assets/index14.css';const
|
|
4
|
-
loading:
|
|
5
|
-
default: "
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { t } from "../../classix-DG18itHa.js";
|
|
3
|
+
import '../../assets/index14.css';const l = "_loading_1nndz_23", _ = "_spin_1nndz_1", p = "_ping_1nndz_39", e = "_sticky_1nndz_65", o = {
|
|
4
|
+
loading: l,
|
|
5
|
+
default: "_default_1nndz_28",
|
|
6
6
|
spin: _,
|
|
7
7
|
ping: p,
|
|
8
8
|
sticky: e
|
|
9
|
-
},
|
|
9
|
+
}, m = ({
|
|
10
10
|
variant: i = "default",
|
|
11
|
-
size:
|
|
12
|
-
sticky:
|
|
11
|
+
size: n,
|
|
12
|
+
sticky: d = !1,
|
|
13
13
|
...a
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
"--border-size":
|
|
17
|
-
"--size":
|
|
15
|
+
const c = {
|
|
16
|
+
"--border-size": n ? n / 8 + "px" : void 0,
|
|
17
|
+
"--size": n ? n + "px" : void 0
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ s("div", { className: t(o.loading, d && o.sticky), "data-component": "loading", children: /* @__PURE__ */ s("span", { className: t(o.loading, o[i]), style: c, ...a }) });
|
|
20
20
|
};
|
|
21
21
|
export {
|
|
22
|
-
|
|
22
|
+
m as Loading
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index39.css');const s=require("react/jsx-runtime"),o=require("../../classix-5H4IWnMA.cjs"),r=require("../icon/index.cjs"),c="_message_k0j8z_1",m="_preview_k0j8z_40",t={message:c,preview:m},g=({content:a,id:n,preview:i,type:e="default"})=>s.jsxs("div",{className:o.t(t.message,i&&t.preview),"data-id":n,"data-type":e,"data-component":"message",children:[e=="system"&&s.jsx(r.Icon,{gap:"right",name:"info"}),a]});exports.Message=g;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { t as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import '../../assets/index39.css';const
|
|
5
|
-
message:
|
|
6
|
-
preview:
|
|
2
|
+
import { t as i } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { Icon as n } from "../icon/index.js";
|
|
4
|
+
import '../../assets/index39.css';const p = "_message_k0j8z_1", c = "_preview_k0j8z_40", s = {
|
|
5
|
+
message: p,
|
|
6
|
+
preview: c
|
|
7
7
|
}, f = ({
|
|
8
8
|
content: t,
|
|
9
9
|
id: a,
|
|
10
10
|
preview: m,
|
|
11
11
|
type: e = "default"
|
|
12
|
-
}) => /* @__PURE__ */ o("div", { className:
|
|
13
|
-
e == "system" && /* @__PURE__ */ r(
|
|
12
|
+
}) => /* @__PURE__ */ o("div", { className: i(s.message, m && s.preview), "data-id": a, "data-type": e, "data-component": "message", children: [
|
|
13
|
+
e == "system" && /* @__PURE__ */ r(n, { gap: "right", name: "info" }),
|
|
14
14
|
t
|
|
15
15
|
] });
|
|
16
16
|
export {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-C_cX1FYp.cjs"),h="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index40.css');const p=require("react/jsx-runtime"),_=require("../../classix-5H4IWnMA.cjs"),f=require("react"),v=require("../../icons-C_cX1FYp.cjs"),h="_nav_2unxd_1",x="_horizontal_2unxd_7",b="_tabs_2unxd_17",g="_pills_2unxd_38",t={nav:h,horizontal:x,tabs:b,pills:g},m={default:t.default,pills:t.pills,tabs:t.tabs},w=({animation:o,children:i,className:l,horizontal:s=!1,variant:e="default",...r})=>{const[c,a]=f.useState(!1),u={"--icon-svg":v.iconSVG("chevron")};return p.jsx("nav",{className:_.t(l,s&&t.horizontal,t.nav,m[e]),"data-animation":o,"data-open":c?"true":"false","data-orientation":s?"horizontal":"vertical",onBlurCapture:n=>{if(e!=="pills"||window.innerWidth>960)return;const d=n.relatedTarget;n.currentTarget.contains(d)||a(!1)},onClick:()=>{e!=="pills"||window.innerWidth>960||a(n=>!n)},style:u,...r,"data-component":"nav",children:i})};exports.Nav=w;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { i as
|
|
5
|
-
import '../../assets/index40.css';const v = "
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { t as f } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { useState as _ } from "react";
|
|
4
|
+
import { i as m } from "../../icons-DfmpRbxE.js";
|
|
5
|
+
import '../../assets/index40.css';const v = "_nav_2unxd_1", h = "_horizontal_2unxd_7", x = "_tabs_2unxd_17", b = "_pills_2unxd_38", t = {
|
|
6
6
|
nav: v,
|
|
7
7
|
horizontal: h,
|
|
8
|
-
tabs:
|
|
9
|
-
pills:
|
|
8
|
+
tabs: x,
|
|
9
|
+
pills: b
|
|
10
10
|
}, w = {
|
|
11
11
|
default: t.default,
|
|
12
12
|
pills: t.pills,
|
|
13
13
|
tabs: t.tabs
|
|
14
|
-
},
|
|
15
|
-
animation:
|
|
16
|
-
children:
|
|
17
|
-
className:
|
|
18
|
-
horizontal:
|
|
19
|
-
variant:
|
|
20
|
-
...
|
|
14
|
+
}, N = ({
|
|
15
|
+
animation: i,
|
|
16
|
+
children: e,
|
|
17
|
+
className: l,
|
|
18
|
+
horizontal: o = !1,
|
|
19
|
+
variant: a = "default",
|
|
20
|
+
...r
|
|
21
21
|
}) => {
|
|
22
|
-
const [c, s] =
|
|
23
|
-
"--icon-svg":
|
|
22
|
+
const [c, s] = _(!1), p = {
|
|
23
|
+
"--icon-svg": m("chevron")
|
|
24
24
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
n.currentTarget.contains(
|
|
25
|
+
return /* @__PURE__ */ u("nav", { className: f(l, o && t.horizontal, t.nav, w[a]), "data-animation": i, "data-open": c ? "true" : "false", "data-orientation": o ? "horizontal" : "vertical", onBlurCapture: (n) => {
|
|
26
|
+
if (a !== "pills" || window.innerWidth > 960) return;
|
|
27
|
+
const d = n.relatedTarget;
|
|
28
|
+
n.currentTarget.contains(d) || s(!1);
|
|
29
29
|
}, onClick: () => {
|
|
30
|
-
|
|
31
|
-
}, style: p, ...
|
|
30
|
+
a !== "pills" || window.innerWidth > 960 || s((n) => !n);
|
|
31
|
+
}, style: p, ...r, "data-component": "nav", children: e });
|
|
32
32
|
};
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
N as Nav
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index4.css');const e=require("react/jsx-runtime"),n="_object_1esdj_1",s={object:n},a=({accessibleLabel:c,url:t,...o})=>e.jsx("object",{"aria-label":c,className:s.object,data:t,type:"application/pdf",...o,"data-component":"objectcomponent",children:t&&e.jsxs(e.Fragment,{children:["We cannot show this file. You can try accessing it directly:",e.jsx("br",{}),e.jsx("a",{href:t,children:t})]})});exports.Object=a;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n accessibleLabel: string;\n url: string;\n};\n\nconst ObjectComponent = ({ accessibleLabel, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={accessibleLabel}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","accessibleLabel","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":"sJASMA,EAAkBA,CAAC,CAAEC,gBAAAA,EAAiBC,IAAAA,EAAK,GAAGC,CAAmB,UAElE,SAAA,CACC,aAAYF,EACZ,UAAWG,EAAOC,OAClB,KAAMH,EACN,KAAM,kBACN,GAAIC,EAAM,iBAAA,kBAETD,YACCI,EAAAA,KAAAC,WAAA,CAAA,SAAA,CAAA,qEAEG,KAAA,EAAE,EACHC,EAAAA,IAAC,IAAA,CAAE,KAAMN,EAAMA,SAAAA,CAAAA,CAAI,CAAA,CAAA,CACrB,CAAA,CAEJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index4.css';const s = "_object_1esdj_1", i = {
|
|
3
|
+
object: s
|
|
4
|
+
}, r = ({
|
|
5
|
+
accessibleLabel: c,
|
|
6
|
+
url: t,
|
|
7
|
+
...o
|
|
8
|
+
}) => /* @__PURE__ */ e("object", { "aria-label": c, className: i.object, data: t, type: "application/pdf", ...o, "data-component": "objectcomponent", children: t && /* @__PURE__ */ n(a, { children: [
|
|
9
|
+
"We cannot show this file. You can try accessing it directly:",
|
|
10
|
+
/* @__PURE__ */ e("br", {}),
|
|
11
|
+
/* @__PURE__ */ e("a", { href: t, children: t })
|
|
12
|
+
] }) });
|
|
13
|
+
export {
|
|
14
|
+
r as Object
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/object/index.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\n\nimport styles from './styles.module.css';\n\nexport type ObjectProps = Omit<ComponentPropsWithoutRef<'object'>, 'data' | 'type'> & {\n accessibleLabel: string;\n url: string;\n};\n\nconst ObjectComponent = ({ accessibleLabel, url, ...props }: ObjectProps) => {\n return (\n <object\n aria-label={accessibleLabel}\n className={styles.object}\n data={url}\n type={`application/pdf`}\n {...props}\n >\n {url && (\n <>\n We cannot show this file. You can try accessing it directly:\n <br />\n <a href={url}>{url}</a>\n </>\n )}\n </object>\n );\n};\n\nexport { ObjectComponent as Object };\n"],"names":["ObjectComponent","accessibleLabel","url","props","styles","object","jsxs","Fragment","jsx"],"mappings":";;;GASMA,IAAkBA,CAAC;AAAA,EAAEC,iBAAAA;AAAAA,EAAiBC,KAAAA;AAAAA,EAAK,GAAGC;AAAmB,wBAElE,UAAA,EACC,cAAYF,GACZ,WAAWG,EAAOC,QAClB,MAAMH,GACN,MAAM,mBACN,GAAIC,GAAM,kBAAA,mBAETD,eACC,gBAAAI,EAAAC,GAAA,EAAA,UAAA;AAAA,EAAA;AAAA,oBAEG,MAAA,EAAE;AAAA,EACH,gBAAAC,EAAC,KAAA,EAAE,MAAMN,GAAMA,UAAAA,EAAAA,CAAI;AAAA,EAAA,CACrB,EAAA,CAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-C_cX1FYp.cjs");require("../../utils-DBzf7CFq.cjs");const e=require("../../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../classix-5H4IWnMA.cjs");require("../../icons-C_cX1FYp.cjs");require("../../utils-DBzf7CFq.cjs");const e=require("../../index-ClrKYsAQ.cjs");exports.Select=e.Select;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "../../classix-DG18itHa.js";
|
|
3
3
|
import "../../icons-DfmpRbxE.js";
|
|
4
4
|
import "../../utils--n2yqjCy.js";
|
|
5
|
-
import { S as e } from "../../index-
|
|
5
|
+
import { S as e } from "../../index-CiEbbnD6.js";
|
|
6
6
|
export {
|
|
7
7
|
e as Select
|
|
8
8
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index3.css');const f=require("react/jsx-runtime"),i=require("react"),k=require("../icon/index.cjs"),z="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index3.css');const f=require("react/jsx-runtime"),i=require("react"),k=require("../icon/index.cjs"),z="_table_1egqd_1",D="_sortable_1egqd_27",h={table:z,sortable:D},m=r=>i.isValidElement(r),q=r=>i.Children.toArray(r).reduce((e,t)=>m(t)?e+(t.type==="td"||t.type==="th"?1:q(t.props.children)):e,0),v=r=>{for(const e of i.Children.toArray(r)){if(!m(e))continue;if(e.type==="tr")return q(e.props.children);const t=v(e.props.children);if(t!==null)return t}return null},S=(r,e)=>i.Children.map(r,t=>{if(!m(t))return t;let s=t.props.children===void 0?t.props.children:S(t.props.children,e),n;return t.type==="td"&&t.props["data-span"]==="all"&&(n={colSpan:e}),t.type==="th"&&t.props["data-type"]&&(s=f.jsxs("span",{className:h.sortable,children:[s,f.jsx(k.Icon,{name:"updown",variant:"primary"})]})),n||s!==t.props.children?i.cloneElement(t,n,s):t}),I=(r,e,t,s,n=1)=>{if(t==="text")return r.localeCompare(e,s,{sensitivity:"base"})*n;const l=t==="date"?Date.parse(r):Number.parseFloat(r),c=t==="date"?Date.parse(e):Number.parseFloat(e);return Number.isNaN(l)&&Number.isNaN(c)?0:Number.isNaN(l)?1:Number.isNaN(c)?-1:(l-c)*n},P=({children:r,locale:e,...t})=>{const s=i.useRef(null),n=v(r),l=n&&n>0?S(r,n):r,c=(d,u,o)=>{d.querySelectorAll("th[data-type]").forEach(a=>{a===u?(a.dataset.dir=o,a.setAttribute("aria-sort",o==="asc"?"ascending":"descending")):(delete a.dataset.dir,a.setAttribute("aria-sort","none"))})},j=i.useCallback(d=>{var x,g;const u=s.current;if(!u)return;const o=(x=d.target)==null?void 0:x.closest("th");if(!o)return;const p=u.tHead;if(!p||!p.contains(o))return;const a=o.cellIndex;if(a<0)return;const b=(g=u.tBodies)==null?void 0:g[0];if(!b)return;const y=o.getAttribute("data-type");if(!y)return;const N=o.dataset.dir==="asc"?"desc":"asc";c(p,o,N);const w=N==="asc"?1:-1,C=Array.from(b.rows);C.sort((E,R)=>{var _,A;const T=(((_=E.cells[a])==null?void 0:_.textContent)??"").trim(),F=(((A=R.cells[a])==null?void 0:A.textContent)??"").trim();return I(T,F,y,e,w)}),b.append(...C)},[e]);return f.jsx("table",{className:h.table,onClick:j,ref:s,...t,"data-component":"table",children:l})};exports.Table=P;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, useCallback, useRef } from 'react';\n\nimport { Icon } from '../icon';\nimport styles from './styles.module.css';\n\nexport type TableProps = React.TableHTMLAttributes<HTMLTableElement> & {\n children?: React.ReactNode;\n locale?: string | string[];\n};\n\ntype SortType = 'date' | 'number' | 'text';\n\ntype TableChildProps = {\n children?: React.ReactNode;\n colSpan?: number;\n 'data-span'?: string;\n 'data-type'?: SortType;\n};\n\nconst isTableElement = (child: React.ReactNode): child is React.ReactElement<TableChildProps> =>\n isValidElement<TableChildProps>(child);\n\nconst countCells = (children: React.ReactNode): number =>\n Children.toArray(children).reduce<number>((count, child) => {\n if (!isTableElement(child)) return count;\n return (\n count + (child.type === 'td' || child.type === 'th' ? 1 : countCells(child.props.children))\n );\n }, 0);\n\nconst getFirstRowCellCount = (children: React.ReactNode): number | null => {\n for (const child of Children.toArray(children)) {\n if (!isTableElement(child)) continue;\n\n if (child.type === 'tr') return countCells(child.props.children);\n\n const nestedCount = getFirstRowCellCount(child.props.children);\n if (nestedCount !== null) return nestedCount;\n }\n\n return null;\n};\n\nconst normalizeChildren = (children: React.ReactNode, columnCount: number): React.ReactNode =>\n Children.map(children, (child) => {\n if (!isTableElement(child)) return child;\n\n let nextChildren =\n child.props.children === undefined\n ? child.props.children\n : normalizeChildren(child.props.children, columnCount);\n let nextProps: Partial<TableChildProps> | undefined;\n\n if (child.type === 'td' && child.props['data-span'] === 'all') {\n nextProps = { colSpan: columnCount };\n }\n\n if (child.type === 'th' && child.props['data-type']) {\n nextChildren = (\n <span className={styles.sortable}>\n {nextChildren}\n <Icon\n name='updown'\n variant='primary'\n />\n </span>\n );\n }\n\n return nextProps || nextChildren !== child.props.children\n ? cloneElement(child, nextProps, nextChildren)\n : child;\n });\n\n/**\n * Sortable columns must provide data-type (text, number, or date) in the `th` element.\n */\n\nconst compare = (a: string, b: string, type: SortType, locale?: string | string[], dir = 1) => {\n if (type === 'text') {\n return a.localeCompare(b, locale, { sensitivity: 'base' }) * dir;\n }\n\n const left = type === 'date' ? Date.parse(a) : Number.parseFloat(a);\n const right = type === 'date' ? Date.parse(b) : Number.parseFloat(b);\n\n if (Number.isNaN(left) && Number.isNaN(right)) return 0;\n if (Number.isNaN(left)) return 1;\n if (Number.isNaN(right)) return -1;\n return (left - right) * dir;\n};\n\nexport const Table = ({ children, locale, ...props }: TableProps) => {\n const ref = useRef<HTMLTableElement | null>(null);\n const columnCount = getFirstRowCellCount(children);\n const normalizedChildren =\n columnCount && columnCount > 0 ? normalizeChildren(children, columnCount) : children;\n\n const setSortState = (\n thead: HTMLTableSectionElement,\n active: HTMLTableCellElement,\n dir: 'asc' | 'desc'\n ) => {\n const ths = thead.querySelectorAll<HTMLTableCellElement>('th[data-type]');\n\n ths.forEach((th) => {\n if (th === active) {\n th.dataset.dir = dir;\n th.setAttribute('aria-sort', dir === 'asc' ? 'ascending' : 'descending');\n } else {\n delete th.dataset.dir;\n th.setAttribute('aria-sort', 'none');\n }\n });\n };\n\n const onClick = useCallback(\n (e: React.MouseEvent<HTMLTableElement>) => {\n const table = ref.current;\n if (!table) return;\n\n const th = (e.target as HTMLElement | null)?.closest('th');\n if (!th) return;\n\n const thead = table.tHead;\n if (!thead || !thead.contains(th)) return;\n\n const col = th.cellIndex;\n if (col < 0) return;\n\n const tbody = table.tBodies?.[0];\n if (!tbody) return;\n\n const type = th.getAttribute('data-type') as SortType | null;\n if (!type) return;\n\n const direction = th.dataset.dir === 'asc' ? 'desc' : 'asc';\n setSortState(thead, th, direction);\n const dir = direction === 'asc' ? 1 : -1;\n\n const rows = Array.from(tbody.rows);\n\n rows.sort((a, b) => {\n const av = (a.cells[col]?.textContent ?? '').trim();\n const bv = (b.cells[col]?.textContent ?? '').trim();\n return compare(av, bv, type, locale, dir);\n });\n\n tbody.append(...rows);\n },\n [locale]\n );\n\n return (\n <table\n className={styles.table}\n onClick={onClick}\n ref={ref}\n {...props}\n >\n {normalizedChildren}\n </table>\n );\n};\n"],"names":["isTableElement","child","isValidElement","countCells","children","Children","toArray","reduce","count","type","props","getFirstRowCellCount","nestedCount","normalizeChildren","columnCount","map","nextChildren","undefined","nextProps","colSpan","jsxs","styles","sortable","jsx","Icon","cloneElement","compare","a","b","locale","dir","localeCompare","sensitivity","left","Date","parse","Number","parseFloat","right","isNaN","Table","ref","useRef","normalizedChildren","setSortState","thead","active","querySelectorAll","forEach","th","dataset","setAttribute","onClick","useCallback","e","table","current","target","closest","tHead","contains","col","cellIndex","tbody","tBodies","getAttribute","direction","rows","Array","from","sort","av","cells","textContent","trim","bv","append"],"mappings":"wOAmBMA,EAAkBC,GACtBC,EAAAA,eAAgCD,CAAK,EAEjCE,EAAcC,GAClBC,EAAAA,SAASC,QAAQF,CAAQ,EAAEG,OAAe,CAACC,EAAOP,IAC3CD,EAAeC,CAAK,EAEvBO,GAASP,EAAMQ,OAAS,MAAQR,EAAMQ,OAAS,KAAO,EAAIN,EAAWF,EAAMS,MAAMN,QAAQ,GAFxDI,EAIlC,CAAC,EAEAG,EAAwBP,GAA6C,CACzE,UAAWH,KAASI,EAAAA,SAASC,QAAQF,CAAQ,EAAG,CAC9C,GAAI,CAACJ,EAAeC,CAAK,EAAG,SAE5B,GAAIA,EAAMQ,OAAS,YAAaN,EAAWF,EAAMS,MAAMN,QAAQ,EAE/D,MAAMQ,EAAcD,EAAqBV,EAAMS,MAAMN,QAAQ,EAC7D,GAAIQ,IAAgB,KAAM,OAAOA,CACnC,CAEA,OAAO,IACT,EAEMC,EAAoBA,CAACT,EAA2BU,IACpDT,EAAAA,SAASU,IAAIX,EAAWH,GAAU,CAChC,GAAI,CAACD,EAAeC,CAAK,EAAG,OAAOA,EAEnC,IAAIe,EACFf,EAAMS,MAAMN,WAAaa,OACrBhB,EAAMS,MAAMN,SACZS,EAAkBZ,EAAMS,MAAMN,SAAUU,CAAW,EACrDI,EAE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X,EACA,GAAI/B,EAAM,iBAAA,QAETiC,SAAAA,CAAAA,CACH,CAEJ"}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { jsx as _, jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as _, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useCallback as R, Children as f, cloneElement as T, isValidElement as B } from "react";
|
|
3
3
|
import { Icon as H } from "../icon/index.js";
|
|
4
|
-
import '../../assets/index3.css';const P = "
|
|
4
|
+
import '../../assets/index3.css';const P = "_table_1egqd_1", V = "_sortable_1egqd_27", v = {
|
|
5
5
|
table: P,
|
|
6
6
|
sortable: V
|
|
7
|
-
}, m = (r) => B(r),
|
|
7
|
+
}, m = (r) => B(r), h = (r) => f.toArray(r).reduce((e, t) => m(t) ? e + (t.type === "td" || t.type === "th" ? 1 : h(t.props.children)) : e, 0), w = (r) => {
|
|
8
8
|
for (const e of f.toArray(r)) {
|
|
9
9
|
if (!m(e)) continue;
|
|
10
|
-
if (e.type === "tr") return
|
|
11
|
-
const t =
|
|
10
|
+
if (e.type === "tr") return h(e.props.children);
|
|
11
|
+
const t = w(e.props.children);
|
|
12
12
|
if (t !== null) return t;
|
|
13
13
|
}
|
|
14
14
|
return null;
|
|
15
|
-
},
|
|
15
|
+
}, E = (r, e) => f.map(r, (t) => {
|
|
16
16
|
if (!m(t)) return t;
|
|
17
|
-
let s = t.props.children === void 0 ? t.props.children :
|
|
17
|
+
let s = t.props.children === void 0 ? t.props.children : E(t.props.children, e), n;
|
|
18
18
|
return t.type === "td" && t.props["data-span"] === "all" && (n = {
|
|
19
19
|
colSpan: e
|
|
20
|
-
}), t.type === "th" && t.props["data-type"] && (s = /* @__PURE__ */
|
|
20
|
+
}), t.type === "th" && t.props["data-type"] && (s = /* @__PURE__ */ D("span", { className: v.sortable, children: [
|
|
21
21
|
s,
|
|
22
|
-
/* @__PURE__ */ _(H, {
|
|
23
|
-
] })), n || s !== t.props.children ?
|
|
22
|
+
/* @__PURE__ */ _(H, { name: "updown", variant: "primary" })
|
|
23
|
+
] })), n || s !== t.props.children ? T(t, n, s) : t;
|
|
24
24
|
}), G = (r, e, t, s, n = 1) => {
|
|
25
25
|
if (t === "text")
|
|
26
26
|
return r.localeCompare(e, s, {
|
|
27
27
|
sensitivity: "base"
|
|
28
28
|
}) * n;
|
|
29
|
-
const
|
|
30
|
-
return Number.isNaN(
|
|
29
|
+
const l = t === "date" ? Date.parse(r) : Number.parseFloat(r), i = t === "date" ? Date.parse(e) : Number.parseFloat(e);
|
|
30
|
+
return Number.isNaN(l) && Number.isNaN(i) ? 0 : Number.isNaN(l) ? 1 : Number.isNaN(i) ? -1 : (l - i) * n;
|
|
31
31
|
}, M = ({
|
|
32
32
|
children: r,
|
|
33
33
|
locale: e,
|
|
34
34
|
...t
|
|
35
35
|
}) => {
|
|
36
|
-
const s =
|
|
36
|
+
const s = I(null), n = w(r), l = n && n > 0 ? E(r, n) : r, i = (u, c, o) => {
|
|
37
37
|
u.querySelectorAll("th[data-type]").forEach((a) => {
|
|
38
38
|
a === c ? (a.dataset.dir = o, a.setAttribute("aria-sort", o === "asc" ? "ascending" : "descending")) : (delete a.dataset.dir, a.setAttribute("aria-sort", "none"));
|
|
39
39
|
});
|
|
40
|
-
},
|
|
40
|
+
}, S = R((u) => {
|
|
41
41
|
var C, x;
|
|
42
42
|
const c = s.current;
|
|
43
43
|
if (!c) return;
|
|
@@ -52,15 +52,15 @@ import '../../assets/index3.css';const P = "_table_18uji_1", V = "_sortable_18uj
|
|
|
52
52
|
const b = o.getAttribute("data-type");
|
|
53
53
|
if (!b) return;
|
|
54
54
|
const N = o.dataset.dir === "asc" ? "desc" : "asc";
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
y.sort((F,
|
|
58
|
-
var
|
|
59
|
-
const
|
|
60
|
-
return G(
|
|
55
|
+
i(p, o, N);
|
|
56
|
+
const q = N === "asc" ? 1 : -1, y = Array.from(d.rows);
|
|
57
|
+
y.sort((F, j) => {
|
|
58
|
+
var g, A;
|
|
59
|
+
const k = (((g = F.cells[a]) == null ? void 0 : g.textContent) ?? "").trim(), z = (((A = j.cells[a]) == null ? void 0 : A.textContent) ?? "").trim();
|
|
60
|
+
return G(k, z, b, e, q);
|
|
61
61
|
}), d.append(...y);
|
|
62
62
|
}, [e]);
|
|
63
|
-
return /* @__PURE__ */ _("table", { className:
|
|
63
|
+
return /* @__PURE__ */ _("table", { className: v.table, onClick: S, ref: s, ...t, "data-component": "table", children: l });
|
|
64
64
|
};
|
|
65
65
|
export {
|
|
66
66
|
M as Table
|