@vygruppen/spor-react 12.13.1 → 12.13.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/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-postinstall.log +1 -1
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs +99 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +100 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/datepicker/DatePicker.tsx +29 -14
- package/src/datepicker/StyledField.tsx +16 -1
- package/src/input/Field.tsx +3 -1
- package/src/input/FloatingLabel.tsx +6 -11
- package/src/input/Input.tsx +33 -2
- package/src/input/NativeSelect.tsx +1 -0
- package/src/input/Popover.tsx +0 -7
- package/src/input/Textarea.tsx +35 -1
- package/src/theme/slot-recipes/collapsible.ts +2 -0
- package/src/theme/slot-recipes/datepicker.ts +5 -0
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @vygruppen/spor-react@12.13.
|
2
|
+
> @vygruppen/spor-react@12.13.3 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
|
-
|
15
|
-
CJS dist/icons/index.cjs 381.00 B
|
16
|
-
CJS dist/index.cjs.map 630.07 KB
|
17
|
-
CJS dist/icons/index.cjs.map 157.00 B
|
18
|
-
CJS ⚡️ Build success in 2628ms
|
19
|
-
ESM dist/index.mjs 294.13 KB
|
14
|
+
ESM dist/index.mjs 296.52 KB
|
20
15
|
ESM dist/icons/index.mjs 110.00 B
|
21
|
-
ESM dist/index.mjs.map
|
16
|
+
ESM dist/index.mjs.map 633.98 KB
|
22
17
|
ESM dist/icons/index.mjs.map 157.00 B
|
23
|
-
ESM ⚡️ Build success in
|
24
|
-
|
18
|
+
ESM ⚡️ Build success in 2612ms
|
19
|
+
CJS dist/index.cjs 318.00 KB
|
20
|
+
CJS dist/icons/index.cjs 381.00 B
|
21
|
+
CJS dist/index.cjs.map 633.98 KB
|
22
|
+
CJS dist/icons/index.cjs.map 157.00 B
|
23
|
+
CJS ⚡️ Build success in 2612ms
|
24
|
+
DTS ⚡️ Build success in 18933ms
|
25
25
|
DTS dist/icons/index.d.ts 44.00 B
|
26
|
-
DTS dist/index.d.ts 156.
|
26
|
+
DTS dist/index.d.ts 156.16 KB
|
27
27
|
DTS dist/icons/index.d.cts 44.00 B
|
28
|
-
DTS dist/index.d.cts 156.
|
28
|
+
DTS dist/index.d.cts 156.16 KB
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# @vygruppen/spor-react
|
2
2
|
|
3
|
+
## 12.13.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 1457051: Added isActive and noCalendar props for datepicker
|
8
|
+
- a8b04df: Label: Fix bug where it was always floating in safari.
|
9
|
+
|
10
|
+
## 12.13.2
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 0714df2: Fix min height on datepicker popover, making sure it fits content.
|
15
|
+
- 5829615: Revert combobox fix
|
16
|
+
- 59306ea: Fix Collapsible to allow a minor overflow for border and shadow
|
17
|
+
|
3
18
|
## 12.13.1
|
4
19
|
|
5
20
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -13,7 +13,6 @@ var lu = require('react-icons/lu');
|
|
13
13
|
var reactStately = require('react-stately');
|
14
14
|
var date = require('@internationalized/date');
|
15
15
|
var reactSwipeable = require('react-swipeable');
|
16
|
-
var ReactDOM = require('react-dom');
|
17
16
|
var awesomePhonenumber = require('awesome-phonenumber');
|
18
17
|
var react$1 = require('@emotion/react');
|
19
18
|
var tokens23 = require('@vygruppen/spor-design-tokens');
|
@@ -44,7 +43,6 @@ function _interopNamespace(e) {
|
|
44
43
|
|
45
44
|
var React27__namespace = /*#__PURE__*/_interopNamespace(React27);
|
46
45
|
var ReactLottie__default = /*#__PURE__*/_interopDefault(ReactLottie);
|
47
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
48
46
|
var tokens23__namespace = /*#__PURE__*/_interopNamespace(tokens23);
|
49
47
|
var tokens4__default = /*#__PURE__*/_interopDefault(tokens4);
|
50
48
|
|
@@ -1333,24 +1331,17 @@ FloatingLabel.displayName = "FloatingLabel";
|
|
1333
1331
|
var floatingLabelStyles = react.defineStyle({
|
1334
1332
|
paddingX: 3,
|
1335
1333
|
fontWeight: "normal",
|
1336
|
-
fontSize: ["mobile.xs", "desktop.xs"],
|
1337
|
-
color: "text",
|
1338
1334
|
pointerEvents: "none",
|
1339
1335
|
zIndex: "docked",
|
1340
1336
|
_disabled: {
|
1341
1337
|
opacity: 0.4
|
1342
1338
|
},
|
1343
1339
|
pos: "absolute",
|
1344
|
-
top: "0.3rem",
|
1345
1340
|
transition: "position",
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
fontSize: ["mobile.sm", "desktop.sm"]
|
1351
|
-
},
|
1352
|
-
_peerFocusVisible: {
|
1353
|
-
/* For when input is in focus */
|
1341
|
+
top: "0.9rem",
|
1342
|
+
color: "text",
|
1343
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
1344
|
+
"&[data-float]": {
|
1354
1345
|
fontSize: ["mobile.xs", "desktop.xs"],
|
1355
1346
|
color: "text",
|
1356
1347
|
top: "0.3rem"
|
@@ -1383,6 +1374,7 @@ var Field3 = React27__namespace.forwardRef(
|
|
1383
1374
|
required,
|
1384
1375
|
direction,
|
1385
1376
|
id,
|
1377
|
+
shouldFloat,
|
1386
1378
|
...rest
|
1387
1379
|
} = props;
|
1388
1380
|
const recipe = react.useSlotRecipe({ key: "field" });
|
@@ -1404,7 +1396,7 @@ var Field3 = React27__namespace.forwardRef(
|
|
1404
1396
|
/* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
|
1405
1397
|
] }),
|
1406
1398
|
children,
|
1407
|
-
label && floatingLabel && /* @__PURE__ */ jsxRuntime.jsxs(FloatingLabel, { children: [
|
1399
|
+
label && floatingLabel && /* @__PURE__ */ jsxRuntime.jsxs(FloatingLabel, { "data-float": shouldFloat ? true : void 0, children: [
|
1408
1400
|
label,
|
1409
1401
|
/* @__PURE__ */ jsxRuntime.jsx(react.Field.RequiredIndicator, {})
|
1410
1402
|
] }),
|
@@ -1896,7 +1888,14 @@ var getAriaLabel = (segmentType) => {
|
|
1896
1888
|
};
|
1897
1889
|
var StyledField = React27.forwardRef(
|
1898
1890
|
function StyledField2(props, ref) {
|
1899
|
-
const {
|
1891
|
+
const {
|
1892
|
+
children,
|
1893
|
+
variant,
|
1894
|
+
isDisabled,
|
1895
|
+
isActive,
|
1896
|
+
overrideBorderColor,
|
1897
|
+
...otherProps
|
1898
|
+
} = props;
|
1900
1899
|
const { invalid } = react.useFieldContext() ?? {
|
1901
1900
|
};
|
1902
1901
|
const recipe = react.useSlotRecipe({
|
@@ -1908,6 +1907,8 @@ var StyledField = React27.forwardRef(
|
|
1908
1907
|
{
|
1909
1908
|
...otherProps,
|
1910
1909
|
css: styles.wrapper,
|
1910
|
+
"data-active": isActive ? "" : void 0,
|
1911
|
+
style: overrideBorderColor ? { outlineColor: overrideBorderColor } : void 0,
|
1911
1912
|
ref,
|
1912
1913
|
"aria-invalid": invalid,
|
1913
1914
|
"aria-disabled": isDisabled,
|
@@ -1950,7 +1951,10 @@ var DatePicker = React27.forwardRef(
|
|
1950
1951
|
});
|
1951
1952
|
const styles = recipe({ variant });
|
1952
1953
|
const locale = useCurrentLocale();
|
1954
|
+
const shouldShowCalendar = state.isOpen && !props.isDisabled && !props.noCalendar;
|
1953
1955
|
const onFieldClick = () => {
|
1956
|
+
if (props.noCalendar)
|
1957
|
+
return;
|
1954
1958
|
state.setOpen(true);
|
1955
1959
|
};
|
1956
1960
|
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(
|
@@ -1982,12 +1986,14 @@ var DatePicker = React27.forwardRef(
|
|
1982
1986
|
StyledField,
|
1983
1987
|
{
|
1984
1988
|
variant,
|
1985
|
-
onClick: onFieldClick,
|
1989
|
+
onClick: props.noCalendar ? void 0 : onFieldClick,
|
1986
1990
|
paddingX: 3,
|
1987
1991
|
minHeight,
|
1988
1992
|
isDisabled: props.isDisabled,
|
1993
|
+
isActive: props.isActive,
|
1994
|
+
overrideBorderColor: props.overrideBorderColor,
|
1989
1995
|
children: [
|
1990
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
1996
|
+
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(
|
1991
1997
|
CalendarTriggerButton,
|
1992
1998
|
{
|
1993
1999
|
paddingLeft: 1,
|
@@ -2011,8 +2017,7 @@ var DatePicker = React27.forwardRef(
|
|
2011
2017
|
) })
|
2012
2018
|
}
|
2013
2019
|
),
|
2014
|
-
|
2015
|
-
state.isOpen && !props.isDisabled && !withPortal && popoverContent
|
2020
|
+
shouldShowCalendar && (withPortal ? /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: popoverContent }) : popoverContent)
|
2016
2021
|
] })
|
2017
2022
|
}
|
2018
2023
|
) });
|
@@ -2582,8 +2587,6 @@ var Popover = React27.forwardRef(
|
|
2582
2587
|
...popoverProps,
|
2583
2588
|
ref: popoverRef,
|
2584
2589
|
minWidth: ((_a5 = triggerRef.current) == null ? void 0 : _a5.clientWidth) ?? "auto",
|
2585
|
-
position: "absolute",
|
2586
|
-
zIndex: 1400,
|
2587
2590
|
children: [
|
2588
2591
|
/* @__PURE__ */ jsxRuntime.jsx(reactAria.DismissButton, { onDismiss: state.close }),
|
2589
2592
|
children,
|
@@ -2592,9 +2595,6 @@ var Popover = React27.forwardRef(
|
|
2592
2595
|
}
|
2593
2596
|
);
|
2594
2597
|
if (isNonModal) {
|
2595
|
-
if (globalThis.window !== void 0 && typeof document !== "undefined") {
|
2596
|
-
return ReactDOM__default.default.createPortal(popoverBox, document.body);
|
2597
|
-
}
|
2598
2598
|
return popoverBox;
|
2599
2599
|
}
|
2600
2600
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactAria.Overlay, { children: [
|
@@ -2826,6 +2826,13 @@ var Input = React27.forwardRef(
|
|
2826
2826
|
const recipe = react.useRecipe({ key: "input" });
|
2827
2827
|
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
2828
2828
|
const styles = recipe(recipeProps);
|
2829
|
+
const [focused, setFocused] = React27.useState(false);
|
2830
|
+
const isControlled = props.value !== void 0;
|
2831
|
+
const [uncontrolledValue, setUncontrolledValue] = React27.useState(
|
2832
|
+
props.defaultValue ? String(props.defaultValue) : ""
|
2833
|
+
);
|
2834
|
+
const inputValue = isControlled ? String(props.value ?? "") : uncontrolledValue;
|
2835
|
+
const shouldFloat = inputValue.length > 0 || focused;
|
2829
2836
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2830
2837
|
Field3,
|
2831
2838
|
{
|
@@ -2835,14 +2842,12 @@ var Input = React27.forwardRef(
|
|
2835
2842
|
hidden,
|
2836
2843
|
errorText,
|
2837
2844
|
id: props.id,
|
2838
|
-
label: (
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
label
|
2843
|
-
] })
|
2844
|
-
),
|
2845
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { children: [
|
2846
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
|
2847
|
+
label
|
2848
|
+
] }),
|
2845
2849
|
floatingLabel: true,
|
2850
|
+
shouldFloat,
|
2846
2851
|
children: [
|
2847
2852
|
startElement && /* @__PURE__ */ jsxRuntime.jsx(react.InputElement, { pointerEvents: "none", paddingX: 2, children: startElement }),
|
2848
2853
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2856,6 +2861,24 @@ var Input = React27.forwardRef(
|
|
2856
2861
|
paddingRight: endElement ? "2.6rem" : void 0,
|
2857
2862
|
...restProps,
|
2858
2863
|
className: `peer ${props.className}`,
|
2864
|
+
value: isControlled ? props.value : void 0,
|
2865
|
+
onFocus: (e) => {
|
2866
|
+
var _a5;
|
2867
|
+
(_a5 = props.onFocus) == null ? void 0 : _a5.call(props, e);
|
2868
|
+
setFocused(true);
|
2869
|
+
},
|
2870
|
+
onBlur: (e) => {
|
2871
|
+
var _a5;
|
2872
|
+
(_a5 = props.onBlur) == null ? void 0 : _a5.call(props, e);
|
2873
|
+
setFocused(false);
|
2874
|
+
},
|
2875
|
+
onChange: (e) => {
|
2876
|
+
var _a5;
|
2877
|
+
(_a5 = props.onChange) == null ? void 0 : _a5.call(props, e);
|
2878
|
+
if (!isControlled) {
|
2879
|
+
setUncontrolledValue(e.target.value);
|
2880
|
+
}
|
2881
|
+
},
|
2859
2882
|
placeholder: "",
|
2860
2883
|
css: styles
|
2861
2884
|
}
|
@@ -3020,6 +3043,7 @@ var NativeSelect = React27__namespace.forwardRef(function NativeSelect2(props, r
|
|
3020
3043
|
errorText,
|
3021
3044
|
id: rest.id,
|
3022
3045
|
floatingLabel: true,
|
3046
|
+
shouldFloat: true,
|
3023
3047
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
3024
3048
|
react.NativeSelect.Root,
|
3025
3049
|
{
|
@@ -3693,11 +3717,23 @@ var Textarea = React27.forwardRef(
|
|
3693
3717
|
readOnly,
|
3694
3718
|
helperText,
|
3695
3719
|
floatingLabel,
|
3720
|
+
value,
|
3721
|
+
defaultValue,
|
3722
|
+
onFocus,
|
3723
|
+
onBlur,
|
3724
|
+
onChange,
|
3696
3725
|
...restProps
|
3697
3726
|
} = props;
|
3698
3727
|
const recipe = react.useRecipe({ key: "textarea" });
|
3699
3728
|
const styles = recipe({ variant });
|
3700
3729
|
const { labelRef, labelHeight } = useLabelHeight(label);
|
3730
|
+
const [focused, setFocused] = React27.useState(false);
|
3731
|
+
const isControlled = value !== void 0;
|
3732
|
+
const [uncontrolledValue, setUncontrolledValue] = React27.useState(
|
3733
|
+
defaultValue ? String(defaultValue) : ""
|
3734
|
+
);
|
3735
|
+
const inputValue = isControlled ? String(value ?? "") : uncontrolledValue;
|
3736
|
+
const shouldFloat = inputValue.length > 0 || focused;
|
3701
3737
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
3702
3738
|
Field3,
|
3703
3739
|
{
|
@@ -3707,6 +3743,7 @@ var Textarea = React27.forwardRef(
|
|
3707
3743
|
required,
|
3708
3744
|
readOnly,
|
3709
3745
|
floatingLabel,
|
3746
|
+
shouldFloat,
|
3710
3747
|
position: "relative",
|
3711
3748
|
children: [
|
3712
3749
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -3716,11 +3753,33 @@ var Textarea = React27.forwardRef(
|
|
3716
3753
|
css: styles,
|
3717
3754
|
className: "peer",
|
3718
3755
|
ref,
|
3756
|
+
value: isControlled ? value : void 0,
|
3757
|
+
defaultValue,
|
3758
|
+
onFocus: (e) => {
|
3759
|
+
onFocus == null ? void 0 : onFocus(e);
|
3760
|
+
setFocused(true);
|
3761
|
+
},
|
3762
|
+
onBlur: (e) => {
|
3763
|
+
onBlur == null ? void 0 : onBlur(e);
|
3764
|
+
setFocused(false);
|
3765
|
+
},
|
3766
|
+
onChange: (e) => {
|
3767
|
+
onChange == null ? void 0 : onChange(e);
|
3768
|
+
if (!isControlled)
|
3769
|
+
setUncontrolledValue(e.target.value);
|
3770
|
+
},
|
3719
3771
|
style: { "--label-height": `${labelHeight}px` },
|
3720
3772
|
placeholder: " "
|
3721
3773
|
}
|
3722
3774
|
),
|
3723
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3775
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3776
|
+
FloatingLabel,
|
3777
|
+
{
|
3778
|
+
ref: labelRef,
|
3779
|
+
"data-float": shouldFloat ? true : void 0,
|
3780
|
+
children: label
|
3781
|
+
}
|
3782
|
+
)
|
3724
3783
|
]
|
3725
3784
|
}
|
3726
3785
|
);
|
@@ -7074,6 +7133,8 @@ var collapsibleSlotRecipe = react.defineSlotRecipe({
|
|
7074
7133
|
className: "chakra-collapsible",
|
7075
7134
|
base: {
|
7076
7135
|
content: {
|
7136
|
+
margin: -1,
|
7137
|
+
padding: 1,
|
7077
7138
|
overflow: "hidden",
|
7078
7139
|
_open: {
|
7079
7140
|
animationName: "expand-height, fade-in",
|
@@ -7111,6 +7172,10 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
|
|
7111
7172
|
_focusWithin: {
|
7112
7173
|
outline: "2px solid",
|
7113
7174
|
outlineColor: "outline.focus"
|
7175
|
+
},
|
7176
|
+
"&[data-active]": {
|
7177
|
+
outline: "2px solid",
|
7178
|
+
outlineColor: "outline.focus"
|
7114
7179
|
}
|
7115
7180
|
},
|
7116
7181
|
inputLabel: {
|
@@ -7154,7 +7219,8 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
|
|
7154
7219
|
outline: "1px solid",
|
7155
7220
|
outlineColor: "floating.outline",
|
7156
7221
|
boxShadow: "md",
|
7157
|
-
backgroundColor: "floating.surface"
|
7222
|
+
backgroundColor: "floating.surface",
|
7223
|
+
minHeight: "min-content"
|
7158
7224
|
},
|
7159
7225
|
rangeCalendarPopover: {
|
7160
7226
|
width: "43rem",
|