@vygruppen/spor-react 12.10.1 → 12.10.3

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 CHANGED
@@ -1227,11 +1227,11 @@ var ServiceAlert = React27.forwardRef(
1227
1227
  ]
1228
1228
  }
1229
1229
  ) }),
1230
- /* @__PURE__ */ jsxRuntime.jsx(react.Accordion.ItemContent, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { flexDirection: "row", justifyContent: "center", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
1230
+ /* @__PURE__ */ jsxRuntime.jsx(react.Accordion.ItemContent, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Stack, { flexDirection: "row", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
1231
1231
  react.Accordion.ItemBody,
1232
1232
  {
1233
1233
  as: react.Stack,
1234
- maxWidth: contentWidth,
1234
+ width: contentWidth,
1235
1235
  css: styles.itemBody,
1236
1236
  children
1237
1237
  }
@@ -1826,7 +1826,11 @@ var DateField = React27.forwardRef(
1826
1826
  css: styles.inputLabel,
1827
1827
  position: "absolute",
1828
1828
  paddingTop: "2px",
1829
- children: /* @__PURE__ */ jsxRuntime.jsx("label", { ...props.labelProps, children: props.label })
1829
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Label, { padding: "0", fontSize: "2xs", ...props.labelProps, children: [
1830
+ props.label,
1831
+ " ",
1832
+ /* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
1833
+ ] })
1830
1834
  }
1831
1835
  ),
1832
1836
  /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { ...fieldProps, ref, paddingTop: "3", paddingBottom: "0.5", children: state.segments.map((segment, i) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -2162,21 +2166,21 @@ var TimeField = ({ state, ...props }) => {
2162
2166
  style: {
2163
2167
  marginBottom: 0,
2164
2168
  fontSize: "mobile.xs",
2169
+ top: 0,
2165
2170
  cursor: "text",
2171
+ left: "50%",
2172
+ transform: "translateX(-50%)",
2166
2173
  position: "absolute",
2167
- paddingTop: "2px"
2174
+ paddingTop: "2px",
2175
+ whiteSpace: "nowrap",
2176
+ overflow: "hidden",
2177
+ textOverflow: "ellipsis",
2178
+ maxWidth: "80%"
2168
2179
  },
2169
2180
  children: props.label
2170
2181
  }
2171
2182
  ),
2172
- /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { ...fieldProps, ref, paddingTop: "3", paddingBottom: "0.5", children: state.segments.map((segment) => /* @__PURE__ */ jsxRuntime.jsx(
2173
- DateTimeSegment,
2174
- {
2175
- segment,
2176
- state
2177
- },
2178
- JSON.stringify(segment)
2179
- )) }),
2183
+ /* @__PURE__ */ jsxRuntime.jsx(react.Flex, { ...fieldProps, ref, paddingTop: "3", paddingBottom: "0.5", children: state.segments.map((segment, index) => /* @__PURE__ */ jsxRuntime.jsx(DateTimeSegment, { segment, state }, index)) }),
2180
2184
  /* @__PURE__ */ jsxRuntime.jsx(
2181
2185
  "input",
2182
2186
  {
@@ -2258,6 +2262,7 @@ var TimePicker = ({
2258
2262
  "aria-disabled": isDisabled,
2259
2263
  "aria-live": "assertive",
2260
2264
  "aria-label": ariaLabel,
2265
+ position: "relative",
2261
2266
  ...boxProps,
2262
2267
  children: [
2263
2268
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2271,7 +2276,8 @@ var TimePicker = ({
2271
2276
  icon: /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.DropdownLeftFill18Icon, {}),
2272
2277
  onClick: handleBackwardsClick,
2273
2278
  disabled: isDisabled,
2274
- style: isDisabled ? { backgroundColor: "transparent" } : {}
2279
+ style: isDisabled ? { backgroundColor: "transparent" } : {},
2280
+ zIndex: 1
2275
2281
  }
2276
2282
  ),
2277
2283
  /* @__PURE__ */ jsxRuntime.jsx(TimeField, { label, state, name }),
@@ -2286,7 +2292,8 @@ var TimePicker = ({
2286
2292
  icon: /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.DropdownRightFill18Icon, {}),
2287
2293
  onClick: handleForwardClick,
2288
2294
  disabled: isDisabled,
2289
- style: isDisabled ? { backgroundColor: "transparent" } : {}
2295
+ style: isDisabled ? { backgroundColor: "transparent" } : {},
2296
+ zIndex: 1
2290
2297
  }
2291
2298
  )
2292
2299
  ]
@@ -2405,11 +2412,11 @@ var DrawerBackTrigger = React27.forwardRef((props, ref) => {
2405
2412
  });
2406
2413
  DrawerBackTrigger.displayName = "DrawerBackTrigger";
2407
2414
  var DrawerFullScreenHeader = React27.forwardRef((props, ref) => {
2408
- const { backTrigger = true, title } = props;
2415
+ const { backTrigger = true, closeTrigger = true, title } = props;
2409
2416
  return /* @__PURE__ */ jsxRuntime.jsx(react.Drawer.Header, { ...props, ref, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(react.Grid, { templateColumns: "1fr auto 1fr", height: "auto", paddingX: "8", children: [
2410
2417
  /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { width: "full", alignSelf: "center", children: backTrigger && /* @__PURE__ */ jsxRuntime.jsx(DrawerBackTrigger, {}) }),
2411
2418
  /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { width: "full", alignSelf: "end", asChild: true, children: title && /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle, { children: title }) }),
2412
- /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { width: "full", alignSelf: "end", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerCloseTrigger, { justifySelf: "end", top: "0" }) })
2419
+ closeTrigger && /* @__PURE__ */ jsxRuntime.jsx(react.GridItem, { width: "full", alignSelf: "end", children: /* @__PURE__ */ jsxRuntime.jsx(DrawerCloseTrigger, { justifySelf: "end", top: "0" }) })
2413
2420
  ] }) });
2414
2421
  });
2415
2422
  DrawerFullScreenHeader.displayName = "DrawerFullScreenHeader";
@@ -2863,6 +2870,7 @@ var ListBox = (props) => {
2863
2870
  css: styles.root,
2864
2871
  "aria-busy": loading,
2865
2872
  maxWidth,
2873
+ padding: "1",
2866
2874
  children: [
2867
2875
  state.collection.size === 0 && props.emptyContent,
2868
2876
  [...state.collection].map(
@@ -2920,7 +2928,18 @@ function Option({ item, state }) {
2920
2928
  { passive: false, once: true }
2921
2929
  );
2922
2930
  }, []);
2923
- return /* @__PURE__ */ jsxRuntime.jsx(OptionContext.Provider, { value: { labelProps, descriptionProps }, children: /* @__PURE__ */ jsxRuntime.jsx(react.ListItem, { ...optionProps, ...dataFields, ref, css: styles.item, children: item.rendered }) });
2931
+ return /* @__PURE__ */ jsxRuntime.jsx(OptionContext.Provider, { value: { labelProps, descriptionProps }, children: /* @__PURE__ */ jsxRuntime.jsx(
2932
+ react.ListItem,
2933
+ {
2934
+ ...optionProps,
2935
+ ...dataFields,
2936
+ ref,
2937
+ css: styles.item,
2938
+ padding: "1",
2939
+ marginX: "0",
2940
+ children: item.rendered
2941
+ }
2942
+ ) });
2924
2943
  }
2925
2944
  var OptionContext = React27__namespace.default.createContext({
2926
2945
  labelProps: {},
@@ -2937,25 +2956,34 @@ function ListBoxSection({ section, state }) {
2937
2956
  });
2938
2957
  const isFirstSection = section.key === state.collection.getFirstKey();
2939
2958
  const titleColor = useColorModeValue("darkGrey", "white");
2940
- return /* @__PURE__ */ jsxRuntime.jsx(List, { children: /* @__PURE__ */ jsxRuntime.jsxs(react.ListItem, { ...itemProps, listStyleType: "none", children: [
2941
- section.rendered && /* @__PURE__ */ jsxRuntime.jsx(
2942
- react.Box,
2943
- {
2944
- fontSize: "mobile.xs",
2945
- color: titleColor,
2946
- paddingX: 3,
2947
- paddingTop: 1,
2948
- marginTop: isFirstSection ? 0 : 2,
2949
- textTransform: "uppercase",
2950
- fontWeight: "bold",
2951
- ...headingProps,
2952
- children: section.rendered
2953
- }
2954
- ),
2955
- /* @__PURE__ */ jsxRuntime.jsx(List, { ...groupProps, padding: 0, listStyleType: "none", children: [...((_b4 = (_a5 = state.collection).getChildren) == null ? void 0 : _b4.call(_a5, section.key)) ?? []].map(
2956
- (item) => /* @__PURE__ */ jsxRuntime.jsx(Option, { item, state }, item.key)
2957
- ) })
2958
- ] }) });
2959
+ return /* @__PURE__ */ jsxRuntime.jsx(List, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2960
+ react.ListItem,
2961
+ {
2962
+ ...itemProps,
2963
+ listStyleType: "none",
2964
+ marginLeft: "0",
2965
+ paddingX: "1",
2966
+ children: [
2967
+ section.rendered && /* @__PURE__ */ jsxRuntime.jsx(
2968
+ react.Box,
2969
+ {
2970
+ fontSize: "mobile.xs",
2971
+ color: titleColor,
2972
+ paddingTop: 1,
2973
+ marginTop: isFirstSection ? 0 : 2,
2974
+ marginLeft: "1",
2975
+ textTransform: "uppercase",
2976
+ fontWeight: "bold",
2977
+ ...headingProps,
2978
+ children: section.rendered
2979
+ }
2980
+ ),
2981
+ /* @__PURE__ */ jsxRuntime.jsx(List, { ...groupProps, padding: 0, listStyleType: "none", children: [...((_b4 = (_a5 = state.collection).getChildren) == null ? void 0 : _b4.call(_a5, section.key)) ?? []].map(
2982
+ (item) => /* @__PURE__ */ jsxRuntime.jsx(Option, { item, state }, item.key)
2983
+ ) })
2984
+ ]
2985
+ }
2986
+ ) });
2959
2987
  }
2960
2988
  var NativeSelect = React27__namespace.forwardRef(function NativeSelect2(props, ref) {
2961
2989
  const {
@@ -3347,54 +3375,43 @@ var PhoneNumberInput = React27.forwardRef((props, ref) => {
3347
3375
  nationalNumber: value.nationalNumber
3348
3376
  });
3349
3377
  };
3350
- return /* @__PURE__ */ jsxRuntime.jsx(
3351
- AttachedInputs,
3352
- {
3353
- border: invalid ? "1px solid" : "none",
3354
- borderColor: invalid ? "outline.error" : "none",
3355
- outline: invalid ? "1px solid" : "none",
3356
- outlineColor: invalid ? "outline.error" : "none",
3357
- borderRadius: invalid ? "sm" : "none",
3358
- display: "grid",
3359
- gridTemplateColumns: "1fr 10fr",
3360
- children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3361
- /* @__PURE__ */ jsxRuntime.jsx(
3362
- CountryCodeSelect,
3363
- {
3364
- value: [value.countryCode],
3365
- onValueChange: handleCountryCodeChange,
3366
- height: "100%",
3367
- width: "6.25rem",
3368
- variant,
3369
- allowedCountryCodes,
3370
- "data-state": "on"
3371
- }
3372
- ),
3373
- /* @__PURE__ */ jsxRuntime.jsx(
3374
- Input,
3375
- {
3376
- ref,
3377
- type: "tel",
3378
- ...props,
3379
- value: value.nationalNumber,
3380
- invalid,
3381
- errorText,
3382
- onChange: (e) => {
3383
- const target = e.target;
3384
- const strippedValue = target.value.replaceAll(/[^\d\s-]/g, "");
3385
- onChange({
3386
- countryCode: value.countryCode,
3387
- nationalNumber: strippedValue
3388
- });
3389
- },
3390
- variant,
3391
- "data-state": "on",
3392
- label
3393
- }
3394
- )
3395
- ] })
3396
- }
3397
- );
3378
+ return /* @__PURE__ */ jsxRuntime.jsxs(AttachedInputs, { display: "grid", gridTemplateColumns: "1fr 10fr", children: [
3379
+ /* @__PURE__ */ jsxRuntime.jsx(
3380
+ CountryCodeSelect,
3381
+ {
3382
+ value: [value.countryCode],
3383
+ onValueChange: handleCountryCodeChange,
3384
+ height: "100%",
3385
+ width: "6.25rem",
3386
+ variant,
3387
+ allowedCountryCodes,
3388
+ "data-state": "on",
3389
+ invalid
3390
+ }
3391
+ ),
3392
+ /* @__PURE__ */ jsxRuntime.jsx(
3393
+ Input,
3394
+ {
3395
+ ref,
3396
+ type: "tel",
3397
+ ...props,
3398
+ value: value.nationalNumber,
3399
+ invalid,
3400
+ errorText,
3401
+ onChange: (e) => {
3402
+ const target = e.target;
3403
+ const strippedValue = target.value.replaceAll(/[^\d\s-]/g, "");
3404
+ onChange({
3405
+ countryCode: value.countryCode,
3406
+ nationalNumber: strippedValue
3407
+ });
3408
+ },
3409
+ variant,
3410
+ "data-state": "on",
3411
+ label
3412
+ }
3413
+ )
3414
+ ] });
3398
3415
  });
3399
3416
  PhoneNumberInput.displayName = "PhoneNumberInput";
3400
3417
  var texts16 = createTexts({
@@ -3632,9 +3649,9 @@ var Switch = React27.forwardRef(
3632
3649
  checked: props.checked,
3633
3650
  css: styles.root,
3634
3651
  children: [
3635
- /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Label, { children: label }),
3636
3652
  /* @__PURE__ */ jsxRuntime.jsx(react.Switch.HiddenInput, { ref }),
3637
- /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Control, { css: styles.control, children: /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Thumb, {}) })
3653
+ /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Control, { css: styles.control, children: /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Thumb, {}) }),
3654
+ /* @__PURE__ */ jsxRuntime.jsx(react.Switch.Label, { children: label })
3638
3655
  ]
3639
3656
  }
3640
3657
  )
@@ -3700,16 +3717,9 @@ var PressableCard = React27.forwardRef(
3700
3717
  PressableCard.displayName = "PressableCard";
3701
3718
  var RadioCard = React27.forwardRef(
3702
3719
  (props, ref) => {
3703
- const { inputProps, children, value, ariaLabel } = props;
3720
+ const { inputProps, children } = props;
3704
3721
  return /* @__PURE__ */ jsxRuntime.jsxs(react.RadioCard.Item, { ...props, children: [
3705
- /* @__PURE__ */ jsxRuntime.jsx(
3706
- react.RadioCard.ItemHiddenInput,
3707
- {
3708
- "aria-label": ariaLabel ?? value,
3709
- ref,
3710
- ...inputProps
3711
- }
3712
- ),
3722
+ /* @__PURE__ */ jsxRuntime.jsx(react.RadioCard.ItemHiddenInput, { ref, ...inputProps }),
3713
3723
  /* @__PURE__ */ jsxRuntime.jsx(react.RadioCard.ItemControl, { children })
3714
3724
  ] });
3715
3725
  }
@@ -3996,18 +4006,42 @@ var TextLink = React27.forwardRef(
3996
4006
  const isExternal = external ?? Boolean((href == null ? void 0 : href.startsWith("http://")) || (href == null ? void 0 : href.startsWith("https://")));
3997
4007
  const externalLabel = t ? t(texts18.externalLink) : texts18.externalLink.en;
3998
4008
  if (props.asChild && React27.isValidElement(children)) {
3999
- return /* @__PURE__ */ jsxRuntime.jsx(react.Link, { href, ...props, ref, children: React27.cloneElement(children, {
4000
- ...children.props,
4001
- children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4002
- children.props.children,
4003
- isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
4004
- ] })
4005
- }) });
4009
+ return /* @__PURE__ */ jsxRuntime.jsx(
4010
+ react.Link,
4011
+ {
4012
+ href,
4013
+ ...props,
4014
+ ref,
4015
+ ...isExternal && {
4016
+ target: "_blank",
4017
+ rel: "noopener noreferrer"
4018
+ },
4019
+ children: React27.cloneElement(children, {
4020
+ ...children.props,
4021
+ children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4022
+ children.props.children,
4023
+ isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
4024
+ ] })
4025
+ })
4026
+ }
4027
+ );
4006
4028
  }
4007
- return /* @__PURE__ */ jsxRuntime.jsxs(react.Link, { href, ...props, ref, children: [
4008
- children,
4009
- isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
4010
- ] });
4029
+ return /* @__PURE__ */ jsxRuntime.jsxs(
4030
+ react.Link,
4031
+ {
4032
+ href,
4033
+ ...props,
4034
+ ref,
4035
+ ...isExternal && {
4036
+ target: "_blank",
4037
+ rel: "noopener noreferrer"
4038
+ },
4039
+ children: [
4040
+ children,
4041
+ isExternal && /* @__PURE__ */ jsxRuntime.jsx(ExternalIcon, { label: externalLabel, size: props.size })
4042
+ ]
4043
+ }
4044
+ );
4011
4045
  }
4012
4046
  );
4013
4047
  TextLink.displayName = "TextLink";
@@ -6698,13 +6732,13 @@ var alertServiceSlotRecipe = react.defineSlotRecipe({
6698
6732
  textWrap: "nowrap"
6699
6733
  },
6700
6734
  itemBody: {
6701
- paddingInline: 2,
6735
+ marginX: "auto",
6736
+ padding: "0 !important",
6702
6737
  paddingBottom: ["0.5", null, null, "1"],
6703
6738
  color: "text.inverted",
6704
6739
  "& > p": {
6705
6740
  gap: 2,
6706
6741
  width: "full",
6707
- justifyContent: "center",
6708
6742
  borderBottom: "1px dashed",
6709
6743
  borderColor: "outline.inverted",
6710
6744
  paddingBottom: "3",
@@ -7498,7 +7532,7 @@ var drawerSlotRecipe = react.defineSlotRecipe({
7498
7532
  maxHeight: "100dvh",
7499
7533
  color: "inherit",
7500
7534
  boxShadow: "lg",
7501
- minHeight: ["50vh", null, null, "auto"],
7535
+ minHeight: ["10rem", null, null, "auto"],
7502
7536
  _open: {
7503
7537
  animationDuration: "slowest",
7504
7538
  animationTimingFunction: "ease-in-smooth"
@@ -7512,16 +7546,16 @@ var drawerSlotRecipe = react.defineSlotRecipe({
7512
7546
  display: "flex",
7513
7547
  alignItems: "center",
7514
7548
  justifyContent: "space-between",
7515
- paddingX: "5",
7549
+ paddingX: ["3", null, null, "5"],
7516
7550
  paddingBottom: "1"
7517
7551
  },
7518
7552
  body: {
7519
- paddingX: "5",
7553
+ paddingX: ["3", null, null, "5"],
7520
7554
  paddingY: ["1", null, null, "2"],
7521
7555
  flex: "1",
7522
7556
  overflow: "auto",
7523
7557
  fontSize: ["xs", null, null, "sm"],
7524
- minHeight: ["12", null, null, "auto"]
7558
+ minHeight: ["2", null, null, "auto"]
7525
7559
  },
7526
7560
  footer: {
7527
7561
  display: "flex",
@@ -7538,8 +7572,8 @@ var drawerSlotRecipe = react.defineSlotRecipe({
7538
7572
  },
7539
7573
  closeTrigger: {
7540
7574
  position: "absolute",
7541
- top: "2",
7542
- insetEnd: "2"
7575
+ top: "0",
7576
+ right: "0"
7543
7577
  }
7544
7578
  },
7545
7579
  variants: {
@@ -9066,29 +9100,20 @@ var selectSlotRecipe = react.defineSlotRecipe({
9066
9100
  },
9067
9101
  floating: {
9068
9102
  control: {
9069
- backgroundColor: {
9070
- _light: "bg",
9071
- _dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`
9072
- },
9073
9103
  outline: "1px solid",
9074
9104
  outlineColor: "floating.outline",
9075
9105
  _hover: {
9076
- outline: "1px solid",
9077
- outlineColor: "floating.outline.hover",
9078
- backgroundColor: {
9079
- _light: "floating.surface.hover",
9080
- _dark: `color-mix(in srgb, white 10%, var(--spor-colors-bg))`
9081
- }
9106
+ outline: "2px solid",
9107
+ outlineColor: "floating.outline"
9082
9108
  },
9083
9109
  _active: {
9084
- outline: "1px solid",
9085
- outlineColor: "floating.outline.active",
9086
- backgroundColor: "floating.surface.active"
9110
+ backgroundColor: "brand.surface.active"
9111
+ },
9112
+ _disabled: {
9113
+ pointerEvents: "none",
9114
+ color: "text.disabled",
9115
+ backgroundColor: "surface.disabled"
9087
9116
  }
9088
- },
9089
- selectContent: {
9090
- outline: "1px solid",
9091
- outlineColor: "floating.outline"
9092
9117
  }
9093
9118
  }
9094
9119
  },
@@ -9210,7 +9235,7 @@ var switchSlotRecipe = react.defineSlotRecipe({
9210
9235
  base: {
9211
9236
  root: {
9212
9237
  display: "inline-flex",
9213
- gap: "2.5",
9238
+ gap: "2",
9214
9239
  alignItems: "center",
9215
9240
  position: "relative",
9216
9241
  verticalAlign: "middle",