@uva-glass/component-library 1.40.4 → 1.41.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/Periods.css +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.stories.js +32 -15
- package/dist/components/Checkbox/Checkbox.stories.js.map +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/package.json +5 -5
|
@@ -4,3 +4,4 @@ import { CheckboxProps } from './Checkbox';
|
|
|
4
4
|
declare const _default: Meta<CheckboxProps>;
|
|
5
5
|
export default _default;
|
|
6
6
|
export declare const CheckboxExample: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckboxProps>;
|
|
7
|
+
export declare const WithLongLabel: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckboxProps>;
|
|
@@ -1,20 +1,37 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { f as
|
|
3
|
-
import { Checkbox as
|
|
4
|
-
import { FormField as
|
|
5
|
-
import { Label as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { f as e } from "../../index-0Faxlks_.js";
|
|
3
|
+
import { Checkbox as l } from "./Checkbox.js";
|
|
4
|
+
import { FormField as t } from "../FormField/FormField.js";
|
|
5
|
+
import { Label as i } from "../Label/Label.js";
|
|
6
|
+
const x = {
|
|
7
7
|
title: "Atoms/Checkbox",
|
|
8
|
-
component:
|
|
9
|
-
},
|
|
10
|
-
/* @__PURE__ */ o(
|
|
11
|
-
/* @__PURE__ */ o(
|
|
12
|
-
] }),
|
|
13
|
-
|
|
14
|
-
onChange:
|
|
8
|
+
component: l
|
|
9
|
+
}, r = (n) => /* @__PURE__ */ g(t, { inline: !0, children: [
|
|
10
|
+
/* @__PURE__ */ o(l, { id: "72103b4d", ...n }),
|
|
11
|
+
/* @__PURE__ */ o(i, { htmlFor: "72103b4d", children: "Example Checkbox" })
|
|
12
|
+
] }), m = r.bind({});
|
|
13
|
+
m.args = {
|
|
14
|
+
onChange: e()
|
|
15
|
+
};
|
|
16
|
+
const a = (n) => /* @__PURE__ */ g(t, { inline: !0, children: [
|
|
17
|
+
/* @__PURE__ */ o(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
style: {
|
|
21
|
+
alignSelf: "flex-start",
|
|
22
|
+
marginTop: "0.18rem"
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ o(l, { id: "72103b4e", ...n })
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ o(i, { htmlFor: "72103b4e", children: "Example Checkbox with long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long label" })
|
|
28
|
+
] }), h = a.bind({});
|
|
29
|
+
h.args = {
|
|
30
|
+
onChange: e()
|
|
15
31
|
};
|
|
16
32
|
export {
|
|
17
|
-
|
|
18
|
-
h as
|
|
33
|
+
m as CheckboxExample,
|
|
34
|
+
h as WithLongLabel,
|
|
35
|
+
x as default
|
|
19
36
|
};
|
|
20
37
|
//# sourceMappingURL=Checkbox.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.stories.js","sources":["../../../src/components/Checkbox/Checkbox.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { CheckboxProps } from './Checkbox';\n\nimport { Checkbox } from './Checkbox';\n\nimport { FormField } from 'components/FormField';\nimport { Label } from 'components/Label';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Checkbox',\n component: Checkbox,\n} as Meta<CheckboxProps>;\n\nconst Template: StoryFn<CheckboxProps> = (args) => (\n <FormField inline>\n <Checkbox id=\"72103b4d\" {...args} />\n <Label htmlFor=\"72103b4d\">Example Checkbox</Label>\n </FormField>\n);\n\nexport const CheckboxExample = Template.bind({});\nCheckboxExample.args = {\n onChange: fn(),\n};\n"],"names":["Checkbox_stories","Checkbox","Template","args","jsxs","FormField","jsx","Label","CheckboxExample","fn"],"mappings":";;;;;AAWA,MAAeA,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AACb,GAEMC,IAAmC,CAACC,MACvC,gBAAAC,EAAAC,GAAA,EAAU,QAAM,IACf,UAAA;AAAA,EAAA,gBAAAC,EAACL,GAAS,EAAA,IAAG,YAAY,GAAGE,EAAM,CAAA;AAAA,EACjC,gBAAAG,EAAAC,GAAA,EAAM,SAAQ,YAAW,UAAgB,oBAAA;AAAA,EAC5C,CAAA,GAGWC,IAAkBN,EAAS,KAAK,EAAE;AAC/CM,EAAgB,OAAO;AAAA,EACrB,UAAUC,EAAG;AACf;"}
|
|
1
|
+
{"version":3,"file":"Checkbox.stories.js","sources":["../../../src/components/Checkbox/Checkbox.stories.tsx"],"sourcesContent":["import { fn } from '@storybook/test';\n\nimport type { Meta, StoryFn } from '@storybook/react';\nimport type { CheckboxProps } from './Checkbox';\n\nimport { Checkbox } from './Checkbox';\n\nimport { FormField } from 'components/FormField';\nimport { Label } from 'components/Label';\n\n// eslint-disable-next-line import/no-default-export\nexport default {\n title: 'Atoms/Checkbox',\n component: Checkbox,\n} as Meta<CheckboxProps>;\n\nconst Template: StoryFn<CheckboxProps> = (args) => (\n <FormField inline>\n <Checkbox id=\"72103b4d\" {...args} />\n <Label htmlFor=\"72103b4d\">Example Checkbox</Label>\n </FormField>\n);\n\nexport const CheckboxExample = Template.bind({});\nCheckboxExample.args = {\n onChange: fn(),\n};\n\n// Extra story created for UX to see how we can solve placement of checkbox when paired with long content\n// TODO: should this component be refactored to always include a label? (see RadioButton)\nconst WithLongLabelTemplate: StoryFn<CheckboxProps> = (args) => (\n <FormField inline>\n <div\n style={{\n alignSelf: 'flex-start',\n marginTop: '0.18rem',\n }}\n >\n <Checkbox id=\"72103b4e\" {...args} />\n </div>\n <Label htmlFor=\"72103b4e\">\n Example Checkbox with long long long long long long long long long long long long long long long long long long\n long long long long long long long long long long long long long long long long long long long long long long long\n long long long long long long long long long long long long long long long long long long long long long long long\n long long long long long long long long long long long label\n </Label>\n </FormField>\n);\n\nexport const WithLongLabel = WithLongLabelTemplate.bind({});\nWithLongLabel.args = {\n onChange: fn(),\n};\n"],"names":["Checkbox_stories","Checkbox","Template","args","jsxs","FormField","jsx","Label","CheckboxExample","fn","WithLongLabelTemplate","WithLongLabel"],"mappings":";;;;;AAWA,MAAeA,IAAA;AAAA,EACb,OAAO;AAAA,EACP,WAAWC;AACb,GAEMC,IAAmC,CAACC,MACvC,gBAAAC,EAAAC,GAAA,EAAU,QAAM,IACf,UAAA;AAAA,EAAA,gBAAAC,EAACL,GAAS,EAAA,IAAG,YAAY,GAAGE,EAAM,CAAA;AAAA,EACjC,gBAAAG,EAAAC,GAAA,EAAM,SAAQ,YAAW,UAAgB,oBAAA;AAAA,EAC5C,CAAA,GAGWC,IAAkBN,EAAS,KAAK,EAAE;AAC/CM,EAAgB,OAAO;AAAA,EACrB,UAAUC,EAAG;AACf;AAIA,MAAMC,IAAgD,CAACP,MACpD,gBAAAC,EAAAC,GAAA,EAAU,QAAM,IACf,UAAA;AAAA,EAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,WAAW;AAAA,QACX,WAAW;AAAA,MACb;AAAA,MAEA,UAAC,gBAAAA,EAAAL,GAAA,EAAS,IAAG,YAAY,GAAGE,GAAM;AAAA,IAAA;AAAA,EACpC;AAAA,EACC,gBAAAG,EAAAC,GAAA,EAAM,SAAQ,YAAW,UAK1B,sZAAA;AAAA,EACF,CAAA,GAGWI,IAAgBD,EAAsB,KAAK,EAAE;AAC1DC,EAAc,OAAO;AAAA,EACnB,UAAUF,EAAG;AACf;"}
|
|
@@ -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,KAA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-library",
|
|
3
3
|
"author": "Team Glass - Frontend vrienden",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.41.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"@storybook/react": "^8.2.6",
|
|
56
56
|
"@storybook/react-vite": "^8.2.6",
|
|
57
57
|
"@storybook/test": "^8.2.6",
|
|
58
|
-
"@types/node": "^20.14.
|
|
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.0",
|
|
87
87
|
"stylelint-config-recommended": "^14.0.1",
|
|
88
88
|
"stylelint-config-standard": "^36.0.1",
|
|
89
89
|
"stylelint-order": "^6.0.4",
|