@uva-glass/component-library 3.50.2 → 3.50.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,51 +1,54 @@
1
- import { jsx as t, jsxs as j } from "react/jsx-runtime";
2
- import { useState as d, useRef as O, useMemo as x, useEffect as h } from "react";
3
- import { createPortal as A } from "react-dom";
4
- import { useOverlay as C, usePreventScroll as D, OverlayContainer as L } from "@react-aria/overlays";
5
- import { FocusScope as $ } from "@react-aria/focus";
6
- import { WeekSelectorButton as q } from "./components/WeekSelectorButton.js";
7
- import { WeekSelectorOptionContainer as E } from "./components/WeekSelectorOptionContainer.js";
8
- import { WeekSelectorOption as K } from "./components/WeekSelectorOption.js";
9
- import { s as M } from "../../WeekSelector.module-Clco7jTs.js";
1
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
2
+ import { useState as b, useRef as k, useMemo as $, useEffect as y } from "react";
3
+ import { createPortal as x } from "react-dom";
4
+ import { useOverlay as A, usePreventScroll as C, OverlayContainer as D } from "@react-aria/overlays";
5
+ import { FocusScope as L } from "@react-aria/focus";
6
+ import { WeekSelectorButton as E } from "./components/WeekSelectorButton.js";
7
+ import { WeekSelectorOptionContainer as K } from "./components/WeekSelectorOptionContainer.js";
8
+ import { WeekSelectorOption as M } from "./components/WeekSelectorOption.js";
9
+ import { s as O } from "../../WeekSelector.module-Clco7jTs.js";
10
10
  import { Backdrop as P } from "../Backdrop/Backdrop.js";
11
11
  import { useOnClickOutside as R } from "../hooks/useOnClickOutside.js";
12
12
  const Z = ({
13
13
  weeks: r,
14
14
  currentPeriod: i = 0,
15
15
  defaultSelection: n,
16
- weekPrefix: k,
17
- optionsHeader: y,
18
- periodLabels: N,
19
- onSelectWeek: v,
20
- portalContainerRef: m,
21
- optionContainerOffset: u = []
16
+ weekPrefix: h,
17
+ optionsHeader: N,
18
+ periodLabels: v,
19
+ onSelectWeek: W,
20
+ portalContainerRef: u,
21
+ optionContainerOffset: m = []
22
22
  }) => {
23
- const [p, a] = d(null), [o, l] = d(!1), f = O(null), s = O(null), W = x(() => Object.keys(r ?? {}), [r]);
24
- h(() => {
23
+ const [a, p] = b(null), [o, l] = b(!1), f = k(null), s = k(null), B = $(() => Object.keys(r ?? {}), [r]);
24
+ y(() => {
25
25
  if (n) {
26
26
  for (const e in r)
27
27
  if (r[e].some((c) => c.calendarWeekNumber === n && !c.isBlocked) && Number(e) > i) {
28
- a(n);
28
+ p(n);
29
29
  return;
30
30
  }
31
31
  }
32
32
  for (const e in r) {
33
- const c = r[e].find((g) => !g.isBlocked);
33
+ const c = r[e].find((q) => !q.isBlocked);
34
34
  if (c && Number(e) > i) {
35
- a(c.calendarWeekNumber);
35
+ p(c.calendarWeekNumber);
36
36
  return;
37
37
  }
38
38
  }
39
- }, [r, i, n]), h(() => {
40
- o && s.current && requestAnimationFrame(() => {
41
- s.current?.focus();
39
+ }, [r, i, n]), y(() => {
40
+ o && requestAnimationFrame(() => {
41
+ const e = s.current?.querySelector(
42
+ `.${O["week-selector-option-week--selected"]}`
43
+ );
44
+ e ? e.focus() : s.current?.querySelector("button:not(:disabled)")?.focus();
42
45
  });
43
- }, [o]);
44
- const B = () => `${k} ${p ?? n ?? "?"}`;
46
+ }, [o, a]);
47
+ const S = () => `${h} ${a ?? n ?? "?"}`;
45
48
  R(f, (e) => {
46
49
  s.current && s.current.contains(e.target) || l(!1);
47
50
  });
48
- const { overlayProps: F, underlayProps: S } = C(
51
+ const { overlayProps: g, underlayProps: j } = A(
49
52
  {
50
53
  isOpen: o,
51
54
  isDismissable: !0,
@@ -53,40 +56,40 @@ const Z = ({
53
56
  },
54
57
  s
55
58
  );
56
- D({ isDisabled: !o || !m?.current });
57
- const b = /* @__PURE__ */ t(
58
- E,
59
+ C({ isDisabled: !o || !u?.current });
60
+ const d = /* @__PURE__ */ t(
61
+ K,
59
62
  {
60
- header: y,
61
- periodLabels: N,
63
+ header: N,
64
+ periodLabels: v,
62
65
  ref: s,
63
- ...u.length === 2 ? {
66
+ ...m.length === 2 ? {
64
67
  style: {
65
- top: u[0],
66
- left: u[1]
68
+ top: m[0],
69
+ left: m[1]
67
70
  }
68
71
  } : {},
69
- children: W.map((e) => /* @__PURE__ */ t(
70
- K,
72
+ children: B.map((e) => /* @__PURE__ */ t(
73
+ M,
71
74
  {
72
75
  periodIndex: e,
73
76
  weeks: r,
74
77
  disabled: Number(e) <= i,
75
- selectedOption: p,
76
- setSelectedOption: a,
77
- onSelectWeek: v,
78
+ selectedOption: a,
79
+ setSelectedOption: p,
80
+ onSelectWeek: W,
78
81
  setIsOpen: l
79
82
  },
80
83
  e
81
84
  ))
82
85
  }
83
86
  );
84
- return /* @__PURE__ */ j("div", { className: M["week-selector"], tabIndex: -1, ref: f, children: [
85
- /* @__PURE__ */ t(q, { label: B(), onClick: () => l(!o) }),
86
- o && (m?.current ? A(
87
- /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(P, { ...S, children: /* @__PURE__ */ t($, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ t("div", { ...F, children: b }) }) }) }),
88
- m.current
89
- ) : b)
87
+ return /* @__PURE__ */ F("div", { className: O["week-selector"], tabIndex: -1, ref: f, children: [
88
+ /* @__PURE__ */ t(E, { label: S(), onClick: () => l(!o) }),
89
+ o && (u?.current ? x(
90
+ /* @__PURE__ */ t(D, { children: /* @__PURE__ */ t(P, { ...j, children: /* @__PURE__ */ t(L, { contain: !0, restoreFocus: !0, children: /* @__PURE__ */ t("div", { ...g, children: d }) }) }) }),
91
+ u.current
92
+ ) : d)
90
93
  ] });
91
94
  };
92
95
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"WeekSelector.js","sources":["../../../src/components/WeekSelector/WeekSelector.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\r\nimport { createPortal } from 'react-dom';\r\nimport { OverlayContainer, useOverlay, usePreventScroll } from '@react-aria/overlays';\r\nimport { FocusScope } from '@react-aria/focus';\r\n\r\nimport type { CSSProperties, RefObject } from 'react';\r\n\r\nimport { WeekSelectorButton } from './components/WeekSelectorButton';\r\nimport { WeekSelectorOptionContainer } from './components/WeekSelectorOptionContainer';\r\nimport { WeekSelectorOption } from './components/WeekSelectorOption';\r\nimport styles from './WeekSelector.module.css';\r\n\r\nimport { Backdrop } from 'components/Backdrop';\r\nimport { useOnClickOutside } from 'components/hooks/useOnClickOutside';\r\n\r\nexport type PeriodWeek = {\r\n academicWeekNumber: number;\r\n calendarWeekNumber: number;\r\n isBlocked: boolean;\r\n period: number;\r\n startDate: string;\r\n endDate: string;\r\n weekNumber: number;\r\n};\r\n\r\nexport interface WeekSelectorProps {\r\n /** Object with periodnumbers with array of weeks in period */\r\n weeks: Record<string, PeriodWeek[]>;\r\n /** Current period to disable previous periods */\r\n currentPeriod?: number;\r\n /** Default selected week */\r\n defaultSelection?: number;\r\n /** Prefix for the week button label */\r\n weekPrefix: string;\r\n /** Labels for each period */\r\n periodLabels: string[];\r\n /** Header text for the options container */\r\n optionsHeader: string;\r\n /** Callback function when a week is selected */\r\n onSelectWeek: (weeknumber: number) => void;\r\n /** Ref for the dropdown portal target */\r\n portalContainerRef?: RefObject<HTMLElement | null>;\r\n /** Optional WeekSelectorOptionContainer offset values [top, bottom] */\r\n optionContainerOffset?: number[];\r\n}\r\n\r\nexport const WeekSelector = ({\r\n weeks,\r\n currentPeriod = 0,\r\n defaultSelection,\r\n weekPrefix,\r\n optionsHeader,\r\n periodLabels,\r\n onSelectWeek,\r\n portalContainerRef,\r\n optionContainerOffset = [],\r\n}: WeekSelectorProps) => {\r\n const [selectedOption, setSelectedOption] = useState<number | null>(null);\r\n const [isOpen, setIsOpen] = useState<boolean>(false);\r\n const wrapperRef = useRef<HTMLDivElement>(null);\r\n const optionContainerRef = useRef<HTMLDivElement>(null);\r\n const periodKeys = useMemo(() => Object.keys(weeks ?? {}), [weeks]);\r\n\r\n useEffect(() => {\r\n if (defaultSelection) {\r\n for (const period in weeks) {\r\n if (\r\n weeks[period].some((week) => week.calendarWeekNumber === defaultSelection && !week.isBlocked) &&\r\n Number(period) > currentPeriod\r\n ) {\r\n setSelectedOption(defaultSelection);\r\n return;\r\n }\r\n }\r\n }\r\n for (const period in weeks) {\r\n const firstAvailableWeek = weeks[period].find((week) => !week.isBlocked);\r\n if (firstAvailableWeek && Number(period) > currentPeriod) {\r\n setSelectedOption(firstAvailableWeek.calendarWeekNumber);\r\n return;\r\n }\r\n }\r\n }, [weeks, currentPeriod, defaultSelection]);\r\n\r\n useEffect(() => {\r\n if (isOpen && optionContainerRef.current) {\r\n requestAnimationFrame(() => {\r\n optionContainerRef.current?.focus();\r\n });\r\n }\r\n }, [isOpen]);\r\n\r\n const getButtonLabel = () => {\r\n const weekNumber = selectedOption ?? defaultSelection ?? '?';\r\n return `${weekPrefix} ${weekNumber}`;\r\n };\r\n\r\n useOnClickOutside(wrapperRef as RefObject<HTMLElement>, (event) => {\r\n if (optionContainerRef.current && optionContainerRef.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n setIsOpen(false);\r\n });\r\n\r\n const { overlayProps, underlayProps } = useOverlay(\r\n {\r\n isOpen,\r\n isDismissable: true,\r\n onClose: () => setIsOpen(false),\r\n },\r\n optionContainerRef\r\n );\r\n\r\n usePreventScroll({ isDisabled: !isOpen || !portalContainerRef?.current });\r\n\r\n const OptionList = (\r\n <WeekSelectorOptionContainer\r\n header={optionsHeader}\r\n periodLabels={periodLabels}\r\n ref={optionContainerRef}\r\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\r\n {...(optionContainerOffset.length === 2\r\n ? {\r\n style: {\r\n top: optionContainerOffset[0],\r\n left: optionContainerOffset[1],\r\n } as CSSProperties,\r\n }\r\n : {})}\r\n >\r\n {periodKeys.map((periodIndex) => (\r\n <WeekSelectorOption\r\n key={periodIndex}\r\n periodIndex={periodIndex}\r\n weeks={weeks}\r\n disabled={Number(periodIndex) <= currentPeriod}\r\n selectedOption={selectedOption}\r\n setSelectedOption={setSelectedOption}\r\n onSelectWeek={onSelectWeek}\r\n setIsOpen={setIsOpen}\r\n />\r\n ))}\r\n </WeekSelectorOptionContainer>\r\n );\r\n\r\n return (\r\n <div className={styles['week-selector']} tabIndex={-1} ref={wrapperRef}>\r\n <WeekSelectorButton label={getButtonLabel()} onClick={() => setIsOpen(!isOpen)} />\r\n\r\n {isOpen &&\r\n (portalContainerRef?.current\r\n ? createPortal(\r\n <OverlayContainer>\r\n <Backdrop {...underlayProps}>\r\n <FocusScope contain restoreFocus autoFocus>\r\n <div {...overlayProps}>{OptionList}</div>\r\n </FocusScope>\r\n </Backdrop>\r\n </OverlayContainer>,\r\n portalContainerRef.current\r\n )\r\n : OptionList)}\r\n </div>\r\n );\r\n};\r\n"],"names":["WeekSelector","weeks","currentPeriod","defaultSelection","weekPrefix","optionsHeader","periodLabels","onSelectWeek","portalContainerRef","optionContainerOffset","selectedOption","setSelectedOption","useState","isOpen","setIsOpen","wrapperRef","useRef","optionContainerRef","periodKeys","useMemo","useEffect","period","week","firstAvailableWeek","getButtonLabel","useOnClickOutside","event","overlayProps","underlayProps","useOverlay","usePreventScroll","OptionList","jsx","WeekSelectorOptionContainer","periodIndex","WeekSelectorOption","jsxs","styles","WeekSelectorButton","createPortal","OverlayContainer","Backdrop","FocusScope"],"mappings":";;;;;;;;;;;AA8CO,MAAMA,IAAe,CAAC;AAAA,EAC3B,OAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,uBAAAC,IAAwB,CAAA;AAC1B,MAAyB;AACvB,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAwB,IAAI,GAClE,CAACC,GAAQC,CAAS,IAAIF,EAAkB,EAAK,GAC7CG,IAAaC,EAAuB,IAAI,GACxCC,IAAqBD,EAAuB,IAAI,GAChDE,IAAaC,EAAQ,MAAM,OAAO,KAA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,MACC,QAAQ5B;AAAA,MACR,cAAAC;AAAA,MACA,KAAKW;AAAA,MAEJ,GAAIR,EAAsB,WAAW,IAClC;AAAA,QACE,OAAO;AAAA,UACL,KAAKA,EAAsB,CAAC;AAAA,UAC5B,MAAMA,EAAsB,CAAC;AAAA,QAAA;AAAA,MAC/B,IAEF,CAAA;AAAA,MAEH,UAAAS,EAAW,IAAI,CAACgB,MACf,gBAAAF;AAAA,QAACG;AAAA,QAAA;AAAA,UAEC,aAAAD;AAAA,UACA,OAAAjC;AAAA,UACA,UAAU,OAAOiC,CAAW,KAAKhC;AAAA,UACjC,gBAAAQ;AAAA,UACA,mBAAAC;AAAA,UACA,cAAAJ;AAAA,UACA,WAAAO;AAAA,QAAA;AAAA,QAPKoB;AAAA,MAAA,CASR;AAAA,IAAA;AAAA,EAAA;AAIL,SACE,gBAAAE,EAAC,SAAI,WAAWC,EAAO,eAAe,GAAG,UAAU,IAAI,KAAKtB,GAC1D,UAAA;AAAA,IAAA,gBAAAiB,EAACM,GAAA,EAAmB,OAAOd,EAAA,GAAkB,SAAS,MAAMV,EAAU,CAACD,CAAM,GAAG;AAAA,IAE/EA,MACEL,GAAoB,UACjB+B;AAAA,MACE,gBAAAP,EAACQ,KACC,UAAA,gBAAAR,EAACS,GAAA,EAAU,GAAGb,GACZ,UAAA,gBAAAI,EAACU,KAAW,SAAO,IAAC,cAAY,IAAC,WAAS,IACxC,UAAA,gBAAAV,EAAC,OAAA,EAAK,GAAGL,GAAe,UAAAI,EAAA,CAAW,EAAA,CACrC,EAAA,CACF,EAAA,CACF;AAAA,MACAvB,EAAmB;AAAA,IAAA,IAErBuB;AAAA,EAAA,GACR;AAEJ;"}
1
+ {"version":3,"file":"WeekSelector.js","sources":["../../../src/components/WeekSelector/WeekSelector.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\r\nimport { createPortal } from 'react-dom';\r\nimport { OverlayContainer, useOverlay, usePreventScroll } from '@react-aria/overlays';\r\nimport { FocusScope } from '@react-aria/focus';\r\n\r\nimport type { CSSProperties, RefObject } from 'react';\r\n\r\nimport { WeekSelectorButton } from './components/WeekSelectorButton';\r\nimport { WeekSelectorOptionContainer } from './components/WeekSelectorOptionContainer';\r\nimport { WeekSelectorOption } from './components/WeekSelectorOption';\r\nimport styles from './WeekSelector.module.css';\r\n\r\nimport { Backdrop } from 'components/Backdrop';\r\nimport { useOnClickOutside } from 'components/hooks/useOnClickOutside';\r\n\r\nexport type PeriodWeek = {\r\n academicWeekNumber: number;\r\n calendarWeekNumber: number;\r\n isBlocked: boolean;\r\n period: number;\r\n startDate: string;\r\n endDate: string;\r\n weekNumber: number;\r\n};\r\n\r\nexport interface WeekSelectorProps {\r\n /** Object with periodnumbers with array of weeks in period */\r\n weeks: Record<string, PeriodWeek[]>;\r\n /** Current period to disable previous periods */\r\n currentPeriod?: number;\r\n /** Default selected week */\r\n defaultSelection?: number;\r\n /** Prefix for the week button label */\r\n weekPrefix: string;\r\n /** Labels for each period */\r\n periodLabels: string[];\r\n /** Header text for the options container */\r\n optionsHeader: string;\r\n /** Callback function when a week is selected */\r\n onSelectWeek: (weeknumber: number) => void;\r\n /** Ref for the dropdown portal target */\r\n portalContainerRef?: RefObject<HTMLElement | null>;\r\n /** Optional WeekSelectorOptionContainer offset values [top, bottom] */\r\n optionContainerOffset?: number[];\r\n}\r\n\r\nexport const WeekSelector = ({\r\n weeks,\r\n currentPeriod = 0,\r\n defaultSelection,\r\n weekPrefix,\r\n optionsHeader,\r\n periodLabels,\r\n onSelectWeek,\r\n portalContainerRef,\r\n optionContainerOffset = [],\r\n}: WeekSelectorProps) => {\r\n const [selectedOption, setSelectedOption] = useState<number | null>(null);\r\n const [isOpen, setIsOpen] = useState<boolean>(false);\r\n const wrapperRef = useRef<HTMLDivElement>(null);\r\n const optionContainerRef = useRef<HTMLDivElement>(null);\r\n const periodKeys = useMemo(() => Object.keys(weeks ?? {}), [weeks]);\r\n\r\n useEffect(() => {\r\n if (defaultSelection) {\r\n for (const period in weeks) {\r\n if (\r\n weeks[period].some((week) => week.calendarWeekNumber === defaultSelection && !week.isBlocked) &&\r\n Number(period) > currentPeriod\r\n ) {\r\n setSelectedOption(defaultSelection);\r\n return;\r\n }\r\n }\r\n }\r\n for (const period in weeks) {\r\n const firstAvailableWeek = weeks[period].find((week) => !week.isBlocked);\r\n if (firstAvailableWeek && Number(period) > currentPeriod) {\r\n setSelectedOption(firstAvailableWeek.calendarWeekNumber);\r\n return;\r\n }\r\n }\r\n }, [weeks, currentPeriod, defaultSelection]);\r\n\r\n useEffect(() => {\r\n if (isOpen) {\r\n requestAnimationFrame(() => {\r\n const selectedButton = optionContainerRef.current?.querySelector<HTMLButtonElement>(\r\n `.${styles['week-selector-option-week--selected']}`\r\n );\r\n if (selectedButton) {\r\n selectedButton.focus();\r\n } else {\r\n optionContainerRef.current?.querySelector<HTMLButtonElement>('button:not(:disabled)')?.focus();\r\n }\r\n });\r\n }\r\n }, [isOpen, selectedOption]);\r\n\r\n const getButtonLabel = () => {\r\n const weekNumber = selectedOption ?? defaultSelection ?? '?';\r\n return `${weekPrefix} ${weekNumber}`;\r\n };\r\n\r\n useOnClickOutside(wrapperRef as RefObject<HTMLElement>, (event) => {\r\n if (optionContainerRef.current && optionContainerRef.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n setIsOpen(false);\r\n });\r\n\r\n const { overlayProps, underlayProps } = useOverlay(\r\n {\r\n isOpen,\r\n isDismissable: true,\r\n onClose: () => setIsOpen(false),\r\n },\r\n optionContainerRef\r\n );\r\n\r\n usePreventScroll({ isDisabled: !isOpen || !portalContainerRef?.current });\r\n\r\n const OptionList = (\r\n <WeekSelectorOptionContainer\r\n header={optionsHeader}\r\n periodLabels={periodLabels}\r\n ref={optionContainerRef}\r\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\r\n {...(optionContainerOffset.length === 2\r\n ? {\r\n style: {\r\n top: optionContainerOffset[0],\r\n left: optionContainerOffset[1],\r\n } as CSSProperties,\r\n }\r\n : {})}\r\n >\r\n {periodKeys.map((periodIndex) => (\r\n <WeekSelectorOption\r\n key={periodIndex}\r\n periodIndex={periodIndex}\r\n weeks={weeks}\r\n disabled={Number(periodIndex) <= currentPeriod}\r\n selectedOption={selectedOption}\r\n setSelectedOption={setSelectedOption}\r\n onSelectWeek={onSelectWeek}\r\n setIsOpen={setIsOpen}\r\n />\r\n ))}\r\n </WeekSelectorOptionContainer>\r\n );\r\n\r\n return (\r\n <div className={styles['week-selector']} tabIndex={-1} ref={wrapperRef}>\r\n <WeekSelectorButton label={getButtonLabel()} onClick={() => setIsOpen(!isOpen)} />\r\n\r\n {isOpen &&\r\n (portalContainerRef?.current\r\n ? createPortal(\r\n <OverlayContainer>\r\n <Backdrop {...underlayProps}>\r\n <FocusScope contain restoreFocus>\r\n <div {...overlayProps}>{OptionList}</div>\r\n </FocusScope>\r\n </Backdrop>\r\n </OverlayContainer>,\r\n portalContainerRef.current\r\n )\r\n : OptionList)}\r\n </div>\r\n );\r\n};\r\n"],"names":["WeekSelector","weeks","currentPeriod","defaultSelection","weekPrefix","optionsHeader","periodLabels","onSelectWeek","portalContainerRef","optionContainerOffset","selectedOption","setSelectedOption","useState","isOpen","setIsOpen","wrapperRef","useRef","optionContainerRef","periodKeys","useMemo","useEffect","period","week","firstAvailableWeek","selectedButton","styles","getButtonLabel","useOnClickOutside","event","overlayProps","underlayProps","useOverlay","usePreventScroll","OptionList","jsx","WeekSelectorOptionContainer","periodIndex","WeekSelectorOption","jsxs","WeekSelectorButton","createPortal","OverlayContainer","Backdrop","FocusScope"],"mappings":";;;;;;;;;;;AA8CO,MAAMA,IAAe,CAAC;AAAA,EAC3B,OAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,kBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,uBAAAC,IAAwB,CAAA;AAC1B,MAAyB;AACvB,QAAM,C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AA,MACAzB,EAAmB;AAAA,IAAA,IAErByB;AAAA,EAAA,GACR;AAEJ;"}
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": "3.50.2",
5
+ "version": "3.50.3",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",