@vygruppen/spor-react 12.2.0 → 12.3.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 +11 -11
- package/.turbo/turbo-typegen.log +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/index.d.mts +115 -212
- package/dist/index.d.ts +115 -212
- package/dist/index.js +566 -457
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +569 -460
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/datepicker/DatePicker.tsx +10 -13
- package/src/datepicker/DateRangePicker.tsx +18 -5
- package/src/datepicker/TimePicker.tsx +34 -35
- package/src/input/AttachedInputs.tsx +7 -4
- package/src/input/ChoiceChip.tsx +49 -66
- package/src/input/Combobox.tsx +5 -0
- package/src/input/Field.tsx +56 -20
- package/src/input/FloatingLabel.tsx +38 -0
- package/src/input/Input.tsx +40 -23
- package/src/input/Label.tsx +18 -0
- package/src/input/NativeSelect.tsx +14 -5
- package/src/input/NumericStepper.tsx +102 -99
- package/src/input/PasswordInput.tsx +1 -2
- package/src/input/Select.tsx +29 -15
- package/src/input/Switch.tsx +17 -3
- package/src/input/Textarea.tsx +2 -2
- package/src/theme/slot-recipes/anatomy.ts +10 -0
- package/src/theme/slot-recipes/choice-chip.ts +183 -0
- package/src/theme/slot-recipes/field.ts +1 -28
- package/src/theme/slot-recipes/index.ts +2 -0
- package/src/theme/slot-recipes/numeric-stepper.ts +8 -3
- package/src/theme/slot-recipes/select.ts +4 -4
- package/src/input/InputGroup.tsx +0 -67
- package/src/theme/recipes/choice-chip.ts +0 -144
@@ -12,33 +12,6 @@ export const fieldSlotRecipe = defineSlotRecipe({
|
|
12
12
|
position: "relative",
|
13
13
|
flexDirection: "column",
|
14
14
|
},
|
15
|
-
label: {
|
16
|
-
/* For when input is filled */
|
17
|
-
pos: "absolute",
|
18
|
-
paddingX: 3,
|
19
|
-
top: "0.3rem",
|
20
|
-
fontWeight: "normal",
|
21
|
-
fontSize: ["mobile.xs", "desktop.xs"],
|
22
|
-
color: "text",
|
23
|
-
pointerEvents: "none",
|
24
|
-
transition: "position",
|
25
|
-
zIndex: "docked",
|
26
|
-
_peerPlaceholderShown: {
|
27
|
-
/* For when input is not in focus */
|
28
|
-
top: "0.9rem",
|
29
|
-
color: "text",
|
30
|
-
fontSize: ["mobile.sm", "desktop.sm"],
|
31
|
-
},
|
32
|
-
_peerFocusVisible: {
|
33
|
-
/* For when input is in focus */
|
34
|
-
fontSize: ["mobile.xs", "desktop.xs"],
|
35
|
-
color: "text",
|
36
|
-
top: "0.3rem",
|
37
|
-
},
|
38
|
-
_disabled: {
|
39
|
-
opacity: 0.4,
|
40
|
-
},
|
41
|
-
},
|
42
15
|
requiredIndicator: {
|
43
16
|
marginStart: 1,
|
44
17
|
color: "brightRed",
|
@@ -58,7 +31,7 @@ export const fieldSlotRecipe = defineSlotRecipe({
|
|
58
31
|
textStyle: "xs",
|
59
32
|
width: "fit-content",
|
60
33
|
position: "absolute",
|
61
|
-
bottom: -
|
34
|
+
bottom: -5,
|
62
35
|
left: 3,
|
63
36
|
zIndex: "dropdown",
|
64
37
|
maxWidth: "50ch",
|
@@ -4,6 +4,7 @@ import { alertExpandableSlotRecipe } from "./alert-expandable";
|
|
4
4
|
import { alertServiceSlotRecipe } from "./alert-service";
|
5
5
|
import { breadcrumbSlotRecipe } from "./breadcrumb";
|
6
6
|
import { checkboxSlotRecipe } from "./checkbox";
|
7
|
+
import { choiceChipSlotRecipe } from "./choice-chip";
|
7
8
|
import { datePickerSlotRecipe } from "./datepicker";
|
8
9
|
import { dialogSlotRecipe } from "./dialog";
|
9
10
|
import { drawerSlotRecipe } from "./drawer";
|
@@ -62,4 +63,5 @@ export const slotRecipes = {
|
|
62
63
|
tabs: tabsSlotRecipe,
|
63
64
|
travelTag: travelTagSlotRecipe,
|
64
65
|
toast: toastSlotRecipe,
|
66
|
+
checkboxCard: choiceChipSlotRecipe,
|
65
67
|
};
|
@@ -7,16 +7,21 @@ export const numericStepperRecipe = defineSlotRecipe({
|
|
7
7
|
className: "spor-numeric-stepper",
|
8
8
|
base: {
|
9
9
|
root: {
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
"& > div": {
|
11
|
+
display: "flex",
|
12
|
+
flexDirection: "row",
|
13
|
+
alignItems: "center",
|
14
|
+
},
|
13
15
|
},
|
14
16
|
input: {
|
15
17
|
fontSize: "sm",
|
16
18
|
fontWeight: "bold",
|
17
19
|
marginX: 0.5,
|
20
|
+
padding: 0,
|
18
21
|
paddingX: 0.5,
|
19
22
|
borderRadius: "xs",
|
23
|
+
outline: "none",
|
24
|
+
height: "auto",
|
20
25
|
textAlign: "center",
|
21
26
|
transitionProperty: "common",
|
22
27
|
transitionDuration: "fast",
|
@@ -146,6 +146,10 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
146
146
|
_open: {
|
147
147
|
borderBottomRadius: 0,
|
148
148
|
},
|
149
|
+
_invalid: {
|
150
|
+
outline: "2px solid",
|
151
|
+
outlineColor: "outline.error",
|
152
|
+
},
|
149
153
|
},
|
150
154
|
itemText: {
|
151
155
|
flex: "1",
|
@@ -179,10 +183,6 @@ export const selectSlotRecipe = defineSlotRecipe({
|
|
179
183
|
_active: {
|
180
184
|
backgroundColor: "brand.surface.active",
|
181
185
|
},
|
182
|
-
_invalid: {
|
183
|
-
outline: "2px solid",
|
184
|
-
outlineColor: "outline.error",
|
185
|
-
},
|
186
186
|
_disabled: {
|
187
187
|
pointerEvents: "none",
|
188
188
|
color: "text.disabled",
|
package/src/input/InputGroup.tsx
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
|
3
|
-
import type { GroupProps, InputElementProps } from "@chakra-ui/react";
|
4
|
-
import { Group, InputElement } from "@chakra-ui/react";
|
5
|
-
import * as React from "react";
|
6
|
-
|
7
|
-
import { FieldLabel } from "./Field";
|
8
|
-
|
9
|
-
export type InputGroupProps = GroupProps & {
|
10
|
-
startElementProps?: InputElementProps;
|
11
|
-
endElementProps?: InputElementProps;
|
12
|
-
startElement?: React.ReactNode;
|
13
|
-
endElement?: React.ReactNode;
|
14
|
-
children: React.ReactElement;
|
15
|
-
label?: string;
|
16
|
-
};
|
17
|
-
|
18
|
-
/**
|
19
|
-
*
|
20
|
-
* InputGroup is a wrapper for inputs that have a startElement and/or endElement.
|
21
|
-
*
|
22
|
-
* It is not exported to users, but used internally in the Input component.
|
23
|
-
*
|
24
|
-
*/
|
25
|
-
|
26
|
-
export const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
|
27
|
-
(props, ref) => {
|
28
|
-
const {
|
29
|
-
startElement,
|
30
|
-
startElementProps,
|
31
|
-
endElement,
|
32
|
-
endElementProps,
|
33
|
-
label,
|
34
|
-
children,
|
35
|
-
...rest
|
36
|
-
} = props;
|
37
|
-
|
38
|
-
return (
|
39
|
-
<Group ref={ref} {...rest}>
|
40
|
-
{startElement && (
|
41
|
-
<InputElement
|
42
|
-
pointerEvents="none"
|
43
|
-
paddingX={2}
|
44
|
-
{...startElementProps}
|
45
|
-
>
|
46
|
-
{startElement}
|
47
|
-
</InputElement>
|
48
|
-
)}
|
49
|
-
{React.cloneElement(children, {
|
50
|
-
...children.props,
|
51
|
-
})}
|
52
|
-
{label && (
|
53
|
-
<FieldLabel left={startElement ? 4 : "0"} right={endElement ? 4 : 0}>
|
54
|
-
{label}
|
55
|
-
</FieldLabel>
|
56
|
-
)}
|
57
|
-
|
58
|
-
{endElement && (
|
59
|
-
<InputElement placement="end" paddingX={2} {...endElementProps}>
|
60
|
-
{endElement}
|
61
|
-
</InputElement>
|
62
|
-
)}
|
63
|
-
</Group>
|
64
|
-
);
|
65
|
-
},
|
66
|
-
);
|
67
|
-
InputGroup.displayName = "InputGroup";
|
@@ -1,144 +0,0 @@
|
|
1
|
-
import { defineRecipe } from "@chakra-ui/react";
|
2
|
-
|
3
|
-
export const choiceChipRecipe = defineRecipe({
|
4
|
-
base: {
|
5
|
-
display: "inline-flex",
|
6
|
-
alignItems: "center",
|
7
|
-
boxAlign: "center",
|
8
|
-
fontSize: "xs",
|
9
|
-
cursor: "pointer",
|
10
|
-
transitionProperty: "all",
|
11
|
-
borderRadius: "xl",
|
12
|
-
transitionDuration: "fast",
|
13
|
-
height: 6,
|
14
|
-
paddingInlineStart: "2",
|
15
|
-
paddingInlineEnd: "2",
|
16
|
-
|
17
|
-
outline: "1px solid",
|
18
|
-
outlineColor: "base.outline",
|
19
|
-
_checked: {
|
20
|
-
backgroundColor: "brand.surface",
|
21
|
-
borderRadius: "sm",
|
22
|
-
outline: "none",
|
23
|
-
color: "brand.text",
|
24
|
-
_hover: {
|
25
|
-
backgroundColor: "brand.surface.hover",
|
26
|
-
_active: {
|
27
|
-
backgroundColor: "brand.surface.active",
|
28
|
-
},
|
29
|
-
},
|
30
|
-
},
|
31
|
-
|
32
|
-
_focusVisible: {
|
33
|
-
outline: "2px solid",
|
34
|
-
outlineColor: "outline.focus",
|
35
|
-
outlineOffset: "1px",
|
36
|
-
},
|
37
|
-
|
38
|
-
_disabled: {
|
39
|
-
pointerEvents: "none",
|
40
|
-
boxShadow: "none",
|
41
|
-
backgroundColor: "surface.disabled",
|
42
|
-
color: "text.disabled",
|
43
|
-
outline: "none",
|
44
|
-
|
45
|
-
_hover: {
|
46
|
-
backgroundColor: "core.surface.disabled",
|
47
|
-
boxShadow: "none",
|
48
|
-
color: "core.text.disabled",
|
49
|
-
},
|
50
|
-
_checked: {
|
51
|
-
cursor: "not-allowed",
|
52
|
-
boxShadow: "none",
|
53
|
-
color: "core.text.disabled",
|
54
|
-
backgroundColor: "core.surface.disabled",
|
55
|
-
_hover: {
|
56
|
-
backgroundColor: "core.surface.disabled",
|
57
|
-
boxShadow: "none",
|
58
|
-
color: "core.text.disabled",
|
59
|
-
},
|
60
|
-
},
|
61
|
-
},
|
62
|
-
},
|
63
|
-
variants: {
|
64
|
-
variant: {
|
65
|
-
core: {
|
66
|
-
color: "core.text",
|
67
|
-
outlineColor: "core.outline",
|
68
|
-
|
69
|
-
_hover: {
|
70
|
-
outline: "2px solid",
|
71
|
-
outlineColor: "core.outline.hover",
|
72
|
-
|
73
|
-
_active: {
|
74
|
-
outline: "1px solid",
|
75
|
-
outlineColor: "core.outline",
|
76
|
-
backgroundColor: "core.surface.active",
|
77
|
-
},
|
78
|
-
},
|
79
|
-
},
|
80
|
-
accent: {
|
81
|
-
backgroundColor: "accent.surface",
|
82
|
-
color: "accent.text",
|
83
|
-
outline: "none",
|
84
|
-
|
85
|
-
_hover: {
|
86
|
-
backgroundColor: "accent.surface.hover",
|
87
|
-
|
88
|
-
_active: {
|
89
|
-
backgroundColor: "accent.surface.active",
|
90
|
-
},
|
91
|
-
},
|
92
|
-
},
|
93
|
-
floating: {
|
94
|
-
backgroundColor: "floating.surface",
|
95
|
-
outline: "1px solid",
|
96
|
-
outlineColor: "floating.outline",
|
97
|
-
color: "floating.text",
|
98
|
-
|
99
|
-
boxShadow: "sm",
|
100
|
-
_hover: {
|
101
|
-
backgroundColor: "floating.surface.hover",
|
102
|
-
outline: "1px solid",
|
103
|
-
outlineColor: "floating.outline.hover",
|
104
|
-
|
105
|
-
_active: {
|
106
|
-
backgroundColor: "floating.surface.active",
|
107
|
-
outline: "1px solid",
|
108
|
-
outlineColor: "floating.outline",
|
109
|
-
},
|
110
|
-
},
|
111
|
-
},
|
112
|
-
},
|
113
|
-
size: {
|
114
|
-
xs: {
|
115
|
-
_checked: {
|
116
|
-
borderRadius: "0.563rem",
|
117
|
-
},
|
118
|
-
height: 5,
|
119
|
-
paddingX: 1.5,
|
120
|
-
},
|
121
|
-
sm: {
|
122
|
-
_checked: {
|
123
|
-
borderRadius: "sm",
|
124
|
-
},
|
125
|
-
height: 6,
|
126
|
-
paddingX: 2,
|
127
|
-
},
|
128
|
-
md: {
|
129
|
-
_checked: {
|
130
|
-
borderRadius: "sm",
|
131
|
-
},
|
132
|
-
height: 7,
|
133
|
-
paddingX: 2,
|
134
|
-
},
|
135
|
-
lg: {
|
136
|
-
_checked: {
|
137
|
-
borderRadius: "md",
|
138
|
-
},
|
139
|
-
height: 8,
|
140
|
-
paddingX: 3,
|
141
|
-
},
|
142
|
-
},
|
143
|
-
},
|
144
|
-
});
|