@vygruppen/spor-react 12.13.2 → 12.13.4

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@12.13.2 build /home/runner/work/spor/spor/packages/spor-react
2
+ > @vygruppen/spor-react@12.13.4 build /home/runner/work/spor/spor/packages/spor-react
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx, src/icons/index.tsx
@@ -11,18 +11,18 @@ CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
13
  DTS Build start
14
- CJS dist/index.cjs 315.38 KB
15
- CJS dist/icons/index.cjs 381.00 B
16
- CJS dist/index.cjs.map 629.75 KB
17
- CJS dist/icons/index.cjs.map 157.00 B
18
- CJS ⚡️ Build success in 2684ms
19
- ESM dist/index.mjs 293.97 KB
14
+ ESM dist/index.mjs 297.26 KB
20
15
  ESM dist/icons/index.mjs 110.00 B
21
16
  ESM dist/icons/index.mjs.map 157.00 B
22
- ESM dist/index.mjs.map 629.75 KB
23
- ESM ⚡️ Build success in 2686ms
24
- DTS ⚡️ Build success in 19002ms
17
+ ESM dist/index.mjs.map 635.10 KB
18
+ ESM ⚡️ Build success in 2617ms
19
+ CJS dist/index.cjs 318.74 KB
20
+ CJS dist/icons/index.cjs 381.00 B
21
+ CJS dist/index.cjs.map 635.10 KB
22
+ CJS dist/icons/index.cjs.map 157.00 B
23
+ CJS ⚡️ Build success in 2618ms
24
+ DTS ⚡️ Build success in 18619ms
25
25
  DTS dist/icons/index.d.ts 44.00 B
26
- DTS dist/index.d.ts 156.05 KB
26
+ DTS dist/index.d.ts 157.02 KB
27
27
  DTS dist/icons/index.d.cts 44.00 B
28
- DTS dist/index.d.cts 156.05 KB
28
+ DTS dist/index.d.cts 157.02 KB
@@ -1,7 +1,8 @@
1
1
 
2
- > @vygruppen/spor-react@12.13.2 postinstall /home/runner/work/spor/spor/packages/spor-react
2
+ > @vygruppen/spor-react@12.13.4 postinstall /home/runner/work/spor/spor/packages/spor-react
3
3
  > chakra typegen src/theme/index.ts
4
4
 
5
+ [dotenv@17.2.2] injecting env (0) from .env -- tip: ⚙️ enable debug logging with { debug: true }
5
6
  ┌ Chakra CLI ⚡️
6
7
  [?25l│
7
8
  ◒ Generating conditions types...
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 12.13.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 3200ed0: datepicker - exposed onClick & changed hover style to be focus color when isActive=true
8
+
9
+ ## 12.13.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 1457051: Added isActive and noCalendar props for datepicker
14
+ - a8b04df: Label: Fix bug where it was always floating in safari.
15
+
3
16
  ## 12.13.2
4
17
 
5
18
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1331,24 +1331,17 @@ FloatingLabel.displayName = "FloatingLabel";
1331
1331
  var floatingLabelStyles = react.defineStyle({
1332
1332
  paddingX: 3,
1333
1333
  fontWeight: "normal",
1334
- fontSize: ["mobile.xs", "desktop.xs"],
1335
- color: "text",
1336
1334
  pointerEvents: "none",
1337
1335
  zIndex: "docked",
1338
1336
  _disabled: {
1339
1337
  opacity: 0.4
1340
1338
  },
1341
1339
  pos: "absolute",
1342
- top: "0.3rem",
1343
1340
  transition: "position",
1344
- _peerPlaceholderShown: {
1345
- /* For when input is not in focus */
1346
- top: "0.9rem",
1347
- color: "text",
1348
- fontSize: ["mobile.sm", "desktop.sm"]
1349
- },
1350
- _peerFocusVisible: {
1351
- /* For when input is in focus */
1341
+ top: "0.9rem",
1342
+ color: "text",
1343
+ fontSize: ["mobile.sm", "desktop.sm"],
1344
+ "&[data-float]": {
1352
1345
  fontSize: ["mobile.xs", "desktop.xs"],
1353
1346
  color: "text",
1354
1347
  top: "0.3rem"
@@ -1381,6 +1374,7 @@ var Field3 = React27__namespace.forwardRef(
1381
1374
  required,
1382
1375
  direction,
1383
1376
  id,
1377
+ shouldFloat,
1384
1378
  ...rest
1385
1379
  } = props;
1386
1380
  const recipe = react.useSlotRecipe({ key: "field" });
@@ -1402,7 +1396,7 @@ var Field3 = React27__namespace.forwardRef(
1402
1396
  /* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
1403
1397
  ] }),
1404
1398
  children,
1405
- label && floatingLabel && /* @__PURE__ */ jsxRuntime.jsxs(FloatingLabel, { children: [
1399
+ label && floatingLabel && /* @__PURE__ */ jsxRuntime.jsxs(FloatingLabel, { "data-float": shouldFloat ? true : void 0, children: [
1406
1400
  label,
1407
1401
  /* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
1408
1402
  ] }),
@@ -1894,7 +1888,14 @@ var getAriaLabel = (segmentType) => {
1894
1888
  };
1895
1889
  var StyledField = React27.forwardRef(
1896
1890
  function StyledField2(props, ref) {
1897
- const { children, variant, isDisabled, ...otherProps } = props;
1891
+ const {
1892
+ children,
1893
+ variant,
1894
+ isDisabled,
1895
+ isActive,
1896
+ overrideBorderColor,
1897
+ ...otherProps
1898
+ } = props;
1898
1899
  const { invalid } = react.useFieldContext() ?? {
1899
1900
  };
1900
1901
  const recipe = react.useSlotRecipe({
@@ -1905,7 +1906,11 @@ var StyledField = React27.forwardRef(
1905
1906
  react.Box,
1906
1907
  {
1907
1908
  ...otherProps,
1908
- css: styles.wrapper,
1909
+ css: {
1910
+ ...styles.wrapper,
1911
+ outlineColor: overrideBorderColor || void 0
1912
+ },
1913
+ "data-active": isActive ? "" : void 0,
1909
1914
  ref,
1910
1915
  "aria-invalid": invalid,
1911
1916
  "aria-disabled": isDisabled,
@@ -1948,8 +1953,13 @@ var DatePicker = React27.forwardRef(
1948
1953
  });
1949
1954
  const styles = recipe({ variant });
1950
1955
  const locale = useCurrentLocale();
1956
+ const shouldShowCalendar = state.isOpen && !props.isDisabled && !props.noCalendar;
1951
1957
  const onFieldClick = () => {
1952
- state.setOpen(true);
1958
+ var _a5;
1959
+ if (!props.noCalendar) {
1960
+ state.setOpen(true);
1961
+ }
1962
+ (_a5 = props.onClick) == null ? void 0 : _a5.call(props);
1953
1963
  };
1954
1964
  const popoverContent = /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Positioner, { children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Content, { css: styles.calendarPopover, children: /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Body, { minWidth: "20rem", children: /* @__PURE__ */ jsxRuntime.jsx(
1955
1965
  Calendar,
@@ -1984,8 +1994,10 @@ var DatePicker = React27.forwardRef(
1984
1994
  paddingX: 3,
1985
1995
  minHeight,
1986
1996
  isDisabled: props.isDisabled,
1997
+ isActive: props.isActive,
1998
+ overrideBorderColor: props.overrideBorderColor,
1987
1999
  children: [
1988
- /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2000
+ props.noCalendar ? /* @__PURE__ */ jsxRuntime.jsx(react.Box, { pr: 3, pl: 0.5, mr: 0.5, children: /* @__PURE__ */ jsxRuntime.jsx(sporIconReact.CalendarOutline24Icon, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(react.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1989
2001
  CalendarTriggerButton,
1990
2002
  {
1991
2003
  paddingLeft: 1,
@@ -2009,8 +2021,7 @@ var DatePicker = React27.forwardRef(
2009
2021
  ) })
2010
2022
  }
2011
2023
  ),
2012
- state.isOpen && !props.isDisabled && withPortal && /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: popoverContent }),
2013
- state.isOpen && !props.isDisabled && !withPortal && popoverContent
2024
+ shouldShowCalendar && (withPortal ? /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: popoverContent }) : popoverContent)
2014
2025
  ] })
2015
2026
  }
2016
2027
  ) });
@@ -2819,6 +2830,13 @@ var Input = React27.forwardRef(
2819
2830
  const recipe = react.useRecipe({ key: "input" });
2820
2831
  const [recipeProps, restProps] = recipe.splitVariantProps(props);
2821
2832
  const styles = recipe(recipeProps);
2833
+ const [focused, setFocused] = React27.useState(false);
2834
+ const isControlled = props.value !== void 0;
2835
+ const [uncontrolledValue, setUncontrolledValue] = React27.useState(
2836
+ props.defaultValue ? String(props.defaultValue) : ""
2837
+ );
2838
+ const inputValue = isControlled ? String(props.value ?? "") : uncontrolledValue;
2839
+ const shouldFloat = inputValue.length > 0 || focused;
2822
2840
  return /* @__PURE__ */ jsxRuntime.jsxs(
2823
2841
  Field3,
2824
2842
  {
@@ -2828,14 +2846,12 @@ var Input = React27.forwardRef(
2828
2846
  hidden,
2829
2847
  errorText,
2830
2848
  id: props.id,
2831
- label: (
2832
- // Render startElement invisibly to align label text with input content when an icon is present
2833
- /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { children: [
2834
- /* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
2835
- label
2836
- ] })
2837
- ),
2849
+ label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { children: [
2850
+ /* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
2851
+ label
2852
+ ] }),
2838
2853
  floatingLabel: true,
2854
+ shouldFloat,
2839
2855
  children: [
2840
2856
  startElement && /* @__PURE__ */ jsxRuntime.jsx(react.InputElement, { pointerEvents: "none", paddingX: 2, children: startElement }),
2841
2857
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2849,6 +2865,24 @@ var Input = React27.forwardRef(
2849
2865
  paddingRight: endElement ? "2.6rem" : void 0,
2850
2866
  ...restProps,
2851
2867
  className: `peer ${props.className}`,
2868
+ value: isControlled ? props.value : void 0,
2869
+ onFocus: (e) => {
2870
+ var _a5;
2871
+ (_a5 = props.onFocus) == null ? void 0 : _a5.call(props, e);
2872
+ setFocused(true);
2873
+ },
2874
+ onBlur: (e) => {
2875
+ var _a5;
2876
+ (_a5 = props.onBlur) == null ? void 0 : _a5.call(props, e);
2877
+ setFocused(false);
2878
+ },
2879
+ onChange: (e) => {
2880
+ var _a5;
2881
+ (_a5 = props.onChange) == null ? void 0 : _a5.call(props, e);
2882
+ if (!isControlled) {
2883
+ setUncontrolledValue(e.target.value);
2884
+ }
2885
+ },
2852
2886
  placeholder: "",
2853
2887
  css: styles
2854
2888
  }
@@ -3013,6 +3047,7 @@ var NativeSelect = React27__namespace.forwardRef(function NativeSelect2(props, r
3013
3047
  errorText,
3014
3048
  id: rest.id,
3015
3049
  floatingLabel: true,
3050
+ shouldFloat: true,
3016
3051
  children: /* @__PURE__ */ jsxRuntime.jsxs(
3017
3052
  react.NativeSelect.Root,
3018
3053
  {
@@ -3686,11 +3721,23 @@ var Textarea = React27.forwardRef(
3686
3721
  readOnly,
3687
3722
  helperText,
3688
3723
  floatingLabel,
3724
+ value,
3725
+ defaultValue,
3726
+ onFocus,
3727
+ onBlur,
3728
+ onChange,
3689
3729
  ...restProps
3690
3730
  } = props;
3691
3731
  const recipe = react.useRecipe({ key: "textarea" });
3692
3732
  const styles = recipe({ variant });
3693
3733
  const { labelRef, labelHeight } = useLabelHeight(label);
3734
+ const [focused, setFocused] = React27.useState(false);
3735
+ const isControlled = value !== void 0;
3736
+ const [uncontrolledValue, setUncontrolledValue] = React27.useState(
3737
+ defaultValue ? String(defaultValue) : ""
3738
+ );
3739
+ const inputValue = isControlled ? String(value ?? "") : uncontrolledValue;
3740
+ const shouldFloat = inputValue.length > 0 || focused;
3694
3741
  return /* @__PURE__ */ jsxRuntime.jsxs(
3695
3742
  Field3,
3696
3743
  {
@@ -3700,6 +3747,7 @@ var Textarea = React27.forwardRef(
3700
3747
  required,
3701
3748
  readOnly,
3702
3749
  floatingLabel,
3750
+ shouldFloat,
3703
3751
  position: "relative",
3704
3752
  children: [
3705
3753
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3709,11 +3757,33 @@ var Textarea = React27.forwardRef(
3709
3757
  css: styles,
3710
3758
  className: "peer",
3711
3759
  ref,
3760
+ value: isControlled ? value : void 0,
3761
+ defaultValue,
3762
+ onFocus: (e) => {
3763
+ onFocus == null ? void 0 : onFocus(e);
3764
+ setFocused(true);
3765
+ },
3766
+ onBlur: (e) => {
3767
+ onBlur == null ? void 0 : onBlur(e);
3768
+ setFocused(false);
3769
+ },
3770
+ onChange: (e) => {
3771
+ onChange == null ? void 0 : onChange(e);
3772
+ if (!isControlled)
3773
+ setUncontrolledValue(e.target.value);
3774
+ },
3712
3775
  style: { "--label-height": `${labelHeight}px` },
3713
3776
  placeholder: " "
3714
3777
  }
3715
3778
  ),
3716
- /* @__PURE__ */ jsxRuntime.jsx(FloatingLabel, { ref: labelRef, children: label })
3779
+ /* @__PURE__ */ jsxRuntime.jsx(
3780
+ FloatingLabel,
3781
+ {
3782
+ ref: labelRef,
3783
+ "data-float": shouldFloat ? true : void 0,
3784
+ children: label
3785
+ }
3786
+ )
3717
3787
  ]
3718
3788
  }
3719
3789
  );
@@ -7106,6 +7176,13 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
7106
7176
  _focusWithin: {
7107
7177
  outline: "2px solid",
7108
7178
  outlineColor: "outline.focus"
7179
+ },
7180
+ "&[data-active]": {
7181
+ outline: "2px solid",
7182
+ outlineColor: "outline.focus",
7183
+ "&:hover": {
7184
+ outlineColor: "outline.focus"
7185
+ }
7109
7186
  }
7110
7187
  },
7111
7188
  inputLabel: {
@@ -7232,6 +7309,13 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
7232
7309
  backgroundColor: "ghost.surface.active",
7233
7310
  outline: "1px solid",
7234
7311
  outlineColor: "core.outline"
7312
+ },
7313
+ "&[data-active]": {
7314
+ outline: "2px solid",
7315
+ outlineColor: "outline.focus",
7316
+ _hover: {
7317
+ outlineColor: "outline.focus"
7318
+ }
7235
7319
  }
7236
7320
  },
7237
7321
  _invalid: {
@@ -7256,6 +7340,13 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
7256
7340
  backgroundColor: "ghost.surface.active",
7257
7341
  outline: "1px solid",
7258
7342
  outlineColor: "core.outline"
7343
+ },
7344
+ "&[data-active]": {
7345
+ outline: "2px solid",
7346
+ outlineColor: "outline.focus",
7347
+ _hover: {
7348
+ outlineColor: "outline.focus"
7349
+ }
7259
7350
  }
7260
7351
  },
7261
7352
  _invalid: {
@@ -7273,6 +7364,13 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
7273
7364
  backgroundColor: "ghost.surface.active",
7274
7365
  outline: "1px solid",
7275
7366
  outlineColor: "core.outline"
7367
+ },
7368
+ "&[data-active]": {
7369
+ outline: "2px solid",
7370
+ outlineColor: "outline.focus",
7371
+ _hover: {
7372
+ outlineColor: "outline.focus"
7373
+ }
7276
7374
  }
7277
7375
  },
7278
7376
  _invalid: {