@helsenorge/designsystem-react 11.0.0-beta.3 → 11.0.0-beta.4

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +886 -1417
  2. package/Panel.js +207 -0
  3. package/Panel.js.map +1 -0
  4. package/PanelTitle.js +18 -0
  5. package/PanelTitle.js.map +1 -0
  6. package/StatusDot.js +3 -1
  7. package/StatusDot.js.map +1 -1
  8. package/components/ExpanderList/index.js +12 -5
  9. package/components/ExpanderList/index.js.map +1 -1
  10. package/components/Panel/Panel.d.ts +65 -0
  11. package/components/Panel/Panel.test.d.ts +1 -0
  12. package/components/Panel/PanelExamples.d.ts +7 -0
  13. package/components/Panel/PanelTitle/PanelTitle.d.ts +15 -0
  14. package/components/Panel/PanelTitle/index.d.ts +3 -0
  15. package/components/Panel/PanelTitle/index.js +5 -0
  16. package/components/Panel/PanelTitle/index.js.map +1 -0
  17. package/components/Panel/PanelTitle/styles.module.scss +43 -0
  18. package/components/Panel/PanelTitle/styles.module.scss.d.ts +13 -0
  19. package/components/Panel/Paneldocs.d.ts +1 -0
  20. package/components/Panel/index.d.ts +3 -0
  21. package/components/Panel/index.js +15 -0
  22. package/components/Panel/index.js.map +1 -0
  23. package/components/Panel/styles.module.scss +224 -0
  24. package/components/Panel/styles.module.scss.d.ts +71 -0
  25. package/components/PanelList/PanelList.d.ts +2 -2
  26. package/components/PanelList/index.js +15 -7
  27. package/components/PanelList/index.js.map +1 -1
  28. package/components/PanelList/styles.module.scss +19 -4
  29. package/components/PanelList/styles.module.scss.d.ts +4 -1
  30. package/components/PanelListOld/PanelListOld.d.ts +12 -0
  31. package/components/PanelListOld/PanelListOld.test.d.ts +1 -0
  32. package/components/PanelListOld/index.d.ts +3 -0
  33. package/components/PanelListOld/index.js +20 -0
  34. package/components/PanelListOld/index.js.map +1 -0
  35. package/components/PanelListOld/styles.module.scss +14 -0
  36. package/components/PanelListOld/styles.module.scss.d.ts +9 -0
  37. package/components/StatusDot/styles.module.scss +8 -16
  38. package/components/StatusDot/styles.module.scss.d.ts +1 -0
  39. package/hooks/useBreakpoint.js +3 -1
  40. package/hooks/useBreakpoint.js.map +1 -1
  41. package/package.json +1 -1
  42. package/scss/helsenorge.scss +7 -7
package/Panel.js ADDED
@@ -0,0 +1,207 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React__default from "react";
3
+ import classNames from "classnames";
4
+ import { B as Button } from "./Button.js";
5
+ import { I as Icon } from "./Icon.js";
6
+ import { IconSize } from "./constants.js";
7
+ import { P as PanelTitle } from "./PanelTitle.js";
8
+ import ChevronDown from "./components/Icons/ChevronDown.js";
9
+ import ChevronRight from "./components/Icons/ChevronRight.js";
10
+ import ChevronUp from "./components/Icons/ChevronUp.js";
11
+ import styles from "./components/Panel/styles.module.scss";
12
+ var PanelLayout = /* @__PURE__ */ ((PanelLayout2) => {
13
+ PanelLayout2["vertical"] = "vertical";
14
+ PanelLayout2["horizontal"] = "horizontal";
15
+ PanelLayout2["combined"] = "combined";
16
+ PanelLayout2["bAsRightCol"] = "bAsRightCol";
17
+ return PanelLayout2;
18
+ })(PanelLayout || {});
19
+ var PanelVariant = /* @__PURE__ */ ((PanelVariant2) => {
20
+ PanelVariant2["fill"] = "fill";
21
+ PanelVariant2["line"] = "line";
22
+ PanelVariant2["outline"] = "outline";
23
+ return PanelVariant2;
24
+ })(PanelVariant || {});
25
+ var PanelStacking = /* @__PURE__ */ ((PanelStacking2) => {
26
+ PanelStacking2["default"] = "default";
27
+ PanelStacking2["bFirst"] = "bFirst";
28
+ return PanelStacking2;
29
+ })(PanelStacking || {});
30
+ var PanelStatus = /* @__PURE__ */ ((PanelStatus2) => {
31
+ PanelStatus2["none"] = "none";
32
+ PanelStatus2["new"] = "new";
33
+ PanelStatus2["error"] = "error";
34
+ PanelStatus2["draft"] = "draft";
35
+ return PanelStatus2;
36
+ })(PanelStatus || {});
37
+ const ExpandButton = ({ onClick, isExpanded }) => {
38
+ const buttonClassName = classNames(styles["expander__button"], isExpanded && styles["expander__button--expanded"]);
39
+ return /* @__PURE__ */ jsxs(
40
+ Button,
41
+ {
42
+ variant: "borderless",
43
+ textClassName: styles["expander__button__text"],
44
+ className: buttonClassName,
45
+ "aria-expanded": isExpanded,
46
+ onClick,
47
+ children: [
48
+ /* @__PURE__ */ jsx(Icon, { svgIcon: isExpanded ? ChevronUp : ChevronDown, size: IconSize.XSmall }),
49
+ /* @__PURE__ */ jsx("span", { children: isExpanded ? "Skjul detaljer" : "Se detaljer" })
50
+ ]
51
+ }
52
+ );
53
+ };
54
+ const Panel = ({
55
+ layout = "vertical",
56
+ variant = "fill",
57
+ color = "neutral",
58
+ stacking = "default",
59
+ testId,
60
+ children,
61
+ status = "none",
62
+ buttonBottomOnClick,
63
+ buttonBottomText,
64
+ className
65
+ }) => {
66
+ const [preContainer, setPreContainer] = React__default.useState([]);
67
+ const [title, setTitle] = React__default.useState([]);
68
+ const [content, setContent] = React__default.useState([]);
69
+ const [expandableContent, setExpandableContent] = React__default.useState([]);
70
+ const [hasIcon, setHasIcon] = React__default.useState(false);
71
+ const [isExpanded, setIsExpanded] = React__default.useState(false);
72
+ const panelRef = React__default.useRef(null);
73
+ const expandedContentRef = React__default.useRef(null);
74
+ const defaultScroll = 100;
75
+ React__default.useEffect(() => {
76
+ let localHasIcon = false;
77
+ const newPreContainer = [];
78
+ const newTitle = [];
79
+ const newContent = [];
80
+ const newExpandableContent = [];
81
+ React__default.Children.forEach(children, (child) => {
82
+ if (React__default.isValidElement(child)) {
83
+ if (child.type === PreContainer) {
84
+ newPreContainer.push(child);
85
+ } else if (child.type === PanelTitle) {
86
+ newTitle.push(child);
87
+ if (child.props.icon) {
88
+ localHasIcon = true;
89
+ }
90
+ } else if (child.type === A || child.type === B || child.type === C) {
91
+ newContent.push(child);
92
+ } else if (child.type === ExpandedContent) {
93
+ newExpandableContent.push(child);
94
+ }
95
+ }
96
+ });
97
+ setPreContainer(newPreContainer);
98
+ setTitle(newTitle);
99
+ setContent(newContent);
100
+ setExpandableContent(newExpandableContent);
101
+ setHasIcon(localHasIcon);
102
+ }, [children]);
103
+ React__default.useEffect(() => {
104
+ if (isExpanded) {
105
+ if (panelRef.current && expandedContentRef.current) {
106
+ const panelRect = panelRef.current.getBoundingClientRect();
107
+ const expandedContentRect = expandedContentRef.current.getBoundingClientRect();
108
+ const scrollAmount = Math.min(defaultScroll, panelRect.top - 20);
109
+ if (scrollAmount > 0 && expandedContentRect.bottom > window.innerHeight) {
110
+ const prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
111
+ if (prefersReducedMotion) {
112
+ return;
113
+ }
114
+ window.scrollBy({
115
+ top: scrollAmount,
116
+ behavior: "smooth"
117
+ });
118
+ }
119
+ }
120
+ }
121
+ }, [isExpanded]);
122
+ const colorScheme = variant === "fill" ? color : "white";
123
+ const outerClassnames = classNames(className, {
124
+ [styles["panel__border--outline--outer"]]: variant === "outline",
125
+ [styles["panel__border--line"]]: variant === "line",
126
+ [styles["panel__border--fill--neutral"]]: variant === "fill" && colorScheme === "neutral"
127
+ });
128
+ const panelClassnames = classNames(styles["panel"], styles[`panel--${colorScheme}`], styles["panel--status"], {
129
+ [styles["panel--line"]]: variant === "line",
130
+ [styles["panel--new"]]: status === "new",
131
+ [styles["panel--draft"]]: status === "draft",
132
+ [styles["panel--error"]]: status === "error",
133
+ [styles["panel--icon"]]: hasIcon
134
+ });
135
+ const contentContainerLayout = classNames(styles["panel__content"], styles[`panel__content--${layout}`], {
136
+ [styles[`panel__content--b-first`]]: stacking === "bFirst"
137
+ /* bFirst */
138
+ });
139
+ const expanderBorderLayout = classNames({
140
+ [styles["panel__expander__border--expanded"]]: isExpanded && status === "none",
141
+ [styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === "none",
142
+ [styles[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === "none" && variant === "line"
143
+ /* line */
144
+ });
145
+ return expandableContent.length > 0 ? /* @__PURE__ */ jsx("div", { className: outerClassnames, children: /* @__PURE__ */ jsx("div", { className: classNames({
146
+ [styles["panel__border--outline--inner"]]: variant === "outline"
147
+ /* outline */
148
+ }), children: /* @__PURE__ */ jsx("div", { className: expanderBorderLayout, children: /* @__PURE__ */ jsxs("div", { className: panelClassnames, "data-testid": testId, ref: panelRef, children: [
149
+ preContainer,
150
+ title,
151
+ /* @__PURE__ */ jsx("div", { className: contentContainerLayout, children: content }),
152
+ /* @__PURE__ */ jsx(ExpandButton, { onClick: () => setIsExpanded(!isExpanded), isExpanded }),
153
+ isExpanded && /* @__PURE__ */ jsxs("div", { ref: expandedContentRef, children: [
154
+ /* @__PURE__ */ jsx("div", { className: styles["panel__expander__separator"] }),
155
+ expandableContent
156
+ ] })
157
+ ] }) }) }) }) : /* @__PURE__ */ jsx("div", { className: outerClassnames, children: /* @__PURE__ */ jsx("div", { className: classNames({
158
+ [styles["panel__border--outline--inner"]]: variant === "outline"
159
+ /* outline */
160
+ }), children: /* @__PURE__ */ jsxs("div", { className: panelClassnames, "data-testid": testId, ref: panelRef, children: [
161
+ preContainer,
162
+ title,
163
+ /* @__PURE__ */ jsx("div", { className: contentContainerLayout, children: content }),
164
+ buttonBottomText && buttonBottomOnClick && /* @__PURE__ */ jsx("div", { className: styles["panel__button-bottom"], children: /* @__PURE__ */ jsxs(Button, { variant: "borderless", type: "button", size: "medium", onClick: buttonBottomOnClick, children: [
165
+ buttonBottomText,
166
+ /* @__PURE__ */ jsx(Icon, { svgIcon: ChevronRight, size: IconSize.XSmall })
167
+ ] }) })
168
+ ] }) }) });
169
+ };
170
+ const PreContainer = ({ children }) => {
171
+ return /* @__PURE__ */ jsx("div", { className: styles["panel__pre-container"], children });
172
+ };
173
+ const A = ({ children }) => {
174
+ const styling = classNames(styles["panel__content__item"], styles["panel__content__item--a"]);
175
+ return /* @__PURE__ */ jsx("div", { className: styling, children });
176
+ };
177
+ const B = ({ children }) => {
178
+ const styling = classNames(styles["panel__content__item"], styles["panel__content__item--b"]);
179
+ return /* @__PURE__ */ jsx("div", { className: styling, children });
180
+ };
181
+ const C = ({ children }) => {
182
+ const styling = classNames(styles["panel__content__item"], styles["panel__content__item--c"]);
183
+ return /* @__PURE__ */ jsx("div", { className: styling, children });
184
+ };
185
+ const ExpandedContent = ({ children }) => {
186
+ const styling = classNames(styles["panel__expander__content"]);
187
+ return /* @__PURE__ */ jsx("div", { className: styling, children });
188
+ };
189
+ Panel.PreContainer = PreContainer;
190
+ Panel.Title = PanelTitle;
191
+ Panel.A = A;
192
+ Panel.B = B;
193
+ Panel.C = C;
194
+ Panel.ExpandedContent = ExpandedContent;
195
+ export {
196
+ A,
197
+ B,
198
+ C,
199
+ ExpandedContent as E,
200
+ Panel as P,
201
+ PanelLayout as a,
202
+ PanelVariant as b,
203
+ PanelStacking as c,
204
+ PanelStatus as d,
205
+ PreContainer as e
206
+ };
207
+ //# sourceMappingURL=Panel.js.map
package/Panel.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Panel.js","sources":["../src/components/Panel/Panel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { PaletteNames } from '../../theme/palette';\nimport Button from '../Button';\nimport Icon, { IconSize } from '../Icon';\nimport PanelTitle, { PanelTitleProps } from './PanelTitle';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronRight from '../Icons/ChevronRight';\nimport ChevronUp from '../Icons/ChevronUp';\n\nimport styles from './styles.module.scss';\n\nexport enum PanelLayout {\n vertical = 'vertical',\n horizontal = 'horizontal',\n combined = 'combined',\n bAsRightCol = 'bAsRightCol',\n}\n\nexport type PanelColors = Extract<PaletteNames, 'white' | 'neutral'>;\n\nexport enum PanelVariant {\n fill = 'fill',\n line = 'line',\n outline = 'outline',\n}\n\nexport enum PanelStacking {\n default = 'default',\n bFirst = 'bFirst',\n}\n\nexport enum PanelStatus {\n none = 'none',\n new = 'new',\n error = 'error',\n draft = 'draft',\n}\n\nexport interface PanelProps {\n /** Sets the text on the bottom call to action button */\n buttonBottomText?: string;\n /** Sets the action on the bottom call to action button */\n buttonBottomOnClick?: () => void;\n /** Sets the layout and order of the content boxes */\n layout?: PanelLayout;\n /** Sets the visual variant of panel */\n variant?: PanelVariant;\n /** Sets the color for panel if it has variant fill */\n color?: PanelColors;\n /** Sets classes on the outermost container of the panel */\n className?: string;\n /** Sets the stacking order of the content boxes */\n stacking?: PanelStacking;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Children elements to be rendered inside the panel */\n children?: React.ReactNode;\n /** Displays a status on the left side: default normal */\n status?: PanelStatus;\n}\n\nconst ExpandButton = ({ onClick, isExpanded }: { onClick: () => void; isExpanded: boolean | undefined }): React.JSX.Element => {\n const buttonClassName = classNames(styles['expander__button'], isExpanded && styles['expander__button--expanded']);\n\n return (\n <Button\n variant=\"borderless\"\n textClassName={styles['expander__button__text']}\n className={buttonClassName}\n aria-expanded={isExpanded}\n onClick={onClick}\n >\n <Icon svgIcon={isExpanded ? ChevronUp : ChevronDown} size={IconSize.XSmall} />\n {/* @todo: språk på knapp */}\n <span>{isExpanded ? 'Skjul detaljer' : 'Se detaljer'}</span>\n </Button>\n );\n};\n\nconst Panel: React.FC<PanelProps> & {\n PreContainer: React.FC<ContentProps>;\n Title: React.FC<PanelTitleProps>;\n A: React.FC<ContentProps>;\n B: React.FC<ContentProps>;\n C: React.FC<ContentProps>;\n ExpandedContent: React.FC<ContentProps>;\n} = ({\n layout = PanelLayout.vertical,\n variant = PanelVariant.fill,\n color = 'neutral',\n stacking = PanelStacking.default,\n testId,\n children,\n status = PanelStatus.none,\n buttonBottomOnClick,\n buttonBottomText,\n className,\n}: PanelProps) => {\n const [preContainer, setPreContainer] = React.useState<React.ReactNode[]>([]);\n const [title, setTitle] = React.useState<React.ReactNode[]>([]);\n const [content, setContent] = React.useState<React.ReactNode[]>([]);\n const [expandableContent, setExpandableContent] = React.useState<React.ReactNode[]>([]);\n const [hasIcon, setHasIcon] = React.useState(false);\n const [isExpanded, setIsExpanded] = React.useState(false);\n const panelRef = React.useRef<HTMLDivElement>(null);\n const expandedContentRef = React.useRef<HTMLDivElement>(null);\n const defaultScroll = 100;\n\n React.useEffect(() => {\n let localHasIcon = false;\n const newPreContainer: React.ReactNode[] = [];\n const newTitle: React.ReactNode[] = [];\n const newContent: React.ReactNode[] = [];\n const newExpandableContent: React.ReactNode[] = [];\n\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\n if (child.type === PreContainer) {\n newPreContainer.push(child);\n } else if (child.type === PanelTitle) {\n newTitle.push(child);\n if (child.props.icon) {\n localHasIcon = true;\n }\n } else if (child.type === A || child.type === B || child.type === C) {\n newContent.push(child);\n } else if (child.type === ExpandedContent) {\n newExpandableContent.push(child);\n }\n }\n });\n\n setPreContainer(newPreContainer);\n setTitle(newTitle);\n setContent(newContent);\n setExpandableContent(newExpandableContent);\n setHasIcon(localHasIcon);\n }, [children]);\n\n React.useEffect(() => {\n // Scroller oppover når expanded content åpnes\n if (isExpanded) {\n if (panelRef.current && expandedContentRef.current) {\n const panelRect = panelRef.current.getBoundingClientRect();\n const expandedContentRect = expandedContentRef.current.getBoundingClientRect();\n\n const scrollAmount = Math.min(defaultScroll, panelRect.top - 20);\n\n // Scroller kun oppover, og kun dersom expandedContent havner utenfor skjermen når åpnet\n if (scrollAmount > 0 && expandedContentRect.bottom > window.innerHeight) {\n const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (prefersReducedMotion) {\n return;\n }\n window.scrollBy({\n top: scrollAmount,\n behavior: 'smooth',\n });\n }\n }\n }\n }, [isExpanded]);\n\n const colorScheme = variant === PanelVariant.fill ? color : 'white';\n\n const outerClassnames = classNames(className, {\n [styles['panel__border--outline--outer']]: variant === PanelVariant.outline,\n [styles['panel__border--line']]: variant === PanelVariant.line,\n [styles['panel__border--fill--neutral']]: variant === PanelVariant.fill && colorScheme === 'neutral',\n });\n const panelClassnames = classNames(styles['panel'], styles[`panel--${colorScheme}`], styles['panel--status'], {\n [styles['panel--line']]: variant === PanelVariant.line,\n [styles['panel--new']]: status === PanelStatus.new,\n [styles['panel--draft']]: status === PanelStatus.draft,\n [styles['panel--error']]: status === PanelStatus.error,\n [styles['panel--icon']]: hasIcon,\n });\n const contentContainerLayout = classNames(styles['panel__content'], styles[`panel__content--${layout}`], {\n [styles[`panel__content--b-first`]]: stacking === PanelStacking.bFirst,\n });\n const expanderBorderLayout = classNames({\n [styles['panel__expander__border--expanded']]: isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--${colorScheme}`]]: !isExpanded && status === PanelStatus.none,\n [styles[`panel__expander__border--not-expanded--line`]]: !isExpanded && status === PanelStatus.none && variant === PanelVariant.line,\n });\n\n return expandableContent.length > 0 ? (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: variant === PanelVariant.outline })}>\n <div className={expanderBorderLayout}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef}>\n {preContainer}\n {title}\n <div className={contentContainerLayout}>{content}</div>\n <ExpandButton onClick={() => setIsExpanded(!isExpanded)} isExpanded={isExpanded} />\n {isExpanded && (\n <div ref={expandedContentRef}>\n <div className={styles['panel__expander__separator']} />\n {expandableContent}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n ) : (\n <div className={outerClassnames}>\n <div className={classNames({ [styles['panel__border--outline--inner']]: variant === PanelVariant.outline })}>\n <div className={panelClassnames} data-testid={testId} ref={panelRef}>\n {preContainer}\n {title}\n <div className={contentContainerLayout}>{content}</div>\n {buttonBottomText && buttonBottomOnClick && (\n <div className={styles['panel__button-bottom']}>\n <Button variant=\"borderless\" type=\"button\" size=\"medium\" onClick={buttonBottomOnClick}>\n {buttonBottomText}\n <Icon svgIcon={ChevronRight} size={IconSize.XSmall} />\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n );\n};\n\nexport interface ContentProps {\n /** Children elements to be rendered inside the content box */\n children?: React.ReactNode;\n}\n\nexport const PreContainer: React.FC<ContentProps> = ({ children }) => {\n return <div className={styles['panel__pre-container']}>{children}</div>;\n};\n\nexport const A: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--a']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const B: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--b']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const C: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__content__item'], styles['panel__content__item--c']);\n return <div className={styling}>{children}</div>;\n};\n\nexport const ExpandedContent: React.FC<ContentProps> = ({ children }) => {\n const styling = classNames(styles['panel__expander__content']);\n return <div className={styling}>{children}</div>;\n};\n\nPanel.PreContainer = PreContainer;\nPanel.Title = PanelTitle;\nPanel.A = A;\nPanel.B = B;\nPanel.C = C;\nPanel.ExpandedContent = ExpandedContent;\n\nexport default Panel;\n"],"names":["PanelLayout","PanelVariant","PanelStacking","PanelStatus","React"],"mappings":";;;;;;;;;;;AAcY,IAAA,gCAAAA,iBAAL;AACLA,eAAA,UAAW,IAAA;AACXA,eAAA,YAAa,IAAA;AACbA,eAAA,UAAW,IAAA;AACXA,eAAA,aAAc,IAAA;AAJJA,SAAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AASA,IAAA,iCAAAC,kBAAL;AACLA,gBAAA,MAAO,IAAA;AACPA,gBAAA,MAAO,IAAA;AACPA,gBAAA,SAAU,IAAA;AAHAA,SAAAA;AAAA,GAAA,gBAAA,CAAA,CAAA;AAMA,IAAA,kCAAAC,mBAAL;AACLA,iBAAA,SAAU,IAAA;AACVA,iBAAA,QAAS,IAAA;AAFCA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AAKA,IAAA,gCAAAC,iBAAL;AACLA,eAAA,MAAO,IAAA;AACPA,eAAA,KAAM,IAAA;AACNA,eAAA,OAAQ,IAAA;AACRA,eAAA,OAAQ,IAAA;AAJEA,SAAAA;AAAA,GAAA,eA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,EAAE,eAAe;AACzD,QAAM,UAAU,WAAW,OAAO,sBAAsB,GAAG,OAAO,yBAAyB,CAAC;AAC5F,SAAQ,oBAAA,OAAA,EAAI,WAAW,SAAU,SAAS,CAAA;AAC5C;AAEO,MAAM,IAA4B,CAAC,EAAE,eAAe;AACzD,QAAM,UAAU,WAAW,OAAO,sBAAsB,GAAG,OAAO,yBAAyB,CAAC;AAC5F,SAAQ,oBAAA,OAAA,EAAI,WAAW,SAAU,SAAS,CAAA;AAC5C;AAEO,MAAM,kBAA0C,CAAC,EAAE,eAAe;AACvE,QAAM,UAAU,WAAW,OAAO,0BAA0B,CAAC;AAC7D,SAAQ,oBAAA,OAAA,EAAI,WAAW,SAAU,SAAS,CAAA;AAC5C;AAEA,MAAM,eAAe;AACrB,MAAM,QAAQ;AACd,MAAM,IAAI;AACV,MAAM,IAAI;AACV,MAAM,IAAI;AACV,MAAM,kBAAkB;"}
package/PanelTitle.js ADDED
@@ -0,0 +1,18 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import { T as Title } from "./Title.js";
4
+ import styles from "./components/Panel/PanelTitle/styles.module.scss";
5
+ const PanelTitle = (props) => {
6
+ const { testId, icon, badge, title, titleMarkup = "h3" } = props;
7
+ return /* @__PURE__ */ jsxs("div", { className: classNames(styles["paneltitle"], { [styles["paneltitle--has-icon"]]: icon }), "data-testid": testId, children: [
8
+ icon && /* @__PURE__ */ jsx("div", { className: styles["paneltitle__icon"], children: icon }),
9
+ title && /* @__PURE__ */ jsxs("div", { className: styles["paneltitle__title"], children: [
10
+ /* @__PURE__ */ jsx(Title, { appearance: "title3", htmlMarkup: titleMarkup, children: title }),
11
+ badge && /* @__PURE__ */ jsx("div", { className: styles["paneltitle__badge"], children: badge })
12
+ ] })
13
+ ] });
14
+ };
15
+ export {
16
+ PanelTitle as P
17
+ };
18
+ //# sourceMappingURL=PanelTitle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelTitle.js","sources":["../src/components/Panel/PanelTitle/PanelTitle.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport Title from '../../Title';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelTitleProps {\n /** Badge displayed in title */\n badge?: React.ReactNode;\n /** Icon displayed in title. Only IconSize Small is supported */\n icon?: React.ReactNode;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Title text */\n title: string;\n /** Title HTML markup */\n titleMarkup?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n}\n\nconst PanelTitle: React.FC<PanelTitleProps> = (props: PanelTitleProps) => {\n const { testId, icon, badge, title, titleMarkup = 'h3' } = props;\n return (\n <div className={classNames(styles['paneltitle'], { [styles['paneltitle--has-icon']]: icon })} data-testid={testId}>\n {icon && <div className={styles['paneltitle__icon']}>{icon}</div>}\n {title && (\n <div className={styles['paneltitle__title']}>\n <Title appearance=\"title3\" htmlMarkup={titleMarkup}>\n {title}\n </Title>\n {badge && <div className={styles['paneltitle__badge']}>{badge}</div>}\n </div>\n )}\n </div>\n );\n};\n\nexport default PanelTitle;\n"],"names":[],"mappings":";;;;AAqBM,MAAA,aAAwC,CAAC,UAA2B;AACxE,QAAM,EAAE,QAAQ,MAAM,OAAO,OAAO,cAAc,SAAS;AAC3D,8BACG,OAAI,EAAA,WAAW,WAAW,OAAO,YAAY,GAAG,EAAE,CAAC,OAAO,sBAAsB,CAAC,GAAG,MAAM,GAAG,eAAa,QACxG,UAAA;AAAA,IAAA,4BAAS,OAAI,EAAA,WAAW,OAAO,kBAAkB,GAAI,UAAK,MAAA;AAAA,IAC1D,SACE,qBAAA,OAAA,EAAI,WAAW,OAAO,mBAAmB,GACxC,UAAA;AAAA,MAAA,oBAAC,OAAM,EAAA,YAAW,UAAS,YAAY,aACpC,UACH,OAAA;AAAA,MACC,SAAU,oBAAA,OAAA,EAAI,WAAW,OAAO,mBAAmB,GAAI,UAAM,MAAA,CAAA;AAAA,IAAA,EAChE,CAAA;AAAA,EAAA,GAEJ;AAEJ;"}
package/StatusDot.js CHANGED
@@ -81,7 +81,9 @@ const StatusDotIcon = ({ onColor, variant = "info" }) => {
81
81
  const StatusDot = (props) => {
82
82
  const { id, onColor = StatusDotOnColor.onwhite, variant = "info", text, className, testId } = props;
83
83
  const statusDotClasses = classNames(styles["statusdot"], className);
84
- const labelClasses = classNames(onColor === StatusDotOnColor.ondark && styles["statusdot__label--on-dark"]);
84
+ const labelClasses = classNames(styles["statusdot__label"], {
85
+ [styles["statusdot__label--on-dark"]]: onColor === StatusDotOnColor.ondark
86
+ });
85
87
  return /* @__PURE__ */ jsxs("span", { id, className: statusDotClasses, "data-testid": testId, "data-analyticsid": AnalyticsId.StatusDot, children: [
86
88
  /* @__PURE__ */ jsx("span", { className: styles["statusdot__dot"], "data-testid": testId + "-dot", children: /* @__PURE__ */ jsx(StatusDotIcon, { onColor, variant }) }),
87
89
  /* @__PURE__ */ jsx("span", { className: labelClasses, children: text })
package/StatusDot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"StatusDot.js","sources":["../src/components/StatusDot/StatusDot.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { IconSize } from '../..';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { getColor } from '../../theme/currys';\nimport { LazyIcon } from '../LazyIcon';\n\nimport styles from './styles.module.scss';\n\nexport enum StatusDotOnColor {\n onwhite = FormOnColor.onwhite,\n ondark = FormOnColor.ondark,\n}\n\nexport enum StatusDotVariant {\n success = 'success',\n inprocess = 'inprocess',\n exception = 'exception',\n unknown = 'unknown',\n inspected = 'inspected',\n cancelled = 'cancelled',\n alert = 'alert',\n transparent = 'transparent',\n info = 'info',\n group = 'group',\n recurring = 'recurring',\n noaccess = 'noaccess',\n draft = 'draft',\n hidden = 'hidden',\n login = 'login',\n attachment = 'attachment',\n}\n\nexport interface StatusDotIconProps {\n /** Defines the color of the icon */\n onColor?: keyof typeof StatusDotOnColor;\n /** The variant defines style formatting and what icon to use */\n variant?: keyof typeof StatusDotVariant;\n}\n\nconst StatusDotIcon: React.FC<StatusDotIconProps> = ({ onColor, variant = 'info' }) => {\n const color = onColor === StatusDotOnColor.ondark ? getColor('white') : getColor('black');\n const iconProps = {\n color,\n size: IconSize.XXSmall,\n onColor,\n className: classNames({\n [styles[`statusdot__dot--${variant}`]]: typeof variant !== 'undefined',\n [styles['statusdot__dot--on-dark']]: onColor === StatusDotOnColor.ondark,\n }),\n };\n\n switch (variant) {\n case StatusDotVariant.success:\n return <LazyIcon {...iconProps} iconName={'DotSuccess'} />;\n case StatusDotVariant.inprocess:\n return <LazyIcon {...iconProps} iconName={'DotHalfDisc'} />;\n case StatusDotVariant.exception:\n return <LazyIcon {...iconProps} iconName={'DotWarningTriangle'} />;\n case StatusDotVariant.unknown:\n return <LazyIcon {...iconProps} iconName={'DotQuestionMark'} />;\n case StatusDotVariant.inspected:\n return <LazyIcon {...iconProps} iconName={'DotLookingGlass'} />;\n case StatusDotVariant.cancelled:\n return <LazyIcon {...iconProps} iconName={'DotCancelled'} />;\n case StatusDotVariant.alert:\n return <LazyIcon {...iconProps} iconName={'DotAlert'} />;\n case StatusDotVariant.transparent:\n return <LazyIcon {...iconProps} iconName={'DotTransparent'} />;\n case StatusDotVariant.info:\n return <LazyIcon {...iconProps} iconName={'DotInfo'} />;\n case StatusDotVariant.group:\n return <LazyIcon {...iconProps} iconName={'Group'} />;\n case StatusDotVariant.recurring:\n return <LazyIcon {...iconProps} iconName={'Change'} />;\n case StatusDotVariant.noaccess:\n return <LazyIcon {...iconProps} iconName={'NoAccess'} />;\n case StatusDotVariant.draft:\n return <LazyIcon {...iconProps} iconName={'Pencil'} />;\n case StatusDotVariant.hidden:\n return <LazyIcon {...iconProps} iconName={'NoEye'} />;\n case StatusDotVariant.login:\n return <LazyIcon {...iconProps} iconName={'Login'} />;\n case StatusDotVariant.attachment:\n return <LazyIcon {...iconProps} iconName={'Attachment'} />;\n }\n\n return null;\n};\n\nexport interface StatusDotProps {\n /** id that is placed on the wrapper */\n id?: string;\n /** Defines the color mode, onwhite, ondark etc. */\n onColor?: keyof typeof StatusDotOnColor;\n /** Visual variants for the statusdot */\n variant?: keyof typeof StatusDotVariant;\n /** Text placed to the right of the statusdot */\n text: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst StatusDot: React.FC<StatusDotProps> = props => {\n const { id, onColor = StatusDotOnColor.onwhite, variant = StatusDotVariant.info, text, className, testId } = props;\n\n const statusDotClasses = classNames(styles['statusdot'], className);\n const labelClasses = classNames(onColor === StatusDotOnColor.ondark && styles['statusdot__label--on-dark']);\n\n return (\n <span id={id} className={statusDotClasses} data-testid={testId} data-analyticsid={AnalyticsId.StatusDot}>\n <span className={styles['statusdot__dot']} data-testid={testId + '-dot'}>\n <StatusDotIcon onColor={onColor} variant={variant} />\n </span>\n <span className={labelClasses}>{text}</span>\n </span>\n );\n};\n\nexport default StatusDot;\n"],"names":["StatusDotOnColor","StatusDotVariant"],"mappings":";;;;;;;;;AAWY,IAAA,oBAAL,CAAKA,sBAAL;AACLA,oBAAAA,kBAAA,SAAU,IAAA,YAAY,OAAtB,IAAA;AACAA,oBAAAA,kBAAA,QAAS,IAAA,YAAY,MAArB,IAAA;AAFUA,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAKA,IAAA,qCAAAC,sBAAL;AACLA,oBAAA,SAAU,IAAA;AACVA,oBAAA,WAAY,IAAA;AACZA,oBAAA,WAAY,IAAA;AACZA,oBAAA,SAAU,IAAA;AACVA,oBAAA,WAAY,IAAA;AACZA,oBAAA,WAAY,IAAA;AACZA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,aAAc,IAAA;AACdA,oBAAA,MAAO,IAAA;AACPA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,WAAY,IAAA;AACZA,oBAAA,UAAW,IAAA;AACXA,oBAAA,OAAQ,IAAA;AACRA,oBAAA,QAAS,IA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AU,SAAS;AAAA,IACrD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,UAAU;AAAA,IACtD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,YAAY;AAAA,IACxD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,UAAU;AAAA,IACtD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,SAAS;AAAA,IACrD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,SAAS;AAAA,IACrD,KAAK;AACH,aAAQ,oBAAA,UAAA,EAAU,GAAG,WAAW,UAAU,cAAc;AAAA,EAAA;AAGrD,SAAA;AACT;AAiBA,MAAM,YAAsC,CAAS,UAAA;AAC7C,QAAA,EAAE,IAAI,UAAU,iBAAiB,SAAS,UAAU,QAAuB,MAAM,WAAW,OAAW,IAAA;AAE7G,QAAM,mBAAmB,WAAW,OAAO,WAAW,GAAG,SAAS;AAClE,QAAM,eAAe,WAAW,YAAY,iBAAiB,UAAU,OAAO,2BAA2B,CAAC;AAGxG,SAAA,qBAAC,UAAK,IAAQ,WAAW,kBAAkB,eAAa,QAAQ,oBAAkB,YAAY,WAC5F,UAAA;AAAA,IAAA,oBAAC,QAAK,EAAA,WAAW,OAAO,gBAAgB,GAAG,eAAa,SAAS,QAC/D,UAAC,oBAAA,eAAA,EAAc,SAAkB,QAAkB,CAAA,GACrD;AAAA,IACC,oBAAA,QAAA,EAAK,WAAW,cAAe,UAAK,KAAA,CAAA;AAAA,EAAA,GACvC;AAEJ;"}
1
+ {"version":3,"file":"StatusDot.js","sources":["../src/components/StatusDot/StatusDot.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { IconSize } from '../..';\nimport { AnalyticsId, FormOnColor } from '../../constants';\nimport { getColor } from '../../theme/currys';\nimport { LazyIcon } from '../LazyIcon';\n\nimport styles from './styles.module.scss';\n\nexport enum StatusDotOnColor {\n onwhite = FormOnColor.onwhite,\n ondark = FormOnColor.ondark,\n}\n\nexport enum StatusDotVariant {\n success = 'success',\n inprocess = 'inprocess',\n exception = 'exception',\n unknown = 'unknown',\n inspected = 'inspected',\n cancelled = 'cancelled',\n alert = 'alert',\n transparent = 'transparent',\n info = 'info',\n group = 'group',\n recurring = 'recurring',\n noaccess = 'noaccess',\n draft = 'draft',\n hidden = 'hidden',\n login = 'login',\n attachment = 'attachment',\n}\n\nexport interface StatusDotIconProps {\n /** Defines the color of the icon */\n onColor?: keyof typeof StatusDotOnColor;\n /** The variant defines style formatting and what icon to use */\n variant?: keyof typeof StatusDotVariant;\n}\n\nconst StatusDotIcon: React.FC<StatusDotIconProps> = ({ onColor, variant = 'info' }) => {\n const color = onColor === StatusDotOnColor.ondark ? getColor('white') : getColor('black');\n const iconProps = {\n color,\n size: IconSize.XXSmall,\n onColor,\n className: classNames({\n [styles[`statusdot__dot--${variant}`]]: typeof variant !== 'undefined',\n [styles['statusdot__dot--on-dark']]: onColor === StatusDotOnColor.ondark,\n }),\n };\n\n switch (variant) {\n case StatusDotVariant.success:\n return <LazyIcon {...iconProps} iconName={'DotSuccess'} />;\n case StatusDotVariant.inprocess:\n return <LazyIcon {...iconProps} iconName={'DotHalfDisc'} />;\n case StatusDotVariant.exception:\n return <LazyIcon {...iconProps} iconName={'DotWarningTriangle'} />;\n case StatusDotVariant.unknown:\n return <LazyIcon {...iconProps} iconName={'DotQuestionMark'} />;\n case StatusDotVariant.inspected:\n return <LazyIcon {...iconProps} iconName={'DotLookingGlass'} />;\n case StatusDotVariant.cancelled:\n return <LazyIcon {...iconProps} iconName={'DotCancelled'} />;\n case StatusDotVariant.alert:\n return <LazyIcon {...iconProps} iconName={'DotAlert'} />;\n case StatusDotVariant.transparent:\n return <LazyIcon {...iconProps} iconName={'DotTransparent'} />;\n case StatusDotVariant.info:\n return <LazyIcon {...iconProps} iconName={'DotInfo'} />;\n case StatusDotVariant.group:\n return <LazyIcon {...iconProps} iconName={'Group'} />;\n case StatusDotVariant.recurring:\n return <LazyIcon {...iconProps} iconName={'Change'} />;\n case StatusDotVariant.noaccess:\n return <LazyIcon {...iconProps} iconName={'NoAccess'} />;\n case StatusDotVariant.draft:\n return <LazyIcon {...iconProps} iconName={'Pencil'} />;\n case StatusDotVariant.hidden:\n return <LazyIcon {...iconProps} iconName={'NoEye'} />;\n case StatusDotVariant.login:\n return <LazyIcon {...iconProps} iconName={'Login'} />;\n case StatusDotVariant.attachment:\n return <LazyIcon {...iconProps} iconName={'Attachment'} />;\n }\n\n return null;\n};\n\nexport interface StatusDotProps {\n /** id that is placed on the wrapper */\n id?: string;\n /** Defines the color mode, onwhite, ondark etc. */\n onColor?: keyof typeof StatusDotOnColor;\n /** Visual variants for the statusdot */\n variant?: keyof typeof StatusDotVariant;\n /** Text placed to the right of the statusdot */\n text: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst StatusDot: React.FC<StatusDotProps> = props => {\n const { id, onColor = StatusDotOnColor.onwhite, variant = StatusDotVariant.info, text, className, testId } = props;\n\n const statusDotClasses = classNames(styles['statusdot'], className);\n const labelClasses = classNames(styles['statusdot__label'], {\n [styles['statusdot__label--on-dark']]: onColor === StatusDotOnColor.ondark,\n });\n\n return (\n <span id={id} className={statusDotClasses} data-testid={testId} data-analyticsid={AnalyticsId.StatusDot}>\n <span className={styles['statusdot__dot']} data-testid={testId + '-dot'}>\n <StatusDotIcon onColor={onColor} variant={variant} />\n </span>\n <span className={labelClasses}>{text}</span>\n </span>\n );\n};\n\nexport default StatusDot;\n"],"names":["StatusDotOnColor","StatusDotVariant"],"mappings":";;;;;;;;;AAWY,IAAA,oBAAL,CAAKA,sBAAL;AACLA,oBAAAA,kBAAA,SAAU,IAAA,YAAY,OAAtB,IAAA;AACAA,oBAAAA,kBAAA,QAAS,IAAA,YAAY,MAArB,IAAA;AAFUA,SAAAA;AAAA,GA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,oBAAkB,YAAY,WAC5F,UAAA;AAAA,IAAA,oBAAC,QAAK,EAAA,WAAW,OAAO,gBAAgB,GAAG,eAAa,SAAS,QAC/D,UAAC,oBAAA,eAAA,EAAc,SAAkB,QAAkB,CAAA,GACrD;AAAA,IACC,oBAAA,QAAA,EAAK,WAAW,cAAe,UAAK,KAAA,CAAA;AAAA,EAAA,GACvC;AAEJ;"}
@@ -3,7 +3,7 @@ import React__default, { useState, useEffect, useRef } from "react";
3
3
  import classNames from "classnames";
4
4
  import { AnalyticsId } from "../../constants.js";
5
5
  import { useExpand } from "../../hooks/useExpand.js";
6
- import { useHover } from "../../hooks/useHover.js";
6
+ import { usePseudoClasses } from "../../hooks/usePseudoClasses.js";
7
7
  import { useUuid } from "../../hooks/useUuid.js";
8
8
  import { mergeRefs } from "../../utils/refs.js";
9
9
  import { isElementInViewport } from "../../utils/viewport.js";
@@ -28,12 +28,12 @@ const Expander = React__default.forwardRef((props, ref) => {
28
28
  onExpand,
29
29
  renderChildrenWhenClosed,
30
30
  variant = "line",
31
- zIndex
31
+ zIndex = 0
32
32
  } = props;
33
33
  const [isExpanded] = useExpand(expanded, onExpand);
34
34
  const expanderRef = useRef(null);
35
35
  const triggerRef = useRef(null);
36
- const { isHovered } = useHover(triggerRef);
36
+ const { isHovered, isFocused } = usePseudoClasses(triggerRef);
37
37
  const isFill = variant === "fill";
38
38
  const isFillNegative = variant === "fill-negative";
39
39
  const isOutline = variant === "outline";
@@ -82,9 +82,16 @@ const Expander = React__default.forwardRef((props, ref) => {
82
82
  ref: triggerRef,
83
83
  "aria-expanded": isExpanded,
84
84
  style: {
85
- zIndex: zIndex ?? void 0
85
+ zIndex: isFocused ? zIndex + 1 : zIndex
86
86
  },
87
- children: renderListHeader(title, titleHtmlMarkup, isHovered, large ? "large" : "medium", isExpanded ? ChevronUp : ChevronDown, icon)
87
+ children: renderListHeader(
88
+ title,
89
+ titleHtmlMarkup,
90
+ isHovered || isFocused,
91
+ large ? "large" : "medium",
92
+ isExpanded ? ChevronUp : ChevronDown,
93
+ icon
94
+ )
88
95
  }
89
96
  ),
90
97
  renderContent()
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { useHover } from '../../hooks/useHover';\nimport { useUuid } from '../../hooks/useUuid';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered } = useHover(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill`]]: isFill,\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: zIndex ?? undefined,\n }}\n >\n {renderListHeader(title, titleHtmlMarkup, isHovered, large ? 'large' : 'medium', isExpanded ? ChevronUp : ChevronDown, icon)}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: {} | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AA8EA,MAAM,WAAyBA,eAAM,WAAyC,CAAC,OAAO,QAAQ;AACtF,QAAA;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AAI,UAAU,CAAC,OAAO,UAAU;AAC1C,QAAA,oBAAoB,KAAK,GAAG;AACxB,YAAA,KAAK,cAAc,KAAK;AACxB,YAAA,WAAW,iDAAiB;AAE3B,aAAAA,eAAM,aAAa,OAA4C;AAAA,QACpE;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,WAAW,mBAAmB,qBAAqB;AAAA,QACnD,qBAAqB,CAAC,UAAyC,oBAAoB,OAAO,GAAG,IAAI,IAAI,KAAK,EAAE;AAAA,QAC5G;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IAAA;AAEI,WAAA;AAAA,EACR,CAAA,GACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { useExpand } from '../../hooks/useExpand';\nimport { usePseudoClasses } from '../../hooks/usePseudoClasses';\nimport { useUuid } from '../../hooks/useUuid';\nimport { PaletteNames } from '../../theme/palette';\nimport { mergeRefs } from '../../utils/refs';\nimport { isElementInViewport } from '../../utils/viewport';\nimport ChevronDown from '../Icons/ChevronDown';\nimport ChevronUp from '../Icons/ChevronUp';\nimport { ListHeaderType, renderListHeader } from '../ListHeader/ListHeader';\nimport { TitleTags } from '../Title';\n\nimport expanderListStyles from './styles.module.scss';\n\nexport type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;\nexport interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {\n ListHeader?: ListHeaderType;\n}\n\nexport interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {\n Expander: ExpanderType;\n}\n\nexport type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';\n\ninterface ExpanderListProps {\n /** Toggles accordion functionality for the expanders. */\n accordion?: boolean;\n /** Items in the ExpanderList */\n children: React.ReactNode;\n /** Toggles padding of child elements */\n childPadding?: boolean;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the colors of the list. */\n color?: ExpanderListColors;\n /** Changes the font size. */\n large?: boolean;\n /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */\n renderChildrenWhenClosed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets visual priority */\n variant?: ExpanderListVariant;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n}\n\ntype Modify<T, R> = Omit<T, keyof R> & R;\n\ntype ExpanderProps = Modify<\n React.HTMLAttributes<HTMLButtonElement>,\n {\n id?: string;\n title: JSX.Element | string;\n /** Changes the underlying element of the title. Default: span*/\n titleHtmlMarkup?: TitleTags;\n children: React.ReactNode;\n className?: string;\n color?: ExpanderListColors;\n icon?: React.ReactElement;\n padding?: boolean;\n expanded?: boolean;\n large?: boolean;\n testId?: string;\n handleExpanderClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Called when expander is open/closed. */\n onExpand?: (isExpanded: boolean) => void;\n /** Overrides the default z-index of the expander header */\n zIndex?: number;\n }\n> &\n Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'>;\n\nconst Expander: ExpanderType = React.forwardRef<HTMLLIElement, ExpanderProps>((props, ref) => {\n const {\n id,\n children,\n padding = true,\n color = 'neutral',\n className = '',\n icon,\n large = false,\n title,\n titleHtmlMarkup = 'span',\n expanded = false,\n testId,\n handleExpanderClick,\n onExpand,\n renderChildrenWhenClosed,\n variant = 'line',\n zIndex = 0,\n } = props;\n const [isExpanded] = useExpand(expanded, onExpand);\n const expanderRef = useRef<HTMLLIElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const { isHovered, isFocused } = usePseudoClasses(triggerRef);\n\n const isFill = variant === 'fill';\n const isFillNegative = variant === 'fill-negative';\n const isOutline = variant === 'outline';\n const isLine = variant === 'line';\n\n const itemClasses = classNames(className, expanderListStyles['expander-list__item'], {\n [expanderListStyles[`expander-list__item--fill`]]: isFill,\n [expanderListStyles[`expander-list__item--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list__item--fill-negative`]]: isFillNegative,\n [expanderListStyles['expander-list__item--outline']]: isOutline,\n [expanderListStyles[`expander-list__item--outline--${color}`]]: isOutline,\n [expanderListStyles['expander-list__item--line']]: isLine,\n [expanderListStyles[`expander-list__item--line--${color}`]]: isLine,\n });\n\n const expanderClasses = classNames(expanderListStyles['expander-list-link'], expanderListStyles[`expander-list-link--${color}`], {\n [expanderListStyles[`expander-list-link--fill`]]: isFill,\n [expanderListStyles[`expander-list-link--fill--${color}`]]: isFill,\n [expanderListStyles[`expander-list-link--fill-negative`]]: isFillNegative,\n [expanderListStyles['expander-list-link--outline']]: isOutline,\n [expanderListStyles[`expander-list-link--outline--${color}`]]: isOutline,\n [expanderListStyles[`expander-list-link--line--${color}`]]: isLine,\n [expanderListStyles['expander-list-link--closed']]: !isExpanded,\n [expanderListStyles['expander-list-link--open']]: isExpanded,\n [expanderListStyles['expander-list-link--large']]: large,\n });\n\n const renderContent = (): React.ReactNode => {\n if (!renderChildrenWhenClosed && !isExpanded) {\n return null;\n }\n\n const mainContentClasses = classNames(\n expanderListStyles['expander-list-link__main-content'],\n isExpanded && expanderListStyles['expander-list-link__main-content--expanded'],\n padding ? expanderListStyles['expander-list-link__main-content--padding'] : ''\n );\n\n return <div className={mainContentClasses}>{children}</div>;\n };\n\n return (\n <li className={itemClasses} ref={mergeRefs([ref, expanderRef])}>\n <button\n type=\"button\"\n id={id}\n onClick={handleExpanderClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.ExpanderListExpander}\n className={expanderClasses}\n ref={triggerRef}\n aria-expanded={isExpanded}\n style={{\n zIndex: isFocused ? zIndex + 1 : zIndex,\n }}\n >\n {renderListHeader(\n title,\n titleHtmlMarkup,\n isHovered || isFocused,\n large ? 'large' : 'medium',\n isExpanded ? ChevronUp : ChevronDown,\n icon\n )}\n </button>\n {renderContent()}\n </li>\n );\n});\n\ntype ActiveExpander = Record<string, boolean>;\n\nconst isExpanderComponent = (element: unknown | null | undefined): element is React.ReactElement<ExpanderProps> =>\n React.isValidElement<ExpanderProps>(element) && (element as React.ReactElement).type === Expander;\n\nexport const ExpanderList = React.forwardRef((props: ExpanderListProps, ref: React.Ref<HTMLUListElement>) => {\n const {\n children,\n childPadding = true,\n large,\n renderChildrenWhenClosed = false,\n color,\n className = '',\n accordion = false,\n testId,\n variant,\n zIndex,\n } = props;\n const [activeExpander, setActiveExpander] = useState<ActiveExpander>();\n const [latestExpander, setLatestExpander] = useState<HTMLElement>();\n const uuid = useUuid();\n const expanderListClasses = classNames(expanderListStyles['expander-list'], className);\n\n function handleExpanderClick(event: React.MouseEvent<HTMLElement, MouseEvent>, id: string): void {\n setActiveExpander(prevState => (accordion ? { [id]: !prevState?.[id] } : { ...prevState, [id]: !prevState?.[id] }));\n setLatestExpander(event.currentTarget);\n }\n\n const getExpanderId = (index: number): string => `${uuid}-${index}`;\n\n useEffect(() => {\n if (accordion && latestExpander && !isElementInViewport(latestExpander)) {\n latestExpander.scrollIntoView();\n }\n }, [accordion, latestExpander]);\n\n useEffect(() => {\n const newActiveExpander = React.Children.map(children, child => {\n if (isExpanderComponent(child)) {\n return child;\n }\n })?.reduce((acc, child, index) => {\n // Expanded-status skal bare settes dersom prop er satt av den som bruker komponenten\n if (typeof child.props.expanded !== 'undefined') {\n acc[getExpanderId(index)] = child.props.expanded;\n }\n return acc;\n }, {} as ActiveExpander);\n\n setActiveExpander({ ...activeExpander, ...newActiveExpander });\n }, [children]);\n\n return (\n <ul className={expanderListClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.ExpanderList}>\n {React.Children.map(children, (child, index) => {\n if (isExpanderComponent(child)) {\n const id = getExpanderId(index);\n const expanded = activeExpander?.[id];\n\n return React.cloneElement(child as React.ReactElement<ExpanderProps>, {\n id,\n key: index,\n expanded,\n padding: childPadding,\n color,\n large,\n 'aria-expanded': expanded,\n className: expanderListStyles['expander-list__item'],\n handleExpanderClick: (event: React.MouseEvent<HTMLElement>) => handleExpanderClick(event, `${uuid}-${index}`),\n renderChildrenWhenClosed,\n variant,\n zIndex: zIndex,\n });\n }\n return child;\n })}\n </ul>\n );\n}) as ExpanderListCompound;\n\nExpanderList.displayName = 'ExpanderList';\nExpanderList.Expander = Expander;\nExpander.displayName = 'ExpanderList.Expander';\n\nexport default ExpanderList;\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AA8EA,MAAM,WAAyBA,eAAM,WAAyC,CAAC,OAAO,QAAQ;AACtF,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,kBAAkB;AAAA,IAClB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,EAAA,IACP;AACJ,QAAM,CAAC,UAAU,IAAI,UAAU,UAAU,QAAQ;AAC3C,QAAA,cAAc,OAAsB,IAAI;AACxC,QAAA,aAAa,OAA0B,IAAI;AACjD,QAAM,EAAE,WAAW,cAAc,iBAAiB,UAAU;AAE5D,QAAM,SAAS,YAAY;AAC3B,QAAM,iBAAiB,YAAY;AACnC,QAAM,YAAY,YAAY;AAC9B,QAAM,SAAS,YAAY;AAE3B,QAAM,cAAc,WAAW,WAAW,mBAAmB,qBAAqB,GAAG;AAAA,IACnF,CAAC,mBAAmB,2BAA2B,CAAC,GAAG;AAAA,IACnD,CAAC,mBAAmB,8BAA8B,KAAK,EAAE,CAAC,GAAG;AAAA,IAC7D,CAAC,mBAAmB,oCAAoC,CAAC,GAAG;AAAA,IAC5D,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A;AAAA,EAChC,GACC,CAAC,WAAW,cAAc,CAAC;AAE9B,YAAU,MAAM;;AACd,UAAM,qBAAoBA,oBAAM,SAAS,IAAI,UAAU,CAAS,UAAA;AAC1D,UAAA,oBAAoB,KAAK,GAAG;AACvB,eAAA;AAAA,MAAA;AAAA,IAEV,CAAA,MAJyBA,mBAItB,OAAO,CAAC,KAAK,OAAO,UAAU;AAEhC,UAAI,OAAO,MAAM,MAAM,aAAa,aAAa;AAC/C,YAAI,cAAc,KAAK,CAAC,IAAI,MAAM,MAAM;AAAA,MAAA;AAEnC,aAAA;AAAA,IACT,GAAG;AAEH,sBAAkB,EAAE,GAAG,gBAAgB,GAAG,mBAAmB;AAAA,EAAA,GAC5D,CAAC,QAAQ,CAAC;AAEb,6BACG,MAAG,EAAA,WAAW,qBAAqB,KAAU,eAAa,QAAQ,oBAAkB,YAAY,cAC9F,yBAAM,SAAS,IAAI,UAAU,CAAC,OAAO,UAAU;AAC1C,QAAA,oBAAoB,KAAK,GAAG;AACxB,YAAA,KAAK,cAAc,KAAK;AACxB,YAAA,WAAW,iDAAiB;AAE3B,aAAAA,eAAM,aAAa,OAA4C;AAAA,QACpE;AAAA,QACA,KAAK;AAAA,QACL;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACA,iBAAiB;AAAA,QACjB,WAAW,mBAAmB,qBAAqB;AAAA,QACnD,qBAAqB,CAAC,UAAyC,oBAAoB,OAAO,GAAG,IAAI,IAAI,KAAK,EAAE;AAAA,QAC5G;AAAA,QACA;AAAA,QACA;AAAA,MAAA,CACD;AAAA,IAAA;AAEI,WAAA;AAAA,EACR,CAAA,GACH;AAEJ,CAAC;AAED,aAAa,cAAc;AAC3B,aAAa,WAAW;AACxB,SAAS,cAAc;"}
@@ -0,0 +1,65 @@
1
+ import { default as React } from 'react';
2
+ import { PaletteNames } from '../../theme/palette';
3
+ import { PanelTitleProps } from './PanelTitle';
4
+ export declare enum PanelLayout {
5
+ vertical = "vertical",
6
+ horizontal = "horizontal",
7
+ combined = "combined",
8
+ bAsRightCol = "bAsRightCol"
9
+ }
10
+ export type PanelColors = Extract<PaletteNames, 'white' | 'neutral'>;
11
+ export declare enum PanelVariant {
12
+ fill = "fill",
13
+ line = "line",
14
+ outline = "outline"
15
+ }
16
+ export declare enum PanelStacking {
17
+ default = "default",
18
+ bFirst = "bFirst"
19
+ }
20
+ export declare enum PanelStatus {
21
+ none = "none",
22
+ new = "new",
23
+ error = "error",
24
+ draft = "draft"
25
+ }
26
+ export interface PanelProps {
27
+ /** Sets the text on the bottom call to action button */
28
+ buttonBottomText?: string;
29
+ /** Sets the action on the bottom call to action button */
30
+ buttonBottomOnClick?: () => void;
31
+ /** Sets the layout and order of the content boxes */
32
+ layout?: PanelLayout;
33
+ /** Sets the visual variant of panel */
34
+ variant?: PanelVariant;
35
+ /** Sets the color for panel if it has variant fill */
36
+ color?: PanelColors;
37
+ /** Sets classes on the outermost container of the panel */
38
+ className?: string;
39
+ /** Sets the stacking order of the content boxes */
40
+ stacking?: PanelStacking;
41
+ /** Sets the data-testid attribute. */
42
+ testId?: string;
43
+ /** Children elements to be rendered inside the panel */
44
+ children?: React.ReactNode;
45
+ /** Displays a status on the left side: default normal */
46
+ status?: PanelStatus;
47
+ }
48
+ declare const Panel: React.FC<PanelProps> & {
49
+ PreContainer: React.FC<ContentProps>;
50
+ Title: React.FC<PanelTitleProps>;
51
+ A: React.FC<ContentProps>;
52
+ B: React.FC<ContentProps>;
53
+ C: React.FC<ContentProps>;
54
+ ExpandedContent: React.FC<ContentProps>;
55
+ };
56
+ export interface ContentProps {
57
+ /** Children elements to be rendered inside the content box */
58
+ children?: React.ReactNode;
59
+ }
60
+ export declare const PreContainer: React.FC<ContentProps>;
61
+ export declare const A: React.FC<ContentProps>;
62
+ export declare const B: React.FC<ContentProps>;
63
+ export declare const C: React.FC<ContentProps>;
64
+ export declare const ExpandedContent: React.FC<ContentProps>;
65
+ export default Panel;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export declare const MedisinskFødselsregister: React.FC;
3
+ export declare const TimeAvtale: React.FC;
4
+ export declare const PasientReiser: React.FC;
5
+ export declare const Helsekontakter: React.FC;
6
+ export declare const Dokumentliste: React.FC;
7
+ export declare const DokumentlisteDeling: React.FC;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ export interface PanelTitleProps {
3
+ /** Badge displayed in title */
4
+ badge?: React.ReactNode;
5
+ /** Icon displayed in title. Only IconSize Small is supported */
6
+ icon?: React.ReactNode;
7
+ /** Sets the data-testid attribute. */
8
+ testId?: string;
9
+ /** Title text */
10
+ title: string;
11
+ /** Title HTML markup */
12
+ titleMarkup?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
13
+ }
14
+ declare const PanelTitle: React.FC<PanelTitleProps>;
15
+ export default PanelTitle;
@@ -0,0 +1,3 @@
1
+ import { default as PanelTitle } from './PanelTitle';
2
+ export * from './PanelTitle';
3
+ export default PanelTitle;
@@ -0,0 +1,5 @@
1
+ import { P as PanelTitle } from "../../../PanelTitle.js";
2
+ export {
3
+ PanelTitle as default
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,43 @@
1
+ @use 'sass:map';
2
+ @use '../../../scss/spacers' as spacers;
3
+ @use '../../../scss/breakpoints' as breakpoints;
4
+
5
+ .paneltitle {
6
+ display: grid;
7
+ width: 100%;
8
+ gap: spacers.getSpacer(2xs);
9
+ grid-template-areas: 'title';
10
+
11
+ @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
12
+ gap: spacers.getSpacer(2xs) spacers.getSpacer(s);
13
+ }
14
+
15
+ &--has-icon {
16
+ margin-left: -3.5rem;
17
+ grid-template-columns: 3rem 1fr;
18
+ grid-template-areas: 'icon title';
19
+
20
+ @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
21
+ margin-left: -4rem;
22
+ }
23
+ }
24
+
25
+ &__icon {
26
+ grid-area: icon;
27
+ justify-self: center;
28
+ height: 48px;
29
+ }
30
+
31
+ &__title {
32
+ grid-area: title;
33
+ display: flex;
34
+ flex-flow: row;
35
+ gap: spacers.getSpacer(s);
36
+ margin-top: 8px;
37
+ height: fit-content;
38
+ }
39
+
40
+ &__badge {
41
+ display: inline;
42
+ }
43
+ }
@@ -0,0 +1,13 @@
1
+ export type Styles = {
2
+ paneltitle: string;
3
+ paneltitle__badge: string;
4
+ paneltitle__icon: string;
5
+ paneltitle__title: string;
6
+ 'paneltitle--has-icon': string;
7
+ };
8
+
9
+ export type ClassNames = keyof Styles;
10
+
11
+ declare const styles: Styles;
12
+
13
+ export default styles;
@@ -0,0 +1 @@
1
+ export declare const PanelDocs: () => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { default as Panel } from './Panel';
2
+ export * from './Panel';
3
+ export default Panel;
@@ -0,0 +1,15 @@
1
+ import { P as Panel } from "../../Panel.js";
2
+ import { A, B, C, E, a, c, d, b, e } from "../../Panel.js";
3
+ export {
4
+ A,
5
+ B,
6
+ C,
7
+ E as ExpandedContent,
8
+ a as PanelLayout,
9
+ c as PanelStacking,
10
+ d as PanelStatus,
11
+ b as PanelVariant,
12
+ e as PreContainer,
13
+ Panel as default
14
+ };
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}