@norges-domstoler/dds-components 24.1.0 → 24.1.1
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.cjs +97 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +12 -113
- package/dist/index.d.cts +34 -32
- package/dist/index.d.mts +34 -32
- package/dist/index.mjs +97 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4554,10 +4554,7 @@ const useOverflowMenuContext = () => {
|
|
|
4554
4554
|
};
|
|
4555
4555
|
//#endregion
|
|
4556
4556
|
//#region src/components/OverflowMenu/OverflowMenu.module.css
|
|
4557
|
-
var OverflowMenu_module_default = {
|
|
4558
|
-
"container": "dds-OverflowMenu-module__container",
|
|
4559
|
-
"list": "dds-OverflowMenu-module__list"
|
|
4560
|
-
};
|
|
4557
|
+
var OverflowMenu_module_default = { "container": "dds-OverflowMenu-module__container" };
|
|
4561
4558
|
//#endregion
|
|
4562
4559
|
//#region src/components/OverflowMenu/OverflowMenu.tsx
|
|
4563
4560
|
const OverflowMenu = ({ placement = "bottom-end", offset = 2, parentElement, portal = true, className, htmlProps = {}, ref, style, ...rest }) => {
|
|
@@ -5719,13 +5716,9 @@ var DateInput_module_default = {
|
|
|
5719
5716
|
"icon-wrapper--readonly": "dds-DateInput-module__icon-wrapper--readonly",
|
|
5720
5717
|
"popover-button--readonly": "dds-DateInput-module__popover-button--readonly",
|
|
5721
5718
|
"popover": "dds-DateInput-module__popover",
|
|
5722
|
-
"modal-close-button-wrapper": "dds-DateInput-module__modal-close-button-wrapper",
|
|
5723
|
-
"calendar": "dds-DateInput-module__calendar",
|
|
5724
5719
|
"calendar__header__month": "dds-DateInput-module__calendar__header__month",
|
|
5725
5720
|
"calendar__month-button": "dds-DateInput-module__calendar__month-button",
|
|
5726
|
-
"calendar__grid-element": "dds-DateInput-module__calendar__grid-element",
|
|
5727
5721
|
"calendar__th": "dds-DateInput-module__calendar__th",
|
|
5728
|
-
"calendar__week-number": "dds-DateInput-module__calendar__week-number",
|
|
5729
5722
|
"calendar__cell-button": "dds-DateInput-module__calendar__cell-button",
|
|
5730
5723
|
"calendar__cell-button--today": "dds-DateInput-module__calendar__cell-button--today",
|
|
5731
5724
|
"calendar__cell-button--default": "dds-DateInput-module__calendar__cell-button--default",
|
|
@@ -5734,6 +5727,16 @@ var DateInput_module_default = {
|
|
|
5734
5727
|
"calendar__cell-button--unavailable--today": "dds-DateInput-module__calendar__cell-button--unavailable--today"
|
|
5735
5728
|
};
|
|
5736
5729
|
//#endregion
|
|
5730
|
+
//#region src/components/date-inputs/DatePicker/Calendar/CalendarCell.tsx
|
|
5731
|
+
function CalendarCell({ ...props }) {
|
|
5732
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
5733
|
+
textAlign: "center",
|
|
5734
|
+
className: cn(typographyStyles_module_default["text-color--subtle"], DateInput_module_default.calendar__th),
|
|
5735
|
+
...props
|
|
5736
|
+
});
|
|
5737
|
+
}
|
|
5738
|
+
CalendarCell.displayName = "CalendarCell";
|
|
5739
|
+
//#endregion
|
|
5737
5740
|
//#region src/components/date-inputs/DatePicker/constants.ts
|
|
5738
5741
|
const LOCALE = {
|
|
5739
5742
|
nb: "nb-NO",
|
|
@@ -5743,8 +5746,8 @@ const LOCALE = {
|
|
|
5743
5746
|
se: "se-NO"
|
|
5744
5747
|
};
|
|
5745
5748
|
//#endregion
|
|
5746
|
-
//#region src/components/date-inputs/DatePicker/Calendar/
|
|
5747
|
-
function
|
|
5749
|
+
//#region src/components/date-inputs/DatePicker/Calendar/CalendarDate.tsx
|
|
5750
|
+
function CalendarDate$1({ date, state, onClose }) {
|
|
5748
5751
|
const ref = (0, react.useRef)(null);
|
|
5749
5752
|
const { buttonProps, cellProps, isOutsideVisibleRange, formattedDate, isSelected, isDisabled, isUnavailable } = (0, _react_aria_calendar.useCalendarCell)({ date }, state, ref);
|
|
5750
5753
|
if (isOutsideVisibleRange) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { ...cellProps });
|
|
@@ -5755,17 +5758,23 @@ function CalendarCell({ date, state, onClose }) {
|
|
|
5755
5758
|
const isUnavailableToday = isEffectivelyUnavailable && (0, _internationalized_date.isToday)(date, "Europe/Oslo");
|
|
5756
5759
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
5757
5760
|
...cellProps,
|
|
5758
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5761
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
5759
5762
|
...buttonProps,
|
|
5763
|
+
as: "button",
|
|
5760
5764
|
type: "button",
|
|
5761
5765
|
ref,
|
|
5762
5766
|
onKeyDown: closeOnKeyboardBlurForward,
|
|
5763
|
-
|
|
5767
|
+
height: "100%",
|
|
5768
|
+
width: "100%",
|
|
5769
|
+
display: "flex",
|
|
5770
|
+
alignItems: "center",
|
|
5771
|
+
justifyContent: "center",
|
|
5772
|
+
className: cn(DateInput_module_default["calendar__cell-button"], (0, _internationalized_date.isToday)(date, "Europe/Oslo") && DateInput_module_default["calendar__cell-button--today"], DateInput_module_default[`calendar__cell-button--default`], isSelected && DateInput_module_default[`calendar__cell-button--selected`], isEffectivelyUnavailable && DateInput_module_default[`calendar__cell-button--unavailable`], isUnavailableToday && DateInput_module_default["calendar__cell-button--unavailable--today"], typographyStyles_module_default["body-short-small"], _key1),
|
|
5764
5773
|
children: formattedDate
|
|
5765
5774
|
})
|
|
5766
5775
|
});
|
|
5767
5776
|
}
|
|
5768
|
-
|
|
5777
|
+
CalendarDate$1.displayName = "CalendarDate";
|
|
5769
5778
|
//#endregion
|
|
5770
5779
|
//#region src/components/date-inputs/utils/getWeekNumber.ts
|
|
5771
5780
|
/**
|
|
@@ -5885,8 +5894,9 @@ const CalendarPopoverContent = ({ children, className, smallScreenBreakpoint })
|
|
|
5885
5894
|
ref: modalRef,
|
|
5886
5895
|
className: cn(DateInput_module_default.popover, className),
|
|
5887
5896
|
...paperStyleProps,
|
|
5888
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5889
|
-
|
|
5897
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
5898
|
+
display: "flex",
|
|
5899
|
+
justifyContent: "flex-end",
|
|
5890
5900
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
5891
5901
|
ref: closeButtonRef,
|
|
5892
5902
|
icon: CloseIcon,
|
|
@@ -5946,7 +5956,6 @@ function CalendarGrid({ state, ...props }) {
|
|
|
5946
5956
|
}
|
|
5947
5957
|
];
|
|
5948
5958
|
const { showWeekNumbers, onClose } = (0, react.useContext)(CalendarPopoverContext);
|
|
5949
|
-
const thCn = cn(DateInput_module_default["calendar__grid-element"], typographyStyles_module_default["text-color--subtle"], DateInput_module_default.calendar__th);
|
|
5950
5959
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
|
|
5951
5960
|
...gridProps,
|
|
5952
5961
|
onKeyDown: (e) => {
|
|
@@ -5957,14 +5966,14 @@ function CalendarGrid({ state, ...props }) {
|
|
|
5957
5966
|
className: typographyStyles_module_default["body-short-xsmall"],
|
|
5958
5967
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
|
|
5959
5968
|
...headerProps,
|
|
5960
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [showWeekNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
5961
|
-
|
|
5969
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [showWeekNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CalendarCell, {
|
|
5970
|
+
as: "th",
|
|
5962
5971
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5963
5972
|
"aria-hidden": true,
|
|
5964
5973
|
children: "#"
|
|
5965
5974
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisuallyHidden, { children: t(texts$24.weekNumber) })]
|
|
5966
|
-
}), weekDays.map((day, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
5967
|
-
|
|
5975
|
+
}), weekDays.map((day, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CalendarCell, {
|
|
5976
|
+
as: "th",
|
|
5968
5977
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
5969
5978
|
"aria-hidden": true,
|
|
5970
5979
|
children: day.short
|
|
@@ -5974,10 +5983,10 @@ function CalendarGrid({ state, ...props }) {
|
|
|
5974
5983
|
const datesInWeek = state.getDatesInWeek(weekIndex);
|
|
5975
5984
|
const firstExistingDay = datesInWeek.find(Boolean);
|
|
5976
5985
|
const weekNumber = firstExistingDay ? getWeekNumber(firstExistingDay) : "";
|
|
5977
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [showWeekNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5978
|
-
|
|
5986
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [showWeekNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarCell, {
|
|
5987
|
+
as: "td",
|
|
5979
5988
|
children: weekNumber
|
|
5980
|
-
}), datesInWeek.map((date, i) => date ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
5989
|
+
}), datesInWeek.map((date, i) => date ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CalendarDate$1, {
|
|
5981
5990
|
state,
|
|
5982
5991
|
date,
|
|
5983
5992
|
onClose
|
|
@@ -6409,7 +6418,7 @@ function DateInput({ errorMessage, tip, componentSize = "medium", style, classNa
|
|
|
6409
6418
|
className: cn(Input_module_default["input-group"], typographyStyles_module_default[`body-short-${componentSize}`], DateInput_module_default["input-group"]),
|
|
6410
6419
|
children: [
|
|
6411
6420
|
button,
|
|
6412
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
6421
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HStack, {
|
|
6413
6422
|
...fieldProps,
|
|
6414
6423
|
ref: internalRef,
|
|
6415
6424
|
className: cn(Input_module_default.input, Input_module_default[`input--${componentSize}`], Input_module_default["input--stateful"], Input_module_default["input--hover"], hasErrorMessage && Input_module_default["input--stateful-danger"], clearable && Input_module_default[`input-with-btn-right--${componentSize}`], DateInput_module_default["date-segment-container"], Input_module_default[`input-with-icon--${componentSize}`], isOpen && focus_module_default.focused, disabled && "disabled", disabled && Input_module_default.disabled, active && "active", readOnly && "read-only", readOnly && Input_module_default["read-only"], focus_module_default["focusable-within"]),
|
|
@@ -6707,8 +6716,13 @@ const DescriptionListTerm = (props) => {
|
|
|
6707
6716
|
DescriptionListTerm.displayName = "DescriptionListTerm";
|
|
6708
6717
|
//#endregion
|
|
6709
6718
|
//#region src/components/DescriptionList/DescriptionListDesc.tsx
|
|
6710
|
-
const DescriptionListDesc = ({ children, icon, id, className, style, htmlProps, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
6719
|
+
const DescriptionListDesc = ({ children, icon, id, className, style, htmlProps, ...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Box, {
|
|
6711
6720
|
...getBaseHTMLProps(id, cn(className, DescriptionList_module_default.desc), style, htmlProps, rest),
|
|
6721
|
+
as: "dd",
|
|
6722
|
+
display: "flex",
|
|
6723
|
+
alignItems: "center",
|
|
6724
|
+
gap: "x0.25",
|
|
6725
|
+
marginInline: "x0",
|
|
6712
6726
|
children: [
|
|
6713
6727
|
icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { icon }),
|
|
6714
6728
|
" ",
|
|
@@ -8143,21 +8157,17 @@ const texts$12 = createTexts({
|
|
|
8143
8157
|
}
|
|
8144
8158
|
});
|
|
8145
8159
|
//#endregion
|
|
8146
|
-
//#region src/components/Footer/Footer.module.css
|
|
8147
|
-
var Footer_module_default = {
|
|
8148
|
-
"container": "dds-Footer-module__container",
|
|
8149
|
-
"left": "dds-Footer-module__left",
|
|
8150
|
-
"list": "dds-Footer-module__list",
|
|
8151
|
-
"list-group": "dds-Footer-module__list-group",
|
|
8152
|
-
"socials-group": "dds-Footer-module__socials-group",
|
|
8153
|
-
"socials-list": "dds-Footer-module__socials-list"
|
|
8154
|
-
};
|
|
8155
|
-
//#endregion
|
|
8156
8160
|
//#region src/components/Footer/Footer.tsx
|
|
8157
|
-
const Footer = (
|
|
8161
|
+
const Footer = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Contrast, {
|
|
8158
8162
|
as: "footer",
|
|
8159
|
-
|
|
8160
|
-
|
|
8163
|
+
paddingBlock: {
|
|
8164
|
+
xs: "x3 x6",
|
|
8165
|
+
sm: "x3 x6",
|
|
8166
|
+
md: "x4",
|
|
8167
|
+
lg: "x4",
|
|
8168
|
+
xl: "x4"
|
|
8169
|
+
},
|
|
8170
|
+
...props
|
|
8161
8171
|
});
|
|
8162
8172
|
//#endregion
|
|
8163
8173
|
//#region src/components/Footer/FooterListHeader.tsx
|
|
@@ -8186,33 +8196,35 @@ const FooterLogo = ({ children, hideBreakpoint, ...rest }) => {
|
|
|
8186
8196
|
};
|
|
8187
8197
|
//#endregion
|
|
8188
8198
|
//#region src/components/Footer/FooterList.tsx
|
|
8189
|
-
const FooterList = (
|
|
8190
|
-
|
|
8191
|
-
|
|
8199
|
+
const FooterList = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
|
|
8200
|
+
as: StylelessList,
|
|
8201
|
+
gap: "x1.5",
|
|
8202
|
+
...props
|
|
8192
8203
|
});
|
|
8193
8204
|
//#endregion
|
|
8194
8205
|
//#region src/components/Footer/FooterSocialsList.tsx
|
|
8195
|
-
const FooterSocialsList = (
|
|
8196
|
-
|
|
8197
|
-
|
|
8206
|
+
const FooterSocialsList = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HStack, {
|
|
8207
|
+
as: StylelessList,
|
|
8208
|
+
gap: "x1.5",
|
|
8209
|
+
...props
|
|
8198
8210
|
});
|
|
8199
8211
|
//#endregion
|
|
8200
8212
|
//#region src/components/Footer/FooterSocialsGroup.tsx
|
|
8201
|
-
const FooterSocialsGroup = (
|
|
8202
|
-
|
|
8203
|
-
...
|
|
8213
|
+
const FooterSocialsGroup = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
|
|
8214
|
+
gap: "x1",
|
|
8215
|
+
...props
|
|
8204
8216
|
});
|
|
8205
8217
|
//#endregion
|
|
8206
8218
|
//#region src/components/Footer/FooterListGroup.tsx
|
|
8207
|
-
const FooterListGroup = (
|
|
8208
|
-
|
|
8209
|
-
...
|
|
8219
|
+
const FooterListGroup = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
|
|
8220
|
+
gap: "x1.5",
|
|
8221
|
+
...props
|
|
8210
8222
|
});
|
|
8211
8223
|
//#endregion
|
|
8212
8224
|
//#region src/components/Footer/FooterLeft.tsx
|
|
8213
|
-
const FooterLeft = (
|
|
8214
|
-
|
|
8215
|
-
...
|
|
8225
|
+
const FooterLeft = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
|
|
8226
|
+
gap: "x4",
|
|
8227
|
+
...props
|
|
8216
8228
|
});
|
|
8217
8229
|
//#endregion
|
|
8218
8230
|
//#region src/components/FormSummary/FormSummary.tsx
|
|
@@ -8315,9 +8327,7 @@ var GlobalMessage_module_default = {
|
|
|
8315
8327
|
"container--info": "dds-GlobalMessage-module__container--info",
|
|
8316
8328
|
"icon": "dds-GlobalMessage-module__icon",
|
|
8317
8329
|
"container--danger": "dds-GlobalMessage-module__container--danger",
|
|
8318
|
-
"container--warning": "dds-GlobalMessage-module__container--warning"
|
|
8319
|
-
"content": "dds-GlobalMessage-module__content",
|
|
8320
|
-
"content--closable": "dds-GlobalMessage-module__content--closable"
|
|
8330
|
+
"container--warning": "dds-GlobalMessage-module__container--warning"
|
|
8321
8331
|
};
|
|
8322
8332
|
const icons$2 = {
|
|
8323
8333
|
info: InfoIcon,
|
|
@@ -8327,10 +8337,16 @@ const icons$2 = {
|
|
|
8327
8337
|
const GlobalMessage = ({ purpose = "info", closable, onClose, children, id, className, style, htmlProps, ...rest }) => {
|
|
8328
8338
|
const { t } = useTranslation();
|
|
8329
8339
|
const [isClosed, setClosed] = (0, react.useState)(false);
|
|
8330
|
-
return !isClosed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
8340
|
+
return !isClosed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HStack, {
|
|
8331
8341
|
...getBaseHTMLProps(id, cn(className, GlobalMessage_module_default.container, GlobalMessage_module_default[`container--${purpose}`], typographyStyles_module_default["body-short-medium"]), style, htmlProps, rest),
|
|
8332
|
-
|
|
8333
|
-
|
|
8342
|
+
alignItems: "center",
|
|
8343
|
+
justifyContent: "space-between",
|
|
8344
|
+
width: "100%",
|
|
8345
|
+
padding: "0 x1",
|
|
8346
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HStack, {
|
|
8347
|
+
alignItems: "center",
|
|
8348
|
+
paddingBlock: "x0.75",
|
|
8349
|
+
paddingInline: closable ? "x0 x0.75" : " x0 x1.5",
|
|
8334
8350
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
8335
8351
|
icon: icons$2[purpose],
|
|
8336
8352
|
iconSize: "component",
|
|
@@ -9334,7 +9350,7 @@ const getCustomStyles = (size, hasError, isReadOnly) => ({
|
|
|
9334
9350
|
zIndex: 100,
|
|
9335
9351
|
transition: "var(--dds-motion-surface)",
|
|
9336
9352
|
border: "1px solid var(--dds-color-border-default)",
|
|
9337
|
-
backgroundColor: "var(--dds-color-surface-default)",
|
|
9353
|
+
backgroundColor: "var(--dds-color-surface-paper-default)",
|
|
9338
9354
|
borderRadius: "var(--dds-border-radius-surface)",
|
|
9339
9355
|
marginBlock: "var(--dds-spacing-x0-25)"
|
|
9340
9356
|
}),
|
|
@@ -9364,11 +9380,15 @@ const getCustomStyles = (size, hasError, isReadOnly) => ({
|
|
|
9364
9380
|
gap: "var(--dds-spacing-x0-25)",
|
|
9365
9381
|
padding: "var(--dds-spacing-x0-75)",
|
|
9366
9382
|
borderRadius: "var(--dds-border-radius-surface)",
|
|
9367
|
-
backgroundColor: "
|
|
9383
|
+
backgroundColor: "inherit",
|
|
9368
9384
|
...typography.option[size],
|
|
9369
9385
|
color: "var(--dds-color-text-default)",
|
|
9370
9386
|
"@media (prefers-reduced-motion: no-preference)": { transition: "color var(--dds-motion-micro-state), background-color var(--dds-motion-micro-state)" },
|
|
9371
|
-
|
|
9387
|
+
"&:active": { backgroundColor: "inherit" },
|
|
9388
|
+
...state.isSelected && {
|
|
9389
|
+
backgroundColor: "var(--dds-color-surface-selected-default)",
|
|
9390
|
+
"&:active": { backgroundColor: "var(--dds-color-surface-selected-default)" }
|
|
9391
|
+
},
|
|
9372
9392
|
...state.isFocused && {
|
|
9373
9393
|
outline: "var(--dds-color-border-action-hover) 2px solid",
|
|
9374
9394
|
outlineOffset: "calc(var(--dds-spacing-x0-125) * -1)"
|
|
@@ -11383,25 +11403,20 @@ const texts$7 = createTexts({
|
|
|
11383
11403
|
}
|
|
11384
11404
|
});
|
|
11385
11405
|
//#endregion
|
|
11386
|
-
//#region src/components/Popover/Popover.module.css
|
|
11387
|
-
var Popover_module_default = {
|
|
11388
|
-
"container": "dds-Popover-module__container",
|
|
11389
|
-
"content--closable--no-header": "dds-Popover-module__content--closable--no-header",
|
|
11390
|
-
"header": "dds-Popover-module__header",
|
|
11391
|
-
"close-button": "dds-Popover-module__close-button"
|
|
11392
|
-
};
|
|
11393
|
-
//#endregion
|
|
11394
11406
|
//#region src/components/Popover/Popover.context.tsx
|
|
11395
11407
|
const PopoverContext = (0, react.createContext)({});
|
|
11396
11408
|
const usePopoverContext = () => (0, react.useContext)(PopoverContext);
|
|
11397
11409
|
//#endregion
|
|
11410
|
+
//#region src/components/Popover/Popover.module.css
|
|
11411
|
+
var Popover_module_default = { "container": "dds-Popover-module__container" };
|
|
11412
|
+
//#endregion
|
|
11398
11413
|
//#region src/components/Popover/Popover.tsx
|
|
11399
11414
|
const Popover = ({ id, header, withCloseButton = true, onBlur, children, placement = "bottom", parentElement, portal = false, offset = 8, sizeProps = {}, returnFocusOnBlur = true, className, htmlProps = {}, anchorRef, isOpen: propIsOpen, onClose: propOnClose, style, ref, ...rest }) => {
|
|
11400
11415
|
const { refs, styles: positionStyles, isPositioned: localIsPositioned } = useFloatPosition(null, {
|
|
11401
11416
|
offset,
|
|
11402
11417
|
placement
|
|
11403
11418
|
});
|
|
11404
|
-
const { maxHeight, maxWidth, minHeight, minWidth, height, width } = sizeProps;
|
|
11419
|
+
const { maxHeight, maxWidth, minHeight, minWidth, height, width = "fit-content" } = sizeProps;
|
|
11405
11420
|
const context = usePopoverContext();
|
|
11406
11421
|
const themeContext = (0, react.useContext)(ThemeContext);
|
|
11407
11422
|
const portalTarget = parentElement ?? themeContext?.el;
|
|
@@ -11461,29 +11476,34 @@ const Popover = ({ id, header, withCloseButton = true, onBlur, children, placeme
|
|
|
11461
11476
|
width,
|
|
11462
11477
|
maxWidth,
|
|
11463
11478
|
minWidth,
|
|
11479
|
+
position: "absolute",
|
|
11480
|
+
padding: "x0.75 x1 x1.5 x1",
|
|
11464
11481
|
role: "dialog",
|
|
11465
11482
|
elevation: "large",
|
|
11466
11483
|
border: "border-subtle",
|
|
11467
11484
|
children: [
|
|
11468
|
-
header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
11469
|
-
|
|
11485
|
+
header && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
11486
|
+
marginInline: "0 x2",
|
|
11470
11487
|
children: typeof header === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
11471
11488
|
level: 2,
|
|
11472
11489
|
typographyType: "heading-medium",
|
|
11473
11490
|
children: header
|
|
11474
11491
|
}) : header
|
|
11475
11492
|
}),
|
|
11476
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
11477
|
-
|
|
11493
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
11494
|
+
marginBlock: !hasTitle && withCloseButton ? "x2 0" : "0",
|
|
11478
11495
|
children
|
|
11479
11496
|
}),
|
|
11480
|
-
withCloseButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
11497
|
+
withCloseButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Box, {
|
|
11498
|
+
as: Button,
|
|
11481
11499
|
icon: CloseIcon,
|
|
11482
11500
|
purpose: "tertiary",
|
|
11483
11501
|
size: "small",
|
|
11484
11502
|
onClick: onClose,
|
|
11485
11503
|
"aria-label": t(commonTexts.close),
|
|
11486
|
-
|
|
11504
|
+
position: "absolute",
|
|
11505
|
+
top: "x0.25",
|
|
11506
|
+
right: "x0.25"
|
|
11487
11507
|
})
|
|
11488
11508
|
]
|
|
11489
11509
|
});
|