@navikt/ds-react 3.2.2 → 3.2.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.
- package/_docs.json +20 -1
- package/cjs/date/DateInput.js +3 -2
- package/cjs/form/search/Search.js +3 -2
- package/esm/copybutton/CopyButton.d.ts +2 -1
- package/esm/copybutton/CopyButton.js.map +1 -1
- package/esm/date/DateInput.js +4 -3
- package/esm/date/DateInput.js.map +1 -1
- package/esm/form/search/Search.d.ts +4 -0
- package/esm/form/search/Search.js +3 -2
- package/esm/form/search/Search.js.map +1 -1
- package/package.json +2 -2
- package/src/copybutton/CopyButton.tsx +2 -1
- package/src/copybutton/copy-button.stories.tsx +33 -1
- package/src/date/DateInput.tsx +15 -17
- package/src/date/datepicker/datepicker.stories.tsx +19 -0
- package/src/form/search/Search.tsx +8 -0
- package/src/form/search/search.stories.tsx +25 -0
package/_docs.json
CHANGED
|
@@ -1278,7 +1278,7 @@
|
|
|
1278
1278
|
],
|
|
1279
1279
|
"required": false,
|
|
1280
1280
|
"type": {
|
|
1281
|
-
"name": "\"medium\" | \"small\""
|
|
1281
|
+
"name": "\"medium\" | \"small\" | \"xsmall\""
|
|
1282
1282
|
}
|
|
1283
1283
|
},
|
|
1284
1284
|
"variant": {
|
|
@@ -13088,6 +13088,25 @@
|
|
|
13088
13088
|
"name": "\"primary\" | \"secondary\" | \"simple\""
|
|
13089
13089
|
}
|
|
13090
13090
|
},
|
|
13091
|
+
"htmlSize": {
|
|
13092
|
+
"defaultValue": null,
|
|
13093
|
+
"description": "Exposes the HTML size attribute",
|
|
13094
|
+
"name": "htmlSize",
|
|
13095
|
+
"parent": {
|
|
13096
|
+
"fileName": "src/form/search/Search.tsx",
|
|
13097
|
+
"name": "SearchProps"
|
|
13098
|
+
},
|
|
13099
|
+
"declarations": [
|
|
13100
|
+
{
|
|
13101
|
+
"fileName": "src/form/search/Search.tsx",
|
|
13102
|
+
"name": "SearchProps"
|
|
13103
|
+
}
|
|
13104
|
+
],
|
|
13105
|
+
"required": false,
|
|
13106
|
+
"type": {
|
|
13107
|
+
"name": "string | number"
|
|
13108
|
+
}
|
|
13109
|
+
},
|
|
13091
13110
|
"error": {
|
|
13092
13111
|
"defaultValue": null,
|
|
13093
13112
|
"description": "Error message for element",
|
package/cjs/date/DateInput.js
CHANGED
|
@@ -70,9 +70,10 @@ const DateInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
70
70
|
}), id: inputDescriptionId, size: size }, description)),
|
|
71
71
|
react_1.default.createElement("div", { className: "navds-date__field-wrapper" },
|
|
72
72
|
react_1.default.createElement("input", Object.assign({ ref: ref }, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { autoComplete: "off", "aria-controls": ariaId, className: (0, clsx_1.default)("navds-date__field-input", "navds-text-field__input", "navds-body-short", `navds-body-${size}`), size: 14 })),
|
|
73
|
-
react_1.default.createElement(
|
|
73
|
+
react_1.default.createElement("button", { disabled: inputProps.disabled, tabIndex: open ? -1 : 0, onClick: () => onOpen(), type: "button", className: "navds-date__field-button" },
|
|
74
|
+
react_1.default.createElement(aksel_icons_1.CalendarIcon, { pointerEvents: "none", title: open
|
|
74
75
|
? conditionalVariables.iconTitle.close
|
|
75
|
-
: conditionalVariables.iconTitle.open })
|
|
76
|
+
: conditionalVariables.iconTitle.open }))),
|
|
76
77
|
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)))));
|
|
77
78
|
});
|
|
78
79
|
exports.DatePickerInput = (0, react_1.forwardRef)((props, ref) => react_1.default.createElement(DateInput, Object.assign({}, props, { ref: ref })));
|
|
@@ -47,7 +47,7 @@ const SearchButton_1 = __importDefault(require("./SearchButton"));
|
|
|
47
47
|
exports.SearchContext = react_1.default.createContext(null);
|
|
48
48
|
exports.Search = (0, react_1.forwardRef)((props, ref) => {
|
|
49
49
|
const { inputProps, size = "medium", inputDescriptionId, errorId, showErrorMsg, hasError, } = (0, useFormField_1.useFormField)(props, "searchfield");
|
|
50
|
-
const { className, hideLabel = true, label, description, value, clearButtonLabel, onClear, clearButton = true, children, variant = "primary", defaultValue, onChange, onSearchClick } = props, rest = __rest(props, ["className", "hideLabel", "label", "description", "value", "clearButtonLabel", "onClear", "clearButton", "children", "variant", "defaultValue", "onChange", "onSearchClick"]);
|
|
50
|
+
const { className, hideLabel = true, label, description, value, clearButtonLabel, onClear, clearButton = true, children, variant = "primary", defaultValue, onChange, onSearchClick, htmlSize } = props, rest = __rest(props, ["className", "hideLabel", "label", "description", "value", "clearButtonLabel", "onClear", "clearButton", "children", "variant", "defaultValue", "onChange", "onSearchClick", "htmlSize"]);
|
|
51
51
|
const searchRef = (0, react_1.useRef)(null);
|
|
52
52
|
const mergedRef = (0, react_1.useMemo)(() => (0, __1.mergeRefs)([searchRef, ref]), [ref]);
|
|
53
53
|
const [wrapperRef, setWrapperRef] = (0, react_1.useState)(null);
|
|
@@ -74,6 +74,7 @@ exports.Search = (0, react_1.forwardRef)((props, ref) => {
|
|
|
74
74
|
return (react_1.default.createElement("div", { ref: setWrapperRef, className: (0, clsx_1.default)(className, "navds-form-field", `navds-form-field--${size}`, "navds-search", {
|
|
75
75
|
"navds-search--error": hasError,
|
|
76
76
|
"navds-search--disabled": !!inputProps.disabled,
|
|
77
|
+
"navds-search--with-size": !!htmlSize,
|
|
77
78
|
}) },
|
|
78
79
|
react_1.default.createElement(__1.Label, { htmlFor: inputProps.id, size: size, className: (0, clsx_1.default)("navds-form-field__label", {
|
|
79
80
|
"navds-sr-only": hideLabel,
|
|
@@ -84,7 +85,7 @@ exports.Search = (0, react_1.forwardRef)((props, ref) => {
|
|
|
84
85
|
react_1.default.createElement("div", { className: "navds-search__wrapper" },
|
|
85
86
|
react_1.default.createElement("div", { className: "navds-search__wrapper-inner" },
|
|
86
87
|
variant === "simple" && (react_1.default.createElement(aksel_icons_1.MagnifyingGlassIcon, { "aria-hidden": true, className: "navds-search__search-icon" })),
|
|
87
|
-
react_1.default.createElement("input", Object.assign({ ref: mergedRef }, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: (0, clsx_1.default)(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body-${size}`) })),
|
|
88
|
+
react_1.default.createElement("input", Object.assign({ ref: mergedRef }, (0, __1.omit)(rest, ["error", "errorId", "size"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: (0, clsx_1.default)(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body-${size}`) }, (htmlSize ? { size: Number(htmlSize) } : {}))),
|
|
88
89
|
(value !== null && value !== void 0 ? value : internalValue) && clearButton && (react_1.default.createElement("button", { type: "button", onClick: (e) => handleClear({ trigger: "Click", event: e }), className: "navds-search__button-clear" },
|
|
89
90
|
react_1.default.createElement("span", { className: "navds-sr-only" }, clearButtonLabel ? clearButtonLabel : "Tøm"),
|
|
90
91
|
react_1.default.createElement(aksel_icons_1.XMarkIcon, { "aria-hidden": true })))),
|
|
@@ -2,8 +2,9 @@ import React, { ButtonHTMLAttributes } from "react";
|
|
|
2
2
|
export interface CopyButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
3
3
|
/**
|
|
4
4
|
* @default "medium"
|
|
5
|
+
* xsmall should only be used in tables/
|
|
5
6
|
*/
|
|
6
|
-
size?: "medium" | "small";
|
|
7
|
+
size?: "medium" | "small" | "xsmall";
|
|
7
8
|
/**
|
|
8
9
|
* @default "neutral"
|
|
9
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/copybutton/CopyButton.tsx"],"names":[],"mappings":";;;;;;;;;;;AA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CACP,oBAAC,SAAS,mBACK,CAAC,CAAC,IAAI,EACnB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAC/B,CACH,CACI,CACR;YAEA,IAAI;gBACH,CAAC,MAAM,CAAC,CAAC,CAAC,CACR,oBAAC,KAAK,IACJ,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,eAClC,QAAQ,IAEjB,UAAU,CACL,CACT,CAAC,CAAC,CAAC,CACF,oBAAC,KAAK,IACJ,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,eAClC,QAAQ,IAEjB,IAAI,CACC,CACT,CAAC,CACC,CACA,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/esm/date/DateInput.js
CHANGED
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { CalendarIcon } from "@navikt/aksel-icons";
|
|
13
13
|
import cl from "clsx";
|
|
14
14
|
import React, { forwardRef } from "react";
|
|
15
|
-
import { BodyShort,
|
|
15
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
16
16
|
import { useFormField } from "../form/useFormField";
|
|
17
17
|
import { useDateInputContext } from "./context";
|
|
18
18
|
const DateInput = forwardRef((props, ref) => {
|
|
@@ -41,9 +41,10 @@ const DateInput = forwardRef((props, ref) => {
|
|
|
41
41
|
}), id: inputDescriptionId, size: size }, description)),
|
|
42
42
|
React.createElement("div", { className: "navds-date__field-wrapper" },
|
|
43
43
|
React.createElement("input", Object.assign({ ref: ref }, omit(rest, ["error", "errorId", "size"]), inputProps, { autoComplete: "off", "aria-controls": ariaId, className: cl("navds-date__field-input", "navds-text-field__input", "navds-body-short", `navds-body-${size}`), size: 14 })),
|
|
44
|
-
React.createElement(
|
|
44
|
+
React.createElement("button", { disabled: inputProps.disabled, tabIndex: open ? -1 : 0, onClick: () => onOpen(), type: "button", className: "navds-date__field-button" },
|
|
45
|
+
React.createElement(CalendarIcon, { pointerEvents: "none", title: open
|
|
45
46
|
? conditionalVariables.iconTitle.close
|
|
46
|
-
: conditionalVariables.iconTitle.open })
|
|
47
|
+
: conditionalVariables.iconTitle.open }))),
|
|
47
48
|
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)))));
|
|
48
49
|
});
|
|
49
50
|
export const DatePickerInput = forwardRef((props, ref) => React.createElement(DateInput, Object.assign({}, props, { ref: ref })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../src/date/DateInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../src/date/DateInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AA6BhD,MAAM,SAAS,GAAkB,UA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U,CAGtD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,oBAAC,SAAS,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,gBAAgB,GAAkB,UAAU,CAGvD,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,oBAAC,SAAS,oBAAK,KAAK,IAAE,OAAO,EAAC,aAAa,EAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC"}
|
|
@@ -47,6 +47,10 @@ export interface SearchProps extends FormFieldProps, Omit<InputHTMLAttributes<HT
|
|
|
47
47
|
* @default "primary"
|
|
48
48
|
*/
|
|
49
49
|
variant?: "primary" | "secondary" | "simple";
|
|
50
|
+
/**
|
|
51
|
+
* Exposes the HTML size attribute
|
|
52
|
+
*/
|
|
53
|
+
htmlSize?: number | string;
|
|
50
54
|
}
|
|
51
55
|
interface SearchComponent extends React.ForwardRefExoticComponent<SearchProps & React.RefAttributes<HTMLDivElement>> {
|
|
52
56
|
Button: SearchButtonType;
|
|
@@ -18,7 +18,7 @@ import SearchButton from "./SearchButton";
|
|
|
18
18
|
export const SearchContext = React.createContext(null);
|
|
19
19
|
export const Search = forwardRef((props, ref) => {
|
|
20
20
|
const { inputProps, size = "medium", inputDescriptionId, errorId, showErrorMsg, hasError, } = useFormField(props, "searchfield");
|
|
21
|
-
const { className, hideLabel = true, label, description, value, clearButtonLabel, onClear, clearButton = true, children, variant = "primary", defaultValue, onChange, onSearchClick } = props, rest = __rest(props, ["className", "hideLabel", "label", "description", "value", "clearButtonLabel", "onClear", "clearButton", "children", "variant", "defaultValue", "onChange", "onSearchClick"]);
|
|
21
|
+
const { className, hideLabel = true, label, description, value, clearButtonLabel, onClear, clearButton = true, children, variant = "primary", defaultValue, onChange, onSearchClick, htmlSize } = props, rest = __rest(props, ["className", "hideLabel", "label", "description", "value", "clearButtonLabel", "onClear", "clearButton", "children", "variant", "defaultValue", "onChange", "onSearchClick", "htmlSize"]);
|
|
22
22
|
const searchRef = useRef(null);
|
|
23
23
|
const mergedRef = useMemo(() => mergeRefs([searchRef, ref]), [ref]);
|
|
24
24
|
const [wrapperRef, setWrapperRef] = useState(null);
|
|
@@ -45,6 +45,7 @@ export const Search = forwardRef((props, ref) => {
|
|
|
45
45
|
return (React.createElement("div", { ref: setWrapperRef, className: cl(className, "navds-form-field", `navds-form-field--${size}`, "navds-search", {
|
|
46
46
|
"navds-search--error": hasError,
|
|
47
47
|
"navds-search--disabled": !!inputProps.disabled,
|
|
48
|
+
"navds-search--with-size": !!htmlSize,
|
|
48
49
|
}) },
|
|
49
50
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, className: cl("navds-form-field__label", {
|
|
50
51
|
"navds-sr-only": hideLabel,
|
|
@@ -55,7 +56,7 @@ export const Search = forwardRef((props, ref) => {
|
|
|
55
56
|
React.createElement("div", { className: "navds-search__wrapper" },
|
|
56
57
|
React.createElement("div", { className: "navds-search__wrapper-inner" },
|
|
57
58
|
variant === "simple" && (React.createElement(MagnifyingGlassIcon, { "aria-hidden": true, className: "navds-search__search-icon" })),
|
|
58
|
-
React.createElement("input", Object.assign({ ref: mergedRef }, omit(rest, ["error", "errorId", "size"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: cl(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body-${size}`) })),
|
|
59
|
+
React.createElement("input", Object.assign({ ref: mergedRef }, omit(rest, ["error", "errorId", "size"]), inputProps, { value: value !== null && value !== void 0 ? value : internalValue, onChange: (e) => handleChange(e.target.value), type: "search", role: "searchbox", className: cl(className, "navds-search__input", `navds-search__input--${variant}`, "navds-text-field__input", "navds-body-short", `navds-body-${size}`) }, (htmlSize ? { size: Number(htmlSize) } : {}))),
|
|
59
60
|
(value !== null && value !== void 0 ? value : internalValue) && clearButton && (React.createElement("button", { type: "button", onClick: (e) => handleClear({ trigger: "Click", event: e }), className: "navds-search__button-clear" },
|
|
60
61
|
React.createElement("span", { className: "navds-sr-only" }, clearButtonLabel ? clearButtonLabel : "Tøm"),
|
|
61
62
|
React.createElement(XMarkIcon, { "aria-hidden": true })))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../src/form/search/Search.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,gBAAgB,GACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAAkC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.js","sourceRoot":"","sources":["../../../src/form/search/Search.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EACZ,UAAU,EAEV,WAAW,EACX,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,gBAAgB,GACjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAAkC,MAAM,gBAAgB,CAAC;AAsEhE,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAC9C,IAAI,CACL,CA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,CAAC,KAAK,CACvC;oBACP,oBAAC,SAAS,0BAAe,CAClB,CACV,CACG;YACN,oBAAC,aAAa,CAAC,QAAQ,IACrB,KAAK,EAAE;oBACL,IAAI;oBACJ,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,OAAO;oBACP,WAAW;iBACZ,IAEA,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,oBAAC,YAAY,OAAG,CACxC,CACrB;QACN,6BACE,SAAS,EAAC,yBAAyB,EACnC,EAAE,EAAE,OAAO,mBACG,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,CACiB,CAAC;AAErB,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC;AAE7B,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Aksel react-components for NAV designsystem",
|
|
5
5
|
"author": "Aksel | NAV designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "0.17.0",
|
|
41
|
-
"@navikt/aksel-icons": "^3.2.
|
|
41
|
+
"@navikt/aksel-icons": "^3.2.4",
|
|
42
42
|
"@radix-ui/react-tabs": "1.0.0",
|
|
43
43
|
"@radix-ui/react-toggle-group": "1.0.0",
|
|
44
44
|
"clsx": "^1.2.1",
|
|
@@ -14,8 +14,9 @@ export interface CopyButtonProps
|
|
|
14
14
|
extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
15
15
|
/**
|
|
16
16
|
* @default "medium"
|
|
17
|
+
* xsmall should only be used in tables/
|
|
17
18
|
*/
|
|
18
|
-
size?: "medium" | "small";
|
|
19
|
+
size?: "medium" | "small" | "xsmall";
|
|
19
20
|
/**
|
|
20
21
|
* @default "neutral"
|
|
21
22
|
*/
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
size: {
|
|
12
12
|
defaultValue: "medium",
|
|
13
13
|
control: { type: "radio" },
|
|
14
|
-
options: ["small", "medium"],
|
|
14
|
+
options: ["small", "medium", "xsmall"],
|
|
15
15
|
},
|
|
16
16
|
variant: {
|
|
17
17
|
defaultValue: undefined,
|
|
@@ -85,6 +85,22 @@ export const Sizes = {
|
|
|
85
85
|
text="Kopier"
|
|
86
86
|
/>
|
|
87
87
|
</div>
|
|
88
|
+
<div className="rowgap">
|
|
89
|
+
<CopyButton size="xsmall" copyText="3.14" variant="action" />
|
|
90
|
+
<CopyButton size="xsmall" copyText="3.14" variant="neutral" />
|
|
91
|
+
<CopyButton
|
|
92
|
+
size="xsmall"
|
|
93
|
+
copyText="3.14"
|
|
94
|
+
variant="action"
|
|
95
|
+
text="Kopier"
|
|
96
|
+
/>
|
|
97
|
+
<CopyButton
|
|
98
|
+
size="xsmall"
|
|
99
|
+
copyText="3.14"
|
|
100
|
+
variant="neutral"
|
|
101
|
+
text="Kopier"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
88
104
|
</div>
|
|
89
105
|
),
|
|
90
106
|
};
|
|
@@ -107,6 +123,14 @@ export const Texts = {
|
|
|
107
123
|
activeText="Kopierte XYZ"
|
|
108
124
|
/>
|
|
109
125
|
</div>
|
|
126
|
+
<div>
|
|
127
|
+
<CopyButton
|
|
128
|
+
copyText="3.14"
|
|
129
|
+
size="xsmall"
|
|
130
|
+
text="Kopier XYZ"
|
|
131
|
+
activeText="Kopierte XYZ"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
110
134
|
</div>
|
|
111
135
|
),
|
|
112
136
|
};
|
|
@@ -129,6 +153,14 @@ export const Icons = {
|
|
|
129
153
|
activeIcon={<ThumbUpIcon title="Kopiert" />}
|
|
130
154
|
/>
|
|
131
155
|
</div>
|
|
156
|
+
<div>
|
|
157
|
+
<CopyButton
|
|
158
|
+
copyText="3.14"
|
|
159
|
+
size="xsmall"
|
|
160
|
+
icon={<LinkIcon title="Kopier" />}
|
|
161
|
+
activeIcon={<ThumbUpIcon title="Kopiert" />}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
132
164
|
</div>
|
|
133
165
|
),
|
|
134
166
|
};
|
package/src/date/DateInput.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CalendarIcon } from "@navikt/aksel-icons";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
4
|
-
import { BodyShort,
|
|
4
|
+
import { BodyShort, ErrorMessage, Label, omit } from "..";
|
|
5
5
|
import { FormFieldProps, useFormField } from "../form/useFormField";
|
|
6
6
|
import { useDateInputContext } from "./context";
|
|
7
7
|
|
|
@@ -115,24 +115,22 @@ const DateInput: DateInputType = forwardRef<HTMLInputElement, DateInputProps>(
|
|
|
115
115
|
)}
|
|
116
116
|
size={14}
|
|
117
117
|
/>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
size="small"
|
|
118
|
+
<button
|
|
119
|
+
disabled={inputProps.disabled}
|
|
120
|
+
tabIndex={open ? -1 : 0}
|
|
122
121
|
onClick={() => onOpen()}
|
|
122
|
+
type="button"
|
|
123
123
|
className="navds-date__field-button"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
/>
|
|
124
|
+
>
|
|
125
|
+
<CalendarIcon
|
|
126
|
+
pointerEvents="none"
|
|
127
|
+
title={
|
|
128
|
+
open
|
|
129
|
+
? conditionalVariables.iconTitle.close
|
|
130
|
+
: conditionalVariables.iconTitle.open
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
</button>
|
|
136
134
|
</div>
|
|
137
135
|
<div
|
|
138
136
|
className="navds-form-field__error"
|
|
@@ -324,3 +324,22 @@ export const defaultShownMonth = () => {
|
|
|
324
324
|
</div>
|
|
325
325
|
);
|
|
326
326
|
};
|
|
327
|
+
|
|
328
|
+
export const Size = () => {
|
|
329
|
+
const { datepickerProps, inputProps } = UNSAFE_useDatepicker({
|
|
330
|
+
fromDate: new Date("Aug 23 2019"),
|
|
331
|
+
toDate: new Date("Feb 23 2024"),
|
|
332
|
+
onDateChange: console.log,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return (
|
|
336
|
+
<div style={{ display: "flex", gap: "1rem" }}>
|
|
337
|
+
<DatePicker {...datepickerProps} dropdownCaption>
|
|
338
|
+
<DatePicker.Input size="medium" {...inputProps} label="Velg dato" />
|
|
339
|
+
</DatePicker>
|
|
340
|
+
<DatePicker {...datepickerProps} dropdownCaption>
|
|
341
|
+
<DatePicker.Input size="small" {...inputProps} label="Velg dato" />
|
|
342
|
+
</DatePicker>
|
|
343
|
+
</div>
|
|
344
|
+
);
|
|
345
|
+
};
|
|
@@ -67,6 +67,10 @@ export interface SearchProps
|
|
|
67
67
|
* @default "primary"
|
|
68
68
|
*/
|
|
69
69
|
variant?: "primary" | "secondary" | "simple";
|
|
70
|
+
/**
|
|
71
|
+
* Exposes the HTML size attribute
|
|
72
|
+
*/
|
|
73
|
+
htmlSize?: number | string;
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
interface SearchComponent
|
|
@@ -112,6 +116,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
112
116
|
defaultValue,
|
|
113
117
|
onChange,
|
|
114
118
|
onSearchClick,
|
|
119
|
+
htmlSize,
|
|
115
120
|
...rest
|
|
116
121
|
} = props;
|
|
117
122
|
|
|
@@ -164,9 +169,11 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
164
169
|
"navds-form-field",
|
|
165
170
|
`navds-form-field--${size}`,
|
|
166
171
|
"navds-search",
|
|
172
|
+
|
|
167
173
|
{
|
|
168
174
|
"navds-search--error": hasError,
|
|
169
175
|
"navds-search--disabled": !!inputProps.disabled,
|
|
176
|
+
"navds-search--with-size": !!htmlSize,
|
|
170
177
|
}
|
|
171
178
|
)}
|
|
172
179
|
>
|
|
@@ -215,6 +222,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
|
|
|
215
222
|
"navds-body-short",
|
|
216
223
|
`navds-body-${size}`
|
|
217
224
|
)}
|
|
225
|
+
{...(htmlSize ? { size: Number(htmlSize) } : {})}
|
|
218
226
|
/>
|
|
219
227
|
{(value ?? internalValue) && clearButton && (
|
|
220
228
|
<button
|
|
@@ -164,3 +164,28 @@ export const NoClearButton = () => (
|
|
|
164
164
|
/>
|
|
165
165
|
</div>
|
|
166
166
|
);
|
|
167
|
+
|
|
168
|
+
export const HtmlSize = () => (
|
|
169
|
+
<div className="colgap">
|
|
170
|
+
<Search
|
|
171
|
+
label="Lorem ipsum dolor sit amet"
|
|
172
|
+
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
|
|
173
|
+
hideLabel={false}
|
|
174
|
+
htmlSize="20"
|
|
175
|
+
/>
|
|
176
|
+
<Search
|
|
177
|
+
label="Lorem ipsum dolor sit amet"
|
|
178
|
+
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
|
|
179
|
+
hideLabel={false}
|
|
180
|
+
htmlSize="20"
|
|
181
|
+
variant="secondary"
|
|
182
|
+
/>
|
|
183
|
+
<Search
|
|
184
|
+
label="Lorem ipsum dolor sit amet"
|
|
185
|
+
description="Saepe laborum delectus officia perferendis quaerat excepturi possimus hic enim dicta assumenda."
|
|
186
|
+
hideLabel={false}
|
|
187
|
+
htmlSize="20"
|
|
188
|
+
variant="simple"
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
);
|