@uva-glass/component-library 3.55.0 → 3.55.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.
@@ -13,7 +13,7 @@ export interface PeriodsProps {
13
13
  /** Indicates which periods are selected. */
14
14
  periods: Period[] | number[];
15
15
  /** Indicates the maximum number of periods to show in the selector. */
16
- maxPeriods?: 6 | 7;
16
+ maxPeriods?: 3 | 6 | 7;
17
17
  /** A object of translations for the tooltip. */
18
18
  tooltipTranslations?: TooltipTranslations;
19
19
  }
@@ -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\ninterface TooltipTranslations {\n period: string;\n periods: string;\n and: string;\n}\n\nexport interface PeriodsProps {\n /** Indicates which periods are selected. */\n periods: Period[] | number[];\n /** Indicates the maximum number of periods to show in the selector. */\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n maxPeriods?: 6 | 7;\n /** A object of translations for the tooltip. */\n tooltipTranslations?: TooltipTranslations;\n}\n\nconst MAX_PERIODS = 6;\n\n/** Represents a component for a period indicator. */\nexport const Periods = ({ periods, tooltipTranslations, 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 = (tooltipTranslations: TooltipTranslations): string => {\n const semesterPeriods: Record<number, number[]> = {};\n\n // Group periods by semester\n isArrayOfNumbers\n ? periods.forEach((period) => {\n if (typeof period === 'number') {\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const groupKey = Math.ceil(period / 3); // Determine the semester (1, 2, or 3)\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const mappedValue = ((period - 1) % 3) + 1; // Map period to semester\n\n if (!semesterPeriods[groupKey]) {\n semesterPeriods[groupKey] = [];\n }\n semesterPeriods[groupKey].push(mappedValue);\n }\n })\n : periods.forEach((period) => {\n const { semesterNumber, periodInSemester } = period as Period;\n\n if (!semesterPeriods[semesterNumber]) {\n semesterPeriods[semesterNumber] = [];\n }\n semesterPeriods[semesterNumber].push(periodInSemester);\n });\n\n // Build the title string\n const title = Object.keys(semesterPeriods).reduce((acc, semesterKey, index) => {\n const semesterNumber = Number(semesterKey);\n const periodsInSemester = semesterPeriods[semesterNumber];\n let periodTitle = '';\n\n // Determine if we need singular or plural form for \"period\"\n const blokLabel = periodsInSemester.length > 1 ? tooltipTranslations.periods : tooltipTranslations.period;\n\n // Build period sequence for the current semester\n if (periodsInSemester.length > 1) {\n const lastPeriod = periodsInSemester.pop();\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester.join(', ')} ${tooltipTranslations.and} ${lastPeriod}`;\n } else {\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester[0]}`;\n }\n\n // Add proper spacing and periods\n return `${acc}${index > 0 ? '. ' : ''}${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 className={styles['periods__container']} title={tooltipTranslations ? getTitles(tooltipTranslations) : ''}>\n {maxPeriodsList.map((periodIndex) => {\n return (\n <span\n className={clsx(\n styles['periods__item'],\n isPeriodActive(periodIndex) ? styles['periods__item--active'] : ''\n )}\n data-period-item\n key={`${idPrefix}-${periodIndex}`}\n />\n );\n })}\n </div>\n );\n};\n"],"names":["MAX_PERIODS","Periods","periods","tooltipTranslations","maxPeriods","maxPeriodsList","_","index","idPrefix","useId","isArrayOfNumbers","value","getTitles","semesterPeriods","period","groupKey","mappedValue","semesterNumber","periodInSemester","acc","semesterKey","periodsInSemester","periodTitle","blokLabel","lastPeriod","isPeriodActive","periodIndex","jsx","styles","clsx"],"mappings":";;;;;;;GA4BMA,IAAc,GAGPC,IAAU,CAAC,EAAE,SAAAC,GAAS,qBAAAC,GAAqB,YAAAC,IAAaJ,QAAgC;AACnG,QAAMK,IAAiB,MAAM,KAAK,EAAE,QAAQD,EAAA,GAAc,CAACE,GAAGC,MAAUA,IAAQ,CAAC,GAC3EC,IAAWC,EAAA,GAEXC,IAAmBR,EAAQ,KAAK,CAACS,MAC9B,OAAOA,KAAU,QACzB,GAEKC,IAAY,CAACT,MAAqD;AACtE,UAAMU,IAA4C,CAAA;AAGlD,WAAAH,IACIR,EAAQ,QAAQ,CAACY,MAAW;AAC1B,UAAI,OAAOA,KAAW,UAAU;AAE9B,cAAMC,IAAW,KAAK,KAAKD,IAAS,CAAC,GAE/BE,KAAgBF,IAAS,KAAK,IAAK;AAEzC,QAAKD,EAAgBE,CAAQ,MAC3BF,EAAgBE,CAAQ,IAAI,CAAA,IAE9BF,EAAgBE,CAAQ,EAAE,KAAKC,CAAW;AAAA,MAC5C;AAAA,IACF,CAAC,IACDd,EAAQ,QAAQ,CAACY,MAAW;AAC1B,YAAM,EAAE,gBAAAG,GAAgB,kBAAAC,EAAA,IAAqBJ;AAE7C,MAAKD,EAAgBI,CAAc,MACjCJ,EAAgBI,CAAc,IAAI,CAAA,IAEpCJ,EAAgBI,CAAc,EAAE,KAAKC,CAAgB;AAAA,IACvD,CAAC,GAGS,OAAO,KAAKL,CAAe,EAAE,OAAO,CAACM,GAAKC,GAAab,MAAU;AAC7E,YAAMU,IAAiB,OAAOG,CAAW,GACnCC,IAAoBR,EAAgBI,CAAc;AACxD,UAAIK,IAAc;AAGlB,YAAMC,IAAYF,EAAkB,SAAS,IAAIlB,EAAoB,UAAUA,EAAoB;AAGnG,UAAIkB,EAAkB,SAAS,GAAG;AAChC,cAAMG,IAAaH,EAAkB,IAAA;AACrC,QAAAC,IAAc,YAAYL,CAAc,IAAIM,CAAS,IAAIF,EAAkB,KAAK,IAAI,CAAC,IAAIlB,EAAoB,GAAG,IAAIqB,CAAU;AAAA,MAChI;AACE,QAAAF,IAAc,YAAYL,CAAc,IAAIM,CAAS,IAAIF,EAAkB,CAAC,CAAC;AAI/E,aAAO,GAAGF,CAAG,GAAGZ,IAAQ,IAAI,OAAO,EAAE,GAAGe,CAAW;AAAA,IACrD,GAAG,EAAE,EAEQ,SAAS;AAAA,EACxB,GAEMG,IAAiB,CAACC,MAClBhB,IACMR,EAAqB,SAASwB,CAAW,IAE1C,EAAAxB,EAAQ,KAAK,CAACY,MAAYA,EAAkB,WAAWY,CAAW;AAI7E,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,oBAAuB,OAAOzB,IAAsBS,EAAUT,CAAmB,IAAI,IACzG,UAAAE,EAAe,IAAI,CAACqB,MAEjB,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWE;AAAA,QACTD,EAAO;AAAA,QACPH,EAAeC,CAAW,IAAIE,EAAO,uBAAuB,IAAI;AAAA,MAAA;AAAA,MAElE,oBAAgB;AAAA,IAAA;AAAA,IACX,GAAGpB,CAAQ,IAAIkB,CAAW;AAAA,EAAA,CAGpC,EAAA,CACH;AAEJ;"}
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\ninterface TooltipTranslations {\n period: string;\n periods: string;\n and: string;\n}\n\nexport interface PeriodsProps {\n /** Indicates which periods are selected. */\n periods: Period[] | number[];\n /** Indicates the maximum number of periods to show in the selector. */\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n maxPeriods?: 3 | 6 | 7;\n /** A object of translations for the tooltip. */\n tooltipTranslations?: TooltipTranslations;\n}\n\nconst MAX_PERIODS = 6;\n\n/** Represents a component for a period indicator. */\nexport const Periods = ({ periods, tooltipTranslations, 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 = (tooltipTranslations: TooltipTranslations): string => {\n const semesterPeriods: Record<number, number[]> = {};\n\n // Group periods by semester\n isArrayOfNumbers\n ? periods.forEach((period) => {\n if (typeof period === 'number') {\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const groupKey = Math.ceil(period / 3); // Determine the semester (1, 2, or 3)\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n const mappedValue = ((period - 1) % 3) + 1; // Map period to semester\n\n if (!semesterPeriods[groupKey]) {\n semesterPeriods[groupKey] = [];\n }\n semesterPeriods[groupKey].push(mappedValue);\n }\n })\n : periods.forEach((period) => {\n const { semesterNumber, periodInSemester } = period as Period;\n\n if (!semesterPeriods[semesterNumber]) {\n semesterPeriods[semesterNumber] = [];\n }\n semesterPeriods[semesterNumber].push(periodInSemester);\n });\n\n // Build the title string\n const title = Object.keys(semesterPeriods).reduce((acc, semesterKey, index) => {\n const semesterNumber = Number(semesterKey);\n const periodsInSemester = semesterPeriods[semesterNumber];\n let periodTitle = '';\n\n // Determine if we need singular or plural form for \"period\"\n const blokLabel = periodsInSemester.length > 1 ? tooltipTranslations.periods : tooltipTranslations.period;\n\n // Build period sequence for the current semester\n if (periodsInSemester.length > 1) {\n const lastPeriod = periodsInSemester.pop();\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester.join(', ')} ${tooltipTranslations.and} ${lastPeriod}`;\n } else {\n periodTitle = `Semester ${semesterNumber} ${blokLabel} ${periodsInSemester[0]}`;\n }\n\n // Add proper spacing and periods\n return `${acc}${index > 0 ? '. ' : ''}${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 className={styles['periods__container']} title={tooltipTranslations ? getTitles(tooltipTranslations) : ''}>\n {maxPeriodsList.map((periodIndex) => {\n return (\n <span\n className={clsx(\n styles['periods__item'],\n isPeriodActive(periodIndex) ? styles['periods__item--active'] : ''\n )}\n data-period-item\n key={`${idPrefix}-${periodIndex}`}\n />\n );\n })}\n </div>\n );\n};\n"],"names":["MAX_PERIODS","Periods","periods","tooltipTranslations","maxPeriods","maxPeriodsList","_","index","idPrefix","useId","isArrayOfNumbers","value","getTitles","semesterPeriods","period","groupKey","mappedValue","semesterNumber","periodInSemester","acc","semesterKey","periodsInSemester","periodTitle","blokLabel","lastPeriod","isPeriodActive","periodIndex","jsx","styles","clsx"],"mappings":";;;;;;;GA4BMA,IAAc,GAGPC,IAAU,CAAC,EAAE,SAAAC,GAAS,qBAAAC,GAAqB,YAAAC,IAAaJ,QAAgC;AACnG,QAAMK,IAAiB,MAAM,KAAK,EAAE,QAAQD,EAAA,GAAc,CAACE,GAAGC,MAAUA,IAAQ,CAAC,GAC3EC,IAAWC,EAAA,GAEXC,IAAmBR,EAAQ,KAAK,CAACS,MAC9B,OAAOA,KAAU,QACzB,GAEKC,IAAY,CAACT,MAAqD;AACtE,UAAMU,IAA4C,CAAA;AAGlD,WAAAH,IACIR,EAAQ,QAAQ,CAACY,MAAW;AAC1B,UAAI,OAAOA,KAAW,UAAU;AAE9B,cAAMC,IAAW,KAAK,KAAKD,IAAS,CAAC,GAE/BE,KAAgBF,IAAS,KAAK,IAAK;AAEzC,QAAKD,EAAgBE,CAAQ,MAC3BF,EAAgBE,CAAQ,IAAI,CAAA,IAE9BF,EAAgBE,CAAQ,EAAE,KAAKC,CAAW;AAAA,MAC5C;AAAA,IACF,CAAC,IACDd,EAAQ,QAAQ,CAACY,MAAW;AAC1B,Y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,CAAW;AAAA,EAAA,CAGpC,EAAA,CACH;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.55.0",
5
+ "version": "3.55.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",