@norges-domstoler/dds-components 13.8.7 → 13.9.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/README.md +4 -2
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -21
package/README.md
CHANGED
|
@@ -22,8 +22,10 @@ import { Button, TextInput } from '@norges-domstoler/dds-components';
|
|
|
22
22
|
const App = () => (
|
|
23
23
|
<>
|
|
24
24
|
<TextInput label="Input" />
|
|
25
|
-
<Button
|
|
26
|
-
<Button purpose="secondary" appearance="ghost"
|
|
25
|
+
<Button>Primary</Button>
|
|
26
|
+
<Button purpose="secondary" appearance="ghost">
|
|
27
|
+
Secondary
|
|
28
|
+
</Button>
|
|
27
29
|
</>
|
|
28
30
|
);
|
|
29
31
|
|
package/dist/index.d.mts
CHANGED
|
@@ -294,8 +294,13 @@ type PickedHTMLAttributes$1 = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
294
294
|
type ButtonProps$1 = BaseComponentProps<HTMLButtonElement, {
|
|
295
295
|
/**Størrelsen på knappen. */
|
|
296
296
|
size?: ButtonSize;
|
|
297
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* Innhold i knappen. Hvis `children` er definert så blir den prioritert.
|
|
299
|
+
* @deprecated Bruk `children` i stedet.
|
|
300
|
+
* */
|
|
298
301
|
label?: string | ReactElement;
|
|
302
|
+
/**Innhold i knappen. Denne blir prioritert over `label`. */
|
|
303
|
+
children?: ReactNode;
|
|
299
304
|
/**Bestemmer farger basert på formål. */
|
|
300
305
|
purpose?: ButtonPurpose;
|
|
301
306
|
/** Posisjonen til ikonet i forhold til teksten.*/
|
|
@@ -319,6 +324,7 @@ type ButtonProps$1 = BaseComponentProps<HTMLButtonElement, {
|
|
|
319
324
|
declare const Button: react.ForwardRefExoticComponent<Pick<Omit<react.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onFocus" | "onBlur" | "onClick">, "className" | "id"> & {
|
|
320
325
|
size?: ButtonSize | undefined;
|
|
321
326
|
label?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
|
|
327
|
+
children?: react.ReactNode;
|
|
322
328
|
purpose?: ButtonPurpose | undefined;
|
|
323
329
|
iconPosition?: IconPosition | undefined;
|
|
324
330
|
appearance?: ButtonAppearance | undefined;
|
|
@@ -1584,8 +1590,9 @@ declare const StyledTextArea: styled_components.StyledComponent<"input", any, Pi
|
|
|
1584
1590
|
prefixLength?: number | undefined;
|
|
1585
1591
|
suffixLength?: number | undefined;
|
|
1586
1592
|
} & Pick<_norges_domstoler_dds_form.InputProps, "componentSize">, never>;
|
|
1593
|
+
declare const TextArea: react.ForwardRefExoticComponent<_norges_domstoler_dds_form.CommonInputProps & react.TextareaHTMLAttributes<HTMLTextAreaElement> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
1594
|
+
|
|
1587
1595
|
type TextAreaProps = CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
1588
|
-
declare const TextArea: react.ForwardRefExoticComponent<CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
1589
1596
|
|
|
1590
1597
|
type SplitButtonPurpose = ExtractStrict<ButtonPurpose, 'primary' | 'secondary'>;
|
|
1591
1598
|
type SplitButtonProps = {
|
package/dist/index.d.ts
CHANGED
|
@@ -294,8 +294,13 @@ type PickedHTMLAttributes$1 = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
294
294
|
type ButtonProps$1 = BaseComponentProps<HTMLButtonElement, {
|
|
295
295
|
/**Størrelsen på knappen. */
|
|
296
296
|
size?: ButtonSize;
|
|
297
|
-
/**
|
|
297
|
+
/**
|
|
298
|
+
* Innhold i knappen. Hvis `children` er definert så blir den prioritert.
|
|
299
|
+
* @deprecated Bruk `children` i stedet.
|
|
300
|
+
* */
|
|
298
301
|
label?: string | ReactElement;
|
|
302
|
+
/**Innhold i knappen. Denne blir prioritert over `label`. */
|
|
303
|
+
children?: ReactNode;
|
|
299
304
|
/**Bestemmer farger basert på formål. */
|
|
300
305
|
purpose?: ButtonPurpose;
|
|
301
306
|
/** Posisjonen til ikonet i forhold til teksten.*/
|
|
@@ -319,6 +324,7 @@ type ButtonProps$1 = BaseComponentProps<HTMLButtonElement, {
|
|
|
319
324
|
declare const Button: react.ForwardRefExoticComponent<Pick<Omit<react.ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onFocus" | "onBlur" | "onClick">, "className" | "id"> & {
|
|
320
325
|
size?: ButtonSize | undefined;
|
|
321
326
|
label?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
|
|
327
|
+
children?: react.ReactNode;
|
|
322
328
|
purpose?: ButtonPurpose | undefined;
|
|
323
329
|
iconPosition?: IconPosition | undefined;
|
|
324
330
|
appearance?: ButtonAppearance | undefined;
|
|
@@ -1584,8 +1590,9 @@ declare const StyledTextArea: styled_components.StyledComponent<"input", any, Pi
|
|
|
1584
1590
|
prefixLength?: number | undefined;
|
|
1585
1591
|
suffixLength?: number | undefined;
|
|
1586
1592
|
} & Pick<_norges_domstoler_dds_form.InputProps, "componentSize">, never>;
|
|
1593
|
+
declare const TextArea: react.ForwardRefExoticComponent<_norges_domstoler_dds_form.CommonInputProps & react.TextareaHTMLAttributes<HTMLTextAreaElement> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
1594
|
+
|
|
1587
1595
|
type TextAreaProps = CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
1588
|
-
declare const TextArea: react.ForwardRefExoticComponent<CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
1589
1596
|
|
|
1590
1597
|
type SplitButtonPurpose = ExtractStrict<ButtonPurpose, 'primary' | 'secondary'>;
|
|
1591
1598
|
type SplitButtonProps = {
|
package/dist/index.js
CHANGED
|
@@ -996,6 +996,7 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
996
996
|
(props, ref) => {
|
|
997
997
|
const {
|
|
998
998
|
label: label3,
|
|
999
|
+
children,
|
|
999
1000
|
purpose = "primary",
|
|
1000
1001
|
size = "medium",
|
|
1001
1002
|
iconPosition = "left",
|
|
@@ -1015,12 +1016,11 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
1015
1016
|
...rest
|
|
1016
1017
|
} = props;
|
|
1017
1018
|
const as = href ? "a" : "button";
|
|
1018
|
-
const hasLabel = !!label3;
|
|
1019
|
+
const hasLabel = !!children || !!label3;
|
|
1019
1020
|
const hasIcon = !!icon12;
|
|
1020
1021
|
const wrapperProps = {
|
|
1021
1022
|
...(0, import_dds_core6.getBaseHTMLProps)(id, className, htmlProps, rest),
|
|
1022
1023
|
href,
|
|
1023
|
-
label: label3,
|
|
1024
1024
|
as,
|
|
1025
1025
|
rel: href ? "noreferrer noopener" : void 0,
|
|
1026
1026
|
target: href && target ? target : void 0,
|
|
@@ -1054,7 +1054,7 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
1054
1054
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(ButtonWrapper, { ...wrapperProps, "aria-disabled": loading, children: [
|
|
1055
1055
|
!isIconButton && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1056
1056
|
iconPosition === "left" && iconElement,
|
|
1057
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { isHidden: loading, "aria-hidden": loading, children: label3 }),
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { isHidden: loading, "aria-hidden": loading, children: children != null ? children : label3 }),
|
|
1058
1058
|
iconPosition === "right" && iconElement
|
|
1059
1059
|
] }),
|
|
1060
1060
|
isIconButton && iconElement,
|
|
@@ -4428,9 +4428,9 @@ var Search = (0, import_react25.forwardRef)(
|
|
|
4428
4428
|
Button,
|
|
4429
4429
|
{
|
|
4430
4430
|
size: componentSize,
|
|
4431
|
-
label: buttonLabel || "S\xF8k",
|
|
4432
4431
|
onClick,
|
|
4433
|
-
...otherButtonProps
|
|
4432
|
+
...otherButtonProps,
|
|
4433
|
+
children: buttonLabel || "S\xF8k"
|
|
4434
4434
|
}
|
|
4435
4435
|
)
|
|
4436
4436
|
]
|
|
@@ -5527,14 +5527,14 @@ var Pagination = (0, import_react44.forwardRef)(
|
|
|
5527
5527
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ListItem2, { children: item !== "truncator" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5528
5528
|
Button,
|
|
5529
5529
|
{
|
|
5530
|
-
label: item.toString(),
|
|
5531
5530
|
purpose: isActive ? "primary" : "secondary",
|
|
5532
5531
|
appearance: isActive ? "filled" : "ghost",
|
|
5533
5532
|
size: "small",
|
|
5534
5533
|
onClick: (event) => {
|
|
5535
5534
|
onPageChange(event, item);
|
|
5536
5535
|
},
|
|
5537
|
-
"aria-label": isActive ? `N\xE5v\xE6rende side (side ${item})` : `G\xE5 til side ${item}
|
|
5536
|
+
"aria-label": isActive ? `N\xE5v\xE6rende side (side ${item})` : `G\xE5 til side ${item}`,
|
|
5537
|
+
children: item
|
|
5538
5538
|
}
|
|
5539
5539
|
) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5540
5540
|
import_dds_icons24.Icon,
|
|
@@ -5602,11 +5602,11 @@ var Pagination = (0, import_react44.forwardRef)(
|
|
|
5602
5602
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ListItem2, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5603
5603
|
Button,
|
|
5604
5604
|
{
|
|
5605
|
-
label: activePage.toString(),
|
|
5606
5605
|
size: "small",
|
|
5607
5606
|
onClick: (event) => {
|
|
5608
5607
|
onPageChange(event, activePage);
|
|
5609
|
-
}
|
|
5608
|
+
},
|
|
5609
|
+
children: activePage
|
|
5610
5610
|
}
|
|
5611
5611
|
) }),
|
|
5612
5612
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ListItem2, { isHidden: isOnLastPage, "aria-hidden": isOnLastPage, children: nextPageButton }),
|
|
@@ -10150,7 +10150,6 @@ var FileUploader = (props) => {
|
|
|
10150
10150
|
type: "button",
|
|
10151
10151
|
appearance: "filled",
|
|
10152
10152
|
purpose: "secondary",
|
|
10153
|
-
label: "Velg fil",
|
|
10154
10153
|
icon: import_dds_icons42.UploadIcon,
|
|
10155
10154
|
htmlProps: {
|
|
10156
10155
|
"aria-invalid": hasRootErrors ? true : void 0,
|
|
@@ -10158,7 +10157,8 @@ var FileUploader = (props) => {
|
|
|
10158
10157
|
hasTip ? tipId : void 0,
|
|
10159
10158
|
...rootErrorsList.map((e) => e.id)
|
|
10160
10159
|
])
|
|
10161
|
-
}
|
|
10160
|
+
},
|
|
10161
|
+
children: "Velg fil"
|
|
10162
10162
|
}
|
|
10163
10163
|
)
|
|
10164
10164
|
]
|
|
@@ -10356,11 +10356,11 @@ var CommentComponent = ({
|
|
|
10356
10356
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
10357
10357
|
Button,
|
|
10358
10358
|
{
|
|
10359
|
-
label: "Send inn",
|
|
10360
10359
|
purpose: "secondary",
|
|
10361
10360
|
size: "small",
|
|
10362
10361
|
onClick: handleSubmit,
|
|
10363
|
-
loading
|
|
10362
|
+
loading,
|
|
10363
|
+
children: "Send inn"
|
|
10364
10364
|
}
|
|
10365
10365
|
)
|
|
10366
10366
|
] });
|