@helsenorge/designsystem-react 10.2.0 → 10.3.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 +25 -0
- package/components/AnchorLink/styles.module.scss +8 -9
- package/components/Avatar/styles.module.scss +9 -9
- package/components/Badge/styles.module.scss +9 -9
- package/components/Button/styles.module.scss +65 -59
- package/components/Checkbox/styles.module.scss +103 -103
- package/components/Chip/styles.module.scss +22 -22
- package/components/Close/styles.module.scss +4 -4
- package/components/DictionaryTrigger/styles.module.scss +5 -5
- package/components/Drawer/styles.module.scss +16 -16
- package/components/Dropdown/styles.module.scss +51 -51
- package/components/Duolist/index.js +2 -1
- package/components/Duolist/index.js.map +1 -1
- package/components/Duolist/styles.module.scss +57 -35
- package/components/Duolist/styles.module.scss.d.ts +1 -0
- package/components/EmptyState/styles.module.scss +12 -12
- package/components/ErrorWrapper/styles.module.scss +11 -21
- package/components/ErrorWrapper/styles.module.scss.d.ts +0 -1
- package/components/Expander/styles.module.scss +46 -46
- package/components/ExpanderHierarchy/expander.module.scss +29 -29
- package/components/ExpanderHierarchy/styles.module.scss +4 -5
- package/components/ExpanderList/styles.module.scss +30 -30
- package/components/EyebrowHeader/styles.module.scss +0 -2
- package/components/FormGroup/styles.module.scss +9 -9
- package/components/FormLayout/styles.module.scss +4 -5
- package/components/HelpBubble/styles.module.scss +13 -13
- package/components/HelpPanel/styles.module.scss +2 -2
- package/components/HelpQuestion/styles.module.scss +19 -19
- package/components/HighlightPanel/styles.module.scss +20 -20
- package/components/HorizontalScroll/styles.module.scss +4 -3
- package/components/Input/styles.module.scss +12 -12
- package/components/Label/styles.module.scss +15 -15
- package/components/LinkList/styles.module.scss +33 -33
- package/components/ListHeader/styles.module.scss +8 -8
- package/components/Loader/styles.module.scss +14 -14
- package/components/MaxCharacters/styles.module.scss +11 -11
- package/components/Modal/styles.module.scss +34 -34
- package/components/NotificationPanel/styles.module.scss +33 -33
- package/components/Panel/styles.module.scss +45 -45
- package/components/PanelList/styles.module.scss +5 -5
- package/components/PopMenu/styles.module.scss +15 -15
- package/components/PopOver/styles.module.scss +13 -14
- package/components/PopOver/styles.module.scss.d.ts +0 -3
- package/components/Progressbar/styles.module.scss +4 -4
- package/components/PromoPanel/styles.module.scss +22 -22
- package/components/RadioButton/styles.module.scss +99 -99
- package/components/Select/styles.module.scss +21 -21
- package/components/ServiceMessage/styles.module.scss +49 -49
- package/components/SharingStatus/styles.module.scss +13 -13
- package/components/Slider/styles.module.scss +24 -24
- package/components/Spacer/styles.module.scss +14 -14
- package/components/StatusDot/styles.module.scss +22 -22
- package/components/Step/styles.module.scss +3 -3
- package/components/StepButtons/styles.module.scss +9 -9
- package/components/Stepper/styles.module.scss +23 -15
- package/components/StickyNote/styles.module.scss +3 -3
- package/components/Table/styles.module.scss +32 -32
- package/components/Tabs/TabList/styles.module.scss +1 -1
- package/components/Tabs/TabPanel/styles.module.scss +5 -5
- package/components/Tabs/styles.module.scss +1 -1
- package/components/Tag/styles.module.scss +16 -16
- package/components/TagList/styles.module.scss +4 -4
- package/components/Textarea/styles.module.scss +9 -9
- package/components/Tile/styles.module.scss +25 -25
- package/components/Title/styles.module.scss +8 -8
- package/components/Toggle/styles.module.scss +14 -14
- package/components/Tooltip/TooltipWord/styles.module.scss +4 -4
- package/components/Trigger/styles.module.scss +21 -21
- package/components/Validation/styles.module.scss +10 -10
- package/package.json +1 -1
- package/scss/_body.scss +5 -6
- package/scss/_breakpoints.scss +2 -2
- package/scss/_font-mixins.scss +2 -2
- package/scss/_fonts.scss +0 -2
- package/scss/_input.scss +53 -50
- package/scss/_print.scss +2 -2
- package/scss/layout.module.scss +2 -2
- package/scss/typography.module.scss +44 -43
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
2
|
+
@use '../../scss/spacers' as spacers;
|
|
3
|
+
@use '../../scss/palette' as palette;
|
|
4
|
+
@use '../../scss/font-settings' as font-settings;
|
|
5
|
+
@use '../../scss/screen-reader' as *;
|
|
6
|
+
@use '../../scss/breakpoints' as *;
|
|
7
7
|
|
|
8
8
|
.dropdown {
|
|
9
9
|
position: relative;
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
border-radius: 0;
|
|
21
21
|
border-width: 2px;
|
|
22
22
|
border-style: solid;
|
|
23
|
-
padding: 0 getSpacer(3xs) 0 getSpacer(s);
|
|
23
|
+
padding: 0 spacers.getSpacer(3xs) 0 spacers.getSpacer(s);
|
|
24
24
|
font-family: inherit;
|
|
25
|
-
font-size:
|
|
25
|
+
font-size: font-settings.$font-size-sm;
|
|
26
26
|
line-height: 1.3rem; // Custom fordi teksten skal henge bedre sammen om den går over to linjer
|
|
27
27
|
|
|
28
28
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
29
|
-
padding: getSpacer(3xs) getSpacer(3xs) getSpacer(3xs) getSpacer(s);
|
|
30
|
-
font-size:
|
|
29
|
+
padding: spacers.getSpacer(3xs) spacers.getSpacer(3xs) spacers.getSpacer(3xs) spacers.getSpacer(s);
|
|
30
|
+
font-size: font-settings.$font-size-md;
|
|
31
31
|
line-height: 1.5rem;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -37,80 +37,80 @@
|
|
|
37
37
|
|
|
38
38
|
&:disabled {
|
|
39
39
|
cursor: initial;
|
|
40
|
-
color:
|
|
40
|
+
color: palette.$neutral700;
|
|
41
41
|
background-color: transparent;
|
|
42
|
-
border-color:
|
|
42
|
+
border-color: palette.$neutral600;
|
|
43
43
|
border-style: dashed;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
&--on-white,
|
|
47
47
|
&--on-grey {
|
|
48
|
-
border-color:
|
|
49
|
-
background-color:
|
|
48
|
+
border-color: palette.$neutral700;
|
|
49
|
+
background-color: palette.$white;
|
|
50
50
|
|
|
51
51
|
&:hover {
|
|
52
|
-
background-color:
|
|
53
|
-
box-shadow: 0 0 0 1px
|
|
52
|
+
background-color: palette.$neutral50;
|
|
53
|
+
box-shadow: 0 0 0 1px palette.$neutral700;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
&:focus {
|
|
57
|
-
border-color:
|
|
58
|
-
box-shadow: 0 0 0 1px
|
|
57
|
+
border-color: palette.$black;
|
|
58
|
+
box-shadow: 0 0 0 1px palette.$black;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
&--on-blueberry {
|
|
63
|
-
border-color:
|
|
64
|
-
background-color:
|
|
63
|
+
border-color: palette.$blueberry500;
|
|
64
|
+
background-color: palette.$white;
|
|
65
65
|
|
|
66
66
|
&:hover {
|
|
67
|
-
background-color:
|
|
68
|
-
box-shadow: 0 0 0 1px
|
|
67
|
+
background-color: palette.$blueberry50;
|
|
68
|
+
box-shadow: 0 0 0 1px palette.$blueberry500;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
&:focus {
|
|
72
|
-
border-color:
|
|
73
|
-
box-shadow: 0 0 0 1px
|
|
72
|
+
border-color: palette.$black;
|
|
73
|
+
box-shadow: 0 0 0 1px palette.$black;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
&--on-cherry {
|
|
78
|
-
border-color:
|
|
79
|
-
background-color:
|
|
78
|
+
border-color: palette.$cherry500;
|
|
79
|
+
background-color: palette.$white;
|
|
80
80
|
|
|
81
81
|
&:hover {
|
|
82
|
-
background-color:
|
|
83
|
-
box-shadow: 0 0 0 1px
|
|
82
|
+
background-color: palette.$cherry50;
|
|
83
|
+
box-shadow: 0 0 0 1px palette.$cherry500;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
&:focus {
|
|
87
|
-
border-color:
|
|
88
|
-
box-shadow: 0 0 0 1px
|
|
87
|
+
border-color: palette.$black;
|
|
88
|
+
box-shadow: 0 0 0 1px palette.$black;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
&--open#{&}--on-white,
|
|
93
93
|
&--open#{&}--on-grey {
|
|
94
|
-
background-color:
|
|
94
|
+
background-color: palette.$neutral50;
|
|
95
95
|
|
|
96
96
|
&:hover {
|
|
97
|
-
background-color:
|
|
97
|
+
background-color: palette.$white;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
&--open#{&}--on-blueberry {
|
|
102
|
-
background-color:
|
|
102
|
+
background-color: palette.$blueberry50;
|
|
103
103
|
|
|
104
104
|
&:hover {
|
|
105
|
-
background-color:
|
|
105
|
+
background-color: palette.$white;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
&--open#{&}--on-cherry {
|
|
110
|
-
background-color:
|
|
110
|
+
background-color: palette.$cherry50;
|
|
111
111
|
|
|
112
112
|
&:hover {
|
|
113
|
-
background-color:
|
|
113
|
+
background-color: palette.$white;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -120,24 +120,24 @@
|
|
|
120
120
|
|
|
121
121
|
&--transparent#{&}--on-grey {
|
|
122
122
|
&:hover {
|
|
123
|
-
background-color:
|
|
123
|
+
background-color: palette.$neutral100;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
&--transparent#{&}--on-blueberry {
|
|
128
128
|
&:hover {
|
|
129
|
-
background-color:
|
|
129
|
+
background-color: palette.$blueberry100;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
&--transparent#{&}--on-cherry {
|
|
134
134
|
&:hover {
|
|
135
|
-
background-color:
|
|
135
|
+
background-color: palette.$cherry100;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
&--transparent#{&}--open#{&}--on-grey {
|
|
140
|
-
background-color:
|
|
140
|
+
background-color: palette.$neutral100;
|
|
141
141
|
|
|
142
142
|
&:hover {
|
|
143
143
|
background-color: transparent;
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
&--transparent#{&}--open#{&}--on-blueberry {
|
|
148
|
-
background-color:
|
|
148
|
+
background-color: palette.$blueberry100;
|
|
149
149
|
|
|
150
150
|
&:hover {
|
|
151
151
|
background-color: transparent;
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
&--transparent#{&}--open#{&}--on-cherry {
|
|
156
|
-
background-color:
|
|
156
|
+
background-color: palette.$cherry100;
|
|
157
157
|
|
|
158
158
|
&:hover {
|
|
159
159
|
background-color: transparent;
|
|
@@ -165,24 +165,24 @@
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
&__label {
|
|
168
|
-
padding: getSpacer(3xs) 0;
|
|
168
|
+
padding: spacers.getSpacer(3xs) 0;
|
|
169
169
|
|
|
170
170
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
171
|
-
padding: getSpacer(2xs) 0;
|
|
171
|
+
padding: spacers.getSpacer(2xs) 0;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
&__icon {
|
|
177
|
-
margin-left: getSpacer(2xs);
|
|
177
|
+
margin-left: spacers.getSpacer(2xs);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
&__content {
|
|
181
181
|
display: none;
|
|
182
182
|
position: absolute;
|
|
183
|
-
background-color:
|
|
184
|
-
margin-top: getSpacer(2xs);
|
|
185
|
-
box-shadow: 0 0 0 2px
|
|
183
|
+
background-color: palette.$white;
|
|
184
|
+
margin-top: spacers.getSpacer(2xs);
|
|
185
|
+
box-shadow: 0 0 0 2px palette.$blueberry500;
|
|
186
186
|
z-index: 1;
|
|
187
187
|
|
|
188
188
|
&--open {
|
|
@@ -203,15 +203,15 @@
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
&__close {
|
|
206
|
-
padding: getSpacer(s);
|
|
206
|
+
padding: spacers.getSpacer(s);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
&__input {
|
|
210
|
-
border-bottom: 1px solid
|
|
211
|
-
padding: getSpacer(2xs) getSpacer(s);
|
|
210
|
+
border-bottom: 1px solid palette.$neutral300;
|
|
211
|
+
padding: spacers.getSpacer(2xs) spacers.getSpacer(s);
|
|
212
212
|
|
|
213
213
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
214
|
-
padding: getSpacer(s);
|
|
214
|
+
padding: spacers.getSpacer(s);
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
&:last-child {
|
|
@@ -56,7 +56,8 @@ const Duolist = (props) => {
|
|
|
56
56
|
const duolistClasses = classNames(duolistStyles.duolist, {
|
|
57
57
|
[duolistStyles["duolist--line"]]: hasLines,
|
|
58
58
|
[duolistStyles["duolist--non-formatted"]]: nonFormatted,
|
|
59
|
-
[duolistStyles["duolist--collapsed"]]: useCollapsedMode
|
|
59
|
+
[duolistStyles["duolist--collapsed"]]: useCollapsedMode,
|
|
60
|
+
[duolistStyles["duolist--not-collapsed"]]: !useCollapsedMode
|
|
60
61
|
});
|
|
61
62
|
const duolistColumnStyle = descriptionWidth ? descriptionWidth + "%" : "minmax(60%, 1fr)";
|
|
62
63
|
return /* @__PURE__ */ jsxs("div", { className: duolistWrapperClasses, "data-testid": testId, "data-analyticsid": AnalyticsId.Duolist, children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Duolist/Duolist.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport Spacer from '../Spacer';\nimport { TitleProps } from '../Title';\n\nimport duolistStyles from './styles.module.scss';\n\nexport type DuolistVariants = 'normal' | 'line';\nexport type BoldColumn = 'first' | 'second' | 'none';\nexport type Border = 'no-border' | 'border';\nexport type Formats = 'formatted' | 'non-formatted';\n\nexport interface DuolistProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Label of the Duolist */\n border?: Border;\n /** Label of the Duolist */\n label?: React.ReactElement<TitleProps>;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets the visual variant of the Duolist. */\n variant?: DuolistVariants;\n /** Sets the content of the Duolist. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Width of the description column in percentage */\n descriptionWidth?: number;\n /** Use collapsed mode on columns from chosen breakpoint and below. */\n useCollapsedFromAndBelowBreakpoint?: keyof typeof Breakpoint;\n}\n\nexport interface DuolistGroupProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Sets content of the <dd> tag. */\n description: React.ReactNode;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets content of the <dt> tag. */\n term: React.ReactNode;\n}\n\nexport const DuolistGroup: React.FC<DuolistGroupProps> = props => {\n const { format = 'formatted', boldColumn = format === 'non-formatted' ? 'none' : 'first', description, separator = ': ', term } = props;\n\n const firstBold = boldColumn === 'first';\n const secondBold = boldColumn === 'second';\n const nonFormatted = format === 'non-formatted';\n\n const dtClassNames = classNames(duolistStyles['duolist__dt'], {\n [duolistStyles['duolist__dt--bold']]: firstBold,\n [duolistStyles['duolist__dt--non-formatted']]: nonFormatted,\n });\n const ddClassNames = classNames(duolistStyles['duolist__dd'], {\n [duolistStyles['duolist__dd--bold']]: secondBold,\n [duolistStyles['duolist__dd--non-formatted']]: nonFormatted,\n });\n\n const renderContent = () => {\n return (\n <>\n <dt data-separator={nonFormatted ? separator : undefined} className={dtClassNames}>\n {term}\n </dt>\n <dd className={ddClassNames}>{description}</dd>\n </>\n );\n };\n\n return nonFormatted ? <div>{renderContent()}</div> : <>{renderContent()}</>;\n};\n\nexport const Duolist: React.FC<DuolistProps> = props => {\n const {\n boldColumn,\n border = 'no-border',\n descriptionWidth,\n label,\n format = 'formatted',\n separator,\n variant = 'normal',\n children,\n className,\n testId,\n useCollapsedFromAndBelowBreakpoint,\n } = props;\n\n const hasBorder = border === 'border';\n const hasLines = variant === 'line';\n const extraPaddingTop = hasBorder && (label || hasLines);\n const nonFormatted = format === 'non-formatted';\n const breakpoint = useBreakpoint();\n const useCollapsedMode = useCollapsedFromAndBelowBreakpoint && breakpoint <= Breakpoint[useCollapsedFromAndBelowBreakpoint];\n\n const duolistWrapperClasses = classNames(\n {\n [duolistStyles['duolist-wrapper--border']]: hasBorder,\n [duolistStyles['duolist-wrapper--extra-padding-top']]: extraPaddingTop,\n },\n className\n );\n\n const duolistClasses = classNames(duolistStyles.duolist, {\n [duolistStyles['duolist--line']]: hasLines,\n [duolistStyles['duolist--non-formatted']]: nonFormatted,\n [duolistStyles['duolist--collapsed']]: useCollapsedMode,\n });\n\n const duolistColumnStyle = descriptionWidth ? descriptionWidth + '%' : 'minmax(60%, 1fr)';\n\n return (\n <div className={duolistWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.Duolist}>\n {label && (\n <>\n {label}\n <Spacer />\n </>\n )}\n <dl\n style={!nonFormatted ? { gridTemplateColumns: useCollapsedMode ? `1fr` : `auto ${duolistColumnStyle}` } : undefined}\n className={duolistClasses}\n >\n {React.Children.map(children, (child: React.ReactNode | React.ReactElement<DuolistGroupProps>) => {\n if (child === null || typeof child === 'undefined') return;\n const duolistGroup = child as React.ReactElement<DuolistGroupProps>;\n if (duolistGroup.type === DuolistGroup) {\n return React.cloneElement(child as React.ReactElement<DuolistGroupProps>, {\n boldColumn: duolistGroup.props.boldColumn ?? boldColumn,\n format: duolistGroup.props.format ?? format,\n separator: duolistGroup.props.separator ?? separator,\n });\n }\n })}\n </dl>\n </div>\n );\n};\n\nexport default Duolist;\n"],"names":["React"],"mappings":";;;;;;;AAsDO,MAAM,eAA4C,CAAS,UAAA;AAChE,QAAM,EAAE,SAAS,aAAa,aAAa,WAAW,kBAAkB,SAAS,SA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oCAAoC,CAAC,GAAG;AAAA,IACzD;AAAA,IACA;AAAA,EACF;AAEM,QAAA,iBAAiB,WAAW,cAAc,SAAS;AAAA,IACvD,CAAC,cAAc,eAAe,CAAC,GAAG;AAAA,IAClC,CAAC,cAAc,wBAAwB,CAAC,GAAG;AAAA,IAC3C,CAAC,cAAc,oBAAoB,CAAC,GAAG;AAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Duolist/Duolist.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport Spacer from '../Spacer';\nimport { TitleProps } from '../Title';\n\nimport duolistStyles from './styles.module.scss';\n\nexport type DuolistVariants = 'normal' | 'line';\nexport type BoldColumn = 'first' | 'second' | 'none';\nexport type Border = 'no-border' | 'border';\nexport type Formats = 'formatted' | 'non-formatted';\n\nexport interface DuolistProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Label of the Duolist */\n border?: Border;\n /** Label of the Duolist */\n label?: React.ReactElement<TitleProps>;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets the visual variant of the Duolist. */\n variant?: DuolistVariants;\n /** Sets the content of the Duolist. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Width of the description column in percentage */\n descriptionWidth?: number;\n /** Use collapsed mode on columns from chosen breakpoint and below. */\n useCollapsedFromAndBelowBreakpoint?: keyof typeof Breakpoint;\n}\n\nexport interface DuolistGroupProps {\n /** Determines which column is bold */\n boldColumn?: BoldColumn;\n /** Sets content of the <dd> tag. */\n description: React.ReactNode;\n /** Formatted or non-formatted visual variants */\n format?: Formats;\n /** Character separator for non-formatted format */\n separator?: string;\n /** Sets content of the <dt> tag. */\n term: React.ReactNode;\n}\n\nexport const DuolistGroup: React.FC<DuolistGroupProps> = props => {\n const { format = 'formatted', boldColumn = format === 'non-formatted' ? 'none' : 'first', description, separator = ': ', term } = props;\n\n const firstBold = boldColumn === 'first';\n const secondBold = boldColumn === 'second';\n const nonFormatted = format === 'non-formatted';\n\n const dtClassNames = classNames(duolistStyles['duolist__dt'], {\n [duolistStyles['duolist__dt--bold']]: firstBold,\n [duolistStyles['duolist__dt--non-formatted']]: nonFormatted,\n });\n const ddClassNames = classNames(duolistStyles['duolist__dd'], {\n [duolistStyles['duolist__dd--bold']]: secondBold,\n [duolistStyles['duolist__dd--non-formatted']]: nonFormatted,\n });\n\n const renderContent = () => {\n return (\n <>\n <dt data-separator={nonFormatted ? separator : undefined} className={dtClassNames}>\n {term}\n </dt>\n <dd className={ddClassNames}>{description}</dd>\n </>\n );\n };\n\n return nonFormatted ? <div>{renderContent()}</div> : <>{renderContent()}</>;\n};\n\nexport const Duolist: React.FC<DuolistProps> = props => {\n const {\n boldColumn,\n border = 'no-border',\n descriptionWidth,\n label,\n format = 'formatted',\n separator,\n variant = 'normal',\n children,\n className,\n testId,\n useCollapsedFromAndBelowBreakpoint,\n } = props;\n\n const hasBorder = border === 'border';\n const hasLines = variant === 'line';\n const extraPaddingTop = hasBorder && (label || hasLines);\n const nonFormatted = format === 'non-formatted';\n const breakpoint = useBreakpoint();\n const useCollapsedMode = useCollapsedFromAndBelowBreakpoint && breakpoint <= Breakpoint[useCollapsedFromAndBelowBreakpoint];\n\n const duolistWrapperClasses = classNames(\n {\n [duolistStyles['duolist-wrapper--border']]: hasBorder,\n [duolistStyles['duolist-wrapper--extra-padding-top']]: extraPaddingTop,\n },\n className\n );\n\n const duolistClasses = classNames(duolistStyles.duolist, {\n [duolistStyles['duolist--line']]: hasLines,\n [duolistStyles['duolist--non-formatted']]: nonFormatted,\n [duolistStyles['duolist--collapsed']]: useCollapsedMode,\n [duolistStyles['duolist--not-collapsed']]: !useCollapsedMode,\n });\n\n const duolistColumnStyle = descriptionWidth ? descriptionWidth + '%' : 'minmax(60%, 1fr)';\n\n return (\n <div className={duolistWrapperClasses} data-testid={testId} data-analyticsid={AnalyticsId.Duolist}>\n {label && (\n <>\n {label}\n <Spacer />\n </>\n )}\n <dl\n style={!nonFormatted ? { gridTemplateColumns: useCollapsedMode ? `1fr` : `auto ${duolistColumnStyle}` } : undefined}\n className={duolistClasses}\n >\n {React.Children.map(children, (child: React.ReactNode | React.ReactElement<DuolistGroupProps>) => {\n if (child === null || typeof child === 'undefined') return;\n const duolistGroup = child as React.ReactElement<DuolistGroupProps>;\n if (duolistGroup.type === DuolistGroup) {\n return React.cloneElement(child as React.ReactElement<DuolistGroupProps>, {\n boldColumn: duolistGroup.props.boldColumn ?? boldColumn,\n format: duolistGroup.props.format ?? format,\n separator: duolistGroup.props.separator ?? separator,\n });\n }\n })}\n </dl>\n </div>\n );\n};\n\nexport default Duolist;\n"],"names":["React"],"mappings":";;;;;;;AAsDO,MAAM,eAA4C,CAAS,UAAA;AAChE,QAAM,EAAE,SAAS,aAAa,aAAa,WAAW,kBAAkB,SAAS,SAAS,aAAa,YAAY,MAAM,KAAS,IAAA;AAElI,QAAM,YAAY,eAAe;AACjC,QAAM,aAAa,eAAe;AAClC,QAAM,eAAe,WAAW;AAEhC,QAAM,eAAe,WAAW,cAAc,aAAa,GAAG;AAAA,IAC5D,CAAC,cAAc,mBAAmB,CAAC,GAAG;AAAA,IACtC,CAAC,cAAc,4BAA4B,CAAC,GAAG;AAAA,EAAA,CAChD;AACD,QAAM,eAAe,WAAW,cAAc,aAAa,GAAG;AAAA,IAC5D,CAAC,cAAc,mBAAmB,CAAC,GAAG;AAAA,IACtC,CAAC,cAAc,4BAA4B,CAAC,GAAG;AAAA,EAAA,CAChD;AAED,QAAM,gBAAgB,MAAM;AAC1B,WAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,oBAAC,QAAG,kBAAgB,eAAe,YAAY,QAAW,WAAW,cAClE,UACH,KAAA,CAAA;AAAA,MACC,oBAAA,MAAA,EAAG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eAAe,EAAE,qBAAqB,mBAAmB,QAAQ,QAAQ,kBAAkB,GAAO,IAAA;AAAA,QAC1G,WAAW;AAAA,QAEV,UAAMA,eAAA,SAAS,IAAI,UAAU,CAAC,UAAmE;AAChG,cAAI,UAAU,QAAQ,OAAO,UAAU,YAAa;AACpD,gBAAM,eAAe;AACjB,cAAA,aAAa,SAAS,cAAc;AAC/B,mBAAAA,eAAM,aAAa,OAAgD;AAAA,cACxE,YAAY,aAAa,MAAM,cAAc;AAAA,cAC7C,QAAQ,aAAa,MAAM,UAAU;AAAA,cACrC,WAAW,aAAa,MAAM,aAAa;AAAA,YAAA,CAC5C;AAAA,UAAA;AAAA,QAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ;"}
|
|
@@ -1,40 +1,35 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
2
|
+
@use '../../scss/font-mixins' as fonts;
|
|
3
|
+
@use '../../scss/spacers' as spacers;
|
|
4
|
+
@use '../../scss/font-settings' as font-settings;
|
|
5
|
+
@use '../../scss/palette' as palette;
|
|
6
|
+
@use '../../scss/breakpoints' as *;
|
|
7
|
+
@import '../../scss/supernova/styles/colors';
|
|
6
8
|
|
|
7
9
|
.duolist-wrapper {
|
|
8
10
|
&--border {
|
|
9
|
-
padding: getSpacer(s) getSpacer(s) getSpacer(l);
|
|
10
|
-
border: 0.062rem solid
|
|
11
|
+
padding: spacers.getSpacer(s) spacers.getSpacer(s) spacers.getSpacer(l);
|
|
12
|
+
border: 0.062rem solid palette.$neutral500;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
&--extra-padding-top {
|
|
14
|
-
padding-top: getSpacer(xl);
|
|
15
|
-
padding-bottom: getSpacer(xl);
|
|
16
|
+
padding-top: spacers.getSpacer(xl);
|
|
17
|
+
padding-bottom: spacers.getSpacer(xl);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
.duolist {
|
|
20
|
-
font-size: $font-size-sm;
|
|
21
|
-
margin: 0;
|
|
22
22
|
display: grid;
|
|
23
23
|
|
|
24
|
-
@media (min-width: map.get($grid-breakpoints, sm)) {
|
|
25
|
-
font-size: $font-size-md;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
&__dt {
|
|
29
|
-
|
|
25
|
+
@include fonts.definition-list-data;
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
padding-right: 2.6669rem;
|
|
33
|
-
}
|
|
27
|
+
padding-right: spacers.getSpacer(l);
|
|
34
28
|
|
|
35
29
|
&--non-formatted {
|
|
36
30
|
padding-right: 0;
|
|
37
31
|
}
|
|
32
|
+
|
|
38
33
|
&--non-formatted#{&}::after {
|
|
39
34
|
content: attr(data-separator);
|
|
40
35
|
font-weight: 400;
|
|
@@ -42,21 +37,15 @@
|
|
|
42
37
|
}
|
|
43
38
|
|
|
44
39
|
&__dd {
|
|
40
|
+
@include fonts.definition-list-data;
|
|
41
|
+
|
|
45
42
|
margin-inline-start: 0;
|
|
46
43
|
}
|
|
47
44
|
|
|
48
45
|
&__dt,
|
|
49
46
|
&__dd {
|
|
50
|
-
line-height: $lineheight-size-md;
|
|
51
|
-
padding-bottom: getSpacer(2xs);
|
|
52
|
-
|
|
53
|
-
&:last-of-type {
|
|
54
|
-
padding-bottom: 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
47
|
&--bold {
|
|
58
|
-
|
|
59
|
-
line-height: $lineheight-size-sm;
|
|
48
|
+
@include fonts.definition-list-type;
|
|
60
49
|
}
|
|
61
50
|
|
|
62
51
|
&--non-formatted {
|
|
@@ -64,19 +53,52 @@
|
|
|
64
53
|
}
|
|
65
54
|
}
|
|
66
55
|
|
|
56
|
+
&--collapsed {
|
|
57
|
+
dt {
|
|
58
|
+
padding-bottom: spacers.getSpacer(3xs);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
dd {
|
|
62
|
+
padding-bottom: spacers.getSpacer(s);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&--not-collapsed {
|
|
67
|
+
dt,
|
|
68
|
+
dd {
|
|
69
|
+
padding-bottom: spacers.getSpacer(2xs);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
67
73
|
&--collapsed &__dd {
|
|
68
74
|
border-top: 0 !important;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
&--line
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
&--line#{&}--collapsed {
|
|
78
|
+
dt {
|
|
79
|
+
padding-top: spacers.getSpacer(3xs);
|
|
80
|
+
padding-top: spacers.getSpacer(2xs);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
dd {
|
|
84
|
+
padding-bottom: spacers.getSpacer(2xs);
|
|
85
|
+
border-bottom: 1px solid var(--color-base-border-onlight);
|
|
86
|
+
|
|
87
|
+
&:last-of-type {
|
|
88
|
+
border-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&--line#{&}--not-collapsed {
|
|
94
|
+
dt,
|
|
95
|
+
dd {
|
|
96
|
+
border-top: 1px solid var(--color-base-border-onlight);
|
|
97
|
+
padding-top: spacers.getSpacer(2xs);
|
|
76
98
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
&:last-of-type {
|
|
100
|
+
border-bottom: 0.062rem solid var(--color-base-border-onlight);
|
|
101
|
+
}
|
|
80
102
|
}
|
|
81
103
|
}
|
|
82
104
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
@use '../../scss/font-mixins' as fonts;
|
|
3
|
-
@
|
|
4
|
-
@
|
|
3
|
+
@use '../../scss/spacers' as spacers;
|
|
4
|
+
@use '../../scss/breakpoints' as *;
|
|
5
5
|
@import '../../scss/supernova/styles/colors';
|
|
6
6
|
|
|
7
7
|
.emptystate {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-flow: row;
|
|
10
|
-
gap: getSpacer(s);
|
|
11
|
-
padding: getSpacer(s);
|
|
10
|
+
gap: spacers.getSpacer(s);
|
|
11
|
+
padding: spacers.getSpacer(s);
|
|
12
12
|
align-items: center;
|
|
13
13
|
|
|
14
14
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
15
|
-
gap: getSpacer(m);
|
|
16
|
-
padding: getSpacer(l);
|
|
15
|
+
gap: spacers.getSpacer(m);
|
|
16
|
+
padding: spacers.getSpacer(l);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
&--dashed {
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
border: none;
|
|
28
28
|
|
|
29
29
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
30
|
-
padding-left: getSpacer(2xs);
|
|
30
|
+
padding-left: spacers.getSpacer(2xs);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&--compact {
|
|
35
35
|
border-radius: 4px;
|
|
36
|
-
gap: getSpacer(3xs);
|
|
37
|
-
padding: getSpacer(2xs);
|
|
38
|
-
min-height: getSpacer(2xl);
|
|
36
|
+
gap: spacers.getSpacer(3xs);
|
|
37
|
+
padding: spacers.getSpacer(2xs);
|
|
38
|
+
min-height: spacers.getSpacer(2xl);
|
|
39
39
|
font-size: 1rem;
|
|
40
40
|
font-weight: 400;
|
|
41
41
|
line-height: 1.25rem;
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
&__text {
|
|
50
50
|
display: flex;
|
|
51
51
|
flex-flow: column;
|
|
52
|
-
gap: getSpacer(3xs);
|
|
52
|
+
gap: spacers.getSpacer(3xs);
|
|
53
53
|
|
|
54
54
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
55
|
-
gap: getSpacer(xs);
|
|
55
|
+
gap: spacers.getSpacer(xs);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@import '../../scss/font-settings';
|
|
2
|
+
@use '../../scss/spacers' as spacers;
|
|
3
|
+
@use '../../scss/breakpoints' as *;
|
|
4
|
+
@use '../../scss/font-mixins' as fonts;
|
|
6
5
|
|
|
7
6
|
.error-wrapper {
|
|
8
|
-
position: relative;
|
|
9
|
-
|
|
10
7
|
&--with-error {
|
|
11
|
-
padding
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
padding-right: getSpacer(xs);
|
|
16
|
-
background-color: $cherry100;
|
|
17
|
-
border-left: getSpacer(3xs) solid $cherry600;
|
|
8
|
+
padding: spacers.getSpacer(s) spacers.getSpacer(xs) spacers.getSpacer(m) spacers.getSpacer(2xs);
|
|
9
|
+
background-color: var(--color-notification-background-error);
|
|
10
|
+
border: 1px solid var(--core-color-cherry-400);
|
|
11
|
+
border-left: 4px solid var(--color-notification-border-error);
|
|
18
12
|
|
|
19
13
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
20
|
-
|
|
21
|
-
margin-right: (getSpacer(m) + 0.25rem) * -1;
|
|
22
|
-
padding-left: getSpacer(m);
|
|
23
|
-
padding-right: getSpacer(m);
|
|
14
|
+
padding: spacers.getSpacer(s) spacers.getSpacer(m) spacers.getSpacer(l) spacers.getSpacer(m);
|
|
24
15
|
}
|
|
25
16
|
}
|
|
26
17
|
|
|
27
18
|
&__errors {
|
|
28
|
-
line-height: 1.875rem;
|
|
29
|
-
font-size: $font-size-sm;
|
|
30
|
-
font-weight: 600;
|
|
31
|
-
color: $cherry600;
|
|
32
19
|
margin-top: 0;
|
|
20
|
+
color: var(--color-notification-border-error);
|
|
21
|
+
|
|
22
|
+
@include fonts.label;
|
|
33
23
|
}
|
|
34
24
|
}
|