@uva-glass/component-library 1.45.6 → 1.47.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/components/Accordion/Accordion.d.ts +4 -0
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/Accordion.stories.js +9 -5
- package/dist/components/Accordion/Accordion.stories.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +37 -25
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/package.json +8 -6
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export interface AccordionProps {
|
|
3
|
+
/** Clickable title (always visible). */
|
|
3
4
|
title: ReactNode;
|
|
5
|
+
/** Main content (hidden when expanded is false). */
|
|
4
6
|
content: ReactNode;
|
|
7
|
+
/** Indicator if Accordion is should be expanded by default.*/
|
|
5
8
|
expanded?: boolean;
|
|
6
9
|
}
|
|
10
|
+
/** A controller for accordion dispay toggeling of content with click on a title. */
|
|
7
11
|
export declare const Accordion: ({ title, content, expanded }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { KeyboardEvent, ReactNode } from 'react';\n\nimport styles from './Accordion.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface AccordionProps {\n title: ReactNode;\n content: ReactNode;\n expanded?: boolean;\n}\n\nexport const Accordion = ({ title, content, expanded = false }: AccordionProps) => {\n const [isExpanded, setIsExpanded] = useState(expanded);\n const accordionId = useId();\n\n function onKeyUp(event: KeyboardEvent<HTMLDivElement>) {\n const { code } = event;\n\n if (code === 'Enter' || code === 'Space') {\n setIsExpanded(!isExpanded);\n }\n }\n\n return (\n <div className={styles['accordion']}>\n <div\n className={styles['accordion__title']}\n id={accordionId}\n role=\"button\"\n tabIndex={0}\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyUp={onKeyUp}\n aria-expanded={isExpanded}\n >\n {title}\n <Icon\n className={clsx(styles['accordion__title-icon'], { [styles['accordion__title-icon--expanded']]: isExpanded })}\n name=\"CheveronLeft\"\n size={16}\n />\n </div>\n <div\n aria-labelledby={accordionId}\n className={clsx(styles.accordion__content, { [styles['accordion__content--expanded']]: isExpanded })}\n >\n {content}\n </div>\n </div>\n );\n};\n"],"names":["Accordion","title","content","expanded","isExpanded","setIsExpanded","useState","accordionId","useId","onKeyUp","event","code","jsxs","styles","jsx","Icon","clsx"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Accordion.js","sources":["../../../src/components/Accordion/Accordion.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useId, useState } from 'react';\n\nimport type { KeyboardEvent, ReactNode } from 'react';\n\nimport styles from './Accordion.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport interface AccordionProps {\n /** Clickable title (always visible). */\n title: ReactNode;\n /** Main content (hidden when expanded is false). */\n content: ReactNode;\n /** Indicator if Accordion is should be expanded by default.*/\n expanded?: boolean;\n}\n\n/** A controller for accordion dispay toggeling of content with click on a title. */\nexport const Accordion = ({ title, content, expanded = false }: AccordionProps) => {\n const [isExpanded, setIsExpanded] = useState(expanded);\n const accordionId = useId();\n\n function onKeyUp(event: KeyboardEvent<HTMLDivElement>) {\n const { code } = event;\n\n if (code === 'Enter' || code === 'Space') {\n setIsExpanded(!isExpanded);\n }\n }\n\n return (\n <div className={styles['accordion']}>\n <div\n className={styles['accordion__title']}\n id={accordionId}\n role=\"button\"\n tabIndex={0}\n onClick={() => setIsExpanded(!isExpanded)}\n onKeyUp={onKeyUp}\n aria-expanded={isExpanded}\n >\n {title}\n <Icon\n className={clsx(styles['accordion__title-icon'], { [styles['accordion__title-icon--expanded']]: isExpanded })}\n name=\"CheveronLeft\"\n size={16}\n />\n </div>\n <div\n aria-labelledby={accordionId}\n className={clsx(styles.accordion__content, { [styles['accordion__content--expanded']]: isExpanded })}\n >\n {content}\n </div>\n </div>\n );\n};\n"],"names":["Accordion","title","content","expanded","isExpanded","setIsExpanded","useState","accordionId","useId","onKeyUp","event","code","jsxs","styles","jsx","Icon","clsx"],"mappings":";;;;;;;;;;;GAmBaA,IAAY,CAAC,EAAE,OAAAC,GAAO,SAAAC,GAAS,UAAAC,IAAW,SAA4B;AACjF,QAAM,CAACC,GAAYC,CAAa,IAAIC,EAASH,CAAQ,GAC/CI,IAAcC;AAEpB,WAASC,EAAQC,GAAsC;AAC/C,UAAA,EAAE,MAAAC,EAAS,IAAAD;AAEb,KAAAC,MAAS,WAAWA,MAAS,YAC/BN,EAAc,CAACD,CAAU;AAAA,EAE7B;AAEA,SACG,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,WACrB,UAAA;AAAA,IAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAO;AAAA,QAClB,IAAIN;AAAA,QACJ,MAAK;AAAA,QACL,UAAU;AAAA,QACV,SAAS,MAAMF,EAAc,CAACD,CAAU;AAAA,QACxC,SAAAK;AAAA,QACA,iBAAeL;AAAA,QAEd,UAAA;AAAA,UAAAH;AAAA,UACD,gBAAAa;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,WAAWC,EAAKH,EAAO,uBAAuB,GAAG,EAAE,CAACA,EAAO,iCAAiC,CAAC,GAAGT,GAAY;AAAA,cAC5G,MAAK;AAAA,cACL,MAAM;AAAA,YAAA;AAAA,UACR;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,IACA,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,mBAAiBP;AAAA,QACjB,WAAWS,EAAKH,EAAO,oBAAoB,EAAE,CAACA,EAAO,8BAA8B,CAAC,GAAGT,GAAY;AAAA,QAElG,UAAAF;AAAA,MAAA;AAAA,IACH;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { Accordion as e } from "./Accordion.js";
|
|
3
3
|
import { Container as i } from "../storyComponents/Container/Container.js";
|
|
4
|
-
const
|
|
4
|
+
const c = "<Accordion title={title} content={content}/>", a = {
|
|
5
5
|
title: "Atoms/Accordion",
|
|
6
6
|
component: e,
|
|
7
7
|
argTypes: {
|
|
@@ -11,20 +11,24 @@ const p = {
|
|
|
11
11
|
disable: !0
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
},
|
|
15
|
+
parameters: {
|
|
16
|
+
inspectComponent: e,
|
|
17
|
+
codeString: c
|
|
14
18
|
}
|
|
15
19
|
}, o = (n) => /* @__PURE__ */ t(i, { children: /* @__PURE__ */ t(e, { ...n }) }), l = o.bind({});
|
|
16
20
|
l.args = {
|
|
17
21
|
title: "Example title",
|
|
18
22
|
content: "Example content"
|
|
19
23
|
};
|
|
20
|
-
const
|
|
21
|
-
|
|
24
|
+
const r = o.bind({});
|
|
25
|
+
r.args = {
|
|
22
26
|
title: /* @__PURE__ */ t("div", { style: { fontWeight: "bold" }, children: "Complex sample title" }),
|
|
23
27
|
content: /* @__PURE__ */ t("div", { style: { fontStyle: "italic" }, children: "Complex sample content" })
|
|
24
28
|
};
|
|
25
29
|
export {
|
|
26
30
|
l as AccordionExample,
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
r as WithComplexProps,
|
|
32
|
+
a as default
|
|
29
33
|
};
|
|
30
34
|
//# sourceMappingURL=Accordion.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.stories.js","sources":["../../../src/components/Accordion/Accordion.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { AccordionProps } from './Accordion';\n\nimport { Accordion } from './Accordion';\n\nimport { Container } from 'components/storyComponents/Container';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Accordion',\n component: Accordion,\n argTypes: {\n expanded: {\n // Hide the expanded prop. Changing the value in Storybook doesn't update the state of the component.\n table: {\n disable: true,\n },\n },\n },\n} as Meta<AccordionProps>;\n\nconst Template: StoryFn<AccordionProps> = (args) => (\n <Container>\n <Accordion {...args} />\n </Container>\n);\n\nexport const AccordionExample = Template.bind({});\nAccordionExample.args = {\n title: 'Example title',\n content: 'Example content',\n};\n\nexport const WithComplexProps = Template.bind({});\nWithComplexProps.args = {\n title: <div style={{ fontWeight: 'bold' }}>Complex sample title</div>,\n content: <div style={{ fontStyle: 'italic' }}>Complex sample content</div>,\n};\n"],"names":["Accordion_stories","Accordion","Template","args","jsx","Container","AccordionExample","WithComplexProps"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Accordion.stories.js","sources":["../../../src/components/Accordion/Accordion.stories.tsx"],"sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport type { AccordionProps } from './Accordion';\n\nimport { Accordion } from './Accordion';\n\nimport { Container } from 'components/storyComponents/Container';\n\nconst codeString = '<Accordion title={title} content={content}/>';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Accordion',\n component: Accordion,\n argTypes: {\n expanded: {\n // Hide the expanded prop. Changing the value in Storybook doesn't update the state of the component.\n table: {\n disable: true,\n },\n },\n },\n parameters: {\n inspectComponent: Accordion,\n codeString: codeString,\n },\n} as Meta<AccordionProps>;\n\nconst Template: StoryFn<AccordionProps> = (args) => (\n <Container>\n <Accordion {...args} />\n </Container>\n);\n\nexport const AccordionExample = Template.bind({});\nAccordionExample.args = {\n title: 'Example title',\n content: 'Example content',\n};\n\nexport const WithComplexProps = Template.bind({});\nWithComplexProps.args = {\n title: <div style={{ fontWeight: 'bold' }}>Complex sample title</div>,\n content: <div style={{ fontStyle: 'italic' }}>Complex sample content</div>,\n};\n"],"names":["codeString","Accordion_stories","Accordion","Template","args","jsx","Container","AccordionExample","WithComplexProps"],"mappings":";;;AAOA,MAAMA,IAAa,gDAGJC,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU;AAAA,IACR,UAAU;AAAA;AAAA,MAER,OAAO;AAAA,QACL,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EACF;AACF,GAEMG,IAAoC,CAACC,MACzC,gBAAAC,EAACC,KACC,UAAC,gBAAAD,EAAAH,GAAA,EAAW,GAAGE,EAAM,CAAA,EACvB,CAAA,GAGWG,IAAmBJ,EAAS,KAAK,EAAE;AAChDI,EAAiB,OAAO;AAAA,EACtB,OAAO;AAAA,EACP,SAAS;AACX;AAEO,MAAMC,IAAmBL,EAAS,KAAK,EAAE;AAChDK,EAAiB,OAAO;AAAA,EACtB,yBAAQ,OAAI,EAAA,OAAO,EAAE,YAAY,UAAU,UAAoB,wBAAA;AAAA,EAC/D,2BAAU,OAAI,EAAA,OAAO,EAAE,WAAW,YAAY,UAAsB,0BAAA;AACtE;"}
|
|
@@ -1,20 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as S, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { f as d } from "../../index-C7tAT8j7.js";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { M as
|
|
5
|
-
import { Container as
|
|
6
|
-
const
|
|
3
|
+
import { useState as M } from "react";
|
|
4
|
+
import { M as a } from "../../MultiSelect-Ckf3uGw5.js";
|
|
5
|
+
import { Container as p } from "../storyComponents/Container/Container.js";
|
|
6
|
+
const f = `
|
|
7
|
+
// MultiSelectHeader can be added optionally
|
|
8
|
+
<MultiSelect.MultiSelectHeader label={label} clearTrigger={clearTrigger} onClear={handleClear} />
|
|
9
|
+
<MultiSelect noBorder={noBorder} scrollable={scrollable}>
|
|
10
|
+
{mockItems.map(({ itemName, itemValue, disabled }) => (
|
|
11
|
+
<MultiSelect.MultiSelectItem key={itemName} label={itemName} value={itemValue}
|
|
12
|
+
checked={stateItems.includes(itemValue)} onChange={handleChange} disabled={disabled} />
|
|
13
|
+
))}
|
|
14
|
+
</MultiSelect>
|
|
15
|
+
`, H = {
|
|
7
16
|
title: "Organisms/MultiSelect",
|
|
8
|
-
component:
|
|
17
|
+
component: a,
|
|
9
18
|
argTypes: {
|
|
10
19
|
header: {
|
|
11
20
|
table: {
|
|
12
21
|
disable: !0
|
|
13
22
|
}
|
|
14
23
|
}
|
|
24
|
+
},
|
|
25
|
+
parameters: {
|
|
26
|
+
codeString: f
|
|
15
27
|
}
|
|
16
|
-
},
|
|
17
|
-
const [n, o] =
|
|
28
|
+
}, m = (i) => {
|
|
29
|
+
const [n, o] = M([]), I = [
|
|
18
30
|
{ itemName: "AItem 1", itemValue: "1", disabled: !0 },
|
|
19
31
|
{ itemName: "BItem 2", itemValue: "2" },
|
|
20
32
|
{ itemName: "Multi line Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3", itemValue: "3" },
|
|
@@ -23,29 +35,29 @@ const T = {
|
|
|
23
35
|
{ itemName: "EItem 6", itemValue: "6" }
|
|
24
36
|
], h = () => {
|
|
25
37
|
o([]), d()();
|
|
26
|
-
},
|
|
38
|
+
}, b = (e) => {
|
|
27
39
|
const { checked: t, value: l } = e.target;
|
|
28
40
|
o((s) => {
|
|
29
41
|
const c = t ? [...s, l] : s.filter((g) => g !== l);
|
|
30
42
|
return d()(c), c;
|
|
31
43
|
});
|
|
32
44
|
};
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
i.header && /* @__PURE__ */
|
|
35
|
-
|
|
45
|
+
return /* @__PURE__ */ S(p, { children: [
|
|
46
|
+
i.header && /* @__PURE__ */ r(
|
|
47
|
+
a.MultiSelectHeader,
|
|
36
48
|
{
|
|
37
49
|
label: "Item list",
|
|
38
50
|
clearTrigger: n.length > 0 ? "Clear Selection" : "",
|
|
39
51
|
onClear: h
|
|
40
52
|
}
|
|
41
53
|
),
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
54
|
+
/* @__PURE__ */ r(a, { ...i, children: I.map(({ itemName: e, itemValue: t, disabled: l }) => /* @__PURE__ */ r(
|
|
55
|
+
a.MultiSelectItem,
|
|
44
56
|
{
|
|
45
57
|
label: e,
|
|
46
58
|
value: t,
|
|
47
59
|
checked: n.includes(t),
|
|
48
|
-
onChange:
|
|
60
|
+
onChange: b,
|
|
49
61
|
disabled: l
|
|
50
62
|
},
|
|
51
63
|
e
|
|
@@ -54,19 +66,19 @@ const T = {
|
|
|
54
66
|
}, u = {
|
|
55
67
|
scrollable: !0,
|
|
56
68
|
noBorder: !1
|
|
57
|
-
},
|
|
58
|
-
|
|
69
|
+
}, C = m.bind({});
|
|
70
|
+
C.args = {
|
|
59
71
|
...u
|
|
60
72
|
};
|
|
61
|
-
const
|
|
62
|
-
|
|
73
|
+
const N = m.bind({});
|
|
74
|
+
N.args = {
|
|
63
75
|
...u,
|
|
64
76
|
// boolean is not normal way of adding header but if added after template the rerender logic of
|
|
65
77
|
// storybook would not correctly clear the checkboxes
|
|
66
78
|
header: !0
|
|
67
79
|
};
|
|
68
|
-
const
|
|
69
|
-
|
|
80
|
+
const V = m.bind({});
|
|
81
|
+
V.args = {
|
|
70
82
|
scrollable: !1,
|
|
71
83
|
noBorder: !0,
|
|
72
84
|
// boolean is not normal way of adding header but if added after template the rerender logic of
|
|
@@ -74,9 +86,9 @@ N.args = {
|
|
|
74
86
|
header: !0
|
|
75
87
|
};
|
|
76
88
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
C as MultiSelectExample,
|
|
90
|
+
N as WithHeader,
|
|
91
|
+
V as WithheaderAndWithoutScrollContainerAndBorder,
|
|
92
|
+
H as default
|
|
81
93
|
};
|
|
82
94
|
//# 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 { 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: 'AItem 1', itemValue: '1', disabled: true },\n { itemName: 'BItem 2', itemValue: '2' },\n { itemName: 'Multi line Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3', itemValue: '3' },\n { itemName: 'CItem 4', itemValue: '4' },\n { itemName: 'DItem 5', itemValue: '5' },\n { itemName: 'EItem 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, disabled }) => (\n <MultiSelect.MultiSelectItem\n key={itemName}\n label={itemName}\n value={itemValue}\n checked={items.includes(itemValue)}\n onChange={handleChange}\n disabled={disabled}\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","disabled","defaultArgs","MultiSelectExample","WithHeader","WithheaderAndWithoutScrollContainerAndBorder"],"mappings":";;;;;
|
|
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\nconst codeString = `\n // MultiSelectHeader can be added optionally\n <MultiSelect.MultiSelectHeader label={label} clearTrigger={clearTrigger} onClear={handleClear} />\n <MultiSelect noBorder={noBorder} scrollable={scrollable}>\n {mockItems.map(({ itemName, itemValue, disabled }) => (\n <MultiSelect.MultiSelectItem key={itemName} label={itemName} value={itemValue}\n checked={stateItems.includes(itemValue)} onChange={handleChange} disabled={disabled} />\n ))}\n </MultiSelect>\n `;\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 parameters: {\n codeString: codeString,\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: 'AItem 1', itemValue: '1', disabled: true },\n { itemName: 'BItem 2', itemValue: '2' },\n { itemName: 'Multi line Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3 Item 3', itemValue: '3' },\n { itemName: 'CItem 4', itemValue: '4' },\n { itemName: 'DItem 5', itemValue: '5' },\n { itemName: 'EItem 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, disabled }) => (\n <MultiSelect.MultiSelectItem\n key={itemName}\n label={itemName}\n value={itemValue}\n checked={items.includes(itemValue)}\n onChange={handleChange}\n disabled={disabled}\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":["codeString","MultiSelect_stories","MultiSelect","Template","args","items","setItems","useState","mockItems","handleClear","fn","handleChange","event","checked","value","prevState","newItems","itemValue","Container","jsx","itemName","disabled","defaultArgs","MultiSelectExample","WithHeader","WithheaderAndWithoutScrollContainerAndBorder"],"mappings":";;;;;AAWA,MAAMA,IAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAYJC,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;AAAA,EACA,YAAY;AAAA,IACV,YAAAF;AAAA,EACF;AACF,GAEMG,IAAyD,CAACC,MAAS;AACvE,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAmB,CAAE,CAAA,GAEzCC,IAAY;AAAA,IAChB,EAAE,UAAU,WAAW,WAAW,KAAK,UAAU,GAAK;AAAA,IACtD,EAAE,UAAU,WAAW,WAAW,IAAI;AAAA,IACtC,EAAE,UAAU,oFAAoF,WAAW,IAAI;AAAA,IAC/G,EAAE,UAAU,WAAW,WAAW,IAAI;AAAA,IACtC,EAAE,UAAU,WAAW,WAAW,IAAI;AAAA,IACtC,EAAE,UAAU,WAAW,WAAW,IAAI;AAAA,EAAA,GAGlCC,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,GAAW,UAAAI,EACrC,MAAA,gBAAAF;AAAA,MAACjB,EAAY;AAAA,MAAZ;AAAA,QAEC,OAAOkB;AAAA,QACP,OAAOH;AAAA,QACP,SAASZ,EAAM,SAASY,CAAS;AAAA,QACjC,UAAUN;AAAA,QACV,UAAAU;AAAA,MAAA;AAAA,MALKD;AAAA,IAOR,CAAA,GACH;AAAA,EACF,EAAA,CAAA;AAEJ,GAEME,IAAyC;AAAA,EAC7C,YAAY;AAAA,EACZ,UAAU;AACZ,GAEaC,IAAqBpB,EAAS,KAAK,EAAE;AAClDoB,EAAmB,OAAO;AAAA,EACxB,GAAGD;AACL;AAEO,MAAME,IAAarB,EAAS,KAAK,EAAE;AAC1CqB,EAAW,OAAO;AAAA,EAChB,GAAGF;AAAA;AAAA;AAAA,EAGH,QAAQ;AACV;AAEO,MAAMG,IAA+CtB,EAAS,KAAK,EAAE;AAC5EsB,EAA6C,OAAO;AAAA,EAClD,YAAY;AAAA,EACZ,UAAU;AAAA;AAAA;AAAA,EAGV,QAAQ;AACV;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uva-glass/component-library",
|
|
3
3
|
"author": "Team Glass - Frontend vrienden",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.47.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -52,10 +52,12 @@
|
|
|
52
52
|
"@storybook/addon-essentials": "^8.2.9",
|
|
53
53
|
"@storybook/addon-links": "^8.2.9",
|
|
54
54
|
"@storybook/blocks": "^8.2.9",
|
|
55
|
+
"@storybook/manager-api": "^8.2.9",
|
|
56
|
+
"@storybook/preview-api": "^8.2.9",
|
|
55
57
|
"@storybook/react": "^8.2.9",
|
|
56
58
|
"@storybook/react-vite": "^8.2.9",
|
|
57
59
|
"@storybook/test": "^8.2.9",
|
|
58
|
-
"@types/node": "^20.16.
|
|
60
|
+
"@types/node": "^20.16.5",
|
|
59
61
|
"@types/react": "^18.3.5",
|
|
60
62
|
"@types/react-dom": "^18.3.0",
|
|
61
63
|
"@uva-glass/eslint-config": "^1.3.1",
|
|
@@ -65,7 +67,7 @@
|
|
|
65
67
|
"eslint": "^8.57.0",
|
|
66
68
|
"eslint-config-prettier": "^9.1.0",
|
|
67
69
|
"eslint-plugin-prettier": "^5.2.1",
|
|
68
|
-
"eslint-plugin-react": "^7.35.
|
|
70
|
+
"eslint-plugin-react": "^7.35.2",
|
|
69
71
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
70
72
|
"eslint-plugin-react-refresh": "^0.4.11",
|
|
71
73
|
"eslint-plugin-storybook": "^0.8.0",
|
|
@@ -77,7 +79,7 @@
|
|
|
77
79
|
"npm-run-all2": "^6.2.2",
|
|
78
80
|
"react": "^18.3.1",
|
|
79
81
|
"react-dom": "^18.3.1",
|
|
80
|
-
"react-router-dom": "^6.26.
|
|
82
|
+
"react-router-dom": "^6.26.2",
|
|
81
83
|
"semantic-release": "^24.1.0",
|
|
82
84
|
"storybook": "^8.2.9",
|
|
83
85
|
"style-dictionary": "^4.1.0",
|
|
@@ -85,9 +87,9 @@
|
|
|
85
87
|
"stylelint-config-recommended": "^14.0.1",
|
|
86
88
|
"stylelint-config-standard": "^36.0.1",
|
|
87
89
|
"stylelint-order": "^6.0.4",
|
|
88
|
-
"typescript": "^5.
|
|
90
|
+
"typescript": "^5.6.2",
|
|
89
91
|
"vite": "^5.4.3",
|
|
90
|
-
"vite-plugin-dts": "^4.1
|
|
92
|
+
"vite-plugin-dts": "^4.2.1",
|
|
91
93
|
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
92
94
|
"vite-plugin-static-copy": "^1.0.6",
|
|
93
95
|
"vite-plugin-svgr": "^4.2.0",
|