@vygruppen/spor-react 13.2.1 → 13.3.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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +4 -3
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +280 -191
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.mjs +210 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
- package/src/error-summary/index.tsx +79 -0
- package/src/index.tsx +1 -0
- package/src/theme/slot-recipes/anatomy.ts +7 -0
- package/src/theme/slot-recipes/error-summary.ts +32 -0
- package/src/theme/slot-recipes/index.ts +2 -0
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var react = require('@chakra-ui/react');
|
|
4
4
|
var spor_icon_react_star = require('@vygruppen/spor-icon-react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var React14 = require('react');
|
|
7
7
|
var sporLoader = require('@vygruppen/spor-loader');
|
|
8
8
|
var lottieReact = require('lottie-react');
|
|
9
9
|
var usehooksTs = require('usehooks-ts');
|
|
@@ -43,7 +43,7 @@ function _interopNamespace(e) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
var spor_icon_react_star__namespace = /*#__PURE__*/_interopNamespace(spor_icon_react_star);
|
|
46
|
-
var
|
|
46
|
+
var React14__namespace = /*#__PURE__*/_interopNamespace(React14);
|
|
47
47
|
var tokens22__namespace = /*#__PURE__*/_interopNamespace(tokens22);
|
|
48
48
|
var tokens4__default = /*#__PURE__*/_interopDefault(tokens4);
|
|
49
49
|
|
|
@@ -206,7 +206,7 @@ var Language = /* @__PURE__ */ ((Language4) => {
|
|
|
206
206
|
Language4["English"] = "en";
|
|
207
207
|
return Language4;
|
|
208
208
|
})(Language || {});
|
|
209
|
-
var LanguageContext =
|
|
209
|
+
var LanguageContext = React14.createContext(void 0);
|
|
210
210
|
function LanguageProvider({
|
|
211
211
|
language,
|
|
212
212
|
children
|
|
@@ -214,7 +214,7 @@ function LanguageProvider({
|
|
|
214
214
|
return /* @__PURE__ */ jsxRuntime.jsx(LanguageContext.Provider, { value: language, children });
|
|
215
215
|
}
|
|
216
216
|
function useLanguage() {
|
|
217
|
-
const language =
|
|
217
|
+
const language = React14.useContext(LanguageContext);
|
|
218
218
|
if (!language) {
|
|
219
219
|
throw new Error("Please wrap your application in a LanguageProvider");
|
|
220
220
|
}
|
|
@@ -358,11 +358,11 @@ var useRotatingLabel = ({
|
|
|
358
358
|
label,
|
|
359
359
|
delay
|
|
360
360
|
}) => {
|
|
361
|
-
const loadingTextArray =
|
|
361
|
+
const loadingTextArray = React14.useMemo(
|
|
362
362
|
() => Array.isArray(label) ? label : [label],
|
|
363
363
|
[label]
|
|
364
364
|
);
|
|
365
|
-
const [currentLoadingTextIndex, setCurrentLoadingTextIndex] =
|
|
365
|
+
const [currentLoadingTextIndex, setCurrentLoadingTextIndex] = React14.useState(0);
|
|
366
366
|
usehooksTs.useInterval(() => {
|
|
367
367
|
setCurrentLoadingTextIndex(
|
|
368
368
|
(previousIndex) => (previousIndex + 1) % loadingTextArray.length
|
|
@@ -424,9 +424,9 @@ var progressLoaderRecipe = react.defineRecipe({
|
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
426
|
var usePathLength = (value) => {
|
|
427
|
-
const pathRef =
|
|
428
|
-
const [pathLength, setPathLength] =
|
|
429
|
-
|
|
427
|
+
const pathRef = React14.useRef(null);
|
|
428
|
+
const [pathLength, setPathLength] = React14.useState(0);
|
|
429
|
+
React14.useEffect(() => {
|
|
430
430
|
if (pathRef.current) {
|
|
431
431
|
const totalLength = pathRef.current.getTotalLength();
|
|
432
432
|
setPathLength(totalLength);
|
|
@@ -460,7 +460,7 @@ var ProgressLoader = ({
|
|
|
460
460
|
pathLength: progressPathLength,
|
|
461
461
|
progressOffset
|
|
462
462
|
} = usePathLength(value);
|
|
463
|
-
const id =
|
|
463
|
+
const id = React14.useId();
|
|
464
464
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
465
465
|
ProgressLoaderWrapper,
|
|
466
466
|
{
|
|
@@ -614,7 +614,7 @@ var LoadingContent = ({
|
|
|
614
614
|
] })
|
|
615
615
|
] });
|
|
616
616
|
var getChildContent = (child) => {
|
|
617
|
-
if (
|
|
617
|
+
if (React14.isValidElement(child)) {
|
|
618
618
|
return child.props.children;
|
|
619
619
|
}
|
|
620
620
|
return child;
|
|
@@ -652,7 +652,7 @@ var Button = ({
|
|
|
652
652
|
variant,
|
|
653
653
|
size,
|
|
654
654
|
...rest,
|
|
655
|
-
children: rest.asChild &&
|
|
655
|
+
children: rest.asChild && React14.isValidElement(children) ? React14.cloneElement(children, {
|
|
656
656
|
children: renderContent()
|
|
657
657
|
}) : renderContent()
|
|
658
658
|
}
|
|
@@ -1002,7 +1002,7 @@ var Heading = function Heading2({
|
|
|
1002
1002
|
id: externalId,
|
|
1003
1003
|
...rest
|
|
1004
1004
|
} = props;
|
|
1005
|
-
const reactId =
|
|
1005
|
+
const reactId = React14.useId();
|
|
1006
1006
|
function getId() {
|
|
1007
1007
|
if (externalId !== void 0)
|
|
1008
1008
|
return externalId;
|
|
@@ -1178,11 +1178,11 @@ var FloatingActionButton = ({
|
|
|
1178
1178
|
);
|
|
1179
1179
|
};
|
|
1180
1180
|
var useScrollDirection = () => {
|
|
1181
|
-
const [scrollDirection, setScrollDirection] =
|
|
1182
|
-
const lastScrollPosition =
|
|
1181
|
+
const [scrollDirection, setScrollDirection] = React14__namespace.default.useState(null);
|
|
1182
|
+
const lastScrollPosition = React14__namespace.default.useRef(
|
|
1183
1183
|
globalThis.window === void 0 ? 0 : window.scrollY
|
|
1184
1184
|
);
|
|
1185
|
-
|
|
1185
|
+
React14__namespace.default.useEffect(() => {
|
|
1186
1186
|
const onScroll = () => {
|
|
1187
1187
|
const delta = window.scrollY - lastScrollPosition.current;
|
|
1188
1188
|
if (delta === 0) {
|
|
@@ -1507,12 +1507,12 @@ var Breadcrumb = ({
|
|
|
1507
1507
|
css,
|
|
1508
1508
|
...props
|
|
1509
1509
|
}) => {
|
|
1510
|
-
const validChildren =
|
|
1511
|
-
(element) =>
|
|
1510
|
+
const validChildren = React14__namespace.default.Children.toArray(children).filter(
|
|
1511
|
+
(element) => React14__namespace.default.isValidElement(element)
|
|
1512
1512
|
);
|
|
1513
1513
|
return /* @__PURE__ */ jsxRuntime.jsx(react.Breadcrumb.Root, { ref, css, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(react.Breadcrumb.List, { "data-part": "list", children: validChildren.map((child, index) => {
|
|
1514
1514
|
const isLast = index === validChildren.length - 1;
|
|
1515
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1515
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React14__namespace.default.Fragment, { children: [
|
|
1516
1516
|
/* @__PURE__ */ jsxRuntime.jsx(react.Breadcrumb.Item, { "data-part": "item", children: child }),
|
|
1517
1517
|
!isLast && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1518
1518
|
react.Breadcrumb.Separator,
|
|
@@ -1567,16 +1567,16 @@ var getCurrentTime = () => {
|
|
|
1567
1567
|
var getTimestampFromTime = (time) => {
|
|
1568
1568
|
return `${(time == null ? void 0 : time.hour) ?? 0}:${(time == null ? void 0 : time.minute) ?? 0}`;
|
|
1569
1569
|
};
|
|
1570
|
-
var CalendarContext =
|
|
1570
|
+
var CalendarContext = React14.createContext(null);
|
|
1571
1571
|
function useCalendar() {
|
|
1572
|
-
const context =
|
|
1572
|
+
const context = React14.useContext(CalendarContext);
|
|
1573
1573
|
if (!context)
|
|
1574
1574
|
throw new Error("useCalendar must be used within CalendarProvider");
|
|
1575
1575
|
return context;
|
|
1576
1576
|
}
|
|
1577
1577
|
function CalendarProvider(props) {
|
|
1578
1578
|
const locale = useCurrentLocale();
|
|
1579
|
-
const ref =
|
|
1579
|
+
const ref = React14.useRef(null);
|
|
1580
1580
|
const {
|
|
1581
1581
|
mode = "single",
|
|
1582
1582
|
onChange,
|
|
@@ -1697,7 +1697,7 @@ var RadioCard = ({
|
|
|
1697
1697
|
...props
|
|
1698
1698
|
}) => {
|
|
1699
1699
|
const { inputProps, children } = props;
|
|
1700
|
-
const uniqueId =
|
|
1700
|
+
const uniqueId = React14.useId();
|
|
1701
1701
|
const itemControlId = `radio-card-item-control-${uniqueId}`;
|
|
1702
1702
|
const inputHasAriaLabel = (inputProps == null ? void 0 : inputProps["aria-labelledby"]) || (inputProps == null ? void 0 : inputProps["aria-label"]);
|
|
1703
1703
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.RadioCard.Item, { ...props, children: [
|
|
@@ -1764,7 +1764,7 @@ function isPhantomPointer(event) {
|
|
|
1764
1764
|
function CalendarCell({ date: date$1, currentMonth }) {
|
|
1765
1765
|
var _a6, _b5;
|
|
1766
1766
|
const { mode, state } = useCalendar();
|
|
1767
|
-
const ref =
|
|
1767
|
+
const ref = React14.useRef(null);
|
|
1768
1768
|
const { cellProps, buttonProps, isSelected, isDisabled, formattedDate } = reactAria.useCalendarCell({ date: date$1 }, state, ref);
|
|
1769
1769
|
const isOutsideMonth = !date.isSameMonth(currentMonth, date$1);
|
|
1770
1770
|
const isSelectionStart = mode === "range" && ((_a6 = state.highlightedRange) == null ? void 0 : _a6.start) ? date.isSameDay(date$1, state.highlightedRange.start) : false;
|
|
@@ -2031,8 +2031,8 @@ function Calendar({ dualView, css }) {
|
|
|
2031
2031
|
}
|
|
2032
2032
|
function ScrollCalendar(boxProps) {
|
|
2033
2033
|
const { state, calendarProps, ref, startValue } = useCalendar();
|
|
2034
|
-
const monthReferences =
|
|
2035
|
-
const hasScrolledRef =
|
|
2034
|
+
const monthReferences = React14.useRef([]);
|
|
2035
|
+
const hasScrolledRef = React14.useRef(false);
|
|
2036
2036
|
const startMonth = state.visibleRange.start.year * 12 + state.visibleRange.start.month;
|
|
2037
2037
|
const endMonth = state.visibleRange.end.year * 12 + state.visibleRange.end.month;
|
|
2038
2038
|
const monthCount = endMonth - startMonth + 1;
|
|
@@ -2041,7 +2041,7 @@ function ScrollCalendar(boxProps) {
|
|
|
2041
2041
|
year: "numeric",
|
|
2042
2042
|
timeZone: state.timeZone
|
|
2043
2043
|
});
|
|
2044
|
-
|
|
2044
|
+
React14.useEffect(
|
|
2045
2045
|
function scrollFocusedMonthIntoView() {
|
|
2046
2046
|
const targetDate = startValue || state.focusedDate;
|
|
2047
2047
|
if (hasScrolledRef.current || !targetDate)
|
|
@@ -2183,13 +2183,13 @@ var labelStyles = react.defineStyle({
|
|
|
2183
2183
|
}
|
|
2184
2184
|
});
|
|
2185
2185
|
function renderLabelWithIndicator(label, labelAsChild) {
|
|
2186
|
-
if (!labelAsChild || !
|
|
2186
|
+
if (!labelAsChild || !React14__namespace.isValidElement(label)) {
|
|
2187
2187
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2188
2188
|
label,
|
|
2189
2189
|
/* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
|
|
2190
2190
|
] });
|
|
2191
2191
|
}
|
|
2192
|
-
return
|
|
2192
|
+
return React14__namespace.cloneElement(
|
|
2193
2193
|
label,
|
|
2194
2194
|
{},
|
|
2195
2195
|
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2279,7 +2279,7 @@ function CalendarCell2({
|
|
|
2279
2279
|
currentMonth,
|
|
2280
2280
|
variant
|
|
2281
2281
|
}) {
|
|
2282
|
-
const ref =
|
|
2282
|
+
const ref = React14.useRef(null);
|
|
2283
2283
|
const {
|
|
2284
2284
|
cellProps,
|
|
2285
2285
|
buttonProps,
|
|
@@ -2306,7 +2306,7 @@ function CalendarCell2({
|
|
|
2306
2306
|
if (isOutsideMonth) {
|
|
2307
2307
|
stateProps["data-unavailable"] = true;
|
|
2308
2308
|
}
|
|
2309
|
-
|
|
2309
|
+
React14.useEffect(() => {
|
|
2310
2310
|
var _a6;
|
|
2311
2311
|
(_a6 = ref.current) == null ? void 0 : _a6.addEventListener(
|
|
2312
2312
|
"touchend",
|
|
@@ -2390,7 +2390,7 @@ function CalendarNavigationButton({
|
|
|
2390
2390
|
"aria-label": ariaLabel,
|
|
2391
2391
|
...rest
|
|
2392
2392
|
}) {
|
|
2393
|
-
const ref =
|
|
2393
|
+
const ref = React14.useRef(null);
|
|
2394
2394
|
const { buttonProps } = reactAria.useButton(rest, ref);
|
|
2395
2395
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2396
2396
|
IconButton,
|
|
@@ -2609,7 +2609,7 @@ var DateTimeSegment = ({
|
|
|
2609
2609
|
ariaDescription,
|
|
2610
2610
|
variant
|
|
2611
2611
|
}) => {
|
|
2612
|
-
const internalRef =
|
|
2612
|
+
const internalRef = React14.useRef(null);
|
|
2613
2613
|
const ref = externalRef ?? internalRef;
|
|
2614
2614
|
const { segmentProps } = reactAria.useDateSegment(
|
|
2615
2615
|
segment,
|
|
@@ -2669,7 +2669,7 @@ var DateField = ({
|
|
|
2669
2669
|
createCalendar: createCalendar3
|
|
2670
2670
|
});
|
|
2671
2671
|
const { t } = useTranslation();
|
|
2672
|
-
const internalRef =
|
|
2672
|
+
const internalRef = React14.useRef(null);
|
|
2673
2673
|
const ref = externalRef ?? internalRef;
|
|
2674
2674
|
const { fieldProps } = reactAria.useDateField(
|
|
2675
2675
|
props,
|
|
@@ -2796,10 +2796,10 @@ var DatePicker = ({
|
|
|
2796
2796
|
isRequired: props.isRequired ?? (chakraFieldProps == null ? void 0 : chakraFieldProps.required),
|
|
2797
2797
|
validationState: (chakraFieldProps == null ? void 0 : chakraFieldProps.invalid) ? "invalid" : "valid"
|
|
2798
2798
|
});
|
|
2799
|
-
const internalRef =
|
|
2799
|
+
const internalRef = React14.useRef(null);
|
|
2800
2800
|
const ref = externalRef ?? internalRef;
|
|
2801
2801
|
const { labelProps, fieldProps, buttonProps, dialogProps, calendarProps } = reactAria.useDatePicker(props, state, ref);
|
|
2802
|
-
const inputGroupId = `input-group-${
|
|
2802
|
+
const inputGroupId = `input-group-${React14.useId()}`;
|
|
2803
2803
|
const recipe = react.useSlotRecipe({
|
|
2804
2804
|
key: "datePicker"
|
|
2805
2805
|
});
|
|
@@ -2892,7 +2892,7 @@ function RangeCalendar(props) {
|
|
|
2892
2892
|
key: "datePicker"
|
|
2893
2893
|
});
|
|
2894
2894
|
const styles = recipe({});
|
|
2895
|
-
const ref =
|
|
2895
|
+
const ref = React14.useRef(null);
|
|
2896
2896
|
const { calendarProps, title } = reactAria.useRangeCalendar(props, state, ref);
|
|
2897
2897
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { ...calendarProps, ref, css: styles.rangeCalendarPopover, children: [
|
|
2898
2898
|
/* @__PURE__ */ jsxRuntime.jsx(CalendarHeader2, { state, title }),
|
|
@@ -2931,7 +2931,7 @@ function DateRangePicker({
|
|
|
2931
2931
|
isRequired: props.required ?? (fieldContextPRops == null ? void 0 : fieldContextPRops.required),
|
|
2932
2932
|
validationState: (fieldContextPRops == null ? void 0 : fieldContextPRops.invalid) ? "invalid" : "valid"
|
|
2933
2933
|
});
|
|
2934
|
-
const ref =
|
|
2934
|
+
const ref = React14.useRef(null);
|
|
2935
2935
|
const uniqueId = reactAria.useId();
|
|
2936
2936
|
const datePickerId = `date-range-picker-${uniqueId}`;
|
|
2937
2937
|
const {
|
|
@@ -3020,7 +3020,7 @@ function DateRangePicker({
|
|
|
3020
3020
|
] }) });
|
|
3021
3021
|
}
|
|
3022
3022
|
var TimeField = ({ state, ...props }) => {
|
|
3023
|
-
const ref =
|
|
3023
|
+
const ref = React14.useRef(null);
|
|
3024
3024
|
const { labelProps, fieldProps } = reactAria.useTimeField(props, state, ref);
|
|
3025
3025
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.Box, { children: [
|
|
3026
3026
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3364,6 +3364,124 @@ var texts13 = createTexts({
|
|
|
3364
3364
|
sv: "St\xE4ng"
|
|
3365
3365
|
}
|
|
3366
3366
|
});
|
|
3367
|
+
var ExternalIcon = ({
|
|
3368
|
+
label,
|
|
3369
|
+
size
|
|
3370
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3371
|
+
size === "lg" || size === "md" ? /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.LinkOutOutline24Icon, { "aria-hidden": true, display: "inline" }) : /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.LinkOutOutline18Icon, { "aria-hidden": true, display: "inline" }),
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.VisuallyHidden, { children: label })
|
|
3373
|
+
] });
|
|
3374
|
+
var TextLink = ({
|
|
3375
|
+
ref,
|
|
3376
|
+
children,
|
|
3377
|
+
external,
|
|
3378
|
+
href,
|
|
3379
|
+
...props
|
|
3380
|
+
}) => {
|
|
3381
|
+
const { t } = useTranslation();
|
|
3382
|
+
const isExternal = external ?? Boolean((href == null ? void 0 : href.startsWith("http://")) || (href == null ? void 0 : href.startsWith("https://")));
|
|
3383
|
+
const externalLabel = t ? t(texts14.externalLink) : texts14.externalLink.en;
|
|
3384
|
+
if (props.asChild && React14.isValidElement(children)) {
|
|
3385
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3386
|
+
react.Link,
|
|
3387
|
+
{
|
|
3388
|
+
href,
|
|
3389
|
+
...props,
|
|
3390
|
+
ref,
|
|
3391
|
+
...isExternal && {
|
|
3392
|
+
target: "_blank",
|
|
3393
|
+
rel: "noopener noreferrer"
|
|
3394
|
+
},
|
|
3395
|
+
children: React14.cloneElement(children, {
|
|
3396
|
+
...children.props,
|
|
3397
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3398
|
+
children.props.children,
|
|
3399
|
+
isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
|
|
3400
|
+
] })
|
|
3401
|
+
})
|
|
3402
|
+
}
|
|
3403
|
+
);
|
|
3404
|
+
}
|
|
3405
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3406
|
+
react.Link,
|
|
3407
|
+
{
|
|
3408
|
+
href,
|
|
3409
|
+
...props,
|
|
3410
|
+
ref,
|
|
3411
|
+
...isExternal && {
|
|
3412
|
+
target: "_blank",
|
|
3413
|
+
rel: "noopener noreferrer"
|
|
3414
|
+
},
|
|
3415
|
+
children: [
|
|
3416
|
+
children,
|
|
3417
|
+
isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
|
|
3418
|
+
]
|
|
3419
|
+
}
|
|
3420
|
+
);
|
|
3421
|
+
};
|
|
3422
|
+
var texts14 = createTexts({
|
|
3423
|
+
externalLink: {
|
|
3424
|
+
nb: "Ekstern lenke",
|
|
3425
|
+
nn: "Ekstern lenke",
|
|
3426
|
+
sv: "Extern l\xE4nk",
|
|
3427
|
+
en: "External link"
|
|
3428
|
+
}
|
|
3429
|
+
});
|
|
3430
|
+
var List = react.List.Root;
|
|
3431
|
+
var ListItem = react.List.Item;
|
|
3432
|
+
var ListIndicator = react.List.Indicator;
|
|
3433
|
+
var ErrorSummary = ({
|
|
3434
|
+
ref: externalRef,
|
|
3435
|
+
children,
|
|
3436
|
+
headingLevel = "h2",
|
|
3437
|
+
heading,
|
|
3438
|
+
...rest
|
|
3439
|
+
}) => {
|
|
3440
|
+
const recipe = react.useSlotRecipe({ key: "errorSummary" });
|
|
3441
|
+
const styles = recipe();
|
|
3442
|
+
const wrapperRef = React14.useRef(null);
|
|
3443
|
+
const headingRef = React14.useRef(null);
|
|
3444
|
+
const ref = externalRef ?? wrapperRef;
|
|
3445
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3446
|
+
react.Box,
|
|
3447
|
+
{
|
|
3448
|
+
css: styles.container,
|
|
3449
|
+
ref,
|
|
3450
|
+
...rest,
|
|
3451
|
+
"aria-labelledby": slugify(heading),
|
|
3452
|
+
tabIndex: -1,
|
|
3453
|
+
children: [
|
|
3454
|
+
heading && /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { css: styles.heading, children: [
|
|
3455
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3456
|
+
spor_icon_react_star.ErrorFill24Icon,
|
|
3457
|
+
{
|
|
3458
|
+
css: {
|
|
3459
|
+
flexShrink: 0,
|
|
3460
|
+
"& path:first-of-type": {
|
|
3461
|
+
fill: `icon.critical`
|
|
3462
|
+
},
|
|
3463
|
+
"& path:not(:first-of-type)": {
|
|
3464
|
+
fill: `surface.critical`
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
),
|
|
3469
|
+
/* @__PURE__ */ jsxRuntime.jsx(Heading, { as: headingLevel, variant: "md", autoId: true, ref: headingRef, children: heading })
|
|
3470
|
+
] }),
|
|
3471
|
+
/* @__PURE__ */ jsxRuntime.jsx(List, { css: styles.list, gap: 2, children })
|
|
3472
|
+
]
|
|
3473
|
+
}
|
|
3474
|
+
);
|
|
3475
|
+
};
|
|
3476
|
+
var ErrorSummaryItem = ({
|
|
3477
|
+
children,
|
|
3478
|
+
href,
|
|
3479
|
+
...rest
|
|
3480
|
+
}) => {
|
|
3481
|
+
const recipe = react.useSlotRecipe({ key: "errorSummary" });
|
|
3482
|
+
const styles = recipe();
|
|
3483
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { css: styles.item, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(TextLink, { href, children }) });
|
|
3484
|
+
};
|
|
3367
3485
|
var AttachedInputs = ({
|
|
3368
3486
|
ref,
|
|
3369
3487
|
...props
|
|
@@ -3438,14 +3556,14 @@ function useFloatingInputState({
|
|
|
3438
3556
|
onChange,
|
|
3439
3557
|
inputRef
|
|
3440
3558
|
}) {
|
|
3441
|
-
const [focused, setFocused] =
|
|
3559
|
+
const [focused, setFocused] = React14.useState(false);
|
|
3442
3560
|
const isControlled = value !== void 0;
|
|
3443
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
3561
|
+
const [uncontrolledValue, setUncontrolledValue] = React14.useState(
|
|
3444
3562
|
defaultValue ? String(defaultValue) : ""
|
|
3445
3563
|
);
|
|
3446
3564
|
const inputValue = isControlled ? String(value ?? "") : uncontrolledValue;
|
|
3447
3565
|
const shouldFloat = inputValue.length > 0 || focused;
|
|
3448
|
-
const syncFromRef =
|
|
3566
|
+
const syncFromRef = React14__namespace.default.useCallback(() => {
|
|
3449
3567
|
if (!isControlled && (inputRef == null ? void 0 : inputRef.current)) {
|
|
3450
3568
|
const v = inputRef.current.value;
|
|
3451
3569
|
if (v !== uncontrolledValue) {
|
|
@@ -3453,7 +3571,7 @@ function useFloatingInputState({
|
|
|
3453
3571
|
}
|
|
3454
3572
|
}
|
|
3455
3573
|
}, [isControlled, inputRef, uncontrolledValue]);
|
|
3456
|
-
|
|
3574
|
+
React14.useEffect(() => {
|
|
3457
3575
|
if (!isControlled && (inputRef == null ? void 0 : inputRef.current)) {
|
|
3458
3576
|
const input = inputRef.current;
|
|
3459
3577
|
syncFromRef();
|
|
@@ -3514,9 +3632,9 @@ var Input = ({
|
|
|
3514
3632
|
const recipe = react.useRecipe({ key: "input" });
|
|
3515
3633
|
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
|
3516
3634
|
const styles = recipe(recipeProps);
|
|
3517
|
-
const labelId =
|
|
3518
|
-
const inputRef =
|
|
3519
|
-
|
|
3635
|
+
const labelId = React14.useId();
|
|
3636
|
+
const inputRef = React14.useRef(null);
|
|
3637
|
+
React14.useImperativeHandle(ref, () => inputRef.current, []);
|
|
3520
3638
|
const { shouldFloat, handleFocus, handleBlur, handleChange, isControlled } = useFloatingInputState({
|
|
3521
3639
|
value: props.value,
|
|
3522
3640
|
defaultValue: props.defaultValue,
|
|
@@ -3609,7 +3727,7 @@ function Autocomplete({
|
|
|
3609
3727
|
}) {
|
|
3610
3728
|
const { contains } = react.useFilter({ sensitivity: "base" });
|
|
3611
3729
|
const { t } = useTranslation();
|
|
3612
|
-
const extractedItems =
|
|
3730
|
+
const extractedItems = React14__namespace.default.useMemo(
|
|
3613
3731
|
() => extractItemsFromChildren(children),
|
|
3614
3732
|
[children]
|
|
3615
3733
|
);
|
|
@@ -3617,11 +3735,11 @@ function Autocomplete({
|
|
|
3617
3735
|
initialItems: extractedItems,
|
|
3618
3736
|
filter: filteredExternally ? void 0 : contains
|
|
3619
3737
|
});
|
|
3620
|
-
|
|
3738
|
+
React14__namespace.default.useEffect(() => {
|
|
3621
3739
|
if (filteredExternally)
|
|
3622
3740
|
reset();
|
|
3623
3741
|
}, [extractedItems, reset, filteredExternally]);
|
|
3624
|
-
const filteredChildren =
|
|
3742
|
+
const filteredChildren = React14__namespace.default.useMemo(
|
|
3625
3743
|
() => filterChildren(children, collection.items),
|
|
3626
3744
|
[children, collection.items]
|
|
3627
3745
|
);
|
|
@@ -3666,10 +3784,10 @@ function Autocomplete({
|
|
|
3666
3784
|
}
|
|
3667
3785
|
}
|
|
3668
3786
|
) }),
|
|
3669
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.ClearTrigger, { asChild: true, "aria-label": t(
|
|
3787
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.IndicatorGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.ClearTrigger, { asChild: true, "aria-label": t(texts15.clearValue), children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { size: "xs", tabIndex: 0 }) }) })
|
|
3670
3788
|
] }),
|
|
3671
3789
|
/* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.Combobox.Content, { children: [
|
|
3672
|
-
!loading && /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Empty, { children: emptyLabel ?? t(
|
|
3790
|
+
!loading && /* @__PURE__ */ jsxRuntime.jsx(react.Combobox.Empty, { children: emptyLabel ?? t(texts15.noItemsFound) }),
|
|
3673
3791
|
loading ? /* @__PURE__ */ jsxRuntime.jsx(ColorSpinner, { width: "1.5rem", p: "2" }) : filteredChildren
|
|
3674
3792
|
] }) })
|
|
3675
3793
|
] });
|
|
@@ -3685,9 +3803,9 @@ var AutocompleteItem = ({ children, ...props }) => {
|
|
|
3685
3803
|
};
|
|
3686
3804
|
var filterChildren = (children, collectionItems) => {
|
|
3687
3805
|
const collectionValues = new Set(collectionItems.map((item) => item.value));
|
|
3688
|
-
return
|
|
3806
|
+
return React14__namespace.default.Children.toArray(children).map((child) => {
|
|
3689
3807
|
var _a6;
|
|
3690
|
-
if (!
|
|
3808
|
+
if (!React14__namespace.default.isValidElement(child))
|
|
3691
3809
|
return null;
|
|
3692
3810
|
if (child.type === AutocompleteItemGroup) {
|
|
3693
3811
|
const groupProps = child.props;
|
|
@@ -3696,11 +3814,11 @@ var filterChildren = (children, collectionItems) => {
|
|
|
3696
3814
|
collectionItems
|
|
3697
3815
|
);
|
|
3698
3816
|
const hasItems = filteredGroupChildren.some(
|
|
3699
|
-
(groupChild) =>
|
|
3817
|
+
(groupChild) => React14__namespace.default.isValidElement(groupChild) && groupChild.type !== AutocompleteItemGroupLabel
|
|
3700
3818
|
);
|
|
3701
3819
|
if (!hasItems)
|
|
3702
3820
|
return null;
|
|
3703
|
-
return
|
|
3821
|
+
return React14__namespace.default.cloneElement(child, groupProps, ...filteredGroupChildren);
|
|
3704
3822
|
}
|
|
3705
3823
|
const itemProps = (_a6 = child.props) == null ? void 0 : _a6.item;
|
|
3706
3824
|
if (itemProps) {
|
|
@@ -3711,8 +3829,8 @@ var filterChildren = (children, collectionItems) => {
|
|
|
3711
3829
|
};
|
|
3712
3830
|
var extractItemsFromChildren = (children) => {
|
|
3713
3831
|
const items = [];
|
|
3714
|
-
|
|
3715
|
-
if (!
|
|
3832
|
+
React14__namespace.default.Children.forEach(children, (child) => {
|
|
3833
|
+
if (!React14__namespace.default.isValidElement(child))
|
|
3716
3834
|
return;
|
|
3717
3835
|
if (child.type === AutocompleteItemGroup) {
|
|
3718
3836
|
items.push(
|
|
@@ -3728,7 +3846,7 @@ var extractItemsFromChildren = (children) => {
|
|
|
3728
3846
|
});
|
|
3729
3847
|
return items;
|
|
3730
3848
|
};
|
|
3731
|
-
var
|
|
3849
|
+
var texts15 = createTexts({
|
|
3732
3850
|
noItemsFound: {
|
|
3733
3851
|
nb: "Ingen resultater",
|
|
3734
3852
|
nn: "Ingen resultat",
|
|
@@ -3813,18 +3931,18 @@ var CheckboxGroup = (props) => {
|
|
|
3813
3931
|
const { direction = "row", children, gap = 1, ...rest } = props;
|
|
3814
3932
|
return /* @__PURE__ */ jsxRuntime.jsx(react.CheckboxGroup, { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { direction, gap, children }) });
|
|
3815
3933
|
};
|
|
3816
|
-
var ChoiceChipContext =
|
|
3934
|
+
var ChoiceChipContext = React14.createContext({
|
|
3817
3935
|
variant: "core",
|
|
3818
3936
|
size: "sm"
|
|
3819
3937
|
});
|
|
3820
|
-
var useChoiceChipContext = () =>
|
|
3938
|
+
var useChoiceChipContext = () => React14.useContext(ChoiceChipContext);
|
|
3821
3939
|
var ChoiceChip = ({
|
|
3822
3940
|
ref,
|
|
3823
3941
|
...props
|
|
3824
3942
|
}) => {
|
|
3825
3943
|
const { children, inputProps, icon, variant, size, css, ...rest } = props;
|
|
3826
3944
|
const { variant: contextVariant, size: contextSize } = useChoiceChipContext();
|
|
3827
|
-
const uniqueId =
|
|
3945
|
+
const uniqueId = React14.useId();
|
|
3828
3946
|
const itemControlId = `radio-card-item-control-${uniqueId}`;
|
|
3829
3947
|
const inputHasAriaLabel = (inputProps == null ? void 0 : inputProps["aria-labelledby"]) || (inputProps == null ? void 0 : inputProps["aria-label"]);
|
|
3830
3948
|
const finalVariant = variant ?? contextVariant;
|
|
@@ -3889,9 +4007,9 @@ var Popover = ({
|
|
|
3889
4007
|
hasBackdrop = true,
|
|
3890
4008
|
containerPadding = 12
|
|
3891
4009
|
}) => {
|
|
3892
|
-
const internalRef =
|
|
4010
|
+
const internalRef = React14.useRef(null);
|
|
3893
4011
|
const popoverRef = ref ?? internalRef;
|
|
3894
|
-
|
|
4012
|
+
React14.useLayoutEffect(() => {
|
|
3895
4013
|
var _a6;
|
|
3896
4014
|
const element = typeof popoverRef === "object" ? popoverRef == null ? void 0 : popoverRef.current : null;
|
|
3897
4015
|
if (element) {
|
|
@@ -3964,11 +4082,11 @@ var Combobox2 = (props) => {
|
|
|
3964
4082
|
...restProps
|
|
3965
4083
|
} = props;
|
|
3966
4084
|
const { contains } = reactAria.useFilter({ sensitivity: "base" });
|
|
3967
|
-
const fallbackInputRef =
|
|
4085
|
+
const fallbackInputRef = React14.useRef(null);
|
|
3968
4086
|
const inputRef = externalInputRef ?? fallbackInputRef;
|
|
3969
|
-
const listBoxRef =
|
|
3970
|
-
const popoverRef =
|
|
3971
|
-
const listboxId =
|
|
4087
|
+
const listBoxRef = React14.useRef(null);
|
|
4088
|
+
const popoverRef = React14.useRef(null);
|
|
4089
|
+
const listboxId = React14.useId();
|
|
3972
4090
|
const inputWidth = useInputWidth(
|
|
3973
4091
|
inputRef
|
|
3974
4092
|
);
|
|
@@ -4100,8 +4218,8 @@ var Combobox2 = (props) => {
|
|
|
4100
4218
|
] });
|
|
4101
4219
|
};
|
|
4102
4220
|
var useInputWidth = (inputRef) => {
|
|
4103
|
-
const [inputWidth, setInputWidth] =
|
|
4104
|
-
|
|
4221
|
+
const [inputWidth, setInputWidth] = React14.useState("auto");
|
|
4222
|
+
React14.useEffect(() => {
|
|
4105
4223
|
const onResize = debounce(() => {
|
|
4106
4224
|
if (inputRef.current) {
|
|
4107
4225
|
setInputWidth(`${inputRef.current.offsetWidth}px`);
|
|
@@ -4213,7 +4331,7 @@ function ItemDescription({ children }) {
|
|
|
4213
4331
|
);
|
|
4214
4332
|
}
|
|
4215
4333
|
function Option({ item, state }) {
|
|
4216
|
-
const ref =
|
|
4334
|
+
const ref = React14.useRef(null);
|
|
4217
4335
|
const {
|
|
4218
4336
|
optionProps,
|
|
4219
4337
|
isSelected,
|
|
@@ -4238,7 +4356,7 @@ function Option({ item, state }) {
|
|
|
4238
4356
|
if (isFocusVisible) {
|
|
4239
4357
|
dataFields["data-focus-visible"] = true;
|
|
4240
4358
|
}
|
|
4241
|
-
|
|
4359
|
+
React14.useEffect(() => {
|
|
4242
4360
|
var _a6;
|
|
4243
4361
|
(_a6 = ref.current) == null ? void 0 : _a6.addEventListener(
|
|
4244
4362
|
"touchend",
|
|
@@ -4261,12 +4379,12 @@ function Option({ item, state }) {
|
|
|
4261
4379
|
}
|
|
4262
4380
|
) });
|
|
4263
4381
|
}
|
|
4264
|
-
var OptionContext =
|
|
4382
|
+
var OptionContext = React14__namespace.default.createContext({
|
|
4265
4383
|
labelProps: {},
|
|
4266
4384
|
descriptionProps: {}
|
|
4267
4385
|
});
|
|
4268
4386
|
var useOptionContext = () => {
|
|
4269
|
-
return
|
|
4387
|
+
return React14.useContext(OptionContext);
|
|
4270
4388
|
};
|
|
4271
4389
|
function ListBoxSection({ section, state }) {
|
|
4272
4390
|
var _a6, _b5;
|
|
@@ -4296,10 +4414,10 @@ function ListBoxSection({ section, state }) {
|
|
|
4296
4414
|
) })
|
|
4297
4415
|
] }) });
|
|
4298
4416
|
}
|
|
4299
|
-
var CustomMenuContext =
|
|
4417
|
+
var CustomMenuContext = React14.createContext({
|
|
4300
4418
|
variant: "core"
|
|
4301
4419
|
});
|
|
4302
|
-
var useMenuContext = () =>
|
|
4420
|
+
var useMenuContext = () => React14.useContext(CustomMenuContext);
|
|
4303
4421
|
var Menu = ({ children, ...props }) => {
|
|
4304
4422
|
return /* @__PURE__ */ jsxRuntime.jsx(CustomMenuContext.Provider, { value: { variant: props.variant }, children: /* @__PURE__ */ jsxRuntime.jsx(react.Menu.Root, { ...props, children }) });
|
|
4305
4423
|
};
|
|
@@ -4511,7 +4629,7 @@ var NumericStepper = ({
|
|
|
4511
4629
|
gap,
|
|
4512
4630
|
...rest
|
|
4513
4631
|
} = props;
|
|
4514
|
-
const addButtonRef =
|
|
4632
|
+
const addButtonRef = React14.useRef(null);
|
|
4515
4633
|
const { t } = useTranslation();
|
|
4516
4634
|
const recipe = react.useSlotRecipe({ key: "numericStepper" });
|
|
4517
4635
|
const styles = recipe();
|
|
@@ -4544,7 +4662,7 @@ var NumericStepper = ({
|
|
|
4544
4662
|
{
|
|
4545
4663
|
icon: /* @__PURE__ */ jsxRuntime.jsx(SubtractIcon, { stepLabel: clampedStepSize }),
|
|
4546
4664
|
"aria-label": t(
|
|
4547
|
-
|
|
4665
|
+
texts16.decrementButtonAriaLabel(
|
|
4548
4666
|
clampedStepSize,
|
|
4549
4667
|
stepSize === 1 ? ariaLabelContext.singular : ariaLabelContext.plural
|
|
4550
4668
|
)
|
|
@@ -4571,7 +4689,7 @@ var NumericStepper = ({
|
|
|
4571
4689
|
css: styles.input,
|
|
4572
4690
|
width: `${Math.max(value.toString().length + 1, 3)}ch`,
|
|
4573
4691
|
"aria-live": "assertive",
|
|
4574
|
-
"aria-label": ariaLabelContext.plural === "" ? "" : t(
|
|
4692
|
+
"aria-label": ariaLabelContext.plural === "" ? "" : t(texts16.currentNumberAriaLabel(ariaLabelContext.plural)),
|
|
4575
4693
|
onChange: (event) => {
|
|
4576
4694
|
const numericInput = Number(event.target.value);
|
|
4577
4695
|
if (Number.isNaN(numericInput)) {
|
|
@@ -4592,7 +4710,7 @@ var NumericStepper = ({
|
|
|
4592
4710
|
paddingX: 0.5,
|
|
4593
4711
|
padding: 0,
|
|
4594
4712
|
textAlign: "center",
|
|
4595
|
-
"aria-label": ariaLabelContext.plural === "" ? "" : t(
|
|
4713
|
+
"aria-label": ariaLabelContext.plural === "" ? "" : t(texts16.currentNumberAriaLabel(ariaLabelContext.plural)),
|
|
4596
4714
|
children: value
|
|
4597
4715
|
}
|
|
4598
4716
|
),
|
|
@@ -4602,7 +4720,7 @@ var NumericStepper = ({
|
|
|
4602
4720
|
ref: addButtonRef,
|
|
4603
4721
|
icon: /* @__PURE__ */ jsxRuntime.jsx(AddIcon, { stepLabel: clampedStepSize }),
|
|
4604
4722
|
"aria-label": t(
|
|
4605
|
-
|
|
4723
|
+
texts16.incrementButtonAriaLabel(
|
|
4606
4724
|
clampedStepSize,
|
|
4607
4725
|
stepSize === 1 ? ariaLabelContext.singular : ariaLabelContext.plural
|
|
4608
4726
|
)
|
|
@@ -4676,7 +4794,7 @@ var AddIcon = ({ stepLabel }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Frag
|
|
|
4676
4794
|
] }),
|
|
4677
4795
|
stepLabel > 1 && /* @__PURE__ */ jsxRuntime.jsx(react.chakra.span, { paddingRight: "1", children: stepLabel.toString() })
|
|
4678
4796
|
] });
|
|
4679
|
-
var
|
|
4797
|
+
var texts16 = createTexts({
|
|
4680
4798
|
currentNumberAriaLabel(ariaContext) {
|
|
4681
4799
|
return {
|
|
4682
4800
|
nb: `Valgt antall ${ariaContext}`,
|
|
@@ -4740,7 +4858,7 @@ var PasswordInput = ({
|
|
|
4740
4858
|
event.preventDefault();
|
|
4741
4859
|
setVisible(!visible);
|
|
4742
4860
|
},
|
|
4743
|
-
children: visible ? t(
|
|
4861
|
+
children: visible ? t(texts17.hidePassword) : t(texts17.showPassword)
|
|
4744
4862
|
}
|
|
4745
4863
|
),
|
|
4746
4864
|
...rest
|
|
@@ -4765,7 +4883,7 @@ var VisibilityTrigger = ({
|
|
|
4765
4883
|
}
|
|
4766
4884
|
);
|
|
4767
4885
|
};
|
|
4768
|
-
var
|
|
4886
|
+
var texts17 = createTexts({
|
|
4769
4887
|
showPassword: {
|
|
4770
4888
|
nb: "Vis",
|
|
4771
4889
|
nn: "Vis",
|
|
@@ -4798,7 +4916,7 @@ var CountryCodeSelect = ({
|
|
|
4798
4916
|
...props
|
|
4799
4917
|
}) => {
|
|
4800
4918
|
const { t } = useTranslation();
|
|
4801
|
-
const filteredCallingCodes =
|
|
4919
|
+
const filteredCallingCodes = React14.useMemo(() => {
|
|
4802
4920
|
if (!props.allowedCountryCodes)
|
|
4803
4921
|
return allCallingCodes;
|
|
4804
4922
|
const filteredItems = allCallingCodes.items.filter(
|
|
@@ -4817,14 +4935,14 @@ var CountryCodeSelect = ({
|
|
|
4817
4935
|
positioning: { placement: "bottom", flip: false },
|
|
4818
4936
|
collection: filteredCallingCodes,
|
|
4819
4937
|
lazyMount: true,
|
|
4820
|
-
"aria-label": t(
|
|
4938
|
+
"aria-label": t(texts18.countryCode),
|
|
4821
4939
|
sideRadiusVariant: "rightSideSquare",
|
|
4822
4940
|
role: "combobox",
|
|
4823
4941
|
children: filteredCallingCodes.items.map((code) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { item: code, children: code.label }, code.label))
|
|
4824
4942
|
}
|
|
4825
4943
|
);
|
|
4826
4944
|
};
|
|
4827
|
-
var
|
|
4945
|
+
var texts18 = createTexts({
|
|
4828
4946
|
countryCode: {
|
|
4829
4947
|
nb: "Landkode",
|
|
4830
4948
|
nn: "Landskode",
|
|
@@ -4847,7 +4965,7 @@ var PhoneNumberInput = ({
|
|
|
4847
4965
|
errorText
|
|
4848
4966
|
} = props;
|
|
4849
4967
|
const { t } = useTranslation();
|
|
4850
|
-
const label = externalLabel ?? (optional ? t(
|
|
4968
|
+
const label = externalLabel ?? (optional ? t(texts19.phoneNumberOptional) : t(texts19.phoneNumber));
|
|
4851
4969
|
const [value, onChange] = react.useControllableState({
|
|
4852
4970
|
value: externalValue,
|
|
4853
4971
|
onChange: externalOnChange,
|
|
@@ -4902,7 +5020,7 @@ var PhoneNumberInput = ({
|
|
|
4902
5020
|
)
|
|
4903
5021
|
] });
|
|
4904
5022
|
};
|
|
4905
|
-
var
|
|
5023
|
+
var texts19 = createTexts({
|
|
4906
5024
|
phoneNumber: {
|
|
4907
5025
|
nb: "Telefonnummer",
|
|
4908
5026
|
nn: "Telefonnummer",
|
|
@@ -4954,16 +5072,16 @@ var SearchInput = ({
|
|
|
4954
5072
|
variant: "ghost",
|
|
4955
5073
|
type: "button",
|
|
4956
5074
|
size: "sm",
|
|
4957
|
-
"aria-label": t(
|
|
5075
|
+
"aria-label": t(texts20.reset),
|
|
4958
5076
|
icon: /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.CloseOutline24Icon, {}),
|
|
4959
5077
|
onClick: onReset
|
|
4960
5078
|
}
|
|
4961
5079
|
),
|
|
4962
|
-
label: label ?? t(
|
|
5080
|
+
label: label ?? t(texts20.label)
|
|
4963
5081
|
}
|
|
4964
5082
|
);
|
|
4965
5083
|
};
|
|
4966
|
-
var
|
|
5084
|
+
var texts20 = createTexts({
|
|
4967
5085
|
label: {
|
|
4968
5086
|
nb: "S\xF8k",
|
|
4969
5087
|
nn: "S\xF8k",
|
|
@@ -5200,9 +5318,9 @@ var Switch = ({
|
|
|
5200
5318
|
);
|
|
5201
5319
|
};
|
|
5202
5320
|
var useLabelHeight = (label) => {
|
|
5203
|
-
const labelRef =
|
|
5204
|
-
const [labelHeight, setLabelHeight] =
|
|
5205
|
-
|
|
5321
|
+
const labelRef = React14.useRef(null);
|
|
5322
|
+
const [labelHeight, setLabelHeight] = React14.useState(0);
|
|
5323
|
+
React14.useLayoutEffect(() => {
|
|
5206
5324
|
const updateLabelHeight = () => {
|
|
5207
5325
|
if (labelRef.current) {
|
|
5208
5326
|
setLabelHeight(labelRef.current.offsetHeight);
|
|
@@ -5240,8 +5358,8 @@ var Textarea = ({
|
|
|
5240
5358
|
const recipe = react.useRecipe({ key: "textarea" });
|
|
5241
5359
|
const styles = recipe({ variant });
|
|
5242
5360
|
const { labelRef, labelHeight } = useLabelHeight(label);
|
|
5243
|
-
const inputRef =
|
|
5244
|
-
|
|
5361
|
+
const inputRef = React14.useRef(null);
|
|
5362
|
+
React14.useImperativeHandle(ref, () => inputRef.current, []);
|
|
5245
5363
|
const { shouldFloat, handleFocus, handleBlur, handleChange, isControlled } = useFloatingInputState({
|
|
5246
5364
|
value: props.value,
|
|
5247
5365
|
defaultValue: props.defaultValue,
|
|
@@ -5250,7 +5368,7 @@ var Textarea = ({
|
|
|
5250
5368
|
onChange: props.onChange,
|
|
5251
5369
|
inputRef
|
|
5252
5370
|
});
|
|
5253
|
-
const labelId =
|
|
5371
|
+
const labelId = React14.useId();
|
|
5254
5372
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5255
5373
|
Field3,
|
|
5256
5374
|
{
|
|
@@ -5499,72 +5617,6 @@ var TravelTag = function TravelTag2({
|
|
|
5499
5617
|
}
|
|
5500
5618
|
);
|
|
5501
5619
|
};
|
|
5502
|
-
var ExternalIcon = ({
|
|
5503
|
-
label,
|
|
5504
|
-
size
|
|
5505
|
-
}) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5506
|
-
size === "lg" || size === "md" ? /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.LinkOutOutline24Icon, { "aria-hidden": true, display: "inline" }) : /* @__PURE__ */ jsxRuntime.jsx(spor_icon_react_star.LinkOutOutline18Icon, { "aria-hidden": true, display: "inline" }),
|
|
5507
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.VisuallyHidden, { children: label })
|
|
5508
|
-
] });
|
|
5509
|
-
var TextLink = ({
|
|
5510
|
-
ref,
|
|
5511
|
-
children,
|
|
5512
|
-
external,
|
|
5513
|
-
href,
|
|
5514
|
-
...props
|
|
5515
|
-
}) => {
|
|
5516
|
-
const { t } = useTranslation();
|
|
5517
|
-
const isExternal = external ?? Boolean((href == null ? void 0 : href.startsWith("http://")) || (href == null ? void 0 : href.startsWith("https://")));
|
|
5518
|
-
const externalLabel = t ? t(texts20.externalLink) : texts20.externalLink.en;
|
|
5519
|
-
if (props.asChild && React13.isValidElement(children)) {
|
|
5520
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5521
|
-
react.Link,
|
|
5522
|
-
{
|
|
5523
|
-
href,
|
|
5524
|
-
...props,
|
|
5525
|
-
ref,
|
|
5526
|
-
...isExternal && {
|
|
5527
|
-
target: "_blank",
|
|
5528
|
-
rel: "noopener noreferrer"
|
|
5529
|
-
},
|
|
5530
|
-
children: React13.cloneElement(children, {
|
|
5531
|
-
...children.props,
|
|
5532
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5533
|
-
children.props.children,
|
|
5534
|
-
isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
|
|
5535
|
-
] })
|
|
5536
|
-
})
|
|
5537
|
-
}
|
|
5538
|
-
);
|
|
5539
|
-
}
|
|
5540
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5541
|
-
react.Link,
|
|
5542
|
-
{
|
|
5543
|
-
href,
|
|
5544
|
-
...props,
|
|
5545
|
-
ref,
|
|
5546
|
-
...isExternal && {
|
|
5547
|
-
target: "_blank",
|
|
5548
|
-
rel: "noopener noreferrer"
|
|
5549
|
-
},
|
|
5550
|
-
children: [
|
|
5551
|
-
children,
|
|
5552
|
-
isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
|
|
5553
|
-
]
|
|
5554
|
-
}
|
|
5555
|
-
);
|
|
5556
|
-
};
|
|
5557
|
-
var texts20 = createTexts({
|
|
5558
|
-
externalLink: {
|
|
5559
|
-
nb: "Ekstern lenke",
|
|
5560
|
-
nn: "Ekstern lenke",
|
|
5561
|
-
sv: "Extern l\xE4nk",
|
|
5562
|
-
en: "External link"
|
|
5563
|
-
}
|
|
5564
|
-
});
|
|
5565
|
-
var List = react.List.Root;
|
|
5566
|
-
var ListItem2 = react.List.Item;
|
|
5567
|
-
var ListIndicator = react.List.Indicator;
|
|
5568
5620
|
var CargonetLogo = ({
|
|
5569
5621
|
ref,
|
|
5570
5622
|
...props
|
|
@@ -5723,7 +5775,7 @@ var VyLogo = ({
|
|
|
5723
5775
|
variant = "default",
|
|
5724
5776
|
...props
|
|
5725
5777
|
}) => {
|
|
5726
|
-
const id =
|
|
5778
|
+
const id = React14.useId();
|
|
5727
5779
|
const fillForAccent = variant === "mono" ? "main" : "accent";
|
|
5728
5780
|
return /* @__PURE__ */ jsxRuntime.jsxs(SvgBox, { ref, viewBox: "0 0 107 54", ...props, children: [
|
|
5729
5781
|
/* @__PURE__ */ jsxRuntime.jsx("title", { children: "Vy logo" }),
|
|
@@ -5876,7 +5928,7 @@ var VyLogoPride = ({
|
|
|
5876
5928
|
const redColor = "#EA3323";
|
|
5877
5929
|
const orangeColor = "#F09436";
|
|
5878
5930
|
const yellowColor = "#FFFF54";
|
|
5879
|
-
const id =
|
|
5931
|
+
const id = React14.useId();
|
|
5880
5932
|
return (
|
|
5881
5933
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5882
5934
|
/* @__PURE__ */ jsxRuntime.jsxs(SvgBox, { ref, viewBox: "0 0 107 54", ...props, children: [
|
|
@@ -6224,17 +6276,17 @@ var NudgeContent = ({
|
|
|
6224
6276
|
children,
|
|
6225
6277
|
...props
|
|
6226
6278
|
}) => {
|
|
6227
|
-
const [currentStep, setCurrentStep] =
|
|
6228
|
-
const childrenArray =
|
|
6279
|
+
const [currentStep, setCurrentStep] = React14.useState(1);
|
|
6280
|
+
const childrenArray = React14__namespace.default.Children.toArray(children);
|
|
6229
6281
|
const { open } = react.usePopoverContext();
|
|
6230
|
-
|
|
6282
|
+
React14.useEffect(() => {
|
|
6231
6283
|
setCurrentStep(1);
|
|
6232
6284
|
}, [children, open]);
|
|
6233
6285
|
const wizardPages = childrenArray.filter(
|
|
6234
|
-
(child) =>
|
|
6286
|
+
(child) => React14__namespace.default.isValidElement(child) && child.type === NudgeWizardStep
|
|
6235
6287
|
);
|
|
6236
6288
|
const restChildren = childrenArray.filter(
|
|
6237
|
-
(child) => !
|
|
6289
|
+
(child) => !React14__namespace.default.isValidElement(child) || child.type !== NudgeWizardStep
|
|
6238
6290
|
);
|
|
6239
6291
|
const totalSteps = wizardPages.length;
|
|
6240
6292
|
const isLastStep = totalSteps === currentStep;
|
|
@@ -6352,7 +6404,7 @@ var PaginationEllipsis = ({
|
|
|
6352
6404
|
ref,
|
|
6353
6405
|
...props
|
|
6354
6406
|
}) => {
|
|
6355
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6407
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Pagination.Ellipsis, { ref, ...props, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Box, { cursor: "default", children: "..." }) }) });
|
|
6356
6408
|
};
|
|
6357
6409
|
var PaginationItem = ({
|
|
6358
6410
|
ref,
|
|
@@ -6362,7 +6414,7 @@ var PaginationItem = ({
|
|
|
6362
6414
|
const { t } = useTranslation();
|
|
6363
6415
|
const { page, totalPages } = react.usePaginationContext();
|
|
6364
6416
|
if (rootProps.getHref) {
|
|
6365
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6417
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6366
6418
|
react.Pagination.Item,
|
|
6367
6419
|
{
|
|
6368
6420
|
as: props.as ?? "a",
|
|
@@ -6377,7 +6429,7 @@ var PaginationItem = ({
|
|
|
6377
6429
|
}
|
|
6378
6430
|
) });
|
|
6379
6431
|
}
|
|
6380
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6432
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6381
6433
|
react.Pagination.Item,
|
|
6382
6434
|
{
|
|
6383
6435
|
as: props.as ?? "button",
|
|
@@ -6401,7 +6453,7 @@ var PaginationPrevTrigger = ({
|
|
|
6401
6453
|
if (page <= 1)
|
|
6402
6454
|
return null;
|
|
6403
6455
|
if (rootProps.getHref) {
|
|
6404
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6456
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6405
6457
|
react.Pagination.PrevTrigger,
|
|
6406
6458
|
{
|
|
6407
6459
|
as: props.as ?? "a",
|
|
@@ -6418,7 +6470,7 @@ var PaginationPrevTrigger = ({
|
|
|
6418
6470
|
}
|
|
6419
6471
|
) });
|
|
6420
6472
|
}
|
|
6421
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6473
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6422
6474
|
react.Pagination.PrevTrigger,
|
|
6423
6475
|
{
|
|
6424
6476
|
ref,
|
|
@@ -6443,7 +6495,7 @@ var PaginationNextTrigger = ({
|
|
|
6443
6495
|
if (page >= totalPages)
|
|
6444
6496
|
return null;
|
|
6445
6497
|
if (rootProps.getHref) {
|
|
6446
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6498
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6447
6499
|
react.Pagination.NextTrigger,
|
|
6448
6500
|
{
|
|
6449
6501
|
ref,
|
|
@@ -6458,7 +6510,7 @@ var PaginationNextTrigger = ({
|
|
|
6458
6510
|
}
|
|
6459
6511
|
) });
|
|
6460
6512
|
}
|
|
6461
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6513
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ListItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6462
6514
|
react.Pagination.NextTrigger,
|
|
6463
6515
|
{
|
|
6464
6516
|
ref,
|
|
@@ -6537,9 +6589,9 @@ var PopoverContent = ({
|
|
|
6537
6589
|
...props
|
|
6538
6590
|
}) => {
|
|
6539
6591
|
const { colorMode } = useColorMode();
|
|
6540
|
-
const closeButtonRef =
|
|
6592
|
+
const closeButtonRef = React14__namespace.default.useRef(null);
|
|
6541
6593
|
const { open } = react.usePopoverContext();
|
|
6542
|
-
|
|
6594
|
+
React14.useEffect(() => {
|
|
6543
6595
|
if (showCloseButton && open && closeButtonRef.current) {
|
|
6544
6596
|
closeButtonRef.current.focus();
|
|
6545
6597
|
}
|
|
@@ -6739,7 +6791,7 @@ var SporProvider = ({
|
|
|
6739
6791
|
children
|
|
6740
6792
|
] }) }) });
|
|
6741
6793
|
};
|
|
6742
|
-
var StepperContext =
|
|
6794
|
+
var StepperContext = React14__namespace.default.createContext(null);
|
|
6743
6795
|
var StepperProvider = ({
|
|
6744
6796
|
activeStep,
|
|
6745
6797
|
children,
|
|
@@ -6756,7 +6808,7 @@ var StepperProvider = ({
|
|
|
6756
6808
|
);
|
|
6757
6809
|
};
|
|
6758
6810
|
var useStepper = () => {
|
|
6759
|
-
const context =
|
|
6811
|
+
const context = React14__namespace.default.useContext(StepperContext);
|
|
6760
6812
|
if (!context) {
|
|
6761
6813
|
throw new Error(
|
|
6762
6814
|
"useStepper must be used within a StepperProvider. Most likely, you forgot to wrap your StepperStep in a Stepper component"
|
|
@@ -6971,13 +7023,13 @@ var captureRowOrder = (tbody) => (
|
|
|
6971
7023
|
// eslint-disable-next-line unicorn/prefer-spread -- HTMLCollectionOf is not spreadable
|
|
6972
7024
|
Array.from(tbody.rows)
|
|
6973
7025
|
);
|
|
6974
|
-
var SortContext =
|
|
7026
|
+
var SortContext = React14.createContext({
|
|
6975
7027
|
enabled: false,
|
|
6976
7028
|
sortState: { direction: "asc", columnIndex: null },
|
|
6977
7029
|
onSort: () => {
|
|
6978
7030
|
}
|
|
6979
7031
|
});
|
|
6980
|
-
var useTableSort = () =>
|
|
7032
|
+
var useTableSort = () => React14.useContext(SortContext);
|
|
6981
7033
|
var Table = ({
|
|
6982
7034
|
variant = "ghost",
|
|
6983
7035
|
size,
|
|
@@ -6987,7 +7039,7 @@ var Table = ({
|
|
|
6987
7039
|
ref,
|
|
6988
7040
|
...rest
|
|
6989
7041
|
}) => {
|
|
6990
|
-
const [sortState, setSortState] =
|
|
7042
|
+
const [sortState, setSortState] = React14.useState({
|
|
6991
7043
|
direction: "asc",
|
|
6992
7044
|
columnIndex: null
|
|
6993
7045
|
});
|
|
@@ -7023,7 +7075,7 @@ var TableColumnHeader = ({
|
|
|
7023
7075
|
...rest
|
|
7024
7076
|
}) => {
|
|
7025
7077
|
const { enabled, sortState, onSort } = useTableSort();
|
|
7026
|
-
const [columnIndex, setColumnIndex] =
|
|
7078
|
+
const [columnIndex, setColumnIndex] = React14.useState(null);
|
|
7027
7079
|
const props = rest;
|
|
7028
7080
|
const columnSortable = enabled && !("data-nosort" in props);
|
|
7029
7081
|
const isActive = columnSortable && columnIndex != null && columnIndex === sortState.columnIndex;
|
|
@@ -7063,10 +7115,10 @@ var TableColumnHeader = ({
|
|
|
7063
7115
|
};
|
|
7064
7116
|
var TableBody = ({ children, ref, ...rest }) => {
|
|
7065
7117
|
const { sortState } = useTableSort();
|
|
7066
|
-
const tbodyRef =
|
|
7067
|
-
const originalOrder =
|
|
7068
|
-
const previousChildren =
|
|
7069
|
-
|
|
7118
|
+
const tbodyRef = React14.useRef(null);
|
|
7119
|
+
const originalOrder = React14.useRef([]);
|
|
7120
|
+
const previousChildren = React14.useRef(children);
|
|
7121
|
+
React14.useLayoutEffect(() => {
|
|
7070
7122
|
const tbody = tbodyRef.current;
|
|
7071
7123
|
if (!tbody)
|
|
7072
7124
|
return;
|
|
@@ -8084,6 +8136,12 @@ var menuAnatomy = anatomy.createAnatomy("menu").parts(
|
|
|
8084
8136
|
"triggerItem",
|
|
8085
8137
|
"checkboxItem"
|
|
8086
8138
|
);
|
|
8139
|
+
var errorSummaryAnatomy = anatomy.createAnatomy("error-summary").parts(
|
|
8140
|
+
"container",
|
|
8141
|
+
"heading",
|
|
8142
|
+
"list",
|
|
8143
|
+
"item"
|
|
8144
|
+
);
|
|
8087
8145
|
|
|
8088
8146
|
// src/theme/slot-recipes/accordion.ts
|
|
8089
8147
|
var accordionSlotRecipe = react.defineSlotRecipe({
|
|
@@ -9620,6 +9678,34 @@ var drawerSlotRecipe = react.defineSlotRecipe({
|
|
|
9620
9678
|
}
|
|
9621
9679
|
}
|
|
9622
9680
|
});
|
|
9681
|
+
var errorSummarySlotRecipe = react.defineSlotRecipe({
|
|
9682
|
+
slots: errorSummaryAnatomy.keys(),
|
|
9683
|
+
className: "spor-error-summary",
|
|
9684
|
+
base: {
|
|
9685
|
+
container: {
|
|
9686
|
+
display: "flex",
|
|
9687
|
+
flexDirection: "column",
|
|
9688
|
+
padding: [3, 5],
|
|
9689
|
+
backgroundColor: "surface.critical",
|
|
9690
|
+
borderRadius: "md"
|
|
9691
|
+
},
|
|
9692
|
+
heading: {
|
|
9693
|
+
fontSize: "md",
|
|
9694
|
+
fontWeight: "bold",
|
|
9695
|
+
color: "text.critical",
|
|
9696
|
+
gap: [1, 1.5],
|
|
9697
|
+
alignItems: "center"
|
|
9698
|
+
},
|
|
9699
|
+
list: {
|
|
9700
|
+
alignItems: "flex-start",
|
|
9701
|
+
paddingLeft: [4, 5]
|
|
9702
|
+
},
|
|
9703
|
+
item: {
|
|
9704
|
+
color: "text.critical.subtle",
|
|
9705
|
+
marginTop: [2, 1.5]
|
|
9706
|
+
}
|
|
9707
|
+
}
|
|
9708
|
+
});
|
|
9623
9709
|
var fieldSlotRecipe = react.defineSlotRecipe({
|
|
9624
9710
|
className: "spor-field",
|
|
9625
9711
|
slots: fieldAnatomy.keys(),
|
|
@@ -12169,7 +12255,8 @@ var slotRecipes = {
|
|
|
12169
12255
|
tooltip: popoverSlotRecipe,
|
|
12170
12256
|
tag: inputChipSlotRecipe,
|
|
12171
12257
|
menu: menuSlotRecipe,
|
|
12172
|
-
choiceChip: choiceChipSlotRecipe
|
|
12258
|
+
choiceChip: choiceChipSlotRecipe,
|
|
12259
|
+
errorSummary: errorSummarySlotRecipe
|
|
12173
12260
|
};
|
|
12174
12261
|
var animations = react.defineTokens.animations({
|
|
12175
12262
|
spin: {
|
|
@@ -13335,6 +13422,8 @@ exports.DrawerFullScreenHeader = DrawerFullScreenHeader;
|
|
|
13335
13422
|
exports.DrawerHeader = DrawerHeader;
|
|
13336
13423
|
exports.DrawerTitle = DrawerTitle;
|
|
13337
13424
|
exports.DrawerTrigger = DrawerTrigger;
|
|
13425
|
+
exports.ErrorSummary = ErrorSummary;
|
|
13426
|
+
exports.ErrorSummaryItem = ErrorSummaryItem;
|
|
13338
13427
|
exports.Expandable = Expandable;
|
|
13339
13428
|
exports.ExpandableAlert = ExpandableAlert;
|
|
13340
13429
|
exports.ExpandableItem = ExpandableItem;
|
|
@@ -13365,7 +13454,7 @@ exports.LineIcon = LineIcon;
|
|
|
13365
13454
|
exports.List = List;
|
|
13366
13455
|
exports.ListBox = ListBox;
|
|
13367
13456
|
exports.ListIndicator = ListIndicator;
|
|
13368
|
-
exports.ListItem =
|
|
13457
|
+
exports.ListItem = ListItem;
|
|
13369
13458
|
exports.Menu = Menu;
|
|
13370
13459
|
exports.MenuCheckboxItem = MenuCheckboxItem;
|
|
13371
13460
|
exports.MenuContent = MenuContent;
|