@navikt/ds-react 0.19.14 → 0.19.15
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/_docs.json +19 -0
- package/cjs/form/Select.js +2 -2
- package/esm/form/Select.d.ts +4 -0
- package/esm/form/Select.js +2 -2
- package/esm/form/Select.js.map +1 -1
- package/package.json +2 -2
- package/src/form/Select.tsx +6 -1
package/_docs.json
CHANGED
|
@@ -960,6 +960,25 @@
|
|
|
960
960
|
"name": "boolean"
|
|
961
961
|
}
|
|
962
962
|
},
|
|
963
|
+
"style": {
|
|
964
|
+
"defaultValue": null,
|
|
965
|
+
"description": "Sets inline-style on select wrapper",
|
|
966
|
+
"name": "style",
|
|
967
|
+
"parent": {
|
|
968
|
+
"fileName": "src/form/Select.tsx",
|
|
969
|
+
"name": "SelectProps"
|
|
970
|
+
},
|
|
971
|
+
"declarations": [
|
|
972
|
+
{
|
|
973
|
+
"fileName": "src/form/Select.tsx",
|
|
974
|
+
"name": "SelectProps"
|
|
975
|
+
}
|
|
976
|
+
],
|
|
977
|
+
"required": false,
|
|
978
|
+
"type": {
|
|
979
|
+
"name": "CSSProperties"
|
|
980
|
+
}
|
|
981
|
+
},
|
|
963
982
|
"error": {
|
|
964
983
|
"defaultValue": null,
|
|
965
984
|
"description": "Error message for element",
|
package/cjs/form/Select.js
CHANGED
|
@@ -45,7 +45,7 @@ const __1 = require("..");
|
|
|
45
45
|
const useFormField_1 = require("./useFormField");
|
|
46
46
|
exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
47
47
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = (0, useFormField_1.useFormField)(props, "textField");
|
|
48
|
-
const { children, label, className, description, htmlSize, hideLabel = false } = props, rest = __rest(props, ["children", "label", "className", "description", "htmlSize", "hideLabel"]);
|
|
48
|
+
const { children, label, className, description, htmlSize, hideLabel = false, style } = props, rest = __rest(props, ["children", "label", "className", "description", "htmlSize", "hideLabel", "style"]);
|
|
49
49
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(className, "navds-form-field", `navds-form-field--${size}`, {
|
|
50
50
|
"navds-form-field--disabled": !!inputProps.disabled,
|
|
51
51
|
"navds-select--error": hasError,
|
|
@@ -58,7 +58,7 @@ exports.Select = (0, react_1.forwardRef)((props, ref) => {
|
|
|
58
58
|
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (react_1.default.createElement(__1.Detail, { className: (0, classnames_1.default)("navds-form-field__description", {
|
|
59
59
|
"navds-sr-only": hideLabel,
|
|
60
60
|
}), id: inputDescriptionId, size: "small", as: "div" }, description)))),
|
|
61
|
-
react_1.default.createElement("div", { className: "navds-select__container" },
|
|
61
|
+
react_1.default.createElement("div", { className: "navds-select__container", style: style },
|
|
62
62
|
react_1.default.createElement("select", Object.assign({}, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, className: (0, classnames_1.default)("navds-select__input", "navds-body-short", `navds-body--${size !== null && size !== void 0 ? size : "medium"}`), size: props.htmlSize }), children),
|
|
63
63
|
react_1.default.createElement(ds_icons_1.Expand, { className: "navds-select__chevron", "aria-hidden": true })),
|
|
64
64
|
react_1.default.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (react_1.default.createElement(__1.ErrorMessage, { size: size }, props.error)))));
|
package/esm/form/Select.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export interface SelectProps extends FormFieldProps, Omit<SelectHTMLAttributes<H
|
|
|
17
17
|
* If enabled shows the label and description for screenreaders only
|
|
18
18
|
*/
|
|
19
19
|
hideLabel?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sets inline-style on select wrapper
|
|
22
|
+
*/
|
|
23
|
+
style?: React.CSSProperties;
|
|
20
24
|
}
|
|
21
25
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
22
26
|
export default Select;
|
package/esm/form/Select.js
CHANGED
|
@@ -16,7 +16,7 @@ import { BodyShort, Label, ErrorMessage, omit, Detail } from "..";
|
|
|
16
16
|
import { useFormField } from "./useFormField";
|
|
17
17
|
export const Select = forwardRef((props, ref) => {
|
|
18
18
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "textField");
|
|
19
|
-
const { children, label, className, description, htmlSize, hideLabel = false } = props, rest = __rest(props, ["children", "label", "className", "description", "htmlSize", "hideLabel"]);
|
|
19
|
+
const { children, label, className, description, htmlSize, hideLabel = false, style } = props, rest = __rest(props, ["children", "label", "className", "description", "htmlSize", "hideLabel", "style"]);
|
|
20
20
|
return (React.createElement("div", { className: cl(className, "navds-form-field", `navds-form-field--${size}`, {
|
|
21
21
|
"navds-form-field--disabled": !!inputProps.disabled,
|
|
22
22
|
"navds-select--error": hasError,
|
|
@@ -29,7 +29,7 @@ export const Select = forwardRef((props, ref) => {
|
|
|
29
29
|
}), id: inputDescriptionId, size: "small", as: "div" }, description)) : (React.createElement(Detail, { className: cl("navds-form-field__description", {
|
|
30
30
|
"navds-sr-only": hideLabel,
|
|
31
31
|
}), id: inputDescriptionId, size: "small", as: "div" }, description)))),
|
|
32
|
-
React.createElement("div", { className: "navds-select__container" },
|
|
32
|
+
React.createElement("div", { className: "navds-select__container", style: style },
|
|
33
33
|
React.createElement("select", Object.assign({}, omit(rest, ["error", "errorId", "size"]), inputProps, { ref: ref, className: cl("navds-select__input", "navds-body-short", `navds-body--${size !== null && size !== void 0 ? size : "medium"}`), size: props.htmlSize }), children),
|
|
34
34
|
React.createElement(Expand, { className: "navds-select__chevron", "aria-hidden": true })),
|
|
35
35
|
React.createElement("div", { className: "navds-form-field__error", id: errorId, "aria-relevant": "additions removals", "aria-live": "polite" }, showErrorMsg && (React.createElement(ErrorMessage, { size: size }, props.error)))));
|
package/esm/form/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../src/form/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G,oBAAoB,eACxB,QAAQ,IAEjB,YAAY,IAAI,CACf,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAC,KAAK,CAAgB,CACvD,CACG,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.15",
|
|
4
4
|
"description": "NAV designsystem react components",
|
|
5
5
|
"author": "NAV Designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"@types/react": "^17.0.30 || ^18.0.0",
|
|
77
77
|
"react": "^17.0.0 || ^18.0.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "15636896bd07e8d253fc28091cc847a8a1860b50"
|
|
80
80
|
}
|
package/src/form/Select.tsx
CHANGED
|
@@ -23,6 +23,10 @@ export interface SelectProps
|
|
|
23
23
|
* If enabled shows the label and description for screenreaders only
|
|
24
24
|
*/
|
|
25
25
|
hideLabel?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Sets inline-style on select wrapper
|
|
28
|
+
*/
|
|
29
|
+
style?: React.CSSProperties;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
@@ -43,6 +47,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
43
47
|
description,
|
|
44
48
|
htmlSize,
|
|
45
49
|
hideLabel = false,
|
|
50
|
+
style,
|
|
46
51
|
...rest
|
|
47
52
|
} = props;
|
|
48
53
|
|
|
@@ -95,7 +100,7 @@ export const Select = forwardRef<HTMLSelectElement, SelectProps>(
|
|
|
95
100
|
)}
|
|
96
101
|
</>
|
|
97
102
|
)}
|
|
98
|
-
<div className="navds-select__container">
|
|
103
|
+
<div className="navds-select__container" style={style}>
|
|
99
104
|
<select
|
|
100
105
|
{...omit(rest, ["error", "errorId", "size"])}
|
|
101
106
|
{...inputProps}
|