@helsenorge/designsystem-react 7.2.1 → 7.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
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [7.2.1](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.2.0&targetVersion=GTv7.2.1) (2024-04-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- i button med accessibility-character-arrow er pilen skjult for skjermleser
|
|
6
|
+
([0a8fd28](https://github.com/helsenorge/designsystem/commit/0a8fd28f16234ff8ca620c5b086d22b080a2cb17)), closes
|
|
7
|
+
[#273312](https://github.com/helsenorge/designsystem/issues/273312)
|
|
8
|
+
- width satt feil på popmenu ([fb4dc2d](https://github.com/helsenorge/designsystem/commit/fb4dc2d7af645e640a44f7800318f2ffcc64f195)), closes
|
|
9
|
+
[#323102](https://github.com/helsenorge/designsystem/issues/323102)
|
|
10
|
+
|
|
1
11
|
## [7.2.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.1.0&targetVersion=GTv7.2.0) (2024-04-19)
|
|
2
12
|
|
|
3
13
|
### Features
|
|
@@ -1377,12 +1387,12 @@ Dette er fordi vi skal kunne dynamisk importere alt som ligger i Icons, så da b
|
|
|
1377
1387
|
|
|
1378
1388
|
### Bug Fixes
|
|
1379
1389
|
|
|
1380
|
-
- økt kontrast på understreking av lenker
|
|
1381
|
-
([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
|
|
1382
|
-
[#229049](https://github.com/helsenorge/designsystem/issues/229049)
|
|
1383
1390
|
- panel har avstand fra tittel til badge
|
|
1384
1391
|
([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
|
|
1385
1392
|
[#282359](https://github.com/helsenorge/designsystem/issues/282359)
|
|
1393
|
+
- økt kontrast på understreking av lenker
|
|
1394
|
+
([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
|
|
1395
|
+
[#229049](https://github.com/helsenorge/designsystem/issues/229049)
|
|
1386
1396
|
|
|
1387
1397
|
## [1.2.2](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv1.2.1&targetVersion=GTv1.2.2) (2022-08-31)
|
|
1388
1398
|
|
|
@@ -26,6 +26,8 @@ export interface SelectProps extends Pick<React.SelectHTMLAttributes<HTMLSelectE
|
|
|
26
26
|
width?: number;
|
|
27
27
|
/** Gives defaultvalue to the comp. Preferred over selected prop on option by react */
|
|
28
28
|
defaultValue?: string | number;
|
|
29
|
+
/** Adds custom classes to the wrapper tag */
|
|
30
|
+
wrapperClassName?: boolean;
|
|
29
31
|
}
|
|
30
32
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
31
33
|
export default Select;
|
|
@@ -1,68 +1,69 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
import
|
|
3
|
-
import { FormMode as
|
|
2
|
+
import s from "classnames";
|
|
3
|
+
import { FormMode as F, AnalyticsId as H, IconSize as M, AVERAGE_CHARACTER_WIDTH_PX as U } from "../../constants.js";
|
|
4
4
|
import { useUuid as w } from "../../hooks/useUuid.js";
|
|
5
|
-
import { getColor as
|
|
6
|
-
import
|
|
7
|
-
import { Icon as
|
|
8
|
-
import
|
|
9
|
-
import { renderLabel as
|
|
5
|
+
import { getColor as v } from "../../theme/currys/color.js";
|
|
6
|
+
import V from "../ErrorWrapper/ErrorWrapper.js";
|
|
7
|
+
import { Icon as X } from "../Icon/Icon.js";
|
|
8
|
+
import j from "../Icons/ChevronDown.js";
|
|
9
|
+
import { renderLabel as B } from "../Label/Label.js";
|
|
10
10
|
import e from "../Select/styles.module.scss";
|
|
11
|
-
const
|
|
11
|
+
const G = (o) => `calc(${o * U}px + 2rem)`, L = (o, t) => t ? v("neutral", 500) : v(o ? "cherry" : "blueberry", 600), P = r.forwardRef(function(t, c) {
|
|
12
12
|
const {
|
|
13
|
-
className:
|
|
13
|
+
className: y,
|
|
14
14
|
children: I,
|
|
15
15
|
concept: h = "normal",
|
|
16
|
-
disabled:
|
|
16
|
+
disabled: l,
|
|
17
17
|
error: E,
|
|
18
|
-
errorText:
|
|
18
|
+
errorText: i,
|
|
19
19
|
errorTextId: x,
|
|
20
20
|
label: S,
|
|
21
|
-
selectId:
|
|
22
|
-
name: W =
|
|
23
|
-
mode:
|
|
24
|
-
testId:
|
|
25
|
-
width:
|
|
26
|
-
required:
|
|
27
|
-
value:
|
|
21
|
+
selectId: d,
|
|
22
|
+
name: W = d,
|
|
23
|
+
mode: n = F.onwhite,
|
|
24
|
+
testId: N,
|
|
25
|
+
width: m,
|
|
26
|
+
required: p,
|
|
27
|
+
value: g,
|
|
28
28
|
defaultValue: R,
|
|
29
|
-
autoComplete:
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
autoComplete: u = "off",
|
|
30
|
+
wrapperClassName: T,
|
|
31
|
+
...A
|
|
32
|
+
} = t, f = w(d), b = w(x), C = n === "onblueberry", a = n === "oninvalid" || !!i || !!E, _ = L(a, !!l), $ = m ? G(m) : void 0, q = s(
|
|
32
33
|
e["select-inner-wrapper"],
|
|
33
34
|
{
|
|
34
35
|
[e["select-inner-wrapper--transparent"]]: h === "transparent",
|
|
35
|
-
[e["select-inner-wrapper--on-blueberry"]]:
|
|
36
|
+
[e["select-inner-wrapper--on-blueberry"]]: C,
|
|
36
37
|
[e["select-inner-wrapper--invalid"]]: a,
|
|
37
|
-
[e["select-inner-wrapper--disabled"]]:
|
|
38
|
+
[e["select-inner-wrapper--disabled"]]: l
|
|
38
39
|
},
|
|
39
|
-
|
|
40
|
-
),
|
|
41
|
-
[e["select--on-blueberry"]]:
|
|
40
|
+
y
|
|
41
|
+
), z = s(e.select, {
|
|
42
|
+
[e["select--on-blueberry"]]: C,
|
|
42
43
|
[e["select--invalid"]]: a
|
|
43
|
-
});
|
|
44
|
-
return /* @__PURE__ */ r.createElement(
|
|
44
|
+
}), D = s(e["select-wrapper"], T);
|
|
45
|
+
return /* @__PURE__ */ r.createElement(V, { errorText: i, errorTextId: b }, /* @__PURE__ */ r.createElement("div", { "data-testid": N, "data-analyticsid": H.Select, className: D, style: { maxWidth: $ } }, B(S, f, n), /* @__PURE__ */ r.createElement("div", { className: q }, /* @__PURE__ */ r.createElement(X, { className: e["select-arrow"], svgIcon: j, color: _, size: M.XSmall }), /* @__PURE__ */ r.createElement(
|
|
45
46
|
"select",
|
|
46
47
|
{
|
|
47
48
|
"aria-invalid": !!a,
|
|
48
|
-
id:
|
|
49
|
+
id: f,
|
|
49
50
|
name: W,
|
|
50
|
-
className:
|
|
51
|
-
disabled:
|
|
51
|
+
className: z,
|
|
52
|
+
disabled: l,
|
|
52
53
|
ref: c,
|
|
53
|
-
required:
|
|
54
|
-
"aria-describedby": [t["aria-describedby"] || "",
|
|
55
|
-
"aria-required": !!
|
|
56
|
-
value:
|
|
54
|
+
required: p,
|
|
55
|
+
"aria-describedby": [t["aria-describedby"] || "", b].join(" "),
|
|
56
|
+
"aria-required": !!p,
|
|
57
|
+
value: g,
|
|
57
58
|
defaultValue: R,
|
|
58
|
-
autoComplete:
|
|
59
|
-
...
|
|
59
|
+
autoComplete: u || void 0,
|
|
60
|
+
...A
|
|
60
61
|
},
|
|
61
62
|
I
|
|
62
63
|
))));
|
|
63
|
-
}),
|
|
64
|
+
}), oe = P;
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
P as Select,
|
|
67
|
+
oe as default
|
|
67
68
|
};
|
|
68
69
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n /** Adds custom classes to the wrapper tag */\n wrapperClassName?: boolean;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n const selectWrapperClasses = classNames(selectStyles['select-wrapper'], wrapperClassName);\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel(label, uuid, mode as FormMode)}\n <div className={selectInnerWrapperClasses}>\n <Icon className={selectStyles['select-arrow']} svgIcon={ChevronDown} color={iconColor} size={IconSize.XSmall} />\n <select\n aria-invalid={!!invalid}\n id={uuid}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={[props['aria-describedby'] || '', errorTextUuid].join(' ')}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n {...rest}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n});\n\nexport default Select;\n"],"names":["getSelectMaxWidth","characters","AVERAGE_CHARACTER_WIDTH_PX","getIconColor","invalid","disabled","getColor","Select","React","props","ref","className","children","concept","error","errorText","errorTextId","label","selectId","name","mode","FormMode","testId","width","required","value","defaultValue","autoComplete","wrapperClassName","rest","uuid","useUuid","errorTextUuid","onBlueberry","iconColor","maxWidth","selectInnerWrapperClasses","classNames","selectStyles","selectClasses","selectWrapperClasses","ErrorWrapper","AnalyticsId","renderLabel","Icon","ChevronDown","IconSize","Select$1"],"mappings":";;;;;;;;;;AAiDA,MAAMA,IAAoB,CAACC,MAGlB,QAAQA,IAAaC,CAA0B,cAGlDC,IAAe,CAACC,GAAkBC,MAE/BA,IAAWC,EAAS,WAAW,GAAG,IAAIA,EAD3BF,IAAU,WAAW,aAC0B,GAAG,GAGzDG,IAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAmC;AAClH,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAR;AAAA,IACA,OAAAS;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AA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