@vygruppen/spor-react 12.13.2 → 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 +7 -0
- package/dist/index.cjs +95 -25
- 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 +96 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- 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/Textarea.tsx +35 -1
- package/src/theme/slot-recipes/datepicker.ts +4 -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 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 296.52 KB
|
20
15
|
ESM dist/icons/index.mjs 110.00 B
|
16
|
+
ESM dist/index.mjs.map 633.98 KB
|
21
17
|
ESM dist/icons/index.mjs.map 157.00 B
|
22
|
-
ESM
|
23
|
-
|
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
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
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
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 {
|
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({
|
@@ -1906,6 +1907,8 @@ var StyledField = React27.forwardRef(
|
|
1906
1907
|
{
|
1907
1908
|
...otherProps,
|
1908
1909
|
css: styles.wrapper,
|
1910
|
+
"data-active": isActive ? "" : void 0,
|
1911
|
+
style: overrideBorderColor ? { outlineColor: overrideBorderColor } : void 0,
|
1909
1912
|
ref,
|
1910
1913
|
"aria-invalid": invalid,
|
1911
1914
|
"aria-disabled": isDisabled,
|
@@ -1948,7 +1951,10 @@ var DatePicker = React27.forwardRef(
|
|
1948
1951
|
});
|
1949
1952
|
const styles = recipe({ variant });
|
1950
1953
|
const locale = useCurrentLocale();
|
1954
|
+
const shouldShowCalendar = state.isOpen && !props.isDisabled && !props.noCalendar;
|
1951
1955
|
const onFieldClick = () => {
|
1956
|
+
if (props.noCalendar)
|
1957
|
+
return;
|
1952
1958
|
state.setOpen(true);
|
1953
1959
|
};
|
1954
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(
|
@@ -1980,12 +1986,14 @@ var DatePicker = React27.forwardRef(
|
|
1980
1986
|
StyledField,
|
1981
1987
|
{
|
1982
1988
|
variant,
|
1983
|
-
onClick: onFieldClick,
|
1989
|
+
onClick: props.noCalendar ? void 0 : onFieldClick,
|
1984
1990
|
paddingX: 3,
|
1985
1991
|
minHeight,
|
1986
1992
|
isDisabled: props.isDisabled,
|
1993
|
+
isActive: props.isActive,
|
1994
|
+
overrideBorderColor: props.overrideBorderColor,
|
1987
1995
|
children: [
|
1988
|
-
/* @__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(
|
1989
1997
|
CalendarTriggerButton,
|
1990
1998
|
{
|
1991
1999
|
paddingLeft: 1,
|
@@ -2009,8 +2017,7 @@ var DatePicker = React27.forwardRef(
|
|
2009
2017
|
) })
|
2010
2018
|
}
|
2011
2019
|
),
|
2012
|
-
|
2013
|
-
state.isOpen && !props.isDisabled && !withPortal && popoverContent
|
2020
|
+
shouldShowCalendar && (withPortal ? /* @__PURE__ */ jsxRuntime.jsx(react.Portal, { children: popoverContent }) : popoverContent)
|
2014
2021
|
] })
|
2015
2022
|
}
|
2016
2023
|
) });
|
@@ -2819,6 +2826,13 @@ var Input = React27.forwardRef(
|
|
2819
2826
|
const recipe = react.useRecipe({ key: "input" });
|
2820
2827
|
const [recipeProps, restProps] = recipe.splitVariantProps(props);
|
2821
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;
|
2822
2836
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2823
2837
|
Field3,
|
2824
2838
|
{
|
@@ -2828,14 +2842,12 @@ var Input = React27.forwardRef(
|
|
2828
2842
|
hidden,
|
2829
2843
|
errorText,
|
2830
2844
|
id: props.id,
|
2831
|
-
label: (
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
label
|
2836
|
-
] })
|
2837
|
-
),
|
2845
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(react.Flex, { children: [
|
2846
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Box, { visibility: "hidden", children: startElement }),
|
2847
|
+
label
|
2848
|
+
] }),
|
2838
2849
|
floatingLabel: true,
|
2850
|
+
shouldFloat,
|
2839
2851
|
children: [
|
2840
2852
|
startElement && /* @__PURE__ */ jsxRuntime.jsx(react.InputElement, { pointerEvents: "none", paddingX: 2, children: startElement }),
|
2841
2853
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -2849,6 +2861,24 @@ var Input = React27.forwardRef(
|
|
2849
2861
|
paddingRight: endElement ? "2.6rem" : void 0,
|
2850
2862
|
...restProps,
|
2851
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
|
+
},
|
2852
2882
|
placeholder: "",
|
2853
2883
|
css: styles
|
2854
2884
|
}
|
@@ -3013,6 +3043,7 @@ var NativeSelect = React27__namespace.forwardRef(function NativeSelect2(props, r
|
|
3013
3043
|
errorText,
|
3014
3044
|
id: rest.id,
|
3015
3045
|
floatingLabel: true,
|
3046
|
+
shouldFloat: true,
|
3016
3047
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
3017
3048
|
react.NativeSelect.Root,
|
3018
3049
|
{
|
@@ -3686,11 +3717,23 @@ var Textarea = React27.forwardRef(
|
|
3686
3717
|
readOnly,
|
3687
3718
|
helperText,
|
3688
3719
|
floatingLabel,
|
3720
|
+
value,
|
3721
|
+
defaultValue,
|
3722
|
+
onFocus,
|
3723
|
+
onBlur,
|
3724
|
+
onChange,
|
3689
3725
|
...restProps
|
3690
3726
|
} = props;
|
3691
3727
|
const recipe = react.useRecipe({ key: "textarea" });
|
3692
3728
|
const styles = recipe({ variant });
|
3693
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;
|
3694
3737
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
3695
3738
|
Field3,
|
3696
3739
|
{
|
@@ -3700,6 +3743,7 @@ var Textarea = React27.forwardRef(
|
|
3700
3743
|
required,
|
3701
3744
|
readOnly,
|
3702
3745
|
floatingLabel,
|
3746
|
+
shouldFloat,
|
3703
3747
|
position: "relative",
|
3704
3748
|
children: [
|
3705
3749
|
/* @__PURE__ */ jsxRuntime.jsx(
|
@@ -3709,11 +3753,33 @@ var Textarea = React27.forwardRef(
|
|
3709
3753
|
css: styles,
|
3710
3754
|
className: "peer",
|
3711
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
|
+
},
|
3712
3771
|
style: { "--label-height": `${labelHeight}px` },
|
3713
3772
|
placeholder: " "
|
3714
3773
|
}
|
3715
3774
|
),
|
3716
|
-
/* @__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
|
+
)
|
3717
3783
|
]
|
3718
3784
|
}
|
3719
3785
|
);
|
@@ -7106,6 +7172,10 @@ var datePickerSlotRecipe = react.defineSlotRecipe({
|
|
7106
7172
|
_focusWithin: {
|
7107
7173
|
outline: "2px solid",
|
7108
7174
|
outlineColor: "outline.focus"
|
7175
|
+
},
|
7176
|
+
"&[data-active]": {
|
7177
|
+
outline: "2px solid",
|
7178
|
+
outlineColor: "outline.focus"
|
7109
7179
|
}
|
7110
7180
|
},
|
7111
7181
|
inputLabel: {
|