@uva-glass/component-library 3.35.1 → 3.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/VarIndicator.css +1 -1
- package/dist/components/Accordion/Accordion.test.js +3 -3
- package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
- package/dist/components/ActionList/ActionList.test.js +3 -3
- package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
- package/dist/components/Attention/Attention.test.js +2 -2
- package/dist/components/Backdrop/Backdrop.test.js +2 -2
- package/dist/components/Buttons/Button.test.js +2 -2
- package/dist/components/Buttons/LinkButton.test.js +2 -2
- package/dist/components/Buttons/MenuButton.test.js +2 -2
- package/dist/components/Card/Card.test.js +2 -2
- package/dist/components/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
- package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
- package/dist/components/Label/Label.test.js +2 -2
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
- package/dist/components/Notification/Notification.test.js +2 -2
- package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
- package/dist/components/SelectListbox/SelectListBox.stories.d.ts +9 -3
- package/dist/components/SelectListbox/SelectListBox.stories.js +126 -48
- package/dist/components/SelectListbox/SelectListBox.stories.js.map +1 -1
- package/dist/components/SelectListbox/SelectProvider.js +25 -23
- package/dist/components/SelectListbox/SelectProvider.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
- package/dist/components/TextArea/TextArea.test.js +2 -2
- package/dist/components/VarIndicator/VarIndicator.d.ts +7 -1
- package/dist/components/VarIndicator/VarIndicator.js +54 -24
- package/dist/components/VarIndicator/VarIndicator.js.map +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +8 -8
- package/dist/components/VarIndicator/VarIndicator.stories.js.map +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
- package/dist/{index-DzN3R4wD.js → index-C5wAoUNf.js} +2382 -3427
- package/dist/index-C5wAoUNf.js.map +1 -0
- package/dist/{index-DDN7R-oN.js → index-DBXreWnr.js} +2 -2
- package/dist/{index-DDN7R-oN.js.map → index-DBXreWnr.js.map} +1 -1
- package/dist/{react.esm-DMlPLy-4.js → react.esm-QfxS8egK.js} +2 -2
- package/dist/{react.esm-DMlPLy-4.js.map → react.esm-QfxS8egK.js.map} +1 -1
- package/dist/setupTests.js +1 -1
- package/package.json +12 -12
- package/dist/index-DzN3R4wD.js.map +0 -1
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
const [
|
|
5
|
-
|
|
6
|
-
},
|
|
2
|
+
import { createContext as w, useContext as L, useState as a, useRef as g, useId as C, useEffect as P } from "react";
|
|
3
|
+
const i = w({}), O = ({ options: e, defaultValue: n, children: v }) => {
|
|
4
|
+
const [s, d] = a({ value: "", label: "" }), [x, c] = a(!1), [b, u] = a(-1), f = g(C()), I = () => {
|
|
5
|
+
c((t) => !t);
|
|
6
|
+
}, l = (t) => e.find((r) => r.value === t) || {
|
|
7
7
|
value: -1,
|
|
8
8
|
label: "",
|
|
9
9
|
selectedLabel: "-"
|
|
10
|
-
},
|
|
11
|
-
const
|
|
12
|
-
r
|
|
10
|
+
}, o = (t) => {
|
|
11
|
+
const r = e.findIndex((S) => S.value === t.value);
|
|
12
|
+
u(r), d(t), c(!1);
|
|
13
13
|
};
|
|
14
|
-
return
|
|
15
|
-
|
|
14
|
+
return n !== -1 && !s.value && o(l(n)), P(() => {
|
|
15
|
+
l(s.value || n).label !== s.label && o(l(s.value || n));
|
|
16
|
+
}, [e, n]), /* @__PURE__ */ m(
|
|
17
|
+
i.Provider,
|
|
16
18
|
{
|
|
17
19
|
value: {
|
|
18
20
|
options: e,
|
|
19
|
-
selectedValue:
|
|
20
|
-
setSelectedValue:
|
|
21
|
+
selectedValue: s,
|
|
22
|
+
setSelectedValue: o,
|
|
21
23
|
isOpen: x,
|
|
22
|
-
setIsOpen:
|
|
23
|
-
toggleListbox:
|
|
24
|
-
getValue:
|
|
25
|
-
activeIndex:
|
|
26
|
-
setActiveIndex:
|
|
27
|
-
listboxId:
|
|
24
|
+
setIsOpen: c,
|
|
25
|
+
toggleListbox: I,
|
|
26
|
+
getValue: l,
|
|
27
|
+
activeIndex: b,
|
|
28
|
+
setActiveIndex: u,
|
|
29
|
+
listboxId: f.current
|
|
28
30
|
},
|
|
29
|
-
children:
|
|
31
|
+
children: v
|
|
30
32
|
}
|
|
31
33
|
);
|
|
32
|
-
},
|
|
33
|
-
const e =
|
|
34
|
+
}, h = () => {
|
|
35
|
+
const e = L(i);
|
|
34
36
|
if (e === void 0) throw new Error("useSelect can only be used in an SelectProvider");
|
|
35
37
|
return e;
|
|
36
38
|
};
|
|
37
39
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
O as SelectProvider,
|
|
41
|
+
h as useSelect
|
|
40
42
|
};
|
|
41
43
|
//# sourceMappingURL=SelectProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectProvider.js","sources":["../../../src/components/SelectListbox/SelectProvider.tsx"],"sourcesContent":["import { createContext, useContext, useState, useId, useRef } from 'react';\n\nimport type { PropsWithChildren } from 'react';\n\nexport type SelectValue = string | number | null;\n\nexport type OptionValue = {\n value: SelectValue;\n label: string;\n selectedLabel?: string;\n disabled?: boolean;\n};\nexport interface SelectListboxContext {\n options: OptionValue[];\n selectedValue: OptionValue;\n setSelectedValue: (v: OptionValue) => void;\n isOpen: boolean;\n setIsOpen: (v: boolean) => void;\n toggleListbox: () => void;\n getValue: (value: SelectValue) => OptionValue;\n activeIndex: number;\n setActiveIndex: (v: number) => void;\n listboxId: string;\n}\n\nconst SelectContext = createContext<SelectListboxContext>({} as SelectListboxContext);\n\ninterface Props {\n options: OptionValue[];\n defaultValue: SelectValue;\n}\n\nexport const SelectProvider = ({ options, defaultValue, children }: PropsWithChildren<Props>) => {\n const [value, setValue] = useState<OptionValue>({ value: '', label: '' });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const listboxId = useRef<string>(useId());\n\n const toggleListbox = () => {\n setIsOpen((status) => !status);\n };\n\n const getValue = (value: SelectValue) => {\n return (\n options.find((option) => option.value === value) || {\n value: -1,\n label: '',\n selectedLabel: '-',\n }\n );\n };\n\n const setSelectedValue = (value: OptionValue) => {\n const selectedIndex = options.findIndex((option) => option.value === value.value);\n setActiveIndex(selectedIndex);\n setValue(value);\n setIsOpen(false);\n };\n\n if (defaultValue !== -1 && !value.value) {\n setSelectedValue(getValue(defaultValue));\n }\n\n return (\n <SelectContext.Provider\n value={{\n options,\n selectedValue: value,\n setSelectedValue,\n isOpen,\n setIsOpen,\n toggleListbox,\n getValue,\n activeIndex,\n setActiveIndex,\n listboxId: listboxId.current,\n }}\n >\n {children}\n </SelectContext.Provider>\n );\n};\n\nexport const useSelect = () => {\n const context = useContext(SelectContext);\n\n if (context === undefined) throw new Error('useSelect can only be used in an SelectProvider');\n\n return context;\n};\n"],"names":["SelectContext","createContext","SelectProvider","options","defaultValue","children","value","setValue","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","listboxId","useRef","useId","toggleListbox","status","getValue","option","setSelectedValue","selectedIndex","jsx","useSelect","context","useContext"],"mappings":";;AAyBA,MAAMA,IAAgBC,EAAoC,EAA0B,GAOvEC,IAAiB,CAAC,EAAE,SAAAC,GAAS,cAAAC,GAAc,UAAAC,QAAyC;AAC/F,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAsB,EAAE,OAAO,IAAI,OAAO,IAAI,GAClE,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpC,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EAAE,GAC3CK,IAAYC,EAAeC,GAAO,GAElCC,IAAgB,MAAM;AAC1B,IAAAN,EAAU,CAACO,MAAW,CAACA,CAAM;AAAA,EAAA,GAGzBC,IAAW,CAACZ,MAEdH,EAAQ,KAAK,CAACgB,MAAWA,EAAO,UAAUb,CAAK,KAAK;AAAA,IAClD,OAAO;AAAA,IACP,OAAO;AAAA,IACP,eAAe;AAAA,EAAA,GAKfc,IAAmB,CAACd,MAAuB;AAC/C,UAAMe,IAAgBlB,EAAQ,UAAU,CAACgB,MAAWA,EAAO,UAAUb,EAAM,KAAK;AAChF,IAAAM,EAAeS,CAAa,GAC5Bd,EAASD,CAAK,GACdI,EAAU,EAAK;AAAA,EAAA;AAGjB,SAAIN,MAAiB,MAAM,CAACE,EAAM,SAChCc,EAAiBF,EAASd,CAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"SelectProvider.js","sources":["../../../src/components/SelectListbox/SelectProvider.tsx"],"sourcesContent":["import { createContext, useContext, useState, useId, useRef, useEffect } from 'react';\n\nimport type { PropsWithChildren } from 'react';\n\nexport type SelectValue = string | number | null;\n\nexport type OptionValue = {\n value: SelectValue;\n label: string;\n selectedLabel?: string;\n disabled?: boolean;\n};\nexport interface SelectListboxContext {\n options: OptionValue[];\n selectedValue: OptionValue;\n setSelectedValue: (v: OptionValue) => void;\n isOpen: boolean;\n setIsOpen: (v: boolean) => void;\n toggleListbox: () => void;\n getValue: (value: SelectValue) => OptionValue;\n activeIndex: number;\n setActiveIndex: (v: number) => void;\n listboxId: string;\n}\n\nconst SelectContext = createContext<SelectListboxContext>({} as SelectListboxContext);\n\ninterface Props {\n options: OptionValue[];\n defaultValue: SelectValue;\n}\n\nexport const SelectProvider = ({ options, defaultValue, children }: PropsWithChildren<Props>) => {\n const [value, setValue] = useState<OptionValue>({ value: '', label: '' });\n const [isOpen, setIsOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(-1);\n const listboxId = useRef<string>(useId());\n\n const toggleListbox = () => {\n setIsOpen((status) => !status);\n };\n\n const getValue = (value: SelectValue) => {\n return (\n options.find((option) => option.value === value) || {\n value: -1,\n label: '',\n selectedLabel: '-',\n }\n );\n };\n\n const setSelectedValue = (value: OptionValue) => {\n const selectedIndex = options.findIndex((option) => option.value === value.value);\n setActiveIndex(selectedIndex);\n setValue(value);\n setIsOpen(false);\n };\n\n if (defaultValue !== -1 && !value.value) {\n setSelectedValue(getValue(defaultValue));\n }\n\n useEffect(() => {\n const newLabel = getValue(value.value || defaultValue).label;\n if (newLabel !== value.label) {\n setSelectedValue(getValue(value.value || defaultValue));\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options, defaultValue]);\n\n return (\n <SelectContext.Provider\n value={{\n options,\n selectedValue: value,\n setSelectedValue,\n isOpen,\n setIsOpen,\n toggleListbox,\n getValue,\n activeIndex,\n setActiveIndex,\n listboxId: listboxId.current,\n }}\n >\n {children}\n </SelectContext.Provider>\n );\n};\n\nexport const useSelect = () => {\n const context = useContext(SelectContext);\n\n if (context === undefined) throw new Error('useSelect can only be used in an SelectProvider');\n\n return context;\n};\n"],"names":["SelectContext","createContext","SelectProvider","options","defaultValue","children","value","setValue","useState","isOpen","setIsOpen","activeIndex","setActiveIndex","listboxId","useRef","useId","toggleListbox","status","getValue","option","setSelectedValue","selectedIndex","useEffect","jsx","useSelect","context","useContext"],"mappings":";;AAyBA,MAAMA,IAAgBC,EAAoC,EAA0B,GAOvEC,IAAiB,CAAC,EAAE,SAAAC,GAAS,cAAAC,GAAc,UAAAC,QAAyC;AAC/F,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAsB,EAAE,OAAO,IAAI,OAAO,IAAI,GAClE,CAACC,GAAQC,CAAS,IAAIF,EAAS,EAAK,GACpC,CAACG,GAAaC,CAAc,IAAIJ,EAAS,EAAE,GAC3CK,IAAYC,EAAeC,GAAO,GAElCC,IAAgB,MAAM;AAC1B,IAAAN,EAAU,CAACO,MAAW,CAACA,CAAM;AAAA,EAAA,GAGzBC,IAAW,CAACZ,MAEdH,EAAQ,KAAK,CAACgB,MAAWA,EAAO,UAAUb,CAAK,KAAK;AAAA,IAClD,OAAO;AAAA,IACP,OAAO;AAAA,IACP,eAAe;AAAA,EAAA,GAKfc,IAAmB,CAACd,MAAuB;AAC/C,UAAMe,IAAgBlB,EAAQ,UAAU,CAACgB,MAAWA,EAAO,UAAUb,EAAM,KAAK;AAChF,IAAAM,EAAeS,CAAa,GAC5Bd,EAASD,CAAK,GACdI,EAAU,EAAK;AAAA,EAAA;AAGjB,SAAIN,MAAiB,MAAM,CAACE,EAAM,SAChCc,EAAiBF,EAASd,CAAY,CAAC,GAGzCkB,EAAU,MAAM;AAEd,IADiBJ,EAASZ,EAAM,SAASF,CAAY,EAAE,UACtCE,EAAM,SACrBc,EAAiBF,EAASZ,EAAM,SAASF,CAAY,CAAC;AAAA,EACxD,GAEC,CAACD,GAASC,CAAY,CAAC,GAGxB,gBAAAmB;AAAA,IAACvB,EAAc;AAAA,IAAd;AAAA,MACC,OAAO;AAAA,QACL,SAAAG;AAAA,QACA,eAAeG;AAAA,QACf,kBAAAc;AAAA,QACA,QAAAX;AAAA,QACA,WAAAC;AAAA,QACA,eAAAM;AAAA,QACA,UAAAE;AAAA,QACA,aAAAP;AAAA,QACA,gBAAAC;AAAA,QACA,WAAWC,EAAU;AAAA,MAAA;AAAA,MAGtB,UAAAR;AAAA,IAAA;AAAA,EAAA;AAGP,GAEamB,IAAY,MAAM;AAC7B,QAAMC,IAAUC,EAAW1B,CAAa;AAExC,MAAIyB,MAAY,OAAW,OAAM,IAAI,MAAM,iDAAiD;AAE5F,SAAOA;AACT;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as t, s } from "../../react.esm-
|
|
2
|
+
import "../../index-C5wAoUNf.js";
|
|
3
|
+
import { r as t, s } from "../../react.esm-QfxS8egK.js";
|
|
4
4
|
import { StatusBadge as a } from "./StatusBage.js";
|
|
5
5
|
describe("StatusBadge", () => {
|
|
6
6
|
it("should render with message", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as o, s as t, f as r } from "../../react.esm-
|
|
2
|
+
import "../../index-C5wAoUNf.js";
|
|
3
|
+
import { r as o, s as t, f as r } from "../../react.esm-QfxS8egK.js";
|
|
4
4
|
import { J as c } from "../../index-DFu0GqDc.js";
|
|
5
5
|
import { TextArea as n } from "./TextArea.js";
|
|
6
6
|
describe("TextArea", () => {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
export type StatusType = 'DRAFT' | 'REJECTED' | 'SUBMITTED' | 'ACTIVE';
|
|
2
2
|
export interface VarIndicatorProps {
|
|
3
|
+
/** Label on the indicator */
|
|
3
4
|
label: Record<StatusType, string>;
|
|
5
|
+
/** Status type 'DRAFT' | 'REJECTED' | 'SUBMITTED' | 'ACTIVE' */
|
|
4
6
|
variant?: StatusType;
|
|
7
|
+
/** Maximum number of steps if variant is 'SUBMITTED' */
|
|
5
8
|
maxSteps?: number;
|
|
9
|
+
/** Current step if variant is 'SUBMITTED' */
|
|
6
10
|
currentStep?: number;
|
|
11
|
+
/** If set shows compact view and opens to the left on hover */
|
|
12
|
+
isCompact?: boolean;
|
|
7
13
|
onClick?: () => void;
|
|
8
14
|
}
|
|
9
|
-
export declare const VarIndicator: ({ label, variant, maxSteps, currentStep, onClick }: VarIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const VarIndicator: ({ label, variant, maxSteps, currentStep, isCompact, onClick, }: VarIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +1,61 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import '../../assets/VarIndicator.css';const
|
|
5
|
-
"var-indicator__container": "_var-
|
|
6
|
-
"var-
|
|
7
|
-
"var-
|
|
8
|
-
"var-indicator__container--
|
|
9
|
-
"var-indicator__container--
|
|
10
|
-
"var-
|
|
11
|
-
"var-
|
|
12
|
-
|
|
1
|
+
import { jsx as r, jsxs as o, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { Icon as t } from "../Icon/Icon.js";
|
|
4
|
+
import '../../assets/VarIndicator.css';const a = {
|
|
5
|
+
"var-indicator__container": "_var-indicator__container_9n427_27",
|
|
6
|
+
"var-indicator__label": "_var-indicator__label_9n427_46",
|
|
7
|
+
"var-indicator__step-container": "_var-indicator__step-container_9n427_50",
|
|
8
|
+
"var-indicator__container--compact": "_var-indicator__container--compact_9n427_61",
|
|
9
|
+
"var-indicator__container--compact-flyover-wrapper": "_var-indicator__container--compact-flyover-wrapper_9n427_71",
|
|
10
|
+
"var-indicator__container--draft": "_var-indicator__container--draft_9n427_85",
|
|
11
|
+
"var-indicator__container--rejected": "_var-indicator__container--rejected_9n427_86",
|
|
12
|
+
"var-indicator__container--submitted": "_var-indicator__container--submitted_9n427_101",
|
|
13
|
+
"var-indicator__container--active": "_var-indicator__container--active_9n427_113"
|
|
14
|
+
}, v = {
|
|
13
15
|
DRAFT: "CircleLarge",
|
|
14
16
|
REJECTED: "CircleLarge",
|
|
15
17
|
SUBMITTED: "CircleLargeDotted",
|
|
16
18
|
ACTIVE: "SignalActive"
|
|
17
|
-
}, E = ({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
)
|
|
19
|
+
}, E = ({
|
|
20
|
+
label: s,
|
|
21
|
+
variant: n = "DRAFT",
|
|
22
|
+
maxSteps: i,
|
|
23
|
+
currentStep: m = 1,
|
|
24
|
+
isCompact: _,
|
|
25
|
+
onClick: p
|
|
26
|
+
}) => {
|
|
27
|
+
const e = () => /* @__PURE__ */ o(d, { children: [
|
|
28
|
+
/* @__PURE__ */ r(t, { name: v[n], size: 16 }),
|
|
29
|
+
/* @__PURE__ */ r("span", { className: a["var-indicator__label"], children: s[`${n}`] }),
|
|
30
|
+
i && i > 0 && n === "SUBMITTED" && Array.from({ length: i }, (c, f) => f + 1).map((c) => /* @__PURE__ */ r("div", { className: a["var-indicator__step-container"], children: /* @__PURE__ */ r(t, { name: c <= m ? "CircleSmallFilled" : "CircleSmall" }) }, c))
|
|
31
|
+
] });
|
|
32
|
+
return /* @__PURE__ */ r(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
className: l(
|
|
36
|
+
a["var-indicator__container"],
|
|
37
|
+
a[`var-indicator__container--${n.toLowerCase()}`],
|
|
38
|
+
{
|
|
39
|
+
[a["var-indicator__container--compact"]]: _
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
onClick: p,
|
|
43
|
+
children: _ ? /* @__PURE__ */ o(d, { children: [
|
|
44
|
+
/* @__PURE__ */ r(t, { name: v[n], size: 16 }),
|
|
45
|
+
/* @__PURE__ */ r(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: l(
|
|
49
|
+
a["var-indicator__container"],
|
|
50
|
+
a["var-indicator__container--compact-flyover-wrapper"]
|
|
51
|
+
),
|
|
52
|
+
children: /* @__PURE__ */ r(e, {})
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] }) : /* @__PURE__ */ r(e, {})
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
};
|
|
29
59
|
export {
|
|
30
60
|
E as VarIndicator
|
|
31
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarIndicator.js","sources":["../../../src/components/VarIndicator/VarIndicator.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport type { IconProps } from 'components/Icon';\n\nimport styles from './VarIndicator.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport type StatusType = 'DRAFT' | 'REJECTED' | 'SUBMITTED' | 'ACTIVE';\n\nexport interface VarIndicatorProps {\n label: Record<StatusType, string>;\n variant?: StatusType;\n maxSteps?: number;\n currentStep?: number;\n onClick?: () => void;\n}\n\nconst ICON_NAMES = {\n DRAFT: 'CircleLarge',\n REJECTED: 'CircleLarge',\n SUBMITTED: 'CircleLargeDotted',\n ACTIVE: 'SignalActive',\n};\n\nexport const VarIndicator = ({
|
|
1
|
+
{"version":3,"file":"VarIndicator.js","sources":["../../../src/components/VarIndicator/VarIndicator.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport type { IconProps } from 'components/Icon';\n\nimport styles from './VarIndicator.module.css';\n\nimport { Icon } from 'components/Icon';\n\nexport type StatusType = 'DRAFT' | 'REJECTED' | 'SUBMITTED' | 'ACTIVE';\n\nexport interface VarIndicatorProps {\n /** Label on the indicator */\n label: Record<StatusType, string>;\n /** Status type 'DRAFT' | 'REJECTED' | 'SUBMITTED' | 'ACTIVE' */\n variant?: StatusType;\n /** Maximum number of steps if variant is 'SUBMITTED' */\n maxSteps?: number;\n /** Current step if variant is 'SUBMITTED' */\n currentStep?: number;\n /** If set shows compact view and opens to the left on hover */\n isCompact?: boolean;\n onClick?: () => void;\n}\n\nconst ICON_NAMES = {\n DRAFT: 'CircleLarge',\n REJECTED: 'CircleLarge',\n SUBMITTED: 'CircleLargeDotted',\n ACTIVE: 'SignalActive',\n};\n\nexport const VarIndicator = ({\n label,\n variant = 'DRAFT',\n maxSteps,\n currentStep = 1,\n isCompact,\n onClick,\n}: VarIndicatorProps) => {\n const IndicatorContent = () => (\n <>\n <Icon name={ICON_NAMES[variant] as IconProps['name']} size={16} />\n <span className={styles['var-indicator__label']}>{label[`${variant}`]}</span>\n {maxSteps &&\n maxSteps > 0 &&\n variant === 'SUBMITTED' &&\n Array.from({ length: maxSteps }, (_, idx) => idx + 1).map((step) => (\n <div key={step} className={styles['var-indicator__step-container']}>\n <Icon name={step <= currentStep ? 'CircleSmallFilled' : 'CircleSmall'} />\n </div>\n ))}\n </>\n );\n\n return (\n <button\n className={clsx(\n styles['var-indicator__container'],\n styles[`var-indicator__container--${variant.toLowerCase()}`],\n {\n [styles['var-indicator__container--compact']]: isCompact,\n }\n )}\n onClick={onClick}\n >\n {isCompact ? (\n <>\n <Icon name={ICON_NAMES[variant] as IconProps['name']} size={16} />\n <div\n className={clsx(\n styles['var-indicator__container'],\n styles['var-indicator__container--compact-flyover-wrapper']\n )}\n >\n <IndicatorContent />\n </div>\n </>\n ) : (\n <IndicatorContent />\n )}\n </button>\n );\n};\n"],"names":["ICON_NAMES","VarIndicator","label","variant","maxSteps","currentStep","isCompact","onClick","IndicatorContent","jsxs","Fragment","jsx","Icon","styles","_","idx","step","clsx"],"mappings":";;;;;;;;;;;;;GAwBMA,IAAa;AAAA,EACjB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AACV,GAEaC,IAAe,CAAC;AAAA,EAC3B,OAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC;AAAA,EACA,SAAAC;AACF,MAAyB;AACvB,QAAMC,IAAmB,MACvB,gBAAAC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAK,MAAMZ,EAAWG,CAAO,GAAwB,MAAM,IAAI;AAAA,IAChE,gBAAAQ,EAAC,QAAA,EAAK,WAAWE,EAAO,sBAAsB,GAAI,UAAAX,EAAM,GAAGC,CAAO,EAAE,EAAA,CAAE;AAAA,IACrEC,KACCA,IAAW,KACXD,MAAY,eACZ,MAAM,KAAK,EAAE,QAAQC,KAAY,CAACU,GAAGC,MAAQA,IAAM,CAAC,EAAE,IAAI,CAACC,MACzD,gBAAAL,EAAC,OAAA,EAAe,WAAWE,EAAO,+BAA+B,GAC/D,UAAA,gBAAAF,EAACC,GAAA,EAAK,MAAMI,KAAQX,IAAc,sBAAsB,cAAA,CAAe,EAAA,GAD/DW,CAEV,CACD;AAAA,EAAA,GACL;AAGF,SACE,gBAAAL;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWM;AAAA,QACTJ,EAAO,0BAA0B;AAAA,QACjCA,EAAO,6BAA6BV,EAAQ,YAAA,CAAa,EAAE;AAAA,QAC3D;AAAA,UACE,CAACU,EAAO,mCAAmC,CAAC,GAAGP;AAAA,QAAA;AAAA,MACjD;AAAA,MAEF,SAAAC;AAAA,MAEC,cACC,gBAAAE,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAAC,EAACC,KAAK,MAAMZ,EAAWG,CAAO,GAAwB,MAAM,IAAI;AAAA,QAChE,gBAAAQ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWM;AAAA,cACTJ,EAAO,0BAA0B;AAAA,cACjCA,EAAO,mDAAmD;AAAA,YAAA;AAAA,YAG5D,4BAACL,GAAA,CAAA,CAAiB;AAAA,UAAA;AAAA,QAAA;AAAA,MACpB,GACF,sBAECA,GAAA,CAAA,CAAiB;AAAA,IAAA;AAAA,EAAA;AAI1B;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { l as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { l as n } from "../../index-DFu0GqDc.js";
|
|
3
3
|
import { VarIndicator as t } from "./VarIndicator.js";
|
|
4
|
-
const
|
|
4
|
+
const o = {
|
|
5
5
|
DRAFT: "Concept",
|
|
6
6
|
REJECTED: "Concept",
|
|
7
7
|
SUBMITTED: "Verificatie",
|
|
@@ -14,14 +14,14 @@ const n = {
|
|
|
14
14
|
inspectComponent: t,
|
|
15
15
|
codeString: a
|
|
16
16
|
}
|
|
17
|
-
},
|
|
18
|
-
label:
|
|
17
|
+
}, i = (e) => /* @__PURE__ */ r("div", { style: { margin: "0 0 0 6rem" }, children: /* @__PURE__ */ r(t, { ...e }) }), c = {
|
|
18
|
+
label: o,
|
|
19
19
|
maxSteps: 3,
|
|
20
20
|
currentStep: 2,
|
|
21
|
-
onClick:
|
|
22
|
-
}, s =
|
|
21
|
+
onClick: n()
|
|
22
|
+
}, s = i.bind({});
|
|
23
23
|
s.args = {
|
|
24
|
-
...
|
|
24
|
+
...c
|
|
25
25
|
};
|
|
26
26
|
export {
|
|
27
27
|
s as VarIndicatorExample,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarIndicator.stories.js","sources":["../../../src/components/VarIndicator/VarIndicator.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { VarIndicatorProps } from './VarIndicator';\n\nimport { VarIndicator } from './VarIndicator';\n\nconst LABELS = {\n DRAFT: 'Concept',\n REJECTED: 'Concept',\n SUBMITTED: 'Verificatie',\n ACTIVE: 'Actief',\n};\n\nconst codeString =\n '<VarIndicator label={[string]: [string]} maxSteps={number} currentStep={number} onClick={() => void} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/VarIndicator',\n component: VarIndicator,\n argTypes: {},\n parameters: {\n inspectComponent: VarIndicator,\n codeString: codeString,\n },\n} as Meta<VarIndicatorProps>;\n\nconst Template: StoryFn<VarIndicatorProps> = (args) => <VarIndicator {...args}
|
|
1
|
+
{"version":3,"file":"VarIndicator.stories.js","sources":["../../../src/components/VarIndicator/VarIndicator.stories.tsx"],"sourcesContent":["import { fn } from 'storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { VarIndicatorProps } from './VarIndicator';\n\nimport { VarIndicator } from './VarIndicator';\n\nconst LABELS = {\n DRAFT: 'Concept',\n REJECTED: 'Concept',\n SUBMITTED: 'Verificatie',\n ACTIVE: 'Actief',\n};\n\nconst codeString =\n '<VarIndicator label={[string]: [string]} maxSteps={number} currentStep={number} onClick={() => void} />';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/VarIndicator',\n component: VarIndicator,\n argTypes: {},\n parameters: {\n inspectComponent: VarIndicator,\n codeString: codeString,\n },\n} as Meta<VarIndicatorProps>;\n\nconst Template: StoryFn<VarIndicatorProps> = (args) => (\n <div style={{ margin: '0 0 0 6rem' }}>\n <VarIndicator {...args} />\n </div>\n);\n\nconst defaultArgs: Partial<VarIndicatorProps> = {\n label: LABELS,\n maxSteps: 3,\n currentStep: 2,\n onClick: fn(),\n};\n\nexport const VarIndicatorExample = Template.bind({});\nVarIndicatorExample.args = {\n ...defaultArgs,\n};\n"],"names":["LABELS","codeString","VarIndicator_stories","VarIndicator","Template","args","jsx","defaultArgs","fn","VarIndicatorExample"],"mappings":";;;AAOA,MAAMA,IAAS;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AACV,GAEMC,IACJ,2GAGFC,IAAe;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AAAA,EACX,UAAU,CAAA;AAAA,EACV,YAAY;AAAA,IACV,kBAAkBA;AAAA,IAClB,YAAAF;AAAA,EAAA;AAEJ,GAEMG,IAAuC,CAACC,MAC5C,gBAAAC,EAAC,SAAI,OAAO,EAAE,QAAQ,aAAA,GACpB,UAAA,gBAAAA,EAACH,GAAA,EAAc,GAAGE,GAAM,GAC1B,GAGIE,IAA0C;AAAA,EAC9C,OAAOP;AAAA,EACP,UAAU;AAAA,EACV,aAAa;AAAA,EACb,SAASQ,EAAA;AACX,GAEaC,IAAsBL,EAAS,KAAK,CAAA,CAAE;AACnDK,EAAoB,OAAO;AAAA,EACzB,GAAGF;AACL;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import "../../index-
|
|
3
|
-
import { r as l, s as e, w as a } from "../../react.esm-
|
|
4
|
-
import { u as i } from "../../index-
|
|
2
|
+
import "../../index-C5wAoUNf.js";
|
|
3
|
+
import { r as l, s as e, w as a } from "../../react.esm-QfxS8egK.js";
|
|
4
|
+
import { u as i } from "../../index-DBXreWnr.js";
|
|
5
5
|
import { useState as s } from "react";
|
|
6
6
|
import { VarIndicator as n } from "./VarIndicator.js";
|
|
7
7
|
const o = {
|