@norges-domstoler/dds-components 23.1.0 → 23.1.2
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/dist/index.css +50 -69
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +359 -329
- package/dist/index.d.ts +359 -329
- package/dist/index.js +67 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -406,7 +406,6 @@ __export(index_exports, {
|
|
|
406
406
|
removeListStyling: () => removeListStyling,
|
|
407
407
|
renderInputMessage: () => renderInputMessage,
|
|
408
408
|
scrollbarStyling: () => scrollbarStyling,
|
|
409
|
-
typographyTypes: () => typographyTypes,
|
|
410
409
|
useAccordion: () => useAccordion,
|
|
411
410
|
useAccordionContext: () => useAccordionContext,
|
|
412
411
|
useCallbackRef: () => useCallbackRef,
|
|
@@ -4849,7 +4848,7 @@ var Button = ({
|
|
|
4849
4848
|
as: propAs,
|
|
4850
4849
|
children,
|
|
4851
4850
|
purpose = "primary",
|
|
4852
|
-
size:
|
|
4851
|
+
size: propSize = "medium",
|
|
4853
4852
|
iconPosition = "left",
|
|
4854
4853
|
loading,
|
|
4855
4854
|
loadingTooltip,
|
|
@@ -4876,11 +4875,12 @@ var Button = ({
|
|
|
4876
4875
|
const isIconButton = !hasLabel && hasIcon;
|
|
4877
4876
|
const isTextButton = hasLabel && !hasIcon;
|
|
4878
4877
|
const noContent = !hasLabel && !hasIcon;
|
|
4878
|
+
const size2 = groupSize != null ? groupSize : propSize;
|
|
4879
4879
|
const buttonCn = cn(
|
|
4880
4880
|
className,
|
|
4881
4881
|
Button_default.button,
|
|
4882
4882
|
Button_default[`button--${groupPurpose ? groupPurpose : purpose}`],
|
|
4883
|
-
Button_default[`button--${
|
|
4883
|
+
Button_default[`button--${size2}`],
|
|
4884
4884
|
isTextButton && Button_default["just-text"],
|
|
4885
4885
|
...hasLabelAndIcon ? [Button_default["with-text-and-icon"], Button_default[`with-icon-${iconPosition}`]] : [],
|
|
4886
4886
|
isIconButton && Button_default["just-icon"],
|
|
@@ -6785,7 +6785,6 @@ var DateInput_default = {
|
|
|
6785
6785
|
segment: "DateInput_segment",
|
|
6786
6786
|
segment__placeholder: "DateInput_segment__placeholder",
|
|
6787
6787
|
"segment__placeholder--invisible": "DateInput_segment__placeholder--invisible",
|
|
6788
|
-
"clear-button--inactive": "DateInput_clear-button--inactive",
|
|
6789
6788
|
"icon-wrapper--disabled": "DateInput_icon-wrapper--disabled",
|
|
6790
6789
|
"popover-button": "DateInput_popover-button",
|
|
6791
6790
|
"icon-wrapper--readonly": "DateInput_icon-wrapper--readonly",
|
|
@@ -6801,8 +6800,8 @@ var DateInput_default = {
|
|
|
6801
6800
|
"calendar__cell-button": "DateInput_calendar__cell-button",
|
|
6802
6801
|
"calendar__cell-button--today": "DateInput_calendar__cell-button--today",
|
|
6803
6802
|
"calendar__cell-button--default": "DateInput_calendar__cell-button--default",
|
|
6804
|
-
"calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
|
|
6805
6803
|
"calendar__cell-button--unavailable": "DateInput_calendar__cell-button--unavailable",
|
|
6804
|
+
"calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
|
|
6806
6805
|
"calendar__cell-button--unavailable--today": "DateInput_calendar__cell-button--unavailable--today"
|
|
6807
6806
|
};
|
|
6808
6807
|
|
|
@@ -6829,28 +6828,31 @@ function CalendarCell({ date, state, onClose }) {
|
|
|
6829
6828
|
isDisabled,
|
|
6830
6829
|
isUnavailable
|
|
6831
6830
|
} = (0, import_calendar.useCalendarCell)({ date }, state, ref);
|
|
6832
|
-
if (
|
|
6831
|
+
if (isOutsideVisibleRange) {
|
|
6833
6832
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)("td", { ...cellProps });
|
|
6834
6833
|
}
|
|
6835
|
-
const variant = isSelected ? "selected" : isUnavailable || isDisabled ? "unavailable" : "default";
|
|
6836
6834
|
const closeOnKeyboardBlurForward = (event) => {
|
|
6837
6835
|
if (event.key === "Tab" && event.shiftKey === false) {
|
|
6838
6836
|
onClose();
|
|
6839
6837
|
}
|
|
6840
6838
|
};
|
|
6839
|
+
const isEffectivelyUnavailable = isUnavailable || isDisabled;
|
|
6840
|
+
const isUnavailableToday = isEffectivelyUnavailable && (0, import_date.isToday)(date, timezone);
|
|
6841
6841
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)("td", { ...cellProps, children: /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
6842
6842
|
"button",
|
|
6843
6843
|
{
|
|
6844
6844
|
...buttonProps,
|
|
6845
6845
|
type: "button",
|
|
6846
6846
|
ref,
|
|
6847
|
-
hidden: isOutsideVisibleRange,
|
|
6848
6847
|
onKeyDown: closeOnKeyboardBlurForward,
|
|
6849
6848
|
className: cn(
|
|
6850
6849
|
DateInput_default["calendar__grid-element"],
|
|
6851
6850
|
DateInput_default["calendar__cell-button"],
|
|
6852
6851
|
(0, import_date.isToday)(date, timezone) && DateInput_default["calendar__cell-button--today"],
|
|
6853
|
-
DateInput_default[`calendar__cell-button
|
|
6852
|
+
DateInput_default[`calendar__cell-button--default`],
|
|
6853
|
+
isSelected && DateInput_default[`calendar__cell-button--selected`],
|
|
6854
|
+
isEffectivelyUnavailable && DateInput_default[`calendar__cell-button--unavailable`],
|
|
6855
|
+
isUnavailableToday && DateInput_default["calendar__cell-button--unavailable--today"],
|
|
6854
6856
|
typographyStyles_default["body-short-small"],
|
|
6855
6857
|
focusable
|
|
6856
6858
|
),
|
|
@@ -7223,6 +7225,8 @@ function Calendar(props) {
|
|
|
7223
7225
|
nextButtonProps: { onPress: onNext },
|
|
7224
7226
|
title
|
|
7225
7227
|
} = (0, import_calendar3.useCalendar)(props, state);
|
|
7228
|
+
const isPrevDisabled = !!props.minValue && state.visibleRange.start.compare(props.minValue) <= 0;
|
|
7229
|
+
const isNextDisabled = !!props.maxValue && state.visibleRange.end.compare(props.maxValue) >= 0;
|
|
7226
7230
|
const { onClose, closeButtonRef } = (0, import_react43.useContext)(CalendarPopoverContext);
|
|
7227
7231
|
const closeOnKeyboardBlurBack = (event) => {
|
|
7228
7232
|
var _a;
|
|
@@ -7237,6 +7241,7 @@ function Calendar(props) {
|
|
|
7237
7241
|
/* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
|
|
7238
7242
|
Button,
|
|
7239
7243
|
{
|
|
7244
|
+
"aria-hidden": optAttr(isPrevDisabled),
|
|
7240
7245
|
type: "button",
|
|
7241
7246
|
"aria-label": t(texts7.previousMonth),
|
|
7242
7247
|
onClick: (e) => onPrev == null ? void 0 : onPrev(e),
|
|
@@ -7244,7 +7249,10 @@ function Calendar(props) {
|
|
|
7244
7249
|
purpose: "tertiary",
|
|
7245
7250
|
icon: ArrowLeftIcon,
|
|
7246
7251
|
htmlProps: { onKeyDown: closeOnKeyboardBlurBack },
|
|
7247
|
-
className:
|
|
7252
|
+
className: cn(
|
|
7253
|
+
DateInput_default["calendar__month-button"],
|
|
7254
|
+
isPrevDisabled && utilStyles_default.invisible
|
|
7255
|
+
)
|
|
7248
7256
|
}
|
|
7249
7257
|
),
|
|
7250
7258
|
/* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
|
|
@@ -7260,12 +7268,16 @@ function Calendar(props) {
|
|
|
7260
7268
|
Button,
|
|
7261
7269
|
{
|
|
7262
7270
|
type: "button",
|
|
7271
|
+
"aria-hidden": optAttr(isNextDisabled),
|
|
7263
7272
|
"aria-label": t(texts7.nextMonth),
|
|
7264
7273
|
onClick: (e) => onNext == null ? void 0 : onNext(e),
|
|
7265
7274
|
size: "small",
|
|
7266
7275
|
purpose: "tertiary",
|
|
7267
7276
|
icon: ArrowRightIcon,
|
|
7268
|
-
className:
|
|
7277
|
+
className: cn(
|
|
7278
|
+
DateInput_default["calendar__month-button"],
|
|
7279
|
+
isNextDisabled && utilStyles_default.invisible
|
|
7280
|
+
)
|
|
7269
7281
|
}
|
|
7270
7282
|
)
|
|
7271
7283
|
] }),
|
|
@@ -7477,9 +7489,13 @@ function DateSegment({
|
|
|
7477
7489
|
const ref = (0, import_react45.useRef)(null);
|
|
7478
7490
|
const { segmentProps } = (0, import_datepicker.useDateSegment)(segment, state, ref);
|
|
7479
7491
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
|
|
7480
|
-
|
|
7492
|
+
Box,
|
|
7481
7493
|
{
|
|
7482
7494
|
...segmentProps,
|
|
7495
|
+
padding: "0 0.05rem",
|
|
7496
|
+
width: "max-content",
|
|
7497
|
+
height: "max-content",
|
|
7498
|
+
marginBlock: "auto",
|
|
7483
7499
|
"aria-describedby": spaceSeparatedIdListGenerator([
|
|
7484
7500
|
errorMessageId ? errorMessageId : void 0,
|
|
7485
7501
|
tipId ? tipId : void 0
|
|
@@ -7488,8 +7504,7 @@ function DateSegment({
|
|
|
7488
7504
|
className: cn(
|
|
7489
7505
|
segmentProps.className,
|
|
7490
7506
|
DateInput_default.segment,
|
|
7491
|
-
typographyStyles_default[`body-short-${componentSize}`]
|
|
7492
|
-
Input_default[`input--${componentSize}`]
|
|
7507
|
+
typographyStyles_default[`body-short-${componentSize}`]
|
|
7493
7508
|
),
|
|
7494
7509
|
style: {
|
|
7495
7510
|
...segmentProps.style,
|
|
@@ -7756,7 +7771,7 @@ function DateField({
|
|
|
7756
7771
|
absolute: true,
|
|
7757
7772
|
"aria-label": t(texts9.clearDate),
|
|
7758
7773
|
"aria-hidden": !hasValue,
|
|
7759
|
-
className: cn(!hasValue &&
|
|
7774
|
+
className: cn(!hasValue && utilStyles_default.invisible),
|
|
7760
7775
|
size: componentSize,
|
|
7761
7776
|
onClick: clearDate
|
|
7762
7777
|
}
|
|
@@ -10472,6 +10487,7 @@ var inlineInputCns = (hasErrorState, showEditingIcon) => [
|
|
|
10472
10487
|
var inlineTextareaCns = (hasErrorState, showEditingIcon) => [
|
|
10473
10488
|
...inlineInputCns(hasErrorState, showEditingIcon),
|
|
10474
10489
|
typographyStyles_default["body-long-medium"],
|
|
10490
|
+
InlineEdit_default["inline-textarea"],
|
|
10475
10491
|
utilStyles_default.scrollbar
|
|
10476
10492
|
];
|
|
10477
10493
|
var inlineSelectCns = (hasErrorState, showEditingIcon, hasValue) => [
|
|
@@ -11393,7 +11409,6 @@ var import_react76 = require("react");
|
|
|
11393
11409
|
var Pagination_default = {
|
|
11394
11410
|
list: "Pagination_list",
|
|
11395
11411
|
list__item: "Pagination_list__item",
|
|
11396
|
-
"list__item--hidden": "Pagination_list__item--hidden",
|
|
11397
11412
|
indicators: "Pagination_indicators",
|
|
11398
11413
|
"truncation-icon": "Pagination_truncation-icon"
|
|
11399
11414
|
};
|
|
@@ -11589,12 +11604,16 @@ var getCustomStyles = (size2, hasError, isReadOnly) => ({
|
|
|
11589
11604
|
textOverflow: "ellipsis",
|
|
11590
11605
|
whiteSpace: "nowrap",
|
|
11591
11606
|
boxSizing: "border-box",
|
|
11592
|
-
|
|
11607
|
+
paddingInlineStart: "var(--dds-spacing-x0-25)",
|
|
11608
|
+
paddingBlock: "var(--dds-spacing-x0-125)",
|
|
11593
11609
|
...state.selectProps.isDisabled && {
|
|
11594
11610
|
color: "var(--dds-color-text-subtle)"
|
|
11595
11611
|
},
|
|
11596
11612
|
...isReadOnly && {
|
|
11597
11613
|
color: "var(--dds-color-text-medium)"
|
|
11614
|
+
},
|
|
11615
|
+
...(state.selectProps.isDisabled || isReadOnly) && {
|
|
11616
|
+
paddingInlineEnd: "var(--dds-spacing-x0-25)"
|
|
11598
11617
|
}
|
|
11599
11618
|
}),
|
|
11600
11619
|
multiValueRemove: (provided, state) => state.selectProps.isDisabled || isReadOnly ? {
|
|
@@ -12280,7 +12299,7 @@ var Pagination = ({
|
|
|
12280
12299
|
{
|
|
12281
12300
|
className: cn(
|
|
12282
12301
|
Pagination_default.list__item,
|
|
12283
|
-
isOnFirstPage &&
|
|
12302
|
+
isOnFirstPage && utilStyles_default.invisible
|
|
12284
12303
|
),
|
|
12285
12304
|
"aria-hidden": isOnFirstPage,
|
|
12286
12305
|
children: previousPageButton
|
|
@@ -12292,7 +12311,7 @@ var Pagination = ({
|
|
|
12292
12311
|
{
|
|
12293
12312
|
className: cn(
|
|
12294
12313
|
Pagination_default.list__item,
|
|
12295
|
-
isOnLastPage &&
|
|
12314
|
+
isOnLastPage && utilStyles_default.invisible
|
|
12296
12315
|
),
|
|
12297
12316
|
"aria-hidden": isOnLastPage,
|
|
12298
12317
|
children: nextPageButton
|
|
@@ -12313,7 +12332,7 @@ var Pagination = ({
|
|
|
12313
12332
|
{
|
|
12314
12333
|
className: cn(
|
|
12315
12334
|
Pagination_default.list__item,
|
|
12316
|
-
isOnFirstPage &&
|
|
12335
|
+
isOnFirstPage && utilStyles_default.invisible
|
|
12317
12336
|
),
|
|
12318
12337
|
"aria-hidden": isOnFirstPage,
|
|
12319
12338
|
children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
|
|
@@ -12335,7 +12354,7 @@ var Pagination = ({
|
|
|
12335
12354
|
{
|
|
12336
12355
|
className: cn(
|
|
12337
12356
|
Pagination_default.list__item,
|
|
12338
|
-
isOnFirstPage &&
|
|
12357
|
+
isOnFirstPage && utilStyles_default.invisible
|
|
12339
12358
|
),
|
|
12340
12359
|
"aria-hidden": isOnFirstPage,
|
|
12341
12360
|
children: previousPageButton
|
|
@@ -12356,7 +12375,7 @@ var Pagination = ({
|
|
|
12356
12375
|
{
|
|
12357
12376
|
className: cn(
|
|
12358
12377
|
Pagination_default.list__item,
|
|
12359
|
-
isOnLastPage &&
|
|
12378
|
+
isOnLastPage && utilStyles_default.invisible
|
|
12360
12379
|
),
|
|
12361
12380
|
"aria-hidden": isOnLastPage,
|
|
12362
12381
|
children: nextPageButton
|
|
@@ -12367,7 +12386,7 @@ var Pagination = ({
|
|
|
12367
12386
|
{
|
|
12368
12387
|
className: cn(
|
|
12369
12388
|
Pagination_default.list__item,
|
|
12370
|
-
isOnLastPage &&
|
|
12389
|
+
isOnLastPage && utilStyles_default.invisible
|
|
12371
12390
|
),
|
|
12372
12391
|
"aria-hidden": isOnLastPage,
|
|
12373
12392
|
children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
|
|
@@ -12885,7 +12904,8 @@ var PhoneInput_default = {
|
|
|
12885
12904
|
"inputs-container--small-screen-md": "PhoneInput_inputs-container--small-screen-md",
|
|
12886
12905
|
"inputs-container--small-screen-lg": "PhoneInput_inputs-container--small-screen-lg",
|
|
12887
12906
|
"inputs-container--small-screen-xl": "PhoneInput_inputs-container--small-screen-xl",
|
|
12888
|
-
"calling-code": "PhoneInput_calling-code"
|
|
12907
|
+
"calling-code": "PhoneInput_calling-code",
|
|
12908
|
+
"calling-code--disabled": "PhoneInput_calling-code--disabled"
|
|
12889
12909
|
};
|
|
12890
12910
|
|
|
12891
12911
|
// src/components/PhoneInput/PhoneInput.tsx
|
|
@@ -13080,7 +13100,8 @@ var PhoneInput = ({
|
|
|
13080
13100
|
className: cn(
|
|
13081
13101
|
typographyStyles_default[`body-short-${componentSize}`],
|
|
13082
13102
|
Input_default["input-group__absolute-el"],
|
|
13083
|
-
PhoneInput_default["calling-code"]
|
|
13103
|
+
PhoneInput_default["calling-code"],
|
|
13104
|
+
(commonProps.disabled || commonProps.readOnly) && PhoneInput_default["calling-code--disabled"]
|
|
13084
13105
|
),
|
|
13085
13106
|
ref: callingCodeRef,
|
|
13086
13107
|
children: callingCode
|
|
@@ -15450,12 +15471,6 @@ ToggleBar.displayName = "ToggleBar";
|
|
|
15450
15471
|
// src/components/ToggleBar/ToggleRadio.tsx
|
|
15451
15472
|
var import_react104 = require("react");
|
|
15452
15473
|
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
15453
|
-
var typographyTypes = {
|
|
15454
|
-
large: "bodyShortLarge",
|
|
15455
|
-
medium: "bodyShortMedium",
|
|
15456
|
-
small: "bodyShortSmall",
|
|
15457
|
-
xsmall: "bodyShortXsmall"
|
|
15458
|
-
};
|
|
15459
15474
|
var calculateChecked = (value, group, checked) => {
|
|
15460
15475
|
if (typeof checked !== "undefined") return checked;
|
|
15461
15476
|
if (typeof value !== "undefined" && value !== null && group) {
|
|
@@ -15518,11 +15533,13 @@ var ToggleRadio = ({
|
|
|
15518
15533
|
}
|
|
15519
15534
|
),
|
|
15520
15535
|
/* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
15521
|
-
|
|
15536
|
+
HStack,
|
|
15522
15537
|
{
|
|
15523
15538
|
as: "span",
|
|
15524
|
-
|
|
15539
|
+
justifyContent: "center",
|
|
15540
|
+
alignItems: "center",
|
|
15525
15541
|
className: cn(
|
|
15542
|
+
typographyStyles_default[`body-short-${group.size}`],
|
|
15526
15543
|
ToggleBar_default.content,
|
|
15527
15544
|
Button_default[contentTypeCn],
|
|
15528
15545
|
hasLabel && hasIcon && Button_default["with-icon-left"],
|
|
@@ -15546,10 +15563,7 @@ var import_react105 = require("react");
|
|
|
15546
15563
|
|
|
15547
15564
|
// src/components/ToggleButton/ToggleButton.module.css
|
|
15548
15565
|
var ToggleButton_default = {
|
|
15549
|
-
content: "ToggleButton_content"
|
|
15550
|
-
small: "ToggleButton_small",
|
|
15551
|
-
xsmall: "ToggleButton_xsmall",
|
|
15552
|
-
"content--with-icon": "ToggleButton_content--with-icon"
|
|
15566
|
+
content: "ToggleButton_content"
|
|
15553
15567
|
};
|
|
15554
15568
|
|
|
15555
15569
|
// src/components/ToggleButton/ToggleButton.tsx
|
|
@@ -15582,19 +15596,29 @@ var ToggleButton = ({
|
|
|
15582
15596
|
}
|
|
15583
15597
|
),
|
|
15584
15598
|
/* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(
|
|
15585
|
-
|
|
15599
|
+
Paper,
|
|
15586
15600
|
{
|
|
15601
|
+
as: "span",
|
|
15602
|
+
border: "border-default",
|
|
15603
|
+
background: "surface-default",
|
|
15604
|
+
borderRadius: "rounded",
|
|
15605
|
+
width: "fit-content",
|
|
15606
|
+
display: "inline-flex",
|
|
15607
|
+
alignItems: "center",
|
|
15587
15608
|
className: cn(
|
|
15588
15609
|
ToggleButton_default.content,
|
|
15589
|
-
ToggleButton_default[size2],
|
|
15590
|
-
hasIcon && ToggleButton_default["content--with-icon"],
|
|
15591
15610
|
typographyStyles_default[`body-short-${size2}`],
|
|
15592
|
-
focus_default["focus-styled-sibling"]
|
|
15611
|
+
focus_default["focus-styled-sibling"],
|
|
15612
|
+
Button_default[`button--${size2}`],
|
|
15613
|
+
Button_default["just-text"],
|
|
15614
|
+
...hasIcon ? [
|
|
15615
|
+
Button_default["with-text-and-icon"],
|
|
15616
|
+
Button_default["with-icon-left"]
|
|
15617
|
+
] : []
|
|
15593
15618
|
),
|
|
15594
15619
|
children: [
|
|
15595
15620
|
hasIcon && /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(Icon, { icon, iconSize: "component" }),
|
|
15596
|
-
|
|
15597
|
-
label
|
|
15621
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)("span", { children: label })
|
|
15598
15622
|
]
|
|
15599
15623
|
}
|
|
15600
15624
|
)
|
|
@@ -16010,7 +16034,6 @@ ToggleButtonGroup.displayName = "ToggleButtonGroup";
|
|
|
16010
16034
|
removeListStyling,
|
|
16011
16035
|
renderInputMessage,
|
|
16012
16036
|
scrollbarStyling,
|
|
16013
|
-
typographyTypes,
|
|
16014
16037
|
useAccordion,
|
|
16015
16038
|
useAccordionContext,
|
|
16016
16039
|
useCallbackRef,
|