@norges-domstoler/dds-components 22.8.1 → 22.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 +17 -18
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -3537,9 +3537,11 @@ type HeadingProps = BaseComponentPropsWithChildren<HTMLHeadingElement, {
|
|
|
3537
3537
|
level: HeadingLevel;
|
|
3538
3538
|
/**Spesifiserer typografistil basert på utvalget for HTML heading elementer. */
|
|
3539
3539
|
typographyType?: TypographyHeadingType;
|
|
3540
|
+
/**Setter standard spacing for `<Heading>` som er over et inputelement. */
|
|
3541
|
+
withMarginsOverInput?: boolean;
|
|
3540
3542
|
} & BaseTypographyProps, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'>>;
|
|
3541
3543
|
declare const Heading: {
|
|
3542
|
-
({ id, className, style, htmlProps, children, typographyType, level, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3544
|
+
({ id, className, style, htmlProps, children, typographyType, level, withMargins, withMarginsOverInput, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3543
3545
|
displayName: string;
|
|
3544
3546
|
};
|
|
3545
3547
|
|
|
@@ -3561,9 +3563,11 @@ declare const Label: {
|
|
|
3561
3563
|
type LegendProps = BaseComponentPropsWithChildren<HTMLLegendElement, BaseTypographyProps & {
|
|
3562
3564
|
/**Typografistil basert på utvalget for HTML heading elementer. */
|
|
3563
3565
|
typographyType?: TypographyHeadingType;
|
|
3566
|
+
/**Setter standard spacing for `<Legend>` som er over et inputelement. */
|
|
3567
|
+
withMarginsOverInput?: boolean;
|
|
3564
3568
|
}, Omit<HTMLAttributes<HTMLLegendElement>, 'color'>>;
|
|
3565
3569
|
declare const Legend: {
|
|
3566
|
-
({ id, className, style, htmlProps, typographyType, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
({ id, className, style, htmlProps, typographyType, withMarginsOverInput, withMargins, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3567
3571
|
displayName: string;
|
|
3568
3572
|
};
|
|
3569
3573
|
|
|
@@ -5008,7 +5012,7 @@ type SelectProps<Option = unknown, IsMulti extends boolean = false> = {
|
|
|
5008
5012
|
ref?: SelectForwardRefType<Option, IsMulti>;
|
|
5009
5013
|
} & CommonInputProps & InputIconProps & Pick<HTMLAttributes<HTMLInputElement>, 'aria-required'> & WrappedReactSelectProps<Option, IsMulti, GroupBase<Option>>;
|
|
5010
5014
|
type SelectForwardRefType<Option, IsMulti extends boolean> = Ref<SelectInstance<Option, IsMulti, GroupBase<Option>>>;
|
|
5011
|
-
declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, afterLabelContent, hideSelectedOptions, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
|
|
5015
|
+
declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, menuPlacement, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, afterLabelContent, hideSelectedOptions, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
|
|
5012
5016
|
declare namespace Select {
|
|
5013
5017
|
var displayName: string;
|
|
5014
5018
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3537,9 +3537,11 @@ type HeadingProps = BaseComponentPropsWithChildren<HTMLHeadingElement, {
|
|
|
3537
3537
|
level: HeadingLevel;
|
|
3538
3538
|
/**Spesifiserer typografistil basert på utvalget for HTML heading elementer. */
|
|
3539
3539
|
typographyType?: TypographyHeadingType;
|
|
3540
|
+
/**Setter standard spacing for `<Heading>` som er over et inputelement. */
|
|
3541
|
+
withMarginsOverInput?: boolean;
|
|
3540
3542
|
} & BaseTypographyProps, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'>>;
|
|
3541
3543
|
declare const Heading: {
|
|
3542
|
-
({ id, className, style, htmlProps, children, typographyType, level, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3544
|
+
({ id, className, style, htmlProps, children, typographyType, level, withMargins, withMarginsOverInput, ...rest }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
3543
3545
|
displayName: string;
|
|
3544
3546
|
};
|
|
3545
3547
|
|
|
@@ -3561,9 +3563,11 @@ declare const Label: {
|
|
|
3561
3563
|
type LegendProps = BaseComponentPropsWithChildren<HTMLLegendElement, BaseTypographyProps & {
|
|
3562
3564
|
/**Typografistil basert på utvalget for HTML heading elementer. */
|
|
3563
3565
|
typographyType?: TypographyHeadingType;
|
|
3566
|
+
/**Setter standard spacing for `<Legend>` som er over et inputelement. */
|
|
3567
|
+
withMarginsOverInput?: boolean;
|
|
3564
3568
|
}, Omit<HTMLAttributes<HTMLLegendElement>, 'color'>>;
|
|
3565
3569
|
declare const Legend: {
|
|
3566
|
-
({ id, className, style, htmlProps, typographyType, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3570
|
+
({ id, className, style, htmlProps, typographyType, withMarginsOverInput, withMargins, ...rest }: LegendProps): react_jsx_runtime.JSX.Element;
|
|
3567
3571
|
displayName: string;
|
|
3568
3572
|
};
|
|
3569
3573
|
|
|
@@ -5008,7 +5012,7 @@ type SelectProps<Option = unknown, IsMulti extends boolean = false> = {
|
|
|
5008
5012
|
ref?: SelectForwardRefType<Option, IsMulti>;
|
|
5009
5013
|
} & CommonInputProps & InputIconProps & Pick<HTMLAttributes<HTMLInputElement>, 'aria-required'> & WrappedReactSelectProps<Option, IsMulti, GroupBase<Option>>;
|
|
5010
5014
|
type SelectForwardRefType<Option, IsMulti extends boolean> = Ref<SelectInstance<Option, IsMulti, GroupBase<Option>>>;
|
|
5011
|
-
declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, afterLabelContent, hideSelectedOptions, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
|
|
5015
|
+
declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, menuPlacement, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, afterLabelContent, hideSelectedOptions, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
|
|
5012
5016
|
declare namespace Select {
|
|
5013
5017
|
var displayName: string;
|
|
5014
5018
|
}
|
package/dist/index.js
CHANGED
|
@@ -469,9 +469,11 @@ var typographyStyles_default = {
|
|
|
469
469
|
"heading-xlarge--margins": "typographyStyles_heading-xlarge--margins",
|
|
470
470
|
"heading-xxlarge": "typographyStyles_heading-xxlarge",
|
|
471
471
|
"heading-xxlarge--margins": "typographyStyles_heading-xxlarge--margins",
|
|
472
|
+
"heading--margins-over-input": "typographyStyles_heading--margins-over-input",
|
|
472
473
|
"label-medium": "typographyStyles_label-medium",
|
|
473
474
|
"label-medium--margins": "typographyStyles_label-medium--margins",
|
|
474
475
|
legend: "typographyStyles_legend",
|
|
476
|
+
"legend--margins-over-input": "typographyStyles_legend--margins-over-input",
|
|
475
477
|
caption: "typographyStyles_caption",
|
|
476
478
|
"caption--withMargins": "typographyStyles_caption--withMargins",
|
|
477
479
|
bold: "typographyStyles_bold",
|
|
@@ -782,6 +784,12 @@ function cn(...classNames) {
|
|
|
782
784
|
function convertCamelToHyphen(value) {
|
|
783
785
|
return value.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([a-z])([0-9])/g, "$1-$2").toLowerCase();
|
|
784
786
|
}
|
|
787
|
+
function optAttr(value, keepZero) {
|
|
788
|
+
if (keepZero && value === 0) {
|
|
789
|
+
return value;
|
|
790
|
+
}
|
|
791
|
+
return value ? value : void 0;
|
|
792
|
+
}
|
|
785
793
|
|
|
786
794
|
// src/utils/getFocusableElements.ts
|
|
787
795
|
function getFocusableElements(elementRef) {
|
|
@@ -4325,6 +4333,8 @@ var Heading = ({
|
|
|
4325
4333
|
children,
|
|
4326
4334
|
typographyType,
|
|
4327
4335
|
level,
|
|
4336
|
+
withMargins,
|
|
4337
|
+
withMarginsOverInput,
|
|
4328
4338
|
...rest
|
|
4329
4339
|
}) => {
|
|
4330
4340
|
const headingElement = getHeadingElement(level);
|
|
@@ -4332,9 +4342,19 @@ var Heading = ({
|
|
|
4332
4342
|
return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
|
|
4333
4343
|
Typography,
|
|
4334
4344
|
{
|
|
4335
|
-
...getBaseHTMLProps(
|
|
4345
|
+
...getBaseHTMLProps(
|
|
4346
|
+
id,
|
|
4347
|
+
cn(
|
|
4348
|
+
className,
|
|
4349
|
+
withMarginsOverInput && typographyStyles_default["heading--margins-over-input"]
|
|
4350
|
+
),
|
|
4351
|
+
style,
|
|
4352
|
+
htmlProps,
|
|
4353
|
+
rest
|
|
4354
|
+
),
|
|
4336
4355
|
typographyType: standardTypographyType,
|
|
4337
4356
|
as: headingElement,
|
|
4357
|
+
withMargins: optAttr(withMargins || withMarginsOverInput),
|
|
4338
4358
|
children
|
|
4339
4359
|
}
|
|
4340
4360
|
);
|
|
@@ -4413,14 +4433,26 @@ var Legend = ({
|
|
|
4413
4433
|
style,
|
|
4414
4434
|
htmlProps,
|
|
4415
4435
|
typographyType = "headingLarge",
|
|
4436
|
+
withMarginsOverInput,
|
|
4437
|
+
withMargins,
|
|
4416
4438
|
...rest
|
|
4417
4439
|
}) => {
|
|
4418
4440
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
4419
4441
|
Typography,
|
|
4420
4442
|
{
|
|
4421
|
-
...getBaseHTMLProps(
|
|
4443
|
+
...getBaseHTMLProps(
|
|
4444
|
+
id,
|
|
4445
|
+
cn(
|
|
4446
|
+
className,
|
|
4447
|
+
withMarginsOverInput && typographyStyles_default["legend--margins-over-input"]
|
|
4448
|
+
),
|
|
4449
|
+
style,
|
|
4450
|
+
htmlProps,
|
|
4451
|
+
rest
|
|
4452
|
+
),
|
|
4422
4453
|
as: "legend",
|
|
4423
|
-
typographyType
|
|
4454
|
+
typographyType,
|
|
4455
|
+
withMargins: optAttr(withMargins || withMarginsOverInput)
|
|
4424
4456
|
}
|
|
4425
4457
|
);
|
|
4426
4458
|
};
|
|
@@ -11248,9 +11280,9 @@ var getCustomStyles = (size2, hasError, isReadOnly) => ({
|
|
|
11248
11280
|
backgroundColor: "var(--dds-color-surface-hover-default)"
|
|
11249
11281
|
}
|
|
11250
11282
|
},
|
|
11251
|
-
menu: () => ({
|
|
11283
|
+
menu: (provided) => ({
|
|
11284
|
+
...provided,
|
|
11252
11285
|
boxSizing: "border-box",
|
|
11253
|
-
position: "absolute",
|
|
11254
11286
|
width: "100%",
|
|
11255
11287
|
boxShadow: "var(--dds-shadow-medium)",
|
|
11256
11288
|
zIndex: 100,
|
|
@@ -11463,6 +11495,7 @@ function Select({
|
|
|
11463
11495
|
isClearable = true,
|
|
11464
11496
|
placeholder,
|
|
11465
11497
|
menuPortalTarget,
|
|
11498
|
+
menuPlacement = "auto",
|
|
11466
11499
|
customOptionElement,
|
|
11467
11500
|
customSingleValueElement,
|
|
11468
11501
|
"data-testid": dataTestId,
|
|
@@ -11558,12 +11591,13 @@ function Select({
|
|
|
11558
11591
|
isClearable,
|
|
11559
11592
|
hideSelectedOptions: hideSelectedOptions ? hideSelectedOptions : false,
|
|
11560
11593
|
placeholder: placeholder ? placeholder : "",
|
|
11561
|
-
closeMenuOnSelect: closeMenuOnSelect ? closeMenuOnSelect : isMulti
|
|
11594
|
+
closeMenuOnSelect: closeMenuOnSelect ? closeMenuOnSelect : !isMulti,
|
|
11562
11595
|
isMulti,
|
|
11563
11596
|
instanceId: instanceId != null ? instanceId : (0, import_react74.useId)(),
|
|
11564
11597
|
inputId: uniqueId,
|
|
11565
11598
|
name: uniqueId,
|
|
11566
11599
|
menuPortalTarget: portalTarget,
|
|
11600
|
+
menuPlacement,
|
|
11567
11601
|
classNamePrefix: prefix,
|
|
11568
11602
|
styles: getCustomStyles(componentSize, hasErrorMessage, readOnly),
|
|
11569
11603
|
filterOption: (option, inputValue) => {
|