@helsenorge/designsystem-react 14.6.0 → 14.7.0
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/lib/CHANGELOG.md +10 -0
- package/lib/Drawer.js +37 -14
- package/lib/Drawer.js.map +1 -1
- package/lib/Select.js +3 -2
- package/lib/Select.js.map +1 -1
- package/lib/Title.js +2 -1
- package/lib/Title.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +6 -0
- package/lib/components/Drawer/styles.module.scss +19 -0
- package/lib/components/Drawer/styles.module.scss.d.ts +1 -0
- package/lib/components/Filter/DrawerNavigation/DrawerNavigation.d.ts +35 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.example.d.ts +2 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss +15 -0
- package/lib/components/Filter/DrawerNavigation/FinnFastlegeFlyt.module.scss.d.ts +11 -0
- package/lib/components/Filter/DrawerNavigation/index.d.ts +4 -0
- package/lib/components/Filter/DrawerNavigation/index.js +81 -0
- package/lib/components/Filter/DrawerNavigation/index.js.map +1 -0
- package/lib/components/Filter/DrawerNavigation/useDrawerNavigation.d.ts +7 -0
- package/lib/components/Filter/FilterButton/FilterButton.d.ts +7 -0
- package/lib/components/Filter/FilterButton/styles.module.scss +52 -0
- package/lib/components/Filter/FilterButton/styles.module.scss.d.ts +12 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/FilterButtonAndChipsWrapper.d.ts +11 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss +8 -0
- package/lib/components/Filter/FilterButtonAndChipsWrapper/styles.module.scss.d.ts +9 -0
- package/lib/components/Filter/FilterDrawer/FilterDrawer.d.ts +42 -0
- package/lib/components/Filter/FilterDrawer/styles.module.scss +29 -0
- package/lib/components/Filter/FilterDrawer/styles.module.scss.d.ts +10 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.d.ts +35 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss +89 -0
- package/lib/components/Filter/FilterLinkList/FilterLinkList.module.scss.d.ts +14 -0
- package/lib/components/Filter/FilterOverviewLinkList/FilterOverviewLinkList.d.ts +19 -0
- package/lib/components/Filter/FilterOverviewSearch/FilterOverviewSearch.d.ts +9 -0
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss +14 -0
- package/lib/components/Filter/FilterOverviewSearch/styles.module.scss.d.ts +9 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/FilterResultCountAndSortWrapper.d.ts +8 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss +17 -0
- package/lib/components/Filter/FilterResultCountAndSortWrapper/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/FilterSearch/FilterSearch.d.ts +19 -0
- package/lib/components/Filter/FilterSearch/styles.module.scss +181 -0
- package/lib/components/Filter/FilterSearch/styles.module.scss.d.ts +16 -0
- package/lib/components/Filter/FilterSort/FilterSort.d.ts +8 -0
- package/lib/components/Filter/FilterSort/styles.module.scss +29 -0
- package/lib/components/Filter/FilterSort/styles.module.scss.d.ts +11 -0
- package/lib/components/Filter/getFilterChips/getFilterChips.d.ts +17 -0
- package/lib/components/Filter/index.d.ts +2 -0
- package/lib/components/Filter/index.js +109 -0
- package/lib/components/Filter/index.js.map +1 -0
- package/lib/components/Filter/resourceHelper.d.ts +3 -0
- package/lib/components/Filter/resourcesMock.d.ts +41 -0
- package/lib/components/Filter/useFilter.d.ts +20 -0
- package/lib/components/Filter/useFilterDrawer.d.ts +11 -0
- package/lib/components/Filter/utils.d.ts +81 -0
- package/lib/components/Label/utils.d.ts +1 -0
- package/lib/components/Select/Select.d.ts +2 -0
- package/lib/components/Select/styles.module.scss +1 -0
- package/lib/components/Title/Title.d.ts +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/resource.js +4 -0
- package/lib/resource.js.map +1 -0
- package/lib/resources/HN.Designsystem.Drawer.nn-NO.json.d.ts +7 -0
- package/lib/utils/resource.d.ts +6 -0
- package/lib/utils/resource.js +2 -0
- package/lib/utils2.js +4 -2
- package/lib/utils2.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
const useFilter = (options) => {
|
|
3
|
+
const [filters, setFiltersState] = useState(() => ({ ...options?.defaultValues }));
|
|
4
|
+
const removeFilter = (filterKey, optionValue) => {
|
|
5
|
+
setFiltersState((prev) => {
|
|
6
|
+
const current = prev[filterKey];
|
|
7
|
+
if (current === void 0) return prev;
|
|
8
|
+
if (optionValue !== void 0 && Array.isArray(current)) {
|
|
9
|
+
const updated = current.filter((v) => v !== optionValue);
|
|
10
|
+
if (updated.length === 0) {
|
|
11
|
+
const { [filterKey]: _removed$1, ...rest$1 } = prev;
|
|
12
|
+
return rest$1;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
...prev,
|
|
16
|
+
[filterKey]: updated
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const { [filterKey]: _removed, ...rest } = prev;
|
|
20
|
+
return rest;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const setFilter = (name, value) => {
|
|
24
|
+
if (value === void 0) {
|
|
25
|
+
removeFilter(name);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
setFiltersState((prev) => ({
|
|
29
|
+
...prev,
|
|
30
|
+
[name]: value
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
const setFilters = (newFilters) => {
|
|
34
|
+
setFiltersState(newFilters);
|
|
35
|
+
};
|
|
36
|
+
const resetFilters = () => {
|
|
37
|
+
setFiltersState({ ...options?.defaultValues });
|
|
38
|
+
};
|
|
39
|
+
const resetFiltersToEmpty = () => {
|
|
40
|
+
setFiltersState({});
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
filters,
|
|
44
|
+
setFilter,
|
|
45
|
+
setFilters,
|
|
46
|
+
removeFilter,
|
|
47
|
+
resetFilters,
|
|
48
|
+
resetFiltersToEmpty
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const createFilterConfig = (categories) => {
|
|
52
|
+
const defaultValues = {};
|
|
53
|
+
const labelMaps = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const key in categories) {
|
|
55
|
+
const category = categories[key];
|
|
56
|
+
if (category?.defaultValue !== void 0) defaultValues[key] = category.defaultValue;
|
|
57
|
+
if (category?.options) {
|
|
58
|
+
const resolve = category.getLabel ?? ((o) => String(o.value));
|
|
59
|
+
const map = /* @__PURE__ */ new Map();
|
|
60
|
+
for (const opt of category.options) map.set(opt.value, resolve(opt));
|
|
61
|
+
labelMaps.set(key, map);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const getLabel = (key, value) => {
|
|
65
|
+
return labelMaps.get(key)?.get(value) ?? String(value);
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
filterOptions: { defaultValues },
|
|
69
|
+
getLabel
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const matchFilter = {
|
|
73
|
+
arrayIncludes: (accessor) => (item, value) => {
|
|
74
|
+
const filterValues = Array.isArray(value) ? value : [value];
|
|
75
|
+
const itemValue = accessor(item);
|
|
76
|
+
if (Array.isArray(itemValue)) return itemValue.some((v) => filterValues.includes(v));
|
|
77
|
+
return filterValues.includes(itemValue);
|
|
78
|
+
},
|
|
79
|
+
exactMatch: (accessor) => (item, value) => {
|
|
80
|
+
if (Array.isArray(value)) return value.includes(accessor(item));
|
|
81
|
+
return accessor(item) === value;
|
|
82
|
+
},
|
|
83
|
+
booleanToggle: (accessor) => (item, value) => {
|
|
84
|
+
return !(Array.isArray(value) ? value.includes(true) : value === true) || accessor(item);
|
|
85
|
+
},
|
|
86
|
+
textSearch: (...accessors) => (item, value) => {
|
|
87
|
+
const search = String(value).toLowerCase();
|
|
88
|
+
return accessors.some((accessor) => accessor(item)?.toLowerCase().includes(search));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const filterItems = (items, filters, matchers) => {
|
|
92
|
+
return items.filter((item) => {
|
|
93
|
+
for (const key in matchers) {
|
|
94
|
+
const value = filters[key];
|
|
95
|
+
if (value === void 0) continue;
|
|
96
|
+
const matcher = matchers[key];
|
|
97
|
+
if (matcher && !matcher(item, value)) return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const toggleArrayFilter = (filter, filterKey, value) => {
|
|
103
|
+
const current = filter.filters[filterKey] ?? [];
|
|
104
|
+
const updated = current.includes(value) ? current.filter((v) => v !== value) : [...current, value];
|
|
105
|
+
filter.setFilter(filterKey, updated.length > 0 ? updated : void 0);
|
|
106
|
+
};
|
|
107
|
+
export { createFilterConfig, filterItems, matchFilter, toggleArrayFilter, useFilter };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Filter/useFilter.ts","../../../src/components/Filter/utils.ts"],"sourcesContent":["import { useState } from 'react';\n\n// Key er string men value kan være hva som helst og er ukjent for oss internt i useFilter. Den er typesikker for consumer.\n// Dette mønsteret lar oss ha ulike typer i samme objekt.\nexport type FilterValues = Record<string, unknown>;\n\nexport interface UseFilterOptions<T extends FilterValues> {\n /** Initial filter values */\n defaultValues?: Partial<T>;\n}\n\nexport interface UseFilterReturn<T extends FilterValues> {\n /** Current filter state */\n filters: Partial<T>;\n /** Update a single filter. Pass undefined to remove it. */\n setFilter: <K extends keyof T>(name: K, value: T[K] | undefined) => void;\n /** Replace all filters at once (useful for applying draft/delayed filters) */\n setFilters: (filters: Partial<T>) => void;\n /** Remove a filter entirely, or a specific value from an array filter */\n removeFilter: (filterKey: keyof T | string, optionValue?: unknown) => void;\n /** Reset filters to default values */\n resetFilters: () => void;\n /** Resets to empty filter */\n resetFiltersToEmpty: () => void;\n}\n\nexport const useFilter = <T extends FilterValues>(options?: UseFilterOptions<T>): UseFilterReturn<T> => {\n const [filters, setFiltersState] = useState<Partial<T>>(() => ({ ...options?.defaultValues }) as Partial<T>);\n\n // Fjern et filter helt, eller fjern en spesifikk verdi fra et array-filter.\n const removeFilter = (filterKey: keyof T, optionValue?: unknown): void => {\n setFiltersState(prev => {\n const current = prev[filterKey];\n if (current === undefined) return prev;\n if (optionValue !== undefined && Array.isArray(current)) {\n const updated = current.filter(v => v !== optionValue);\n if (updated.length === 0) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [filterKey as string]: _removed, ...rest } = prev;\n return rest as Partial<T>;\n }\n return { ...prev, [filterKey]: updated };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [filterKey as string]: _removed, ...rest } = prev;\n return rest as Partial<T>;\n });\n };\n\n // Sett en filtervalue. Send inn undefined for å fjerne filteret.\n const setFilter = <K extends keyof T>(name: K, value: T[K] | undefined): void => {\n if (value === undefined) {\n removeFilter(name);\n return;\n }\n setFiltersState(prev => ({ ...prev, [name]: value }));\n };\n\n // Erstatt alle filtre på en gang (f.eks. ved \"Bruk filter\" i delayed filtrering).\n const setFilters = (newFilters: Partial<T>): void => {\n setFiltersState(newFilters);\n };\n\n const resetFilters = (): void => {\n setFiltersState({ ...options?.defaultValues } as Partial<T>);\n };\n\n const resetFiltersToEmpty = (): void => {\n setFiltersState({});\n };\n\n return { filters, setFilter, setFilters, removeFilter, resetFilters, resetFiltersToEmpty };\n};\n","import type { FilterValues, UseFilterOptions, UseFilterReturn } from './useFilter';\n\n/** Et filtervalg med verdi og visningstekst */\nexport interface FilterOption<V = string> {\n value: V;\n label: string;\n}\n\n// Hvis V er et array (f.eks. string[]), hent ut typen inni arrayet (string).\n// Hvis V ikke er et array (f.eks. boolean), bruk V som den er.\n// Brukes for å sikre at options-listen matcher elementene, ikke hele arrayet.\n// Eksempel: FilterCategoryConfig<string[]> → options er FilterOption<string>[], ikke FilterOption<string[]>[]\ntype OptionValue<V> = V extends (infer U)[] ? U : V;\n\n/** Konfigurasjon for en filterkategori. */\nexport interface FilterCategoryConfig<V = unknown> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options?: ({ value: OptionValue<V> } & { [key: string]: any })[];\n defaultValue?: V;\n /** Hent visningstekst fra et option-objekt. Hvis ikke satt, brukes String(value). */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getLabel?: (option: any) => string;\n}\n\nexport interface FilterConfigResult<T extends FilterValues> {\n /** Options for useFilter (defaultValues) */\n filterOptions: UseFilterOptions<T>;\n /** Look up the display label for a filter value */\n getLabel: (key: keyof T, value: unknown) => string;\n}\n\n/**\n * Lager UseFilterOptions fra et oppsett av filterkategorier.\n * Samler defaultValues og label-oppslag automatisk fra config.\n *\n * Eksempel:\n * const { filterOptions, getLabel } = createFilterConfig<MyFilters>({\n * sykehus: { options: sykehusOptions, defaultValue: ['haukeland'], getLabel: o => o.label },\n * status: { options: statusOptions, getLabel: o => o.displayText },\n * });\n * const filter = useFilter(filterOptions);\n * getLabel('sykehus', 'haukeland') // → 'Haukeland universitetssjukehus'\n */\nexport const createFilterConfig = <T extends FilterValues>(categories: {\n [K in keyof T]?: FilterCategoryConfig<T[K]>;\n}): FilterConfigResult<T> => {\n const defaultValues = {} as Partial<T>;\n const labelMaps = new Map<string, Map<unknown, string>>();\n\n for (const key in categories) {\n const category = categories[key];\n if (category?.defaultValue !== undefined) {\n defaultValues[key] = category.defaultValue as T[typeof key];\n }\n if (category?.options) {\n const resolve = category.getLabel ?? ((o: { value: unknown }): string => String(o.value));\n const map = new Map<unknown, string>();\n for (const opt of category.options) {\n map.set(opt.value, resolve(opt));\n }\n labelMaps.set(key, map);\n }\n }\n\n const getLabel = (key: keyof T, value: unknown): string => {\n return labelMaps.get(key as string)?.get(value) ?? String(value); // todo: fallback til .displaytext om det ikke er sendt inn noe, og String(value) om .label ikke finnes\n };\n\n return { filterOptions: { defaultValues }, getLabel };\n};\n\n/**\n * Ferdige matcher-funksjoner for typiske filter mønster.\n * Brukes som deler i matcher objektet til filterItems.\n *\n * Eksempel:\n * const filterMatchers = {\n * categories: matchFilter.arrayIncludes<Medisin>(m => m.sykehus),\n * status: matchFilter.exactMatch<Medisin>(m => m.status),\n * eResept: matchFilter.booleanToggle<Medisin>(m => m.eResept),\n * };\n */\nexport const matchFilter = {\n /** Array-filter: matcher hvis det er overlapp mellom filterverdier og item-verdier (OR-logikk). */\n arrayIncludes:\n <TItem>(accessor: (item: TItem) => unknown) =>\n (item: TItem, value: unknown): boolean => {\n const filterValues = Array.isArray(value) ? value : [value];\n const itemValue = accessor(item);\n if (Array.isArray(itemValue)) {\n return itemValue.some(v => filterValues.includes(v));\n }\n return filterValues.includes(itemValue);\n },\n\n /** Eksakt match: matcher hvis item-verdien er lik én av filterverdiene */\n exactMatch:\n <TItem>(accessor: (item: TItem) => unknown) =>\n (item: TItem, value: unknown): boolean => {\n if (Array.isArray(value)) {\n return value.includes(accessor(item));\n }\n return accessor(item) === value;\n },\n\n /** Boolean toggle: når filterverdien er true, inkluder kun items der accessor returnerer true */\n booleanToggle:\n <TItem>(accessor: (item: TItem) => boolean) =>\n (item: TItem, value: unknown): boolean => {\n const active = Array.isArray(value) ? value.includes(true) : value === true;\n return !active || accessor(item);\n },\n\n /** Fritekstsøk: matcher hvis søketeksten finnes i ett eller flere felt (case-insensitive) */\n textSearch:\n <TItem>(...accessors: ((item: TItem) => string | undefined)[]) =>\n (item: TItem, value: unknown): boolean => {\n const search = String(value).toLowerCase();\n return accessors.some(accessor => accessor(item)?.toLowerCase().includes(search));\n },\n};\n\n/**\n * Filtrerer en liste med items basert på aktive filterverdier.\n * Hvert filter som er satt må matche for at et item skal inkluderes (AND-logikk).\n *\n * Eksempel:\n * const filtered = filterItems(medisiner, filter.filters, {\n * sykehus: matchFilter.arrayIncludes<Medisin>(m => m.sykehus),\n * reseptstatus: matchFilter.exactMatch<Medisin>(m => m.reseptstatus),\n * eResept: matchFilter.booleanToggle<Medisin>(m => m.eResept),\n * });\n */\n\n/** Type for matcher-objektet som sendes til filterItems. Sikrer at keys matcher filtertypen. */\nexport type FilterMatchers<TItem, T extends FilterValues> = { [K in keyof T]?: (item: TItem, value: NonNullable<T[K]>) => boolean };\n\nexport const filterItems = <TItem, T extends FilterValues>(\n items: TItem[],\n filters: Partial<T>,\n matchers: FilterMatchers<TItem, T>\n): TItem[] => {\n return items.filter(item => {\n for (const key in matchers) {\n const value = filters[key];\n if (value === undefined) {\n continue;\n }\n const matcher = matchers[key];\n if (matcher && !matcher(item, value as NonNullable<T[typeof key]>)) {\n return false;\n }\n }\n return true;\n });\n};\n\n/**\n * Toggler en verdi i et array-basert filter.\n * Legger til verdien hvis den ikke finnes, fjerner den hvis den finnes.\n * Setter filteret til undefined hvis arrayet blir tomt.\n */\nexport const toggleArrayFilter = <T extends FilterValues, K extends keyof T>(\n filter: UseFilterReturn<T>,\n filterKey: K,\n value: T[K] extends (infer U)[] | undefined ? U : never\n): void => {\n const current = (filter.filters[filterKey] ?? []) as unknown[];\n const updated = current.includes(value) ? current.filter(v => v !== value) : [...current, value];\n filter.setFilter(filterKey, (updated.length > 0 ? updated : undefined) as T[K] | undefined);\n};\n"],"mappings":";AA0BA,MAAa,aAAqC,YAAsD;CACtG,MAAM,CAAC,SAAS,mBAAmB,gBAA4B,EAAE,GAAG,SAAS,eAAe,EAAgB;CAG5G,MAAM,gBAAgB,WAAoB,gBAAgC;AACxE,mBAAgB,SAAQ;GACtB,MAAM,UAAU,KAAK;AACrB,OAAI,YAAY,KAAA,EAAW,QAAO;AAClC,OAAI,gBAAgB,KAAA,KAAa,MAAM,QAAQ,QAAQ,EAAE;IACvD,MAAM,UAAU,QAAQ,QAAO,MAAK,MAAM,YAAY;AACtD,QAAI,QAAQ,WAAW,GAAG;KAExB,MAAM,GAAG,YAAsB,YAAU,GAAG,WAAS;AACrD,YAAO;;AAET,WAAO;KAAE,GAAG;MAAO,YAAY;KAAS;;GAG1C,MAAM,GAAG,YAA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SAAO,aAAa,SAAS,UAAU;;CAI3C,aACU,cACP,MAAa,UAA4B;AACxC,MAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,SAAS,SAAS,KAAK,CAAC;AAEvC,SAAO,SAAS,KAAK,KAAK;;CAI9B,gBACU,cACP,MAAa,UAA4B;AAExC,SAAO,EADQ,MAAM,QAAQ,MAAM,GAAG,MAAM,SAAS,KAAK,GAAG,UAAU,SACrD,SAAS,KAAK;;CAIpC,aACU,GAAG,eACV,MAAa,UAA4B;EACxC,MAAM,SAAS,OAAO,MAAM,CAAC,aAAa;AAC1C,SAAO,UAAU,MAAK,aAAY,SAAS,KAAK,EAAE,aAAa,CAAC,SAAS,OAAO,CAAC;;CAEtF;AAiBD,MAAa,eACX,OACA,SACA,aACY;AACZ,QAAO,MAAM,QAAO,SAAQ;AAC1B,OAAK,MAAM,OAAO,UAAU;GAC1B,MAAM,QAAQ,QAAQ;AACtB,OAAI,UAAU,KAAA,EACZ;GAEF,MAAM,UAAU,SAAS;AACzB,OAAI,WAAW,CAAC,QAAQ,MAAM,MAAoC,CAChE,QAAO;;AAGX,SAAO;GACP;;AAQJ,MAAa,qBACX,QACA,WACA,UACS;CACT,MAAM,UAAW,OAAO,QAAQ,cAAc,EAAE;CAChD,MAAM,UAAU,QAAQ,SAAS,MAAM,GAAG,QAAQ,QAAO,MAAK,MAAM,MAAM,GAAG,CAAC,GAAG,SAAS,MAAM;AAChG,QAAO,UAAU,WAAY,QAAQ,SAAS,IAAI,UAAU,KAAA,EAA+B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LanguageLocales } from '../../constants';
|
|
2
|
+
export declare const getResources: (language: LanguageLocales) => {
|
|
3
|
+
verktoydata_aa_name: string;
|
|
4
|
+
verktoydata_aa_ingress: string;
|
|
5
|
+
verktoydata_grubl_name: string;
|
|
6
|
+
verktoydata_grubl_ingress: string;
|
|
7
|
+
verktoydata_mm_name: string;
|
|
8
|
+
verktoydata_mm_ingress: string;
|
|
9
|
+
verktoydata_hverdagshjelpen_name: string;
|
|
10
|
+
verktoydata_hverdagshjelpen_ingress: string;
|
|
11
|
+
verktoydata_ungmestring_name: string;
|
|
12
|
+
verktoydata_ungmestring_ingress: string;
|
|
13
|
+
verktoydata_bevegelsesglede_name: string;
|
|
14
|
+
verktoydata_bevegelsesglede_ingress: string;
|
|
15
|
+
verktoydata_tryggfodsel_name: string;
|
|
16
|
+
verktoydata_tryggfodsel_ingress: string;
|
|
17
|
+
verktoydata_skadekompasset_name: string;
|
|
18
|
+
verktoydata_skadekompasset_ingress: string;
|
|
19
|
+
verktoydata_seniorbalanse_name: string;
|
|
20
|
+
verktoydata_seniorbalanse_ingress: string;
|
|
21
|
+
verktoydata_tankevenn_name: string;
|
|
22
|
+
verktoydata_tankevenn_ingress: string;
|
|
23
|
+
filterOptionTitles_omrade: string;
|
|
24
|
+
filterOptionTitles_passerfor: string;
|
|
25
|
+
filterOptionTitles_type: string;
|
|
26
|
+
omradeOptions_psykiskhelse: string;
|
|
27
|
+
omradeOptions_graviditet: string;
|
|
28
|
+
omradeOptions_livsstil: string;
|
|
29
|
+
omradeOptions_sykdom: string;
|
|
30
|
+
omradeOptions_rad: string;
|
|
31
|
+
omradeOptions_tanker: string;
|
|
32
|
+
passerForOptions_barn: string;
|
|
33
|
+
passerForOptions_ungdom: string;
|
|
34
|
+
passerForOptions_voksne: string;
|
|
35
|
+
passerForOptions_eldre: string;
|
|
36
|
+
typeOptions_app: string;
|
|
37
|
+
typeOptions_web: string;
|
|
38
|
+
filterOption_omrade_legend: string;
|
|
39
|
+
filterOption_passerFor_legend: string;
|
|
40
|
+
filterOption_type_legend: string;
|
|
41
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type FilterValues = Record<string, unknown>;
|
|
2
|
+
export interface UseFilterOptions<T extends FilterValues> {
|
|
3
|
+
/** Initial filter values */
|
|
4
|
+
defaultValues?: Partial<T>;
|
|
5
|
+
}
|
|
6
|
+
export interface UseFilterReturn<T extends FilterValues> {
|
|
7
|
+
/** Current filter state */
|
|
8
|
+
filters: Partial<T>;
|
|
9
|
+
/** Update a single filter. Pass undefined to remove it. */
|
|
10
|
+
setFilter: <K extends keyof T>(name: K, value: T[K] | undefined) => void;
|
|
11
|
+
/** Replace all filters at once (useful for applying draft/delayed filters) */
|
|
12
|
+
setFilters: (filters: Partial<T>) => void;
|
|
13
|
+
/** Remove a filter entirely, or a specific value from an array filter */
|
|
14
|
+
removeFilter: (filterKey: keyof T | string, optionValue?: unknown) => void;
|
|
15
|
+
/** Reset filters to default values */
|
|
16
|
+
resetFilters: () => void;
|
|
17
|
+
/** Resets to empty filter */
|
|
18
|
+
resetFiltersToEmpty: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const useFilter: <T extends FilterValues>(options?: UseFilterOptions<T>) => UseFilterReturn<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UseFilterDrawerReturn<ViewId extends string = string> {
|
|
2
|
+
/** Whether the drawer is currently open */
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** The view to navigate to when the drawer opens */
|
|
5
|
+
initialView: ViewId | undefined;
|
|
6
|
+
/** Open the drawer, optionally navigating directly to a specific view */
|
|
7
|
+
open: (view?: ViewId) => void;
|
|
8
|
+
/** Close the drawer */
|
|
9
|
+
close: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useFilterDrawer: <ViewId extends string = string>() => UseFilterDrawerReturn<ViewId>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FilterValues, UseFilterOptions, UseFilterReturn } from './useFilter';
|
|
2
|
+
/** Et filtervalg med verdi og visningstekst */
|
|
3
|
+
export interface FilterOption<V = string> {
|
|
4
|
+
value: V;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
type OptionValue<V> = V extends (infer U)[] ? U : V;
|
|
8
|
+
/** Konfigurasjon for en filterkategori. */
|
|
9
|
+
export interface FilterCategoryConfig<V = unknown> {
|
|
10
|
+
options?: ({
|
|
11
|
+
value: OptionValue<V>;
|
|
12
|
+
} & {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
})[];
|
|
15
|
+
defaultValue?: V;
|
|
16
|
+
/** Hent visningstekst fra et option-objekt. Hvis ikke satt, brukes String(value). */
|
|
17
|
+
getLabel?: (option: any) => string;
|
|
18
|
+
}
|
|
19
|
+
export interface FilterConfigResult<T extends FilterValues> {
|
|
20
|
+
/** Options for useFilter (defaultValues) */
|
|
21
|
+
filterOptions: UseFilterOptions<T>;
|
|
22
|
+
/** Look up the display label for a filter value */
|
|
23
|
+
getLabel: (key: keyof T, value: unknown) => string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Lager UseFilterOptions fra et oppsett av filterkategorier.
|
|
27
|
+
* Samler defaultValues og label-oppslag automatisk fra config.
|
|
28
|
+
*
|
|
29
|
+
* Eksempel:
|
|
30
|
+
* const { filterOptions, getLabel } = createFilterConfig<MyFilters>({
|
|
31
|
+
* sykehus: { options: sykehusOptions, defaultValue: ['haukeland'], getLabel: o => o.label },
|
|
32
|
+
* status: { options: statusOptions, getLabel: o => o.displayText },
|
|
33
|
+
* });
|
|
34
|
+
* const filter = useFilter(filterOptions);
|
|
35
|
+
* getLabel('sykehus', 'haukeland') // → 'Haukeland universitetssjukehus'
|
|
36
|
+
*/
|
|
37
|
+
export declare const createFilterConfig: <T extends FilterValues>(categories: { [K in keyof T]?: FilterCategoryConfig<T[K]>; }) => FilterConfigResult<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Ferdige matcher-funksjoner for typiske filter mønster.
|
|
40
|
+
* Brukes som deler i matcher objektet til filterItems.
|
|
41
|
+
*
|
|
42
|
+
* Eksempel:
|
|
43
|
+
* const filterMatchers = {
|
|
44
|
+
* categories: matchFilter.arrayIncludes<Medisin>(m => m.sykehus),
|
|
45
|
+
* status: matchFilter.exactMatch<Medisin>(m => m.status),
|
|
46
|
+
* eResept: matchFilter.booleanToggle<Medisin>(m => m.eResept),
|
|
47
|
+
* };
|
|
48
|
+
*/
|
|
49
|
+
export declare const matchFilter: {
|
|
50
|
+
/** Array-filter: matcher hvis det er overlapp mellom filterverdier og item-verdier (OR-logikk). */
|
|
51
|
+
arrayIncludes: <TItem>(accessor: (item: TItem) => unknown) => (item: TItem, value: unknown) => boolean;
|
|
52
|
+
/** Eksakt match: matcher hvis item-verdien er lik én av filterverdiene */
|
|
53
|
+
exactMatch: <TItem>(accessor: (item: TItem) => unknown) => (item: TItem, value: unknown) => boolean;
|
|
54
|
+
/** Boolean toggle: når filterverdien er true, inkluder kun items der accessor returnerer true */
|
|
55
|
+
booleanToggle: <TItem>(accessor: (item: TItem) => boolean) => (item: TItem, value: unknown) => boolean;
|
|
56
|
+
/** Fritekstsøk: matcher hvis søketeksten finnes i ett eller flere felt (case-insensitive) */
|
|
57
|
+
textSearch: <TItem>(...accessors: ((item: TItem) => string | undefined)[]) => (item: TItem, value: unknown) => boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Filtrerer en liste med items basert på aktive filterverdier.
|
|
61
|
+
* Hvert filter som er satt må matche for at et item skal inkluderes (AND-logikk).
|
|
62
|
+
*
|
|
63
|
+
* Eksempel:
|
|
64
|
+
* const filtered = filterItems(medisiner, filter.filters, {
|
|
65
|
+
* sykehus: matchFilter.arrayIncludes<Medisin>(m => m.sykehus),
|
|
66
|
+
* reseptstatus: matchFilter.exactMatch<Medisin>(m => m.reseptstatus),
|
|
67
|
+
* eResept: matchFilter.booleanToggle<Medisin>(m => m.eResept),
|
|
68
|
+
* });
|
|
69
|
+
*/
|
|
70
|
+
/** Type for matcher-objektet som sendes til filterItems. Sikrer at keys matcher filtertypen. */
|
|
71
|
+
export type FilterMatchers<TItem, T extends FilterValues> = {
|
|
72
|
+
[K in keyof T]?: (item: TItem, value: NonNullable<T[K]>) => boolean;
|
|
73
|
+
};
|
|
74
|
+
export declare const filterItems: <TItem, T extends FilterValues>(items: TItem[], filters: Partial<T>, matchers: FilterMatchers<TItem, T>) => TItem[];
|
|
75
|
+
/**
|
|
76
|
+
* Toggler en verdi i et array-basert filter.
|
|
77
|
+
* Legger til verdien hvis den ikke finnes, fjerner den hvis den finnes.
|
|
78
|
+
* Setter filteret til undefined hvis arrayet blir tomt.
|
|
79
|
+
*/
|
|
80
|
+
export declare const toggleArrayFilter: <T extends FilterValues, K extends keyof T>(filter: UseFilterReturn<T>, filterKey: K, value: T[K] extends (infer U)[] | undefined ? U : never) => void;
|
|
81
|
+
export {};
|
|
@@ -10,6 +10,8 @@ export interface SelectProps extends ErrorWrapperClassNameProps, Pick<React.Sele
|
|
|
10
10
|
concept?: SelectConcept;
|
|
11
11
|
/** The label text above the select */
|
|
12
12
|
label?: React.ReactNode;
|
|
13
|
+
/** Adds custom classes to the label wrapper */
|
|
14
|
+
labelClassName?: string;
|
|
13
15
|
/** Changes the visuals of the component */
|
|
14
16
|
onColor?: keyof typeof FormOnColor;
|
|
15
17
|
/** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */
|
|
@@ -12,6 +12,8 @@ export interface TitleProps {
|
|
|
12
12
|
htmlMarkup?: TitleTags;
|
|
13
13
|
/** Changes the appearance of the title. */
|
|
14
14
|
appearance?: TitleAppearances;
|
|
15
|
+
/** Sets the tabIndex. Use this with caution. */
|
|
16
|
+
tabIndex?: number;
|
|
15
17
|
/** Sets the data-testid attribute. */
|
|
16
18
|
testId?: string;
|
|
17
19
|
/** Ref passed to the heading element */
|
package/lib/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export { useOutsideEvent } from './hooks/useOutsideEvent';
|
|
|
15
15
|
export { useLanguage } from './hooks/useLanguage';
|
|
16
16
|
export { isMobileUA } from './utils/mobile';
|
|
17
17
|
export { uuid } from './utils/uuid';
|
|
18
|
+
export { formatResource } from './utils/resource';
|
|
18
19
|
export * from './constants';
|
package/lib/index.js
CHANGED
|
@@ -16,4 +16,5 @@ import { t as useToggle } from "./useToggle.js";
|
|
|
16
16
|
import { t as useKeyboardEvent } from "./useKeyboardEvent.js";
|
|
17
17
|
import { t as useOutsideEvent } from "./useOutsideEvent.js";
|
|
18
18
|
import { t as isMobileUA } from "./mobile.js";
|
|
19
|
-
|
|
19
|
+
import { t as formatResource } from "./resource.js";
|
|
20
|
+
export { AVERAGE_CHARACTER_WIDTH_PX, AnalyticsId, Breakpoint, FormOnColor, FormSize, IconSize, KeyboardEventKey, LanguageLocales, ZIndex, formatResource, isMobileUA, theme, useBreakpoint, useFocusToggle, useFocusTrap, useIntersectionObserver, useIsVisible, useKeyboardEvent, useLanguage, useLayoutEvent, useOutsideEvent, usePrevious, usePseudoClasses, useResizeObserver, useSize, useToggle, uuid };
|
package/lib/resource.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","names":[],"sources":["../src/utils/resource.ts"],"sourcesContent":["/**\n * Replace `{0}`, `{1}` etc. placeholders in a resource string with the supplied values.\n * @example formatResource('Siste {0} måneder', 6) // 'Siste 6 måneder'\n * @example formatResource('{0} av {1}', 'side', 10) // 'side av 10'\n */\nexport const formatResource = (template: string, ...args: (string | number)[]): string =>\n args.reduce<string>((result, arg, index) => result.replace(`{${index}}`, String(arg)), template);\n"],"mappings":"AAKA,MAAa,kBAAkB,UAAkB,GAAG,SAClD,KAAK,QAAgB,QAAQ,KAAK,UAAU,OAAO,QAAQ,IAAI,MAAM,IAAI,OAAO,IAAI,CAAC,EAAE,SAAS"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace `{0}`, `{1}` etc. placeholders in a resource string with the supplied values.
|
|
3
|
+
* @example formatResource('Siste {0} måneder', 6) // 'Siste 6 måneder'
|
|
4
|
+
* @example formatResource('{0} av {1}', 'side', 10) // 'side av 10'
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatResource: (template: string, ...args: (string | number)[]) => string;
|
package/lib/utils2.js
CHANGED
|
@@ -100,14 +100,16 @@ const renderLabel = (props) => {
|
|
|
100
100
|
return /* @__PURE__ */ jsx(Fragment, { children: props.label && isComponent(props.label, Label_default) ? React.cloneElement(props.label, {
|
|
101
101
|
htmlFor: props.inputId,
|
|
102
102
|
htmlMarkup: props.markup || "label",
|
|
103
|
-
onColor: props.onColor
|
|
103
|
+
onColor: props.onColor,
|
|
104
|
+
className: props.className
|
|
104
105
|
}) : typeof props.label === "string" && /* @__PURE__ */ jsx(Label_default, {
|
|
105
106
|
labelTexts: [{
|
|
106
107
|
text: props.label,
|
|
107
108
|
type: "normal"
|
|
108
109
|
}],
|
|
109
110
|
htmlFor: props.inputId,
|
|
110
|
-
onColor: props.onColor
|
|
111
|
+
onColor: props.onColor,
|
|
112
|
+
className: props.className
|
|
111
113
|
}) });
|
|
112
114
|
};
|
|
113
115
|
const renderLabelAsParent = (props) => {
|
package/lib/utils2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils2.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\n}\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n afterLabelChildrenClassName,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div className={mainLabelWrapperClasses}>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n })\n : typeof props.label === 'string' && (\n <Label labelTexts={[{ text: props.label, type: 'normal' }]} htmlFor={props.inputId} onColor={props.onColor} />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\n label: React.ReactNode;\n children: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n labelClassName?: string;\n labelTextClassName?: string;\n sublabelWrapperClassName?: string;\n large?: boolean;\n markup?: LabelTags;\n afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabel: props.large ? undefined : props.label.props.sublabel,\n statusDot: props.large ? undefined : props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;AAwBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,WAAG,OAAO,OAAO,OAAO,aAAa;KACvD,OAAO,uBAAuB,aAAa,SAAS;KACpD,OAAO,uBAAuB,YAAY,YAAY;IACxD,CAAC;AACF,UACE,yBAAyB,aAAa,wBACpC,oBAAC,QAAA;IAAK,WAAW;cACd,aAAa;MADoB,MAE7B;IAGX;;CAIN,MAAM,YAAY,cAAc;CAChC,MAAM,sBAAsB,aAAa,KAAK;AAE9C,QACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS;GACrB,aAAa,aACb,qBAAC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W,MAAM,QAAQ,KAAA,IAAY,MAAM,MAAM,MAAM;EACvD,6BAA6B,MAAM;EACpC,CAAC,GACF,OAAO,MAAM,UAAU,YACrB,oBAAC,eAAA;EACC,YAAY,CAAC;GAAE,MAAM,MAAM;GAAO,MAAM;GAAW,CAAC;EACpD,SAAS,MAAM;EACf,SAAS,MAAM;EACf,YAAY,MAAM,UAAU;EAC5B,gBAAgB,MAAM;EACtB,oBAAoB,MAAM;EAC1B,0BAA0B,MAAM;EAChC,6BAA6B,MAAM;YAElC,MAAM;GACD,EAAA,CAEb"}
|
|
1
|
+
{"version":3,"file":"utils2.js","names":["Sublabel: React.FC<SublabelProps>","Label: FunctionComponent<LabelProps>"],"sources":["../src/components/Label/SubLabel.tsx","../src/components/Label/Label.tsx","../src/components/Label/utils.tsx"],"sourcesContent":["import cn from 'classnames';\n\nimport type { LabelText } from './Label';\n\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport Spacer from '../Spacer';\n\nimport styles from './styles.module.scss';\n\nexport interface SublabelProps {\n /** Sets the content of the Sublabel */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** id that is placed on the wrapper */\n id: string;\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: FormOnColor;\n /** Array of sublabel strings. Can be of type semibold or normal */\n sublabelTexts?: LabelText[];\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nexport const Sublabel: React.FC<SublabelProps> = ({ children, className, id, onColor, sublabelTexts, testId }) => {\n const mapSublabels = (hideFromScreenReader?: boolean): React.ReactNode => {\n return (\n sublabelTexts &&\n sublabelTexts.map((sublabelText, index) => {\n const labelClasses = cn(styles.label, styles['sublabel'], {\n [styles['sublabel--subdued']]: sublabelText.type === 'subdued',\n [styles['sublabel--on-dark']]: onColor === FormOnColor.ondark,\n });\n return (\n hideFromScreenReader === sublabelText.hideFromScreenReader && (\n <span className={labelClasses} key={index}>\n {sublabelText.text}\n </span>\n )\n );\n })\n );\n };\n\n const subLabels = mapSublabels();\n const ariaHiddenSublabels = mapSublabels(true);\n\n return (\n <>\n <Spacer size={'3xs'} />\n {(subLabels || children) && (\n <div className={className} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Sublabel}>\n {subLabels}\n {children}\n </div>\n )}\n {ariaHiddenSublabels && (\n <div className={className} data-testid={testId}>\n {ariaHiddenSublabels}\n </div>\n )}\n </>\n );\n};\n","import type { FunctionComponent } from 'react';\nimport React from 'react';\n\nimport cn from 'classnames';\n\nimport type { SublabelProps } from './SubLabel';\nimport type { FormFieldTagProps } from '../FormFieldTag';\nimport type { StatusDotProps } from '../StatusDot';\n\nimport { Sublabel } from './SubLabel';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { isComponent } from '../../utils/component';\nimport FormFieldTag from '../FormFieldTag';\nimport Spacer from '../Spacer';\nimport StatusDot from '../StatusDot';\n\nimport styles from './styles.module.scss';\n\nexport type LabelText = {\n hideFromScreenReader?: boolean;\n text: string;\n type?: 'normal' | 'subdued';\n};\n\nexport type LabelTags = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'label' | 'p' | 'legend';\n\nexport interface LabelProps {\n /** Component shown after label - discourage use of this */\n afterLabelChildren?: React.ReactNode;\n /** Sets the content of the Label */\n children?: React.ReactNode;\n /** Sets a tag that describes whether the form field is required or optional */\n formFieldTag?: React.ReactNode;\n /** Adds custom classes to the label tag. */\n labelClassName?: string;\n /** Adds custom classes to the label text. */\n labelTextClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Id that is put on the \"for\" attribute of the label */\n htmlFor?: string;\n /** Changes the underlying element of the label */\n htmlMarkup?: LabelTags;\n /** Id som plasseres på <label/> */\n labelId?: string;\n /** Array of main label strings. Can be of type semibold or normal */\n labelTexts?: LabelText[];\n /** Array of sublabel strings. Can be of type semibold or normal */\n onColor?: keyof typeof FormOnColor;\n /** StatusDot placed underneath the last sublabel */\n statusDot?: React.ReactNode;\n /** Sublabel component */\n sublabel?: React.ReactNode;\n /** Adds custom classes to the div wrapping the sublabels. */\n sublabelWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Gives a custom classname to the afterLabelChildren wrapper. Used in checkbox and radiobutton */\n afterLabelChildrenClassName?: string;\n}\n\nconst Label: FunctionComponent<LabelProps> = ({\n afterLabelChildren,\n children,\n className,\n formFieldTag,\n htmlFor,\n htmlMarkup = 'label',\n labelClassName,\n labelTextClassName,\n labelId,\n labelTexts,\n onColor = FormOnColor.onwhite,\n statusDot,\n sublabel,\n sublabelWrapperClassName,\n testId,\n afterLabelChildrenClassName,\n}) => {\n const hasChildren = children && typeof children !== 'undefined';\n const labelWrapperClasses = cn(styles['label-wrapper'], { [styles['label-wrapper--no-bottom-margin']]: hasChildren }, className);\n const mainLabelWrapperClasses = cn({\n [styles['label-wrapper--after-label-children']]: afterLabelChildren,\n });\n const afterLabelChildrenClasses = cn(styles['after-label-children'], afterLabelChildrenClassName);\n\n const mapLabels = (): React.ReactNode => {\n if (typeof labelTexts === 'undefined') return null;\n\n return labelTexts.map((labelText, index) => {\n const labelClasses = cn(\n styles.label,\n {\n [styles['label--subdued']]: labelText.type === 'subdued',\n [styles['label--on-dark']]: onColor === FormOnColor.ondark,\n },\n labelTextClassName\n );\n return (\n <span aria-hidden={labelText.hideFromScreenReader} className={labelClasses} key={index}>\n {labelText.text}\n </span>\n );\n });\n };\n const CustomTag = htmlMarkup;\n\n return (\n <div className={labelWrapperClasses}>\n <div className={mainLabelWrapperClasses}>\n <CustomTag className={labelClassName} id={labelId} htmlFor={htmlFor} data-testid={testId} data-analyticsid={AnalyticsId.Label}>\n <span className={styles['label-content-wrapper']}>\n {children}\n <span className={styles.label__texts}>{mapLabels()}</span>\n </span>\n </CustomTag>\n {afterLabelChildren && <div className={afterLabelChildrenClasses}>{afterLabelChildren}</div>}\n </div>\n {(sublabel || statusDot || formFieldTag) && (\n <div className={sublabelWrapperClassName}>\n {formFieldTag && isComponent<FormFieldTagProps>(formFieldTag, FormFieldTag) && React.cloneElement(formFieldTag)}\n {sublabel &&\n isComponent<SublabelProps>(sublabel, Sublabel) &&\n React.cloneElement(sublabel, {\n onColor: onColor as FormOnColor,\n })}\n {statusDot && isComponent<StatusDotProps>(statusDot, StatusDot) && (\n <>\n <Spacer size={'3xs'} />\n {React.cloneElement(statusDot, {\n onColor: onColor === FormOnColor.ondark ? 'ondark' : 'onwhite',\n })}\n </>\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport default Label;\n","import React from 'react';\n\nimport cn from 'classnames';\n\nimport type { LabelProps, LabelTags } from './Label';\nimport type { FormOnColor } from '../../constants';\n\nimport Label from './Label';\nimport { isComponent } from '../../utils/component';\n\nexport const getLabelText = (label: React.ReactNode): string => {\n let allLabelText = '';\n\n if (isComponent<LabelProps>(label, Label)) {\n label.props.labelTexts?.forEach(labelText => {\n allLabelText += !labelText.hideFromScreenReader ? labelText.text : '';\n });\n }\n\n return allLabelText;\n};\n\ninterface RenderLabelProps {\n label: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n markup?: LabelTags;\n className?: string;\n}\n\nexport const renderLabel = (props: RenderLabelProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n htmlMarkup: props.markup || 'label',\n onColor: props.onColor,\n className: props.className,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'normal' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n className={props.className}\n />\n )}\n </>\n );\n};\n\ninterface RenderLabelAsParentProps {\n label: React.ReactNode;\n children: React.ReactNode;\n inputId: string;\n onColor: FormOnColor;\n labelClassName?: string;\n labelTextClassName?: string;\n sublabelWrapperClassName?: string;\n large?: boolean;\n markup?: LabelTags;\n afterLabelChildrenClassName?: string;\n}\n\nexport const renderLabelAsParent = (props: RenderLabelAsParentProps): React.ReactNode => {\n return (\n <>\n {props.label && isComponent<LabelProps>(props.label, Label)\n ? React.cloneElement(props.label, {\n htmlFor: props.inputId,\n onColor: props.onColor,\n children: props.children,\n labelClassName: cn(props.labelClassName, props.label.props.labelClassName),\n labelTextClassName: props.labelTextClassName,\n htmlMarkup: props.markup || 'label',\n sublabelWrapperClassName: props.sublabelWrapperClassName,\n sublabel: props.large ? undefined : props.label.props.sublabel,\n statusDot: props.large ? undefined : props.label.props.statusDot,\n afterLabelChildrenClassName: props.afterLabelChildrenClassName,\n })\n : typeof props.label === 'string' && (\n <Label\n labelTexts={[{ text: props.label, type: 'subdued' }]}\n htmlFor={props.inputId}\n onColor={props.onColor}\n htmlMarkup={props.markup || 'label'}\n labelClassName={props.labelClassName}\n labelTextClassName={props.labelTextClassName}\n sublabelWrapperClassName={props.sublabelWrapperClassName}\n afterLabelChildrenClassName={props.afterLabelChildrenClassName}\n >\n {props.children}\n </Label>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;AAwBA,MAAaA,YAAqC,EAAE,UAAU,WAAW,IAAI,SAAS,eAAe,aAAa;CAChH,MAAM,gBAAgB,yBAAoD;AACxE,SACE,iBACA,cAAc,KAAK,cAAc,UAAU;GACzC,MAAM,eAAe,WAAG,OAAO,OAAO,OAAO,aAAa;KACvD,OAAO,uBAAuB,aAAa,SAAS;KACpD,OAAO,uBAAuB,YAAY,YAAY;IACxD,CAAC;AACF,UACE,yBAAyB,aAAa,wBACpC,oBAAC,QAAA;IAAK,WAAW;cACd,aAAa;MADoB,MAE7B;IAGX;;CAIN,MAAM,YAAY,cAAc;CAChC,MAAM,sBAAsB,aAAa,KAAK;AAE9C,QACE,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,gBAAA,EAAO,MAAM,OAAA,CAAS;GACrB,aAAa,aACb,qBAAC,OAAA;GAAe;GAAe;GAAI,eAAa;GAAQ,oBAAkB,YAAY;cACnF,WACA,SAAA;IACG;EAEP,uBACC,oBAAC,OAAA;GAAe;GAAW,eAAa;aACrC;IACG;KAEP;;ACAP,IAAMC,SAAwC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