@helsenorge/designsystem-react 11.1.0 → 11.2.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/CHANGELOG.md +1544 -881
- package/Close.js +21 -6
- package/Close.js.map +1 -1
- package/Drawer.js +362 -0
- package/Drawer.js.map +1 -0
- package/InfoTeaser.js +75 -0
- package/InfoTeaser.js.map +1 -0
- package/LazyIcon.js +1 -1
- package/LazyIcon.js.map +1 -1
- package/LazyIllustration.js +1 -1
- package/LazyIllustration.js.map +1 -1
- package/Panel.js +38 -5
- package/Panel.js.map +1 -1
- package/components/ArticleTeaser/ArticleTeaser.d.ts +23 -0
- package/components/ArticleTeaser/ArticleTeaser.test.d.ts +1 -0
- package/components/ArticleTeaser/index.d.ts +3 -0
- package/components/ArticleTeaser/index.js +67 -0
- package/components/ArticleTeaser/index.js.map +1 -0
- package/components/ArticleTeaser/resourceHelper.d.ts +3 -0
- package/components/ArticleTeaser/styles.module.scss +79 -0
- package/components/ArticleTeaser/styles.module.scss.d.ts +13 -0
- package/components/Close/Close.d.ts +1 -1
- package/components/Close/styles.module.scss +46 -20
- package/components/Close/styles.module.scss.d.ts +2 -0
- package/components/Drawer/Drawer.d.ts +4 -0
- package/components/Drawer/index.js +1 -346
- package/components/Drawer/index.js.map +1 -1
- package/components/Drawer/styles.module.scss +4 -0
- package/components/Drawer/styles.module.scss.d.ts +1 -0
- package/components/Dropdown/index.js +1 -3
- package/components/Dropdown/index.js.map +1 -1
- package/components/HelpDrawer/HelpDrawer.d.ts +8 -0
- package/components/HelpDrawer/HelpDrawer.test.d.ts +1 -0
- package/components/HelpDrawer/index.d.ts +3 -0
- package/components/HelpDrawer/index.js +10 -0
- package/components/HelpDrawer/index.js.map +1 -0
- package/components/HelpDrawer/styles.module.scss +16 -0
- package/components/HelpDrawer/styles.module.scss.d.ts +10 -0
- package/components/HelpTeaser/HelpTeaser.d.ts +20 -0
- package/components/HelpTeaser/HelpTeaser.test.d.ts +1 -0
- package/components/HelpTeaser/index.d.ts +3 -0
- package/components/HelpTeaser/index.js +25 -0
- package/components/HelpTeaser/index.js.map +1 -0
- package/components/HelpTeaser/styles.module.scss +22 -0
- package/components/HelpTeaser/styles.module.scss.d.ts +10 -0
- package/components/Icons/AdditionalIconInformation.d.ts +1 -1
- package/components/Icons/AdditionalIconInformation.js +1 -1
- package/components/Icons/AdditionalIconInformation.js.map +1 -1
- package/components/Icons/IconNames.d.ts +1 -1
- package/components/Icons/IconNames.js +1 -0
- package/components/Icons/IconNames.js.map +1 -1
- package/components/Icons/Toddler.d.ts +4 -0
- package/components/Icons/Toddler.js +10 -0
- package/components/Icons/Toddler.js.map +1 -0
- package/components/Illustrations/BabyMobile.d.ts +8 -0
- package/components/Illustrations/BabyMobile.js +11 -0
- package/components/Illustrations/BabyMobile.js.map +1 -0
- package/components/Illustrations/BabyMobileMedium.d.ts +4 -0
- package/components/Illustrations/BabyMobileMedium.js +424 -0
- package/components/Illustrations/BabyMobileMedium.js.map +1 -0
- package/components/Illustrations/Child.d.ts +12 -0
- package/components/Illustrations/Child.js +11 -0
- package/components/Illustrations/Child.js.map +1 -0
- package/components/Illustrations/ChildMedium.d.ts +4 -0
- package/components/Illustrations/ChildMedium.js +185 -0
- package/components/Illustrations/ChildMedium.js.map +1 -0
- package/components/Illustrations/GiveBabyFood.d.ts +11 -0
- package/components/Illustrations/GiveBabyFood.js +11 -0
- package/components/Illustrations/GiveBabyFood.js.map +1 -0
- package/components/Illustrations/GiveBabyFoodMedium.d.ts +4 -0
- package/components/Illustrations/GiveBabyFoodMedium.js +377 -0
- package/components/Illustrations/GiveBabyFoodMedium.js.map +1 -0
- package/components/Illustrations/IllustrationNames.d.ts +1 -1
- package/components/Illustrations/IllustrationNames.js +15 -1
- package/components/Illustrations/IllustrationNames.js.map +1 -1
- package/components/Illustrations/Stroller.d.ts +12 -0
- package/components/Illustrations/Stroller.js +11 -0
- package/components/Illustrations/Stroller.js.map +1 -0
- package/components/Illustrations/StrollerMedium.d.ts +4 -0
- package/components/Illustrations/StrollerMedium.js +236 -0
- package/components/Illustrations/StrollerMedium.js.map +1 -0
- package/components/InfoTeaser/InfoTeaser.d.ts +28 -0
- package/components/InfoTeaser/InfoTeaser.test.d.ts +1 -0
- package/components/InfoTeaser/index.d.ts +3 -0
- package/components/InfoTeaser/index.js +5 -0
- package/components/InfoTeaser/index.js.map +1 -0
- package/components/InfoTeaser/resourceHelper.d.ts +3 -0
- package/components/InfoTeaser/styles.module.scss +98 -0
- package/components/InfoTeaser/styles.module.scss.d.ts +15 -0
- package/components/Panel/Panel.d.ts +3 -0
- package/components/Panel/resourceHelper.d.ts +3 -0
- package/components/Panel/styles.module.scss +6 -6
- package/constants.d.ts +2 -0
- package/constants.js +2 -0
- package/constants.js.map +1 -1
- package/designsystem-react.css +3 -1
- package/hooks/useBreakpoint.js +10 -28
- package/hooks/useBreakpoint.js.map +1 -1
- package/package.json +1 -1
- package/resources/HN.Designsystem.ArticleTeaser.en-GB.json.d.ts +7 -0
- package/resources/HN.Designsystem.ArticleTeaser.nb-NO.json.d.ts +7 -0
- package/resources/HN.Designsystem.Dropdown.nb-NO.json.d.ts +1 -2
- package/resources/HN.Designsystem.InfoTeaser.en-GB.json.d.ts +7 -0
- package/resources/HN.Designsystem.InfoTeaser.nb-NO.json.d.ts +7 -0
- package/resources/HN.Designsystem.Panel.en-GB.json.d.ts +7 -0
- package/resources/HN.Designsystem.Panel.nb-NO.json.d.ts +7 -0
- package/scss/supernova/styles/colors.css +3 -1
package/hooks/useBreakpoint.js
CHANGED
|
@@ -24,42 +24,24 @@ const useBreakpoint = () => {
|
|
|
24
24
|
typeof window.matchMedia !== "undefined" ? getCurrentBreakpoint() : Breakpoint.xxs
|
|
25
25
|
);
|
|
26
26
|
useEffect(() => {
|
|
27
|
-
const
|
|
28
|
-
switch (event.media) {
|
|
29
|
-
case screen.xl:
|
|
30
|
-
setBreakpoint(event.matches ? Breakpoint.xl : Breakpoint.lg);
|
|
31
|
-
return;
|
|
32
|
-
case screen.lg:
|
|
33
|
-
setBreakpoint(event.matches ? Breakpoint.lg : Breakpoint.md);
|
|
34
|
-
return;
|
|
35
|
-
case screen.md:
|
|
36
|
-
setBreakpoint(event.matches ? Breakpoint.md : Breakpoint.sm);
|
|
37
|
-
return;
|
|
38
|
-
case screen.sm:
|
|
39
|
-
setBreakpoint(event.matches ? Breakpoint.sm : Breakpoint.xs);
|
|
40
|
-
return;
|
|
41
|
-
case screen.xs:
|
|
42
|
-
setBreakpoint(event.matches ? Breakpoint.xs : Breakpoint.xxs);
|
|
43
|
-
return;
|
|
44
|
-
default:
|
|
45
|
-
setBreakpoint(Breakpoint.xxs);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const mediaQueryList = Object.entries(screen).map(([_size, mediaQuery]) => {
|
|
27
|
+
const mediaQueryList = Object.values(screen).map((mediaQuery) => {
|
|
49
28
|
const mq = window.matchMedia(mediaQuery);
|
|
29
|
+
const handler = () => {
|
|
30
|
+
setBreakpoint(getCurrentBreakpoint());
|
|
31
|
+
};
|
|
50
32
|
if (mq.addEventListener) {
|
|
51
|
-
mq.addEventListener("change",
|
|
33
|
+
mq.addEventListener("change", handler);
|
|
52
34
|
} else if (mq.addListener) {
|
|
53
|
-
mq.addListener(
|
|
35
|
+
mq.addListener(handler);
|
|
54
36
|
}
|
|
55
|
-
return mq;
|
|
37
|
+
return { mq, handler };
|
|
56
38
|
});
|
|
57
39
|
return () => {
|
|
58
|
-
mediaQueryList.forEach((mq) => {
|
|
40
|
+
mediaQueryList.forEach(({ mq, handler }) => {
|
|
59
41
|
if (mq.removeEventListener) {
|
|
60
|
-
mq.removeEventListener("change",
|
|
42
|
+
mq.removeEventListener("change", handler);
|
|
61
43
|
} else if (mq.removeListener) {
|
|
62
|
-
mq.removeListener(
|
|
44
|
+
mq.removeListener(handler);
|
|
63
45
|
}
|
|
64
46
|
});
|
|
65
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const mediaQueryList = Object.values(screen).map(mediaQuery => {\n const mq = window.matchMedia(mediaQuery);\n // iOS <=13 har ikke støtte for addEventListener/removeEventListener på MediaQueryList,\n // men har støtte for addListener\n const handler = (): void => {\n setBreakpoint(getCurrentBreakpoint());\n };\n\n if (mq.addEventListener) {\n mq.addEventListener('change', handler);\n } else if (mq.addListener) {\n mq.addListener(handler);\n }\n return { mq, handler };\n });\n\n return (): void => {\n mediaQueryList.forEach(({ mq, handler }) => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handler);\n } else if (mq.removeListener) {\n mq.removeListener(handler);\n }\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"names":["Breakpoint"],"mappings":";;AAIY,IAAA,cAAL,CAAKA,gBAAL;AACLA,cAAAA,YAAA,KAAM,IAAA,YAAY,GAAlB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AANUA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AASZ,SAAS,uBAAmC;AAG1C,QAAM,iBAAiB,OAAO,QAAQ,MAAM,EACzC,QACA,EAAA,IAAI,CAAC,CAAC,MAAM,UAAU,MAAM;AACpB,WAAA;AAAA,MACL,YAAY,WAAW,IAA+B;AAAA,MACtD,IAAI,OAAO,WAAW,UAAU;AAAA,IAClC;AAAA,EAAA,CACD;AAEH,QAAM,UAAU,eAAe,KAAK,CAAS,UAAA,MAAM,GAAG,OAAO;AACtD,UAAA,mCAAS,eAAc,WAAW;AAC3C;AAEO,MAAM,gBAAgB,MAAkB;AACvC,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,OAAO,OAAO,eAAe,cAAc,qBAAA,IAAyB,WAAW;AAAA,EACjF;AAEA,YAAU,MAAM;AACd,UAAM,iBAAiB,OAAO,OAAO,MAAM,EAAE,IAAI,CAAc,eAAA;AACvD,YAAA,KAAK,OAAO,WAAW,UAAU;AAGvC,YAAM,UAAU,MAAY;AAC1B,sBAAc,sBAAsB;AAAA,MACtC;AAEA,UAAI,GAAG,kBAAkB;AACpB,WAAA,iBAAiB,UAAU,OAAO;AAAA,MAAA,WAC5B,GAAG,aAAa;AACzB,WAAG,YAAY,OAAO;AAAA,MAAA;AAEjB,aAAA,EAAE,IAAI,QAAQ;AAAA,IAAA,CACtB;AAED,WAAO,MAAY;AACjB,qBAAe,QAAQ,CAAC,EAAE,IAAI,cAAc;AAC1C,YAAI,GAAG,qBAAqB;AACvB,aAAA,oBAAoB,UAAU,OAAO;AAAA,QAAA,WAC/B,GAAG,gBAAgB;AAC5B,aAAG,eAAe,OAAO;AAAA,QAAA;AAAA,MAC3B,CACD;AAAA,IACH;AAAA,EACF,GAAG,EAAE;AAEE,SAAA;AACT;"}
|
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
--color-base-background-dark-cherry: #c83521;
|
|
74
74
|
--color-base-graphics-onlight: #000000;
|
|
75
75
|
--color-base-border-ondark: #d6d4d3;
|
|
76
|
-
--color-base-border-onlight: #
|
|
76
|
+
--color-base-border-onlight: #7d7c79;
|
|
77
77
|
--color-base-border-onlight-emphasized: #62625f;
|
|
78
78
|
--color-help-background: #efe4fd;
|
|
79
79
|
--color-help-graphics: #5b22a6;
|
|
@@ -184,4 +184,6 @@
|
|
|
184
184
|
/* In a few cases where coloured text is required to stress the semantics of an error notification text */
|
|
185
185
|
--color-notification-text-error: #a31f0e;
|
|
186
186
|
--color-notification-text-success: #078141;
|
|
187
|
+
--color-base-border-neutral-emphasized: #bdbab9;
|
|
188
|
+
--color-notification-status-draft: #7d7c79;
|
|
187
189
|
}
|