@vygruppen/spor-react 10.2.0 → 10.4.0
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 +9 -9
- package/CHANGELOG.md +18 -0
- package/dist/{CountryCodeSelect-UFSVRLDY.mjs → CountryCodeSelect-XMQTDWRD.mjs} +2 -1
- package/dist/{chunk-BPDFFQ3U.mjs → chunk-T4CLCBB5.mjs} +245 -111
- package/dist/index.d.mts +582 -107
- package/dist/index.d.ts +582 -107
- package/dist/index.js +260 -120
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/input/Combobox.tsx +4 -0
- package/src/input/CountryCodeSelect.tsx +2 -0
- package/src/input/InfoSelect.tsx +5 -3
- package/src/input/ListBox.tsx +4 -1
- package/src/input/NumericStepper.tsx +72 -19
- package/src/input/PhoneNumberInput.tsx +5 -0
- package/src/input/Switch.tsx +4 -2
- package/src/input/Textarea.tsx +1 -2
- package/src/theme/components/card-select.ts +1 -1
- package/src/theme/components/info-select.ts +1 -0
- package/src/theme/components/input.ts +4 -83
- package/src/theme/components/listbox.ts +16 -2
- package/src/theme/components/select.ts +18 -3
- package/src/theme/components/textarea.ts +13 -2
- package/src/theme/utils/focus-utils.ts +2 -2
- package/src/theme/utils/input-utils.ts +119 -0
- package/src/theme/utils/types.ts +2 -0
@@ -0,0 +1,119 @@
|
|
1
|
+
import { StyleFunctionProps } from "@chakra-ui/theme-tools";
|
2
|
+
import { baseBackground, baseBorder, baseText } from "./base-utils";
|
3
|
+
import { floatingBackground, floatingBorder } from "./floating-utils";
|
4
|
+
import { InputState } from "./types";
|
5
|
+
import { focusVisibleStyles } from "./focus-utils";
|
6
|
+
import { surface } from "./surface-utils";
|
7
|
+
|
8
|
+
export function inputVariant(state: InputState, props: StyleFunctionProps) {
|
9
|
+
switch (state) {
|
10
|
+
case "base":
|
11
|
+
return {
|
12
|
+
...baseBackground("default", props),
|
13
|
+
...baseBorder("default", props),
|
14
|
+
_hover: {
|
15
|
+
...baseBorder("hover", props),
|
16
|
+
},
|
17
|
+
_active: {
|
18
|
+
...baseBackground("active", props),
|
19
|
+
...baseBorder("default", props),
|
20
|
+
},
|
21
|
+
_selected: {
|
22
|
+
...baseBackground("selected", props),
|
23
|
+
...baseBorder("selected", props),
|
24
|
+
},
|
25
|
+
};
|
26
|
+
case "floating":
|
27
|
+
return {
|
28
|
+
boxShadow: "sm",
|
29
|
+
...floatingBackground("default", props),
|
30
|
+
...floatingBorder("default", props),
|
31
|
+
|
32
|
+
_hover: {
|
33
|
+
...floatingBorder("hover", props),
|
34
|
+
...floatingBackground("hover", props),
|
35
|
+
},
|
36
|
+
_active: {
|
37
|
+
...floatingBorder("active", props),
|
38
|
+
...floatingBackground("active", props),
|
39
|
+
},
|
40
|
+
_selected: {
|
41
|
+
...floatingBorder("selected", props),
|
42
|
+
...floatingBackground("selected", props),
|
43
|
+
},
|
44
|
+
};
|
45
|
+
case "default":
|
46
|
+
default:
|
47
|
+
return {
|
48
|
+
...baseBackground("default", props),
|
49
|
+
...baseBorder("default", props),
|
50
|
+
_hover: {
|
51
|
+
...baseBorder("hover", props),
|
52
|
+
},
|
53
|
+
_active: {
|
54
|
+
...baseBackground("active", props),
|
55
|
+
...baseBorder("default", props),
|
56
|
+
},
|
57
|
+
_selected: {
|
58
|
+
...baseBackground("selected", props),
|
59
|
+
...baseBorder("selected", props),
|
60
|
+
},
|
61
|
+
};
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
export const inputBaseStyle = (props: StyleFunctionProps) => ({
|
66
|
+
field: {
|
67
|
+
appearance: "none",
|
68
|
+
width: "100%",
|
69
|
+
outline: "none",
|
70
|
+
border: 0,
|
71
|
+
borderRadius: "sm",
|
72
|
+
transitionProperty: "common",
|
73
|
+
transitionDuration: "fast",
|
74
|
+
position: "relative",
|
75
|
+
paddingX: 3,
|
76
|
+
height: 8,
|
77
|
+
fontSize: "mobile.md",
|
78
|
+
_focusVisible: {
|
79
|
+
...focusVisibleStyles(props)._focusVisible,
|
80
|
+
outlineOffset: 0,
|
81
|
+
},
|
82
|
+
_disabled: {
|
83
|
+
...surface("disabled", props),
|
84
|
+
...baseBorder("disabled", props),
|
85
|
+
pointerEvents: "none",
|
86
|
+
},
|
87
|
+
_invalid: {
|
88
|
+
...baseBorder("invalid", props),
|
89
|
+
_hover: {
|
90
|
+
...baseBorder("hover", props),
|
91
|
+
},
|
92
|
+
},
|
93
|
+
" + label": {
|
94
|
+
fontSize: ["mobile.sm", "desktop.sm"],
|
95
|
+
top: "2px",
|
96
|
+
left: props.paddingLeft || props.pl || 3,
|
97
|
+
zIndex: 2,
|
98
|
+
position: "absolute",
|
99
|
+
marginY: 2,
|
100
|
+
transition: ".1s ease-out",
|
101
|
+
transformOrigin: "top left",
|
102
|
+
cursor: "text",
|
103
|
+
},
|
104
|
+
"&:not(:placeholder-shown)": {
|
105
|
+
paddingTop: "1rem",
|
106
|
+
"& + label": {
|
107
|
+
transform: "scale(0.825) translateY(-10px)",
|
108
|
+
},
|
109
|
+
},
|
110
|
+
},
|
111
|
+
element: {
|
112
|
+
height: "100%",
|
113
|
+
},
|
114
|
+
group: {
|
115
|
+
":has(:disabled)": {
|
116
|
+
...baseText("disabled", props),
|
117
|
+
},
|
118
|
+
},
|
119
|
+
});
|
package/src/theme/utils/types.ts
CHANGED