@vygruppen/spor-react 12.8.7 → 12.8.8

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.mjs CHANGED
@@ -753,8 +753,15 @@ var Heading = forwardRef(
753
753
  id: externalId,
754
754
  ...rest
755
755
  } = props;
756
- const id = externalId ?? (autoId && typeof rest.children === "string") ? slugify(rest.children) : void 0;
757
- return /* @__PURE__ */ jsx(Text, { as, textStyle: variant, id, ref, ...rest });
756
+ const reactId = useId();
757
+ function getId() {
758
+ if (externalId !== void 0)
759
+ return externalId;
760
+ if (!autoId)
761
+ return;
762
+ return typeof rest.children === "string" ? slugify(rest.children) : reactId;
763
+ }
764
+ return /* @__PURE__ */ jsx(Text, { as, textStyle: variant, id: getId(), ref, ...rest });
758
765
  }
759
766
  );
760
767
  function resolveTextProps({
@@ -1385,9 +1392,15 @@ var Field3 = React27.forwardRef(
1385
1392
  css: styles.root,
1386
1393
  direction,
1387
1394
  children: [
1388
- label && !floatingLabel && /* @__PURE__ */ jsx(Label, { children: label }),
1395
+ label && !floatingLabel && /* @__PURE__ */ jsxs(Label, { children: [
1396
+ label,
1397
+ /* @__PURE__ */ jsx(Field.RequiredIndicator, {})
1398
+ ] }),
1389
1399
  children,
1390
- label && floatingLabel && /* @__PURE__ */ jsx(FloatingLabel, { children: label }),
1400
+ label && floatingLabel && /* @__PURE__ */ jsxs(FloatingLabel, { children: [
1401
+ label,
1402
+ /* @__PURE__ */ jsx(Field.RequiredIndicator, {})
1403
+ ] }),
1391
1404
  errorText && /* @__PURE__ */ jsx(Field.ErrorText, { children: errorText })
1392
1405
  ]
1393
1406
  }
@@ -1953,6 +1966,7 @@ var DatePicker = forwardRef(
1953
1966
  errorText,
1954
1967
  invalid,
1955
1968
  helperText,
1969
+ required: props.required,
1956
1970
  children: /* @__PURE__ */ jsx(PopoverAnchor, { children: /* @__PURE__ */ jsxs(
1957
1971
  StyledField,
1958
1972
  {
@@ -2076,6 +2090,7 @@ function DateRangePicker({
2076
2090
  errorText,
2077
2091
  helperText,
2078
2092
  invalid,
2093
+ required: props.required,
2079
2094
  children: /* @__PURE__ */ jsx(PopoverAnchor, { children: /* @__PURE__ */ jsxs(
2080
2095
  StyledField,
2081
2096
  {
@@ -2785,6 +2800,7 @@ var Input = forwardRef(
2785
2800
  invalid,
2786
2801
  helperText,
2787
2802
  errorText,
2803
+ required,
2788
2804
  ...props
2789
2805
  }, ref) => {
2790
2806
  const recipe = useRecipe({ key: "input" });
@@ -2795,6 +2811,7 @@ var Input = forwardRef(
2795
2811
  {
2796
2812
  invalid,
2797
2813
  helperText,
2814
+ required,
2798
2815
  errorText,
2799
2816
  label: (
2800
2817
  // Render startElement invisibly to align label text with input content when an icon is present
@@ -3467,22 +3484,31 @@ var Select = React27.forwardRef(
3467
3484
  } = props;
3468
3485
  const recipe = useSlotRecipe({ key: "select" });
3469
3486
  const styles = recipe({ variant });
3470
- return /* @__PURE__ */ jsx(Field3, { errorText, invalid, helperText, children: /* @__PURE__ */ jsxs(
3471
- Select$1.Root,
3487
+ return /* @__PURE__ */ jsx(
3488
+ Field3,
3472
3489
  {
3473
- ...rest,
3474
- ref,
3475
- positioning: { sameWidth: true, ...positioning },
3476
- variant,
3477
- css: styles.root,
3478
- position: "relative",
3479
- children: [
3480
- /* @__PURE__ */ jsx(SelectTrigger, { "data-attachable": true, children: /* @__PURE__ */ jsx(SelectValueText, { withPlaceholder: label ? true : false }) }),
3481
- label && /* @__PURE__ */ jsx(SelectLabel, { css: styles.label, children: label }),
3482
- /* @__PURE__ */ jsx(SelectContent, { css: styles.selectContent, children })
3483
- ]
3490
+ errorText,
3491
+ invalid,
3492
+ helperText,
3493
+ required: props.required,
3494
+ children: /* @__PURE__ */ jsxs(
3495
+ Select$1.Root,
3496
+ {
3497
+ ...rest,
3498
+ ref,
3499
+ positioning: { sameWidth: true, ...positioning },
3500
+ variant,
3501
+ css: styles.root,
3502
+ position: "relative",
3503
+ children: [
3504
+ /* @__PURE__ */ jsx(SelectTrigger, { "data-attachable": true, children: /* @__PURE__ */ jsx(SelectValueText, { withPlaceholder: label ? true : false }) }),
3505
+ label && /* @__PURE__ */ jsx(SelectLabel, { css: styles.label, children: label }),
3506
+ /* @__PURE__ */ jsx(SelectContent, { css: styles.selectContent, children })
3507
+ ]
3508
+ }
3509
+ )
3484
3510
  }
3485
- ) });
3511
+ );
3486
3512
  }
3487
3513
  );
3488
3514
  var SelectLabel = (props) => {
@@ -3589,6 +3615,7 @@ var Switch = forwardRef(
3589
3615
  invalid,
3590
3616
  errorText,
3591
3617
  helperText,
3618
+ required: props.required,
3592
3619
  children: /* @__PURE__ */ jsxs(
3593
3620
  Switch$1.Root,
3594
3621
  {
@@ -7609,6 +7636,9 @@ var fieldSlotRecipe = defineSlotRecipe({
7609
7636
  marginStart: 1,
7610
7637
  color: "brightRed"
7611
7638
  },
7639
+ label: {
7640
+ display: "flex"
7641
+ },
7612
7642
  helperText: {
7613
7643
  marginTop: 2,
7614
7644
  color: "text.tertiary",