@uva-glass/component-library 1.41.0 → 1.41.2
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/Periods.css +1 -1
- package/dist/assets/StatusPill.css +1 -1
- package/dist/components/Periods/Periods.d.ts +1 -1
- package/dist/components/Periods/Periods.js +20 -20
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/StatusPill/StatusPill.js +8 -8
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
._status-
|
|
1
|
+
._status-pill_1i67r_1{align-items:center;border-radius:1.5rem;display:flex;gap:.25rem;padding:.25rem .5rem;width:fit-content}._status-pill__possible_1i67r_10{background-color:var(--color-mint-cream);color:var(--color-san-felix)}._status-pill__impossible_1i67r_15{background-color:var(--color-amour);color:var(--color-uva-red-dark)}._status-pill__new_1i67r_20{background-color:var(--color-blue-50);color:var(--color-blue-500);font-size:var(--font-size-text-non-essential)}._status-pill--bar_1i67r_26{border-radius:0;justify-content:center;padding:.5rem;width:100%}
|
|
@@ -6,7 +6,7 @@ interface Period {
|
|
|
6
6
|
}
|
|
7
7
|
export interface PeriodsProps {
|
|
8
8
|
periods: Period[] | number[];
|
|
9
|
-
maxPeriods?:
|
|
9
|
+
maxPeriods?: 6 | 7;
|
|
10
10
|
titlePeriods?: Record<string, Record<string, string>>;
|
|
11
11
|
}
|
|
12
12
|
export declare const Periods: ({ periods, titlePeriods, maxPeriods }: PeriodsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { useId as
|
|
4
|
-
import '../../assets/Periods.css';const
|
|
5
|
-
period__container:
|
|
6
|
-
period__item:
|
|
7
|
-
"period__item--active": "_period__item--
|
|
8
|
-
},
|
|
9
|
-
const
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
const { semesterNumber:
|
|
2
|
+
import { c as N } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { useId as v } from "react";
|
|
4
|
+
import '../../assets/Periods.css';const y = "_period__container_12tqn_3", A = "_period__item_12tqn_8", n = {
|
|
5
|
+
period__container: y,
|
|
6
|
+
period__item: A,
|
|
7
|
+
"period__item--active": "_period__item--active_12tqn_20"
|
|
8
|
+
}, P = 6, x = ({ periods: r, titlePeriods: a, maxPeriods: l = P }) => {
|
|
9
|
+
const p = Array.from({ length: l }, (e, t) => t + 1), u = v(), _ = r.some((e) => typeof e == "number"), d = (e) => {
|
|
10
|
+
let t = 0;
|
|
11
|
+
return r.reduce(($, b, m) => {
|
|
12
|
+
const { semesterNumber: s, periodInSemester: o } = b;
|
|
13
13
|
let i = "";
|
|
14
|
-
return
|
|
15
|
-
}, "");
|
|
16
|
-
}, f = (e) =>
|
|
14
|
+
return s !== t ? i = ` ${e.periods["period-title"].replace("{{ semester }}", s.toString())} ${o}` : r[m + 1] && r[m + 1].semesterNumber === t ? i = `, ${o}` : i = ` ${e.periods["last-separator"]} ${o}`, t = s, `${$}${i}`;
|
|
15
|
+
}, "").trim();
|
|
16
|
+
}, f = (e) => _ ? r.includes(e) : !!r.find((t) => t.number === e);
|
|
17
17
|
return /* @__PURE__ */ c(
|
|
18
18
|
"div",
|
|
19
19
|
{
|
|
20
|
-
className:
|
|
21
|
-
title:
|
|
22
|
-
children:
|
|
20
|
+
className: n.period__container,
|
|
21
|
+
title: _ ? "" : d(a),
|
|
22
|
+
children: p.map((e) => /* @__PURE__ */ c(
|
|
23
23
|
"span",
|
|
24
24
|
{
|
|
25
|
-
className:
|
|
25
|
+
className: N(n.period__item, f(e) ? n["period__item--active"] : "")
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
`${u}-${e}`
|
|
28
28
|
))
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
x as Periods
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=Periods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Periods.js","sources":["../../../src/components/Periods/Periods.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId } from 'react';\n\nimport styles from './Periods.module.css';\n\ninterface Period {\n id: string;\n number: number;\n semesterNumber: number;\n periodInSemester: number;\n}\n\nexport interface PeriodsProps {\n periods: Period[] | number[];\n maxPeriods?:
|
|
1
|
+
{"version":3,"file":"Periods.js","sources":["../../../src/components/Periods/Periods.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { useId } from 'react';\n\nimport styles from './Periods.module.css';\n\ninterface Period {\n id: string;\n number: number;\n semesterNumber: number;\n periodInSemester: number;\n}\n\nexport interface PeriodsProps {\n periods: Period[] | number[];\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n maxPeriods?: 6 | 7;\n titlePeriods?: Record<string, Record<string, string>>;\n}\n\nconst MAX_PERIODS = 6;\n\nexport const Periods = ({ periods, titlePeriods, maxPeriods = MAX_PERIODS }: PeriodsProps) => {\n const maxPeriodsList = Array.from({ length: maxPeriods }, (_, index) => index + 1);\n const idPrefix = useId();\n\n const isArrayOfNumbers = periods.some((value) => {\n return typeof value === 'number';\n });\n\n const getTitles = (titlePeriods: Record<string, Record<string, string>>): string => {\n let currrentSemesterNumber = 0;\n\n const title = periods.reduce((acc, period, index) => {\n const { semesterNumber, periodInSemester } = period as Period;\n let periodTitle = '';\n if (semesterNumber !== currrentSemesterNumber) {\n periodTitle = ` ${titlePeriods.periods['period-title'].replace('{{ semester }}', semesterNumber.toString())} ${periodInSemester}`;\n } else if (periods[index + 1] && (periods[index + 1] as Period).semesterNumber === currrentSemesterNumber) {\n periodTitle = `, ${periodInSemester}`;\n } else {\n periodTitle = ` ${titlePeriods.periods['last-separator']} ${periodInSemester}`;\n }\n\n currrentSemesterNumber = semesterNumber;\n return `${acc}${periodTitle}`;\n }, '');\n\n return title.trim();\n };\n\n const isPeriodActive = (periodIndex: number): boolean => {\n if (isArrayOfNumbers) {\n return (periods as number[]).includes(periodIndex);\n } else {\n return periods.find((period) => (period as Period).number === periodIndex) ? true : false;\n }\n };\n\n return (\n <div\n className={styles['period__container']}\n title={isArrayOfNumbers ? '' : getTitles(titlePeriods as Record<string, Record<string, string>>)}\n >\n {maxPeriodsList.map((periodIndex) => {\n return (\n <span\n className={clsx(styles['period__item'], isPeriodActive(periodIndex) ? styles['period__item--active'] : '')}\n key={`${idPrefix}-${periodIndex}`}\n />\n );\n })}\n </div>\n );\n};\n"],"names":["MAX_PERIODS","Periods","periods","titlePeriods","maxPeriods","maxPeriodsList","_","index","idPrefix","useId","isArrayOfNumbers","value","getTitles","currrentSemesterNumber","acc","period","semesterNumber","periodInSemester","periodTitle","isPeriodActive","periodIndex","jsx","styles","clsx"],"mappings":";;;;;;;GAmBMA,IAAc,GAEPC,IAAU,CAAC,EAAE,SAAAC,GAAS,cAAAC,GAAc,YAAAC,IAAaJ,QAAgC;AACtF,QAAAK,IAAiB,MAAM,KAAK,EAAE,QAAQD,KAAc,CAACE,GAAGC,MAAUA,IAAQ,CAAC,GAC3EC,IAAWC,KAEXC,IAAmBR,EAAQ,KAAK,CAACS,MAC9B,OAAOA,KAAU,QACzB,GAEKC,IAAY,CAACT,MAAiE;AAClF,QAAIU,IAAyB;AAiB7B,WAfcX,EAAQ,OAAO,CAACY,GAAKC,GAAQR,MAAU;AAC7C,YAAA,EAAE,gBAAAS,GAAgB,kBAAAC,EAAqB,IAAAF;AAC7C,UAAIG,IAAc;AAClB,aAAIF,MAAmBH,IACrBK,IAAc,IAAIf,EAAa,QAAQ,cAAc,EAAE,QAAQ,kBAAkBa,EAAe,SAAU,CAAA,CAAC,IAAIC,CAAgB,KACtHf,EAAQK,IAAQ,CAAC,KAAML,EAAQK,IAAQ,CAAC,EAAa,mBAAmBM,IACjFK,IAAc,KAAKD,CAAgB,KAEnCC,IAAc,IAAIf,EAAa,QAAQ,gBAAgB,CAAC,IAAIc,CAAgB,IAGrDJ,IAAAG,GAClB,GAAGF,CAAG,GAAGI,CAAW;AAAA,OAC1B,EAAE,EAEQ;EAAK,GAGdC,IAAiB,CAACC,MAClBV,IACMR,EAAqB,SAASkB,CAAW,IAE1C,EAAAlB,EAAQ,KAAK,CAACa,MAAYA,EAAkB,WAAWK,CAAW;AAK3E,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAO;AAAA,MAClB,OAAOZ,IAAmB,KAAKE,EAAUT,CAAsD;AAAA,MAE9F,UAAAE,EAAe,IAAI,CAACe,MAEjB,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWE,EAAKD,EAAO,cAAiBH,EAAeC,CAAW,IAAIE,EAAO,sBAAsB,IAAI,EAAE;AAAA,QAAA;AAAA,QACpG,GAAGd,CAAQ,IAAIY,CAAW;AAAA,MAAA,CAGpC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as _, jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import { c as e } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import { Icon as a } from "../Icon/Icon.js";
|
|
4
4
|
import '../../assets/StatusPill.css';const l = {
|
|
5
|
-
"status-pill": "_status-
|
|
6
|
-
"status-pill__possible": "_status-
|
|
7
|
-
"status-pill__impossible": "_status-
|
|
8
|
-
"status-pill__new": "_status-
|
|
9
|
-
"status-pill--bar": "_status-pill--
|
|
5
|
+
"status-pill": "_status-pill_1i67r_1",
|
|
6
|
+
"status-pill__possible": "_status-pill__possible_1i67r_10",
|
|
7
|
+
"status-pill__impossible": "_status-pill__impossible_1i67r_15",
|
|
8
|
+
"status-pill__new": "_status-pill__new_1i67r_20",
|
|
9
|
+
"status-pill--bar": "_status-pill--bar_1i67r_26"
|
|
10
10
|
}, o = {
|
|
11
11
|
possible: "CheckCircleFillMini",
|
|
12
12
|
impossible: "CrossCircleFillMini"
|
|
13
13
|
};
|
|
14
14
|
function c({ status: s, variant: i = "default", label: t }) {
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ _(
|
|
16
16
|
"span",
|
|
17
17
|
{
|
|
18
18
|
className: e(
|
|
@@ -21,7 +21,7 @@ function c({ status: s, variant: i = "default", label: t }) {
|
|
|
21
21
|
i !== "default" && l[`status-pill--${i}`]
|
|
22
22
|
),
|
|
23
23
|
children: [
|
|
24
|
-
s !== "new" && /* @__PURE__ */
|
|
24
|
+
s !== "new" && /* @__PURE__ */ p(a, { name: o[s], title: s, size: 16 }),
|
|
25
25
|
t
|
|
26
26
|
]
|
|
27
27
|
}
|
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.41.
|
|
5
|
+
"version": "1.41.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"@types/node": "^20.14.13",
|
|
59
59
|
"@types/react": "^18.3.3",
|
|
60
60
|
"@types/react-dom": "^18.3.0",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
62
|
-
"@typescript-eslint/parser": "^7.
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
62
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
63
63
|
"@uva-glass/eslint-config": "^1.2.0",
|
|
64
64
|
"@uva-glass/stylelint-config": "^1.1.0",
|
|
65
65
|
"@vitejs/plugin-react": "^4.3.1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"semantic-release": "^24.0.0",
|
|
84
84
|
"storybook": "^8.2.6",
|
|
85
85
|
"style-dictionary": "^4.0.1",
|
|
86
|
-
"stylelint": "^16.
|
|
86
|
+
"stylelint": "^16.8.1",
|
|
87
87
|
"stylelint-config-recommended": "^14.0.1",
|
|
88
88
|
"stylelint-config-standard": "^36.0.1",
|
|
89
89
|
"stylelint-order": "^6.0.4",
|