@uva-glass/component-library 3.36.0 → 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.
Files changed (34) hide show
  1. package/dist/components/Accordion/Accordion.test.js +3 -3
  2. package/dist/components/AccordionCard/AccordionCard.test.js +3 -3
  3. package/dist/components/ActionList/ActionList.test.js +3 -3
  4. package/dist/components/AppStatusBar/AppStatusBar.test.js +2 -2
  5. package/dist/components/Attention/Attention.test.js +2 -2
  6. package/dist/components/Backdrop/Backdrop.test.js +2 -2
  7. package/dist/components/Buttons/Button.test.js +2 -2
  8. package/dist/components/Buttons/LinkButton.test.js +2 -2
  9. package/dist/components/Buttons/MenuButton.test.js +2 -2
  10. package/dist/components/Card/Card.test.js +2 -2
  11. package/dist/components/Checkbox/Checkbox.test.js +3 -3
  12. package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +2 -2
  13. package/dist/components/FeedbackBar/FeedbackBar.test.js +2 -2
  14. package/dist/components/Label/Label.test.js +2 -2
  15. package/dist/components/MultiSelectBox/MultiSelectBox.test.js +2 -2
  16. package/dist/components/Notification/Notification.test.js +2 -2
  17. package/dist/components/RadioGroup/Radiogroup.test.js +2 -2
  18. package/dist/components/SelectListbox/SelectListBox.stories.d.ts +9 -3
  19. package/dist/components/SelectListbox/SelectListBox.stories.js +126 -48
  20. package/dist/components/SelectListbox/SelectListBox.stories.js.map +1 -1
  21. package/dist/components/SelectListbox/SelectProvider.js +25 -23
  22. package/dist/components/SelectListbox/SelectProvider.js.map +1 -1
  23. package/dist/components/StatusBadge/StatusBadge.test.js +2 -2
  24. package/dist/components/TextArea/TextArea.test.js +2 -2
  25. package/dist/components/VarIndicator/VarIndicator.test.js +3 -3
  26. package/dist/{index-DzN3R4wD.js → index-C5wAoUNf.js} +2382 -3427
  27. package/dist/index-C5wAoUNf.js.map +1 -0
  28. package/dist/{index-DDN7R-oN.js → index-DBXreWnr.js} +2 -2
  29. package/dist/{index-DDN7R-oN.js.map → index-DBXreWnr.js.map} +1 -1
  30. package/dist/{react.esm-DMlPLy-4.js → react.esm-QfxS8egK.js} +2 -2
  31. package/dist/{react.esm-DMlPLy-4.js.map → react.esm-QfxS8egK.js.map} +1 -1
  32. package/dist/setupTests.js +1 -1
  33. package/package.json +2 -2
  34. 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 g, useContext as p, useState as l, useRef as C, useId as P } from "react";
3
- const d = g({}), L = ({ options: e, defaultValue: o, children: i }) => {
4
- const [c, v] = l({ value: "", label: "" }), [x, s] = l(!1), [f, r] = l(-1), I = C(P()), b = () => {
5
- s((t) => !t);
6
- }, u = (t) => e.find((n) => n.value === t) || {
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
- }, a = (t) => {
11
- const n = e.findIndex((S) => S.value === t.value);
12
- r(n), v(t), s(!1);
10
+ }, o = (t) => {
11
+ const r = e.findIndex((S) => S.value === t.value);
12
+ u(r), d(t), c(!1);
13
13
  };
14
- return o !== -1 && !c.value && a(u(o)), /* @__PURE__ */ m(
15
- d.Provider,
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: c,
20
- setSelectedValue: a,
21
+ selectedValue: s,
22
+ setSelectedValue: o,
21
23
  isOpen: x,
22
- setIsOpen: s,
23
- toggleListbox: b,
24
- getValue: u,
25
- activeIndex: f,
26
- setActiveIndex: r,
27
- listboxId: I.current
24
+ setIsOpen: c,
25
+ toggleListbox: I,
26
+ getValue: l,
27
+ activeIndex: b,
28
+ setActiveIndex: u,
29
+ listboxId: f.current
28
30
  },
29
- children: i
31
+ children: v
30
32
  }
31
33
  );
32
- }, O = () => {
33
- const e = p(d);
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
- L as SelectProvider,
39
- O as useSelect
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,GAIvC,gBAAAkB;AAAA,IAACtB,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,GAEakB,IAAY,MAAM;AAC7B,QAAMC,IAAUC,EAAWzB,CAAa;AAExC,MAAIwB,MAAY,OAAW,OAAM,IAAI,MAAM,iDAAiD;AAE5F,SAAOA;AACT;"}
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-DzN3R4wD.js";
3
- import { r as t, s } from "../../react.esm-DMlPLy-4.js";
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-DzN3R4wD.js";
3
- import { r as o, s as t, f as r } from "../../react.esm-DMlPLy-4.js";
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,7 +1,7 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import "../../index-DzN3R4wD.js";
3
- import { r as l, s as e, w as a } from "../../react.esm-DMlPLy-4.js";
4
- import { u as i } from "../../index-DDN7R-oN.js";
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 = {