@uva-glass/component-library 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiSelect-CFOkF66G.js +46 -0
- package/dist/MultiSelect-CFOkF66G.js.map +1 -0
- package/dist/MultiSelectItem-D5q99kfp.js +24 -0
- package/dist/MultiSelectItem-D5q99kfp.js.map +1 -0
- package/dist/assets/Label.css +1 -1
- package/dist/assets/MultiSelectItem.css +1 -1
- package/dist/components/InputField/InputField.d.ts +1 -0
- package/dist/components/InputField/InputField.js +21 -24
- package/dist/components/InputField/InputField.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +41 -26
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/Label/Label.d.ts +2 -1
- package/dist/components/Label/Label.js +17 -5
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Label/Label.stories.d.ts +1 -0
- package/dist/components/Label/Label.stories.js +13 -5
- package/dist/components/Label/Label.stories.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +11 -8
- package/dist/components/MultiSelect/MultiSelect.js +5 -7
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +5 -2
- package/dist/components/MultiSelect/MultiSelect.stories.js +74 -35
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.d.ts +6 -0
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +16 -0
- package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -0
- package/dist/components/MultiSelect/components/MultiSelectItem.js +9 -0
- package/dist/components/MultiSelect/components/MultiSelectItem.js.map +1 -0
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +3 -2
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +24 -26
- package/dist/components/index.js.map +1 -1
- package/dist/index-DFUrxrKJ.js.map +1 -1
- package/dist/index.js +24 -26
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/dist/assets/MultiSelect.css +0 -1
- package/dist/components/MultiSelectItem/MultiSelectItem.js +0 -19
- package/dist/components/MultiSelectItem/MultiSelectItem.js.map +0 -1
- package/dist/components/MultiSelectItem/MultiSelectItem.stories.d.ts +0 -5
- package/dist/components/MultiSelectItem/MultiSelectItem.stories.js +0 -17
- package/dist/components/MultiSelectItem/MultiSelectItem.stories.js.map +0 -1
- package/dist/components/MultiSelectItem/index.d.ts +0 -1
- package/dist/components/MultiSelectItem/index.js +0 -5
- package/dist/components/MultiSelectItem/index.js.map +0 -1
- /package/dist/components/{MultiSelectItem → MultiSelect/components}/MultiSelectItem.d.ts +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as s, jsx as l, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import { c as m } from "./clsx-DB4S2d7J.js";
|
|
3
|
+
import { s as t, M as u } from "./MultiSelectItem-D5q99kfp.js";
|
|
4
|
+
import { Label as n } from "./components/Label/Label.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { Button as p } from "./components/Button/Button.js";
|
|
7
|
+
import "./components/OverlayCloseButton/OverlayCloseButton.js";
|
|
8
|
+
import "./components/IconButton/IconButton.js";
|
|
9
|
+
import "./components/Input/Input.js";
|
|
10
|
+
import "./components/InputField/InputField.js";
|
|
11
|
+
import "./components/SelectListbox/SelectListbox.js";
|
|
12
|
+
import "./components/SelectListbox/SelectProvider.js";
|
|
13
|
+
function d({ label: i, clearTrigger: e, onClear: r }) {
|
|
14
|
+
return /* @__PURE__ */ s("header", { className: t["multi-select__header"], children: [
|
|
15
|
+
/* @__PURE__ */ l(n, { htmlFor: "multi-select-list", children: i }),
|
|
16
|
+
e && /* @__PURE__ */ l(p, { variant: "blank", onClick: r, children: e })
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
const o = ({ scrollable: i = !0, noBorder: e, header: r, children: c }) => /* @__PURE__ */ s(a, { children: [
|
|
20
|
+
r,
|
|
21
|
+
/* @__PURE__ */ l(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: m(t["multi-select"], {
|
|
25
|
+
[t["multi-select--no-border"]]: e
|
|
26
|
+
}),
|
|
27
|
+
children: /* @__PURE__ */ l(
|
|
28
|
+
"ul",
|
|
29
|
+
{
|
|
30
|
+
className: m(t["multi-select__list"], {
|
|
31
|
+
[t["multi-select__list--scrollable"]]: i
|
|
32
|
+
}),
|
|
33
|
+
id: "multi-select-list",
|
|
34
|
+
children: c
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] });
|
|
40
|
+
o.MultiSelectHeader = d;
|
|
41
|
+
o.MultiSelectItem = u;
|
|
42
|
+
export {
|
|
43
|
+
o as M,
|
|
44
|
+
d as a
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=MultiSelect-CFOkF66G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSelect-CFOkF66G.js","sources":["../src/components/MultiSelect/components/MultiSelectHeader.tsx","../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import styles from 'components/MultiSelect/MultiSelect.module.css';\nimport { Label } from 'components/Label';\nimport { Button } from 'components';\n\nexport interface MultiSelectHeaderProps {\n label: string;\n clearTrigger?: string;\n onClear?: () => void;\n}\n\nexport function MultiSelectHeader({ label, clearTrigger, onClear }: MultiSelectHeaderProps) {\n return (\n <header className={styles['multi-select__header']}>\n <Label htmlFor=\"multi-select-list\">{label}</Label>\n {clearTrigger && (\n <Button variant={'blank'} onClick={onClear}>\n {clearTrigger}\n </Button>\n )}\n </header>\n );\n}\n","import clsx from 'clsx';\n\nimport type { PropsWithChildren, ReactNode } from 'react';\n\nimport styles from './MultiSelect.module.css';\n\nimport { MultiSelectItem } from 'components/MultiSelect/components/MultiSelectItem';\nimport { MultiSelectHeader } from 'components/MultiSelect/components/MultiSelectHeader';\nexport interface MultiSelectProps {\n scrollable?: boolean;\n noBorder?: boolean;\n header?: ReactNode;\n}\n\nexport const MultiSelect = ({ scrollable = true, noBorder, header, children }: PropsWithChildren<MultiSelectProps>) => (\n <>\n {header}\n <div\n className={clsx(styles['multi-select'], {\n [styles['multi-select--no-border']]: noBorder,\n })}\n >\n <ul\n className={clsx(styles['multi-select__list'], {\n [styles['multi-select__list--scrollable']]: scrollable,\n })}\n id=\"multi-select-list\"\n >\n {children}\n </ul>\n </div>\n </>\n);\n\nMultiSelect.MultiSelectHeader = MultiSelectHeader;\nMultiSelect.MultiSelectItem = MultiSelectItem;\n"],"names":["MultiSelectHeader","label","clearTrigger","onClear","jsxs","styles","jsx","Label","Button","MultiSelect","scrollable","noBorder","header","children","Fragment","clsx","MultiSelectItem"],"mappings":";;;;;;;;;;;;AAUO,SAASA,EAAkB,EAAE,OAAAC,GAAO,cAAAC,GAAc,SAAAC,KAAmC;AAC1F,SACG,gBAAAC,EAAA,UAAA,EAAO,WAAWC,EAAO,sBAAsB,GAC9C,UAAA;AAAA,IAAC,gBAAAC,EAAAC,GAAA,EAAM,SAAQ,qBAAqB,UAAMN,GAAA;AAAA,IACzCC,KACE,gBAAAI,EAAAE,GAAA,EAAO,SAAS,SAAS,SAASL,GAChC,UACHD,GAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ;ACPa,MAAAO,IAAc,CAAC,EAAE,YAAAC,IAAa,IAAM,UAAAC,GAAU,QAAAC,GAAQ,UAAAC,QAE9D,gBAAAT,EAAAU,GAAA,EAAA,UAAA;AAAA,EAAAF;AAAA,EACD,gBAAAN;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWS,EAAKV,EAAO,cAAc,GAAG;AAAA,QACtC,CAACA,EAAO,yBAAyB,CAAC,GAAGM;AAAA,MAAA,CACtC;AAAA,MAED,UAAA,gBAAAL;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWS,EAAKV,EAAO,oBAAoB,GAAG;AAAA,YAC5C,CAACA,EAAO,gCAAgC,CAAC,GAAGK;AAAA,UAAA,CAC7C;AAAA,UACD,IAAG;AAAA,UAEF,UAAAG;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EACF;AAAA,GACF;AAGFJ,EAAY,oBAAoBT;AAChCS,EAAY,kBAAkBO;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useId as c } from "react";
|
|
3
|
+
import { Checkbox as o } from "./components/Checkbox/Checkbox.js";
|
|
4
|
+
import { Label as n } from "./components/Label/Label.js";
|
|
5
|
+
import './assets/MultiSelectItem.css';const i = {
|
|
6
|
+
"multi-select": "_multi-select_mabi4_1",
|
|
7
|
+
"multi-select--no-border": "_multi-select--no-border_mabi4_7",
|
|
8
|
+
"multi-select__header": "_multi-select__header_mabi4_12",
|
|
9
|
+
"multi-select__list": "_multi-select__list_mabi4_18",
|
|
10
|
+
"multi-select__list--scrollable": "_multi-select__list--scrollable_mabi4_27",
|
|
11
|
+
"multi-select__item-inner": "_multi-select__item-inner_mabi4_32"
|
|
12
|
+
};
|
|
13
|
+
function h({ label: _, value: m, checked: t, onChange: s }) {
|
|
14
|
+
const l = c();
|
|
15
|
+
return /* @__PURE__ */ e("li", { className: i["multi-select__item"], children: /* @__PURE__ */ r("div", { className: i["multi-select__item-inner"], children: [
|
|
16
|
+
/* @__PURE__ */ e(o, { id: l, value: m, checked: t, onChange: s }),
|
|
17
|
+
/* @__PURE__ */ e(n, { htmlFor: l, noFontWeight: !t, children: _ })
|
|
18
|
+
] }) });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
h as M,
|
|
22
|
+
i as s
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=MultiSelectItem-D5q99kfp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSelectItem-D5q99kfp.js","sources":["../src/components/MultiSelect/components/MultiSelectItem.tsx"],"sourcesContent":["import { useId } from 'react';\n\nimport type { ChangeEvent } from 'react';\n\nimport styles from 'components/MultiSelect/MultiSelect.module.css';\nimport { Checkbox } from 'components/Checkbox';\nimport { Label } from 'components/Label';\n\nexport interface MultiSelectItemProps {\n label: string;\n value: string | number;\n checked: boolean;\n onChange(event: ChangeEvent<HTMLInputElement>): void;\n}\n\nexport function MultiSelectItem({ label, value, checked, onChange }: MultiSelectItemProps) {\n const id = useId();\n\n return (\n <li className={styles['multi-select__item']}>\n <div className={styles['multi-select__item-inner']}>\n <Checkbox id={id} value={value} checked={checked} onChange={onChange} />\n <Label htmlFor={id} noFontWeight={!checked}>\n {label}\n </Label>\n </div>\n </li>\n );\n}\n"],"names":["MultiSelectItem","label","value","checked","onChange","id","useId","jsx","styles","jsxs","Checkbox","Label"],"mappings":";;;;;;;;;;;;AAeO,SAASA,EAAgB,EAAE,OAAAC,GAAO,OAAAC,GAAO,SAAAC,GAAS,UAAAC,KAAkC;AACzF,QAAMC,IAAKC;AAGT,SAAA,gBAAAC,EAAC,MAAG,EAAA,WAAWC,EAAO,oBAAoB,GACxC,UAAA,gBAAAC,EAAC,OAAI,EAAA,WAAWD,EAAO,0BAA0B,GAC/C,UAAA;AAAA,IAAA,gBAAAD,EAACG,GAAS,EAAA,IAAAL,GAAQ,OAAAH,GAAc,SAAAC,GAAkB,UAAAC,GAAoB;AAAA,sBACrEO,GAAM,EAAA,SAASN,GAAI,cAAc,CAACF,GAChC,UACHF,GAAA;AAAA,EAAA,EACF,CAAA,EACF,CAAA;AAEJ;"}
|
package/dist/assets/Label.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._label_1b4r9_1{font-weight:var(--semibold);text-align:left}._label--unset-font-weight_1b4r9_6{font-weight:unset}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._multi-
|
|
1
|
+
._multi-select_mabi4_1{border:1px solid var(--color-black);border-radius:var(--border-radius-default);padding:.75rem}._multi-select--no-border_mabi4_7{border:none;padding:0}._multi-select__header_mabi4_12{display:flex;justify-content:space-between;margin-bottom:.5rem}._multi-select__list_mabi4_18{display:flex;flex-direction:column;gap:.5rem;list-style:none;margin:0;padding:0}._multi-select__list--scrollable_mabi4_27{max-height:8.75rem;overflow:auto}._multi-select__item-inner_mabi4_32{align-items:center;display:flex;gap:.75rem}
|
|
@@ -5,5 +5,6 @@ export interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputEleme
|
|
|
5
5
|
type?: 'text' | 'search' | 'password' | 'email';
|
|
6
6
|
id: string;
|
|
7
7
|
clearTrigger?: ReactNode;
|
|
8
|
+
onClear?: () => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const InputField: import('react').ForwardRefExoticComponent<InputFieldProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as h, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m, useState as b, useRef as g, useEffect as x } from "react";
|
|
3
3
|
import { c as y } from "../../clsx-DB4S2d7J.js";
|
|
4
|
-
import '../../assets/InputField.css';const
|
|
4
|
+
import '../../assets/InputField.css';const i = {
|
|
5
5
|
"input-field-wrapper": "_input-field-wrapper_hh88t_1",
|
|
6
6
|
"input-field": "_input-field_hh88t_1",
|
|
7
7
|
"input-field--large": "_input-field--large_hh88t_22",
|
|
8
8
|
"input-field__clear-button": "_input-field__clear-button_hh88t_30"
|
|
9
|
-
},
|
|
10
|
-
({ autoComplete: c = "off", id:
|
|
11
|
-
const [
|
|
12
|
-
|
|
9
|
+
}, W = m(
|
|
10
|
+
({ autoComplete: c = "off", id: r, value: e, variant: s, type: f = "text", clearTrigger: n, onClear: u, ...o }, t) => {
|
|
11
|
+
const [a, _] = b(0), l = g(null);
|
|
12
|
+
x(() => {
|
|
13
13
|
l.current && _(l.current.offsetWidth);
|
|
14
14
|
}, [e]);
|
|
15
15
|
const d = () => {
|
|
16
|
-
|
|
17
|
-
}, m = (g) => {
|
|
18
|
-
r(g.target.value);
|
|
16
|
+
u && t && "current" in t && t.current && (u(), t.current.focus());
|
|
19
17
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
/* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ h("div", { className: i["input-field-wrapper"], children: [
|
|
19
|
+
/* @__PURE__ */ p(
|
|
22
20
|
"input",
|
|
23
21
|
{
|
|
24
|
-
...
|
|
22
|
+
...o,
|
|
25
23
|
autoComplete: c,
|
|
26
24
|
ref: t,
|
|
27
|
-
id:
|
|
28
|
-
className: y(
|
|
29
|
-
[
|
|
25
|
+
id: r,
|
|
26
|
+
className: y(i["input-field"], {
|
|
27
|
+
[i["input-field--large"]]: s === "large"
|
|
30
28
|
}),
|
|
31
|
-
type:
|
|
29
|
+
type: f,
|
|
32
30
|
value: e,
|
|
33
|
-
|
|
34
|
-
style: { paddingRight: e && i ? h : void 0 }
|
|
31
|
+
style: { paddingRight: e && n ? a : void 0 }
|
|
35
32
|
}
|
|
36
33
|
),
|
|
37
|
-
e &&
|
|
34
|
+
e && n && /* @__PURE__ */ p(
|
|
38
35
|
"button",
|
|
39
36
|
{
|
|
40
37
|
type: "button",
|
|
41
|
-
className:
|
|
38
|
+
className: i["input-field__clear-button"],
|
|
42
39
|
onClick: d,
|
|
43
40
|
ref: l,
|
|
44
|
-
"aria-label": `clear trigger for ${
|
|
45
|
-
children:
|
|
41
|
+
"aria-label": `clear trigger for ${r}`,
|
|
42
|
+
children: n
|
|
46
43
|
}
|
|
47
44
|
)
|
|
48
45
|
] });
|
|
49
46
|
}
|
|
50
47
|
);
|
|
51
48
|
export {
|
|
52
|
-
|
|
49
|
+
W as InputField
|
|
53
50
|
};
|
|
54
51
|
//# sourceMappingURL=InputField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.js","sources":["../../../src/components/InputField/InputField.tsx"],"sourcesContent":["import { forwardRef, useState, useEffect, useRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { InputHTMLAttributes, ReactNode } from 'react';\n\nimport styles from './InputField.module.css';\n\nexport interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {\n variant?: 'large';\n type?: 'text' | 'search' | 'password' | 'email';\n id: string;\n clearTrigger?: ReactNode;\n}\n\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n ({ autoComplete = 'off', id, variant, type = 'text', clearTrigger, ...restProps }: InputFieldProps
|
|
1
|
+
{"version":3,"file":"InputField.js","sources":["../../../src/components/InputField/InputField.tsx"],"sourcesContent":["import { forwardRef, useState, useEffect, useRef } from 'react';\nimport { clsx } from 'clsx';\n\nimport type { InputHTMLAttributes, ReactNode } from 'react';\n\nimport styles from './InputField.module.css';\n\nexport interface InputFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {\n variant?: 'large';\n type?: 'text' | 'search' | 'password' | 'email';\n id: string;\n clearTrigger?: ReactNode;\n onClear?: () => void;\n}\n\nexport const InputField = forwardRef<HTMLInputElement, InputFieldProps>(\n (\n { autoComplete = 'off', id, value, variant, type = 'text', clearTrigger, onClear, ...restProps }: InputFieldProps,\n forwardedRef\n ) => {\n const [clearButtonWidth, setClearButtonWidth] = useState<number>(0);\n const clearButtonRef = useRef<HTMLButtonElement>(null);\n\n useEffect(() => {\n if (clearButtonRef.current) {\n setClearButtonWidth(clearButtonRef.current.offsetWidth);\n }\n }, [value]);\n\n const handleClearTriggerClick = () => {\n if (onClear && forwardedRef && 'current' in forwardedRef && forwardedRef.current) {\n onClear();\n forwardedRef.current.focus();\n }\n };\n\n return (\n <div className={styles['input-field-wrapper']}>\n <input\n {...restProps}\n autoComplete={autoComplete}\n ref={forwardedRef}\n id={id}\n className={clsx(styles['input-field'], {\n [styles['input-field--large']]: variant === 'large',\n })}\n type={type}\n value={value}\n style={{ paddingRight: value && clearTrigger ? clearButtonWidth : undefined }}\n />\n {value && clearTrigger && (\n <button\n type=\"button\"\n className={styles['input-field__clear-button']}\n onClick={handleClearTriggerClick}\n ref={clearButtonRef}\n aria-label={`clear trigger for ${id}`}\n >\n {clearTrigger}\n </button>\n )}\n </div>\n );\n }\n);\n"],"names":["InputField","forwardRef","autoComplete","id","value","variant","type","clearTrigger","onClear","restProps","forwardedRef","clearButtonWidth","setClearButtonWidth","useState","clearButtonRef","useRef","useEffect","handleClearTriggerClick","jsxs","styles","jsx","clsx"],"mappings":";;;;;;;;GAeaA,IAAaC;AAAA,EACxB,CACE,EAAE,cAAAC,IAAe,OAAO,IAAAC,GAAI,OAAAC,GAAO,SAAAC,GAAS,MAAAC,IAAO,QAAQ,cAAAC,GAAc,SAAAC,GAAS,GAAGC,EAAA,GACrFC,MACG;AACH,UAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAiB,CAAC,GAC5DC,IAAiBC,EAA0B,IAAI;AAErD,IAAAC,EAAU,MAAM;AACd,MAAIF,EAAe,WACGF,EAAAE,EAAe,QAAQ,WAAW;AAAA,IACxD,GACC,CAACV,CAAK,CAAC;AAEV,UAAMa,IAA0B,MAAM;AACpC,MAAIT,KAAWE,KAAgB,aAAaA,KAAgBA,EAAa,YAC/DF,KACRE,EAAa,QAAQ;IACvB;AAGF,WACG,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,qBAAqB,GAC1C,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACE,GAAGX;AAAA,UACJ,cAAAP;AAAA,UACA,KAAKQ;AAAA,UACL,IAAAP;AAAA,UACA,WAAWkB,EAAKF,EAAO,aAAa,GAAG;AAAA,YACrC,CAACA,EAAO,oBAAoB,CAAC,GAAGd,MAAY;AAAA,UAAA,CAC7C;AAAA,UACD,MAAAC;AAAA,UACA,OAAAF;AAAA,UACA,OAAO,EAAE,cAAcA,KAASG,IAAeI,IAAmB,OAAU;AAAA,QAAA;AAAA,MAC9E;AAAA,MACCP,KAASG,KACR,gBAAAa;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAWD,EAAO,2BAA2B;AAAA,UAC7C,SAASF;AAAA,UACT,KAAKH;AAAA,UACL,cAAY,qBAAqBX,CAAE;AAAA,UAElC,UAAAI;AAAA,QAAA;AAAA,MACH;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as g } from "react";
|
|
3
|
+
import { f as i } from "../../index-DFUrxrKJ.js";
|
|
4
|
+
import { InputField as l } from "./InputField.js";
|
|
5
|
+
import { Container as u } from "../storyComponents/Container/Container.js";
|
|
6
|
+
import { Icon as f } from "../Icon/Icon.js";
|
|
6
7
|
import "../Button/Button.js";
|
|
7
8
|
import "../OverlayCloseButton/OverlayCloseButton.js";
|
|
8
9
|
import "../IconButton/IconButton.js";
|
|
9
10
|
import "../Input/Input.js";
|
|
11
|
+
import "../../MultiSelect-CFOkF66G.js";
|
|
10
12
|
import "../SelectListbox/SelectListbox.js";
|
|
11
13
|
import "../SelectListbox/SelectProvider.js";
|
|
12
|
-
const
|
|
14
|
+
const h = (t) => {
|
|
13
15
|
const r = t.variant ?? [];
|
|
14
16
|
return { ...t, variant: r.toString() };
|
|
15
|
-
},
|
|
17
|
+
}, E = {
|
|
16
18
|
title: "Atoms/InputField",
|
|
17
|
-
component:
|
|
19
|
+
component: l,
|
|
18
20
|
argTypes: {
|
|
19
21
|
variant: {
|
|
20
22
|
options: ["large"],
|
|
@@ -33,31 +35,44 @@ const l = (t) => {
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
},
|
|
37
|
-
const r =
|
|
38
|
-
|
|
39
|
-
},
|
|
38
|
+
}, o = (t) => {
|
|
39
|
+
const [r, a] = d(""), s = g(null), p = (c) => {
|
|
40
|
+
a(c.target.value), i()("handleChange");
|
|
41
|
+
}, m = () => {
|
|
42
|
+
a(""), i()("handleClear");
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(
|
|
45
|
+
l,
|
|
46
|
+
{
|
|
47
|
+
...h(t),
|
|
48
|
+
value: r,
|
|
49
|
+
onChange: p,
|
|
50
|
+
onClear: m,
|
|
51
|
+
ref: s
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}, n = {
|
|
40
55
|
type: "text",
|
|
41
56
|
variant: void 0,
|
|
42
57
|
id: "4f9ca77d"
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
...
|
|
58
|
+
}, C = o.bind({});
|
|
59
|
+
C.args = {
|
|
60
|
+
...n
|
|
46
61
|
};
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
...
|
|
62
|
+
const v = o.bind({});
|
|
63
|
+
v.args = {
|
|
64
|
+
...n,
|
|
50
65
|
clearTrigger: "Clear"
|
|
51
66
|
};
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
...
|
|
55
|
-
clearTrigger: /* @__PURE__ */
|
|
67
|
+
const I = o.bind({});
|
|
68
|
+
I.args = {
|
|
69
|
+
...n,
|
|
70
|
+
clearTrigger: /* @__PURE__ */ e(f, { name: "Cross" })
|
|
56
71
|
};
|
|
57
72
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
C as InputFieldExample,
|
|
74
|
+
I as WithIconClearTrigger,
|
|
75
|
+
v as WithStringClearTrigger,
|
|
76
|
+
E as default
|
|
62
77
|
};
|
|
63
78
|
//# sourceMappingURL=InputField.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputField.stories.js","sources":["../../../src/components/InputField/InputField.stories.tsx"],"sourcesContent":["import { useRef } from 'react';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { InputFieldProps } from './InputField';\n\nimport { InputField } from './InputField';\n\nimport { Container } from 'components/storyComponents/Container';\nimport { Icon } from 'components';\n\nconst transformArgs = (args: InputFieldProps) => {\n // args.variant is provided as an array because the control type is set to a checkbox. So this transforms the selected value into its proper value: a string\n const variantArray = (args.variant as unknown as string[]) ?? [];\n return { ...args, ...{ variant: variantArray.toString() } } as InputFieldProps;\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/InputField',\n component: InputField,\n argTypes: {\n variant: {\n options: ['large'],\n control: 'check',\n },\n type: {\n control: 'radio',\n options: ['text', 'search', 'password', 'email'],\n },\n id: {\n control: 'text',\n },\n autoComplete: {\n table: {\n disable: true,\n },\n },\n },\n} as Meta<InputFieldProps>;\n\nconst Template: StoryFn<InputFieldProps> = (args) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n return (\n <Container>\n <InputField
|
|
1
|
+
{"version":3,"file":"InputField.stories.js","sources":["../../../src/components/InputField/InputField.stories.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { fn } from '@storybook/test';\n\nimport type { ChangeEvent } from 'react';\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { InputFieldProps } from './InputField';\n\nimport { InputField } from './InputField';\n\nimport { Container } from 'components/storyComponents/Container';\nimport { Icon } from 'components';\n\nconst transformArgs = (args: InputFieldProps) => {\n // args.variant is provided as an array because the control type is set to a checkbox. So this transforms the selected value into its proper value: a string\n const variantArray = (args.variant as unknown as string[]) ?? [];\n return { ...args, ...{ variant: variantArray.toString() } } as InputFieldProps;\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/InputField',\n component: InputField,\n argTypes: {\n variant: {\n options: ['large'],\n control: 'check',\n },\n type: {\n control: 'radio',\n options: ['text', 'search', 'password', 'email'],\n },\n id: {\n control: 'text',\n },\n autoComplete: {\n table: {\n disable: true,\n },\n },\n },\n} as Meta<InputFieldProps>;\n\nconst Template: StoryFn<InputFieldProps> = (args) => {\n const [inputValue, setInputValue] = useState<InputFieldProps['value']>('');\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInputValue(event.target.value);\n fn()('handleChange');\n };\n\n const handleClear = () => {\n setInputValue('');\n fn()('handleClear');\n };\n\n return (\n <Container>\n <InputField\n {...transformArgs(args)}\n value={inputValue}\n onChange={handleChange}\n onClear={handleClear}\n ref={inputRef}\n />\n </Container>\n );\n};\n\nconst defaultArgs: Partial<InputFieldProps> = {\n type: 'text',\n variant: undefined,\n id: '4f9ca77d',\n};\n\nexport const InputFieldExample = Template.bind({});\nInputFieldExample.args = {\n ...defaultArgs,\n};\n\nexport const WithStringClearTrigger = Template.bind({});\nWithStringClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: 'Clear',\n};\n\nexport const WithIconClearTrigger = Template.bind({});\nWithIconClearTrigger.args = {\n ...defaultArgs,\n clearTrigger: <Icon name=\"Cross\" />,\n};\n"],"names":["transformArgs","args","variantArray","InputField_stories","InputField","Template","inputValue","setInputValue","useState","inputRef","useRef","handleChange","event","fn","handleClear","Container","jsx","defaultArgs","InputFieldExample","WithStringClearTrigger","WithIconClearTrigger","Icon"],"mappings":";;;;;;;;;;;;;AAYA,MAAMA,IAAgB,CAACC,MAA0B;AAEzC,QAAAC,IAAgBD,EAAK,WAAmC;AACvD,SAAA,EAAE,GAAGA,GAAW,SAASC,EAAa,SAAS;AACxD,GAGeC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS,CAAC,OAAO;AAAA,MACjB,SAAS;AAAA,IACX;AAAA,IACA,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,SAAS,CAAC,QAAQ,UAAU,YAAY,OAAO;AAAA,IACjD;AAAA,IACA,IAAI;AAAA,MACF,SAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,MACZ,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF,GAEMC,IAAqC,CAACJ,MAAS;AACnD,QAAM,CAACK,GAAYC,CAAa,IAAIC,EAAmC,EAAE,GACnEC,IAAWC,EAAyB,IAAI,GAExCC,IAAe,CAACC,MAAyC;AAC/C,IAAAL,EAAAK,EAAM,OAAO,KAAK,GAChCC,EAAA,EAAK,cAAc;AAAA,EAAA,GAGfC,IAAc,MAAM;AACxB,IAAAP,EAAc,EAAE,GAChBM,EAAA,EAAK,aAAa;AAAA,EAAA;AAGpB,2BACGE,GACC,EAAA,UAAA,gBAAAC;AAAA,IAACZ;AAAA,IAAA;AAAA,MACE,GAAGJ,EAAcC,CAAI;AAAA,MACtB,OAAOK;AAAA,MACP,UAAUK;AAAA,MACV,SAASG;AAAA,MACT,KAAKL;AAAA,IAAA;AAAA,EAET,EAAA,CAAA;AAEJ,GAEMQ,IAAwC;AAAA,EAC5C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,IAAI;AACN,GAEaC,IAAoBb,EAAS,KAAK,EAAE;AACjDa,EAAkB,OAAO;AAAA,EACvB,GAAGD;AACL;AAEO,MAAME,IAAyBd,EAAS,KAAK,EAAE;AACtDc,EAAuB,OAAO;AAAA,EAC5B,GAAGF;AAAA,EACH,cAAc;AAChB;AAEO,MAAMG,IAAuBf,EAAS,KAAK,EAAE;AACpDe,EAAqB,OAAO;AAAA,EAC1B,GAAGH;AAAA,EACH,cAAc,gBAAAD,EAACK,GAAK,EAAA,MAAK,QAAQ,CAAA;AACnC;"}
|
|
@@ -2,5 +2,6 @@ import { LabelHTMLAttributes } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'className' | 'style'> {
|
|
4
4
|
htmlFor: string;
|
|
5
|
+
noFontWeight?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const Label: ({ children, htmlFor, ...restProps }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const Label: ({ children, htmlFor, noFontWeight, ...restProps }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../../clsx-DB4S2d7J.js";
|
|
3
|
+
import '../../assets/Label.css';const n = "_label_1b4r9_1", l = {
|
|
4
|
+
label: n,
|
|
5
|
+
"label--unset-font-weight": "_label--unset-font-weight_1b4r9_6"
|
|
6
|
+
}, _ = ({ children: e, htmlFor: t, noFontWeight: s, ...a }) => /* @__PURE__ */ b(
|
|
7
|
+
"label",
|
|
8
|
+
{
|
|
9
|
+
...a,
|
|
10
|
+
htmlFor: t,
|
|
11
|
+
className: o(l.label, {
|
|
12
|
+
[l["label--unset-font-weight"]]: s
|
|
13
|
+
}),
|
|
14
|
+
children: e
|
|
15
|
+
}
|
|
16
|
+
);
|
|
5
17
|
export {
|
|
6
|
-
|
|
18
|
+
_ as Label
|
|
7
19
|
};
|
|
8
20
|
//# sourceMappingURL=Label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import type { LabelHTMLAttributes } from 'react';\n\nimport styles from './Label.module.css';\n\nexport interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'className' | 'style'> {\n htmlFor: string;\n}\n\nexport const Label = ({ children, htmlFor, ...restProps }: LabelProps) => (\n <label
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import clsx from 'clsx';\n\nimport type { LabelHTMLAttributes } from 'react';\n\nimport styles from './Label.module.css';\n\nexport interface LabelProps extends Omit<LabelHTMLAttributes<HTMLLabelElement>, 'className' | 'style'> {\n htmlFor: string;\n noFontWeight?: boolean;\n}\n\nexport const Label = ({ children, htmlFor, noFontWeight, ...restProps }: LabelProps) => (\n <label\n {...restProps}\n htmlFor={htmlFor}\n className={clsx(styles['label'], {\n [styles['label--unset-font-weight']]: noFontWeight,\n })}\n >\n {children}\n </label>\n);\n"],"names":["Label","children","htmlFor","noFontWeight","restProps","jsx","clsx","styles"],"mappings":";;;;;GAWaA,IAAQ,CAAC,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,GAAc,GAAGC,QAC1D,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,SAAAF;AAAA,IACA,WAAWI,EAAKC,EAAO,OAAU;AAAA,MAC/B,CAACA,EAAO,0BAA0B,CAAC,GAAGJ;AAAA,IAAA,CACvC;AAAA,IAEA,UAAAF;AAAA,EAAA;AACH;"}
|
|
@@ -3,3 +3,4 @@ import { LabelProps } from './Label';
|
|
|
3
3
|
declare const _default: import('@storybook/types').ComponentAnnotations<import('@storybook/react').ReactRenderer, LabelProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const LabelExample: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, LabelProps>;
|
|
6
|
+
export declare const WithNoFontWeight: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, LabelProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { Label as t } from "./Label.js";
|
|
3
|
-
const
|
|
3
|
+
const c = {
|
|
4
4
|
title: "Atoms/Label",
|
|
5
5
|
component: t,
|
|
6
6
|
argTypes: {
|
|
@@ -11,13 +11,21 @@ const a = {
|
|
|
11
11
|
control: "text"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
l.args = {
|
|
14
|
+
}, o = (r) => /* @__PURE__ */ n(t, { ...r }), e = {
|
|
16
15
|
children: "Lorem Ipsum",
|
|
17
16
|
htmlFor: "bd79f7ec"
|
|
17
|
+
}, l = o.bind({});
|
|
18
|
+
l.args = {
|
|
19
|
+
...e
|
|
20
|
+
};
|
|
21
|
+
const s = o.bind({});
|
|
22
|
+
s.args = {
|
|
23
|
+
...e,
|
|
24
|
+
noFontWeight: !0
|
|
18
25
|
};
|
|
19
26
|
export {
|
|
20
27
|
l as LabelExample,
|
|
21
|
-
|
|
28
|
+
s as WithNoFontWeight,
|
|
29
|
+
c as default
|
|
22
30
|
};
|
|
23
31
|
//# sourceMappingURL=Label.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.stories.js","sources":["../../../src/components/Label/Label.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { LabelProps } from './Label';\n\nimport { Label } from './Label';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Label',\n component: Label,\n argTypes: {\n htmlFor: {\n control: 'text',\n },\n children: {\n control: 'text',\n },\n },\n} as Meta<LabelProps>;\n\nconst Template: StoryFn<LabelProps> = (args) => <Label {...args} />;\n\nexport const LabelExample = Template.bind({});\nLabelExample.args = {\n
|
|
1
|
+
{"version":3,"file":"Label.stories.js","sources":["../../../src/components/Label/Label.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { LabelProps } from './Label';\n\nimport { Label } from './Label';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Label',\n component: Label,\n argTypes: {\n htmlFor: {\n control: 'text',\n },\n children: {\n control: 'text',\n },\n },\n} as Meta<LabelProps>;\n\nconst Template: StoryFn<LabelProps> = (args) => <Label {...args} />;\n\nconst defaultArgs: Partial<LabelProps> = {\n children: 'Lorem Ipsum',\n htmlFor: 'bd79f7ec',\n};\n\nexport const LabelExample = Template.bind({});\nLabelExample.args = {\n ...defaultArgs,\n};\n\nexport const WithNoFontWeight = Template.bind({});\nWithNoFontWeight.args = {\n ...defaultArgs,\n noFontWeight: true,\n};\n"],"names":["Label_stories","Label","Template","args","jsx","defaultArgs","LabelExample","WithNoFontWeight"],"mappings":";;AAMA,MAAeA,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,SAAS;AAAA,MACP,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,IACX;AAAA,EACF;AACF,GAEMC,IAAgC,CAACC,MAAU,gBAAAC,EAAAH,GAAA,EAAO,GAAGE,EAAM,CAAA,GAE3DE,IAAmC;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AACX,GAEaC,IAAeJ,EAAS,KAAK,EAAE;AAC5CI,EAAa,OAAO;AAAA,EAClB,GAAGD;AACL;AAEO,MAAME,IAAmBL,EAAS,KAAK,EAAE;AAChDK,EAAiB,OAAO;AAAA,EACtB,GAAGF;AAAA,EACH,cAAc;AAChB;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { MultiSelectItem } from 'components/MultiSelect/components/MultiSelectItem';
|
|
3
|
+
import { MultiSelectHeader } from 'components/MultiSelect/components/MultiSelectHeader';
|
|
2
4
|
|
|
3
5
|
export interface MultiSelectProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
checked: boolean;
|
|
8
|
-
}>;
|
|
9
|
-
onChange(event: ChangeEvent<HTMLInputElement>): void;
|
|
6
|
+
scrollable?: boolean;
|
|
7
|
+
noBorder?: boolean;
|
|
8
|
+
header?: ReactNode;
|
|
10
9
|
}
|
|
11
|
-
export declare const MultiSelect:
|
|
10
|
+
export declare const MultiSelect: {
|
|
11
|
+
({ scrollable, noBorder, header, children }: PropsWithChildren<MultiSelectProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
MultiSelectHeader: typeof MultiSelectHeader;
|
|
13
|
+
MultiSelectItem: typeof MultiSelectItem;
|
|
14
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
"multi-select__scroll-container": "_multi-select__scroll-container_1se76_7"
|
|
6
|
-
}, r = ({ items: c, onChange: s }) => /* @__PURE__ */ l("div", { className: t["multi-select"], children: /* @__PURE__ */ l("ul", { className: t["multi-select__scroll-container"], children: c.map((e) => /* @__PURE__ */ l(i, { ...e, onChange: s }, e.label)) }) });
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../../clsx-DB4S2d7J.js";
|
|
3
|
+
import "../../MultiSelectItem-D5q99kfp.js";
|
|
4
|
+
import { M as p } from "../../MultiSelect-CFOkF66G.js";
|
|
7
5
|
export {
|
|
8
|
-
|
|
6
|
+
p as MultiSelect
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=MultiSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sources":[
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
1
2
|
import { MultiSelectProps } from './MultiSelect';
|
|
2
3
|
|
|
3
|
-
declare const _default: import('@storybook/types').ComponentAnnotations<import('@storybook/react').ReactRenderer, MultiSelectProps
|
|
4
|
+
declare const _default: import('@storybook/types').ComponentAnnotations<import('@storybook/react').ReactRenderer, PropsWithChildren<MultiSelectProps>>;
|
|
4
5
|
export default _default;
|
|
5
|
-
export declare const MultiSelectExample: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, MultiSelectProps
|
|
6
|
+
export declare const MultiSelectExample: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<MultiSelectProps>>;
|
|
7
|
+
export declare const WithHeader: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<MultiSelectProps>>;
|
|
8
|
+
export declare const WithheaderAndWithoutScrollContainerAndBorder: import('@storybook/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, PropsWithChildren<MultiSelectProps>>;
|
|
@@ -1,42 +1,81 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { f as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { f as d } from "../../index-DFUrxrKJ.js";
|
|
3
|
+
import { useState as b } from "react";
|
|
4
|
+
import { M as l } from "../../MultiSelect-CFOkF66G.js";
|
|
5
|
+
import { Container as S } from "../storyComponents/Container/Container.js";
|
|
6
|
+
const T = {
|
|
6
7
|
title: "Organisms/MultiSelect",
|
|
7
|
-
component:
|
|
8
|
+
component: l,
|
|
8
9
|
argTypes: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const [s, i] = u([]);
|
|
13
|
-
return /* @__PURE__ */ c(
|
|
14
|
-
o,
|
|
15
|
-
{
|
|
16
|
-
items: [
|
|
17
|
-
{ label: "Item 1", itemValue: "1" },
|
|
18
|
-
{ label: "Item 2", itemValue: "2" },
|
|
19
|
-
{ label: "Item 3", itemValue: "3" },
|
|
20
|
-
{ label: "Item 4", itemValue: "4" },
|
|
21
|
-
{ label: "Item 5", itemValue: "5" },
|
|
22
|
-
{ label: "Item 6", itemValue: "6" }
|
|
23
|
-
].map(({ label: t, itemValue: e }) => ({
|
|
24
|
-
label: t,
|
|
25
|
-
value: e,
|
|
26
|
-
checked: s.includes(e)
|
|
27
|
-
})),
|
|
28
|
-
onChange: (t) => {
|
|
29
|
-
const { checked: e, value: l } = t.target;
|
|
30
|
-
i((m) => {
|
|
31
|
-
const a = e ? [...m, l] : m.filter((n) => n !== l);
|
|
32
|
-
return r()(a), a;
|
|
33
|
-
});
|
|
10
|
+
header: {
|
|
11
|
+
table: {
|
|
12
|
+
disable: !0
|
|
34
13
|
}
|
|
35
14
|
}
|
|
36
|
-
|
|
37
|
-
},
|
|
15
|
+
}
|
|
16
|
+
}, a = (m) => {
|
|
17
|
+
const [i, n] = b([]), h = [
|
|
18
|
+
{ itemName: "Item 1", itemValue: "1" },
|
|
19
|
+
{ itemName: "Item 2", itemValue: "2" },
|
|
20
|
+
{ itemName: "Item 3", itemValue: "3" },
|
|
21
|
+
{ itemName: "Item 4", itemValue: "4" },
|
|
22
|
+
{ itemName: "Item 5", itemValue: "5" },
|
|
23
|
+
{ itemName: "Item 6", itemValue: "6" }
|
|
24
|
+
], f = () => {
|
|
25
|
+
n([]), d()();
|
|
26
|
+
}, g = (e) => {
|
|
27
|
+
const { checked: t, value: o } = e.target;
|
|
28
|
+
n((s) => {
|
|
29
|
+
const c = t ? [...s, o] : s.filter((I) => I !== o);
|
|
30
|
+
return d()(c), c;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return /* @__PURE__ */ p(S, { children: [
|
|
34
|
+
m.header && /* @__PURE__ */ r(
|
|
35
|
+
l.MultiSelectHeader,
|
|
36
|
+
{
|
|
37
|
+
label: "Item list",
|
|
38
|
+
clearTrigger: i.length > 0 ? "Clear Selection" : "",
|
|
39
|
+
onClear: f
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ r(l, { ...m, children: h.map(({ itemName: e, itemValue: t }) => /* @__PURE__ */ r(
|
|
43
|
+
l.MultiSelectItem,
|
|
44
|
+
{
|
|
45
|
+
label: e,
|
|
46
|
+
value: t,
|
|
47
|
+
checked: i.includes(t),
|
|
48
|
+
onChange: g
|
|
49
|
+
},
|
|
50
|
+
e
|
|
51
|
+
)) })
|
|
52
|
+
] });
|
|
53
|
+
}, u = {
|
|
54
|
+
scrollable: !0,
|
|
55
|
+
noBorder: !1
|
|
56
|
+
}, C = a.bind({});
|
|
57
|
+
C.args = {
|
|
58
|
+
...u
|
|
59
|
+
};
|
|
60
|
+
const M = a.bind({});
|
|
61
|
+
M.args = {
|
|
62
|
+
...u,
|
|
63
|
+
// boolean is not normal way of adding header but if added after template the rerender logic of
|
|
64
|
+
// storybook would not correctly clear the checkboxes
|
|
65
|
+
header: !0
|
|
66
|
+
};
|
|
67
|
+
const N = a.bind({});
|
|
68
|
+
N.args = {
|
|
69
|
+
scrollable: !1,
|
|
70
|
+
noBorder: !0,
|
|
71
|
+
// boolean is not normal way of adding header but if added after template the rerender logic of
|
|
72
|
+
// storybook would not correctly clear the checkboxes
|
|
73
|
+
header: !0
|
|
74
|
+
};
|
|
38
75
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
76
|
+
C as MultiSelectExample,
|
|
77
|
+
M as WithHeader,
|
|
78
|
+
N as WithheaderAndWithoutScrollContainerAndBorder,
|
|
79
|
+
T as default
|
|
41
80
|
};
|
|
42
81
|
//# sourceMappingURL=MultiSelect.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.stories.js","sources":["../../../src/components/MultiSelect/MultiSelect.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\nimport { useState } from 'react';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { MultiSelectProps } from './MultiSelect';\n\nimport { MultiSelect } from './MultiSelect';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/MultiSelect',\n component: MultiSelect,\n argTypes: {\n
|
|
1
|
+
{"version":3,"file":"MultiSelect.stories.js","sources":["../../../src/components/MultiSelect/MultiSelect.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\nimport { useState } from 'react';\n\nimport type { ChangeEvent, PropsWithChildren } from 'react';\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { MultiSelectProps } from './MultiSelect';\n\nimport { MultiSelect } from './MultiSelect';\n\nimport { Container } from 'components/storyComponents/Container';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Organisms/MultiSelect',\n component: MultiSelect,\n argTypes: {\n header: {\n table: {\n disable: true,\n },\n },\n },\n} as Meta<PropsWithChildren<MultiSelectProps>>;\n\nconst Template: StoryFn<PropsWithChildren<MultiSelectProps>> = (args) => {\n const [items, setItems] = useState<string[]>([]);\n\n const mockItems = [\n { itemName: 'Item 1', itemValue: '1' },\n { itemName: 'Item 2', itemValue: '2' },\n { itemName: 'Item 3', itemValue: '3' },\n { itemName: 'Item 4', itemValue: '4' },\n { itemName: 'Item 5', itemValue: '5' },\n { itemName: 'Item 6', itemValue: '6' },\n ];\n\n const handleClear = () => {\n setItems([]);\n fn()();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const { checked, value } = event.target;\n setItems((prevState) => {\n const newItems = checked ? [...prevState, value] : prevState.filter((itemValue) => itemValue !== value);\n fn()(newItems);\n return newItems;\n });\n };\n\n return (\n <Container>\n {/* header added under separate boolean arg here for storybook purpose, \n it should be added as direct arg to MultiSelect when used in application */}\n {args.header && (\n <MultiSelect.MultiSelectHeader\n label=\"Item list\"\n clearTrigger={items.length > 0 ? 'Clear Selection' : ''}\n onClear={handleClear}\n />\n )}\n <MultiSelect {...args}>\n {mockItems.map(({ itemName, itemValue }) => (\n <MultiSelect.MultiSelectItem\n key={itemName}\n label={itemName}\n value={itemValue}\n checked={items.includes(itemValue)}\n onChange={handleChange}\n />\n ))}\n </MultiSelect>\n </Container>\n );\n};\n\nconst defaultArgs: Partial<MultiSelectProps> = {\n scrollable: true,\n noBorder: false,\n};\n\nexport const MultiSelectExample = Template.bind({});\nMultiSelectExample.args = {\n ...defaultArgs,\n};\n\nexport const WithHeader = Template.bind({});\nWithHeader.args = {\n ...defaultArgs,\n // boolean is not normal way of adding header but if added after template the rerender logic of\n // storybook would not correctly clear the checkboxes\n header: true,\n};\n\nexport const WithheaderAndWithoutScrollContainerAndBorder = Template.bind({});\nWithheaderAndWithoutScrollContainerAndBorder.args = {\n scrollable: false,\n noBorder: true,\n // boolean is not normal way of adding header but if added after template the rerender logic of\n // storybook would not correctly clear the checkboxes\n header: true,\n};\n"],"names":["MultiSelect_stories","MultiSelect","Template","args","items","setItems","useState","mockItems","handleClear","fn","handleChange","event","checked","value","prevState","newItems","itemValue","Container","jsx","itemName","defaultArgs","MultiSelectExample","WithHeader","WithheaderAndWithoutScrollContainerAndBorder"],"mappings":";;;;;AAYA,MAAeA,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF,GAEMC,IAAyD,CAACC,MAAS;AACvE,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAmB,CAAE,CAAA,GAEzCC,IAAY;AAAA,IAChB,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,IACrC,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,IACrC,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,IACrC,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,IACrC,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,IACrC,EAAE,UAAU,UAAU,WAAW,IAAI;AAAA,EAAA,GAGjCC,IAAc,MAAM;AACxB,IAAAH,EAAS,CAAE,CAAA,GACXI,EAAK,EAAA;AAAA,EAAA,GAGDC,IAAe,CAACC,MAAyC;AAC7D,UAAM,EAAE,SAAAC,GAAS,OAAAC,MAAUF,EAAM;AACjC,IAAAN,EAAS,CAACS,MAAc;AACtB,YAAMC,IAAWH,IAAU,CAAC,GAAGE,GAAWD,CAAK,IAAIC,EAAU,OAAO,CAACE,MAAcA,MAAcH,CAAK;AACtGJ,aAAAA,EAAA,EAAKM,CAAQ,GACNA;AAAA,IAAA,CACR;AAAA,EAAA;AAGH,2BACGE,GAGE,EAAA,UAAA;AAAA,IAAAd,EAAK,UACJ,gBAAAe;AAAA,MAACjB,EAAY;AAAA,MAAZ;AAAA,QACC,OAAM;AAAA,QACN,cAAcG,EAAM,SAAS,IAAI,oBAAoB;AAAA,QACrD,SAASI;AAAA,MAAA;AAAA,IACX;AAAA,IAEF,gBAAAU,EAACjB,GAAa,EAAA,GAAGE,GACd,UAAAI,EAAU,IAAI,CAAC,EAAE,UAAAY,GAAU,WAAAH,EAC1B,MAAA,gBAAAE;AAAA,MAACjB,EAAY;AAAA,MAAZ;AAAA,QAEC,OAAOkB;AAAA,QACP,OAAOH;AAAA,QACP,SAASZ,EAAM,SAASY,CAAS;AAAA,QACjC,UAAUN;AAAA,MAAA;AAAA,MAJLS;AAAA,IAMR,CAAA,GACH;AAAA,EACF,EAAA,CAAA;AAEJ,GAEMC,IAAyC;AAAA,EAC7C,YAAY;AAAA,EACZ,UAAU;AACZ,GAEaC,IAAqBnB,EAAS,KAAK,EAAE;AAClDmB,EAAmB,OAAO;AAAA,EACxB,GAAGD;AACL;AAEO,MAAME,IAAapB,EAAS,KAAK,EAAE;AAC1CoB,EAAW,OAAO;AAAA,EAChB,GAAGF;AAAA;AAAA;AAAA,EAGH,QAAQ;AACV;AAEO,MAAMG,IAA+CrB,EAAS,KAAK,EAAE;AAC5EqB,EAA6C,OAAO;AAAA,EAClD,YAAY;AAAA,EACZ,UAAU;AAAA;AAAA;AAAA,EAGV,QAAQ;AACV;"}
|