@vygruppen/spor-react 12.24.16 → 13.0.1
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 +10 -10
- package/.turbo/turbo-postinstall.log +2 -2
- package/CHANGELOG.md +24 -0
- package/dist/index.cjs +2753 -2646
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +887 -601
- package/dist/index.d.ts +887 -601
- package/dist/index.mjs +2712 -2605
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
- package/src/accordion/Accordion.tsx +34 -29
- package/src/accordion/Expandable.tsx +20 -21
- package/src/alert/Alert.tsx +7 -5
- package/src/alert/AlertIcon.tsx +19 -20
- package/src/alert/ExpandableAlert.tsx +65 -64
- package/src/alert/ServiceAlert.tsx +78 -78
- package/src/breadcrumb/Breadcrumb.tsx +37 -34
- package/src/button/Button.tsx +64 -57
- package/src/button/ButtonGroup.tsx +12 -10
- package/src/button/Clipboard.tsx +21 -18
- package/src/button/CloseButton.tsx +19 -17
- package/src/button/FloatingActionButton.tsx +41 -47
- package/src/button/IconButton.tsx +20 -18
- package/src/calendar/CalendarContext.tsx +1 -1
- package/src/color-mode/color-mode.tsx +7 -5
- package/src/datepicker/CalendarTriggerButton.tsx +11 -7
- package/src/datepicker/DateField.tsx +53 -51
- package/src/datepicker/DatePicker.tsx +127 -134
- package/src/datepicker/DateTimeSegment.tsx +44 -40
- package/src/datepicker/StyledField.tsx +39 -36
- package/src/dialog/Dialog.tsx +14 -11
- package/src/dialog/Drawer.tsx +74 -67
- package/src/input/AttachedInputs.tsx +35 -41
- package/src/input/Autocomplete.tsx +118 -129
- package/src/input/CardSelect.tsx +67 -65
- package/src/input/Checkbox.tsx +19 -17
- package/src/input/CheckboxGroup.tsx +0 -2
- package/src/input/ChoiceChip.tsx +42 -38
- package/src/input/Combobox.tsx +4 -4
- package/src/input/CountryCodeSelect.tsx +8 -8
- package/src/input/Field.tsx +78 -75
- package/src/input/FloatingLabel.tsx +6 -8
- package/src/input/Input.tsx +87 -92
- package/src/input/ListBox.tsx +3 -4
- package/src/input/Menu.tsx +149 -142
- package/src/input/NativeSelect.tsx +7 -5
- package/src/input/NumericStepper.tsx +15 -12
- package/src/input/PasswordInput.tsx +65 -61
- package/src/input/PhoneNumberInput.tsx +7 -7
- package/src/input/Popover.tsx +52 -55
- package/src/input/Radio.tsx +16 -11
- package/src/input/SearchInput.tsx +32 -31
- package/src/input/Select.tsx +106 -96
- package/src/input/Switch.tsx +43 -41
- package/src/input/Textarea.tsx +68 -66
- package/src/input/useFLoatingInputState.tsx +1 -1
- package/src/layout/PressableCard.tsx +11 -10
- package/src/layout/RadioCard.tsx +57 -53
- package/src/layout/Separator.tsx +8 -7
- package/src/layout/StaticCard.tsx +11 -10
- package/src/linjetag/LineIcon.tsx +48 -54
- package/src/linjetag/TravelTag.tsx +57 -59
- package/src/link/TextLink.tsx +50 -40
- package/src/loader/ProgressBar.tsx +41 -46
- package/src/loader/ProgressLoader.tsx +83 -86
- package/src/loader/Skeleton.tsx +56 -48
- package/src/logo/CargonetLogo.tsx +88 -87
- package/src/logo/VyLogo.tsx +80 -77
- package/src/logo/VyLogoPride.tsx +137 -135
- package/src/media-controller/JumpButton.tsx +30 -28
- package/src/media-controller/PlayPauseButton.tsx +8 -7
- package/src/media-controller/SkipButton.tsx +28 -26
- package/src/nudge/Nudge.tsx +66 -70
- package/src/pagination/Pagination.tsx +52 -46
- package/src/popover/index.tsx +46 -41
- package/src/progress-indicator/ProgressIndicator.tsx +10 -7
- package/src/stepper/Stepper.tsx +84 -81
- package/src/tab/Tabs.tsx +8 -4
- package/src/table/Table.tsx +89 -109
- package/src/tooltip.tsx +26 -22
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Code.tsx +8 -5
- package/src/typography/Heading.tsx +22 -23
- package/src/typography/Text.tsx +11 -9
- package/tsconfig.json +1 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Box, Field, Flex, useSlotRecipe } from "@chakra-ui/react";
|
|
3
3
|
import { DateValue, GregorianCalendar } from "@internationalized/date";
|
|
4
4
|
import { DOMAttributes, FocusableElement } from "@react-types/shared";
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { PropsWithChildren, RefObject, useRef } from "react";
|
|
6
6
|
import { AriaDateFieldProps, useDateField } from "react-aria";
|
|
7
7
|
import { DateSegment, useDateFieldState } from "react-stately";
|
|
8
8
|
|
|
@@ -30,60 +30,62 @@ type DateFieldProps = AriaDateFieldProps<DateValue> &
|
|
|
30
30
|
labelProps?: DOMAttributes<FocusableElement>;
|
|
31
31
|
name?: string;
|
|
32
32
|
};
|
|
33
|
-
export const DateField =
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
export const DateField = ({
|
|
34
|
+
ref: externalRef,
|
|
35
|
+
...props
|
|
36
|
+
}: DateFieldProps & {
|
|
37
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
38
|
+
}) => {
|
|
39
|
+
const locale = useCurrentLocale();
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
const recipe = useSlotRecipe({
|
|
42
|
+
key: "datePicker",
|
|
43
|
+
});
|
|
44
|
+
const styles = recipe({});
|
|
45
|
+
const state = useDateFieldState({
|
|
46
|
+
...props,
|
|
47
|
+
locale,
|
|
48
|
+
createCalendar,
|
|
49
|
+
});
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
const { t } = useTranslation();
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const internalRef = useRef(null);
|
|
54
|
+
const ref = externalRef ?? internalRef;
|
|
55
|
+
const { fieldProps } = useDateField(
|
|
56
|
+
props,
|
|
57
|
+
state,
|
|
58
|
+
ref as RefObject<HTMLDivElement>,
|
|
59
|
+
);
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
);
|
|
86
|
-
DateField.displayName = "DateField";
|
|
61
|
+
return (
|
|
62
|
+
<Box minWidth="6rem" width="100%">
|
|
63
|
+
{props.label && (
|
|
64
|
+
<Box css={styles.inputLabel} position="absolute" paddingTop="2px">
|
|
65
|
+
<Label padding="0" {...props.labelProps}>
|
|
66
|
+
{props.label} <Field.RequiredIndicator />
|
|
67
|
+
</Label>
|
|
68
|
+
</Box>
|
|
69
|
+
)}
|
|
70
|
+
<Flex {...fieldProps} ref={ref} paddingTop="3" paddingBottom="0.5">
|
|
71
|
+
{state.segments.map((segment, index) => (
|
|
72
|
+
<DateTimeSegment
|
|
73
|
+
key={index}
|
|
74
|
+
segment={segment}
|
|
75
|
+
ariaDescription={t(getAriaLabel(segment.type))}
|
|
76
|
+
state={state}
|
|
77
|
+
/>
|
|
78
|
+
))}
|
|
79
|
+
</Flex>
|
|
80
|
+
<input
|
|
81
|
+
type="hidden"
|
|
82
|
+
value={state.value?.toString() ?? ""}
|
|
83
|
+
name={props.name}
|
|
84
|
+
id={props.id}
|
|
85
|
+
/>
|
|
86
|
+
</Box>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
87
89
|
|
|
88
90
|
const texts = createTexts({
|
|
89
91
|
day: {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
useSlotRecipe,
|
|
13
13
|
} from "@chakra-ui/react";
|
|
14
14
|
import { CalendarOutline24Icon } from "@vygruppen/spor-icon-react";
|
|
15
|
-
import React, {
|
|
15
|
+
import React, { PropsWithChildren, useId, useRef } from "react";
|
|
16
16
|
import {
|
|
17
17
|
AriaDatePickerProps,
|
|
18
18
|
DateValue,
|
|
@@ -62,136 +62,129 @@ type DatePickerProps = Omit<AriaDatePickerProps<DateValue>, "onChange"> &
|
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
-
export const DatePicker =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</ChakraPopover.Root>
|
|
192
|
-
</Box>
|
|
193
|
-
</I18nProvider>
|
|
194
|
-
);
|
|
195
|
-
},
|
|
196
|
-
);
|
|
197
|
-
DatePicker.displayName = "DatePicker";
|
|
65
|
+
export const DatePicker = ({
|
|
66
|
+
ref: externalRef,
|
|
67
|
+
variant,
|
|
68
|
+
errorText,
|
|
69
|
+
minHeight,
|
|
70
|
+
showYearNavigation,
|
|
71
|
+
withPortal = true,
|
|
72
|
+
width = "auto",
|
|
73
|
+
invalid = false,
|
|
74
|
+
helperText,
|
|
75
|
+
positioning,
|
|
76
|
+
css,
|
|
77
|
+
...props
|
|
78
|
+
}: DatePickerProps & {
|
|
79
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
80
|
+
}) => {
|
|
81
|
+
const chakraFieldProps = useFieldContext();
|
|
82
|
+
const state = useDatePickerState({
|
|
83
|
+
...props,
|
|
84
|
+
shouldCloseOnSelect: true,
|
|
85
|
+
onChange: props.onValueChange,
|
|
86
|
+
errorMessage: errorText,
|
|
87
|
+
isRequired: props.isRequired ?? chakraFieldProps?.required,
|
|
88
|
+
validationState: chakraFieldProps?.invalid ? "invalid" : "valid",
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const internalRef = useRef<HTMLDivElement>(null);
|
|
92
|
+
const ref = externalRef ?? internalRef;
|
|
93
|
+
const { labelProps, fieldProps, buttonProps, dialogProps, calendarProps } =
|
|
94
|
+
useDatePicker(props, state, ref as React.MutableRefObject<HTMLDivElement>);
|
|
95
|
+
|
|
96
|
+
const inputGroupId = `input-group-${useId()}`;
|
|
97
|
+
|
|
98
|
+
const recipe = useSlotRecipe({
|
|
99
|
+
key: "datePicker",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const styles = recipe({ variant });
|
|
103
|
+
const locale = useCurrentLocale();
|
|
104
|
+
|
|
105
|
+
const shouldShowCalendar =
|
|
106
|
+
state.isOpen && !props.isDisabled && !props.noCalendar;
|
|
107
|
+
|
|
108
|
+
const onFieldClick = () => {
|
|
109
|
+
if (!props.noCalendar) {
|
|
110
|
+
state.setOpen(true);
|
|
111
|
+
}
|
|
112
|
+
props.onClick?.();
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const popoverContent = (
|
|
116
|
+
<ChakraPopover.Positioner>
|
|
117
|
+
<ChakraPopover.Content css={styles.calendarPopover}>
|
|
118
|
+
<ChakraPopover.Body minWidth="20rem">
|
|
119
|
+
<Calendar
|
|
120
|
+
{...calendarProps}
|
|
121
|
+
variant={variant}
|
|
122
|
+
showYearNavigation={showYearNavigation}
|
|
123
|
+
css={css}
|
|
124
|
+
/>
|
|
125
|
+
</ChakraPopover.Body>
|
|
126
|
+
</ChakraPopover.Content>
|
|
127
|
+
</ChakraPopover.Positioner>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<I18nProvider locale={locale}>
|
|
132
|
+
<Box
|
|
133
|
+
position="relative"
|
|
134
|
+
display="inline-flex"
|
|
135
|
+
flexDirection="column"
|
|
136
|
+
width={width}
|
|
137
|
+
css={css}
|
|
138
|
+
>
|
|
139
|
+
<ChakraPopover.Root {...dialogProps} positioning={positioning}>
|
|
140
|
+
<Field
|
|
141
|
+
display="inline-flex"
|
|
142
|
+
id={inputGroupId}
|
|
143
|
+
errorText={errorText}
|
|
144
|
+
invalid={invalid}
|
|
145
|
+
helperText={helperText}
|
|
146
|
+
required={props.required}
|
|
147
|
+
>
|
|
148
|
+
<PopoverAnchor>
|
|
149
|
+
<StyledField
|
|
150
|
+
variant={variant}
|
|
151
|
+
onClick={onFieldClick}
|
|
152
|
+
paddingX={3}
|
|
153
|
+
minHeight={minHeight}
|
|
154
|
+
isDisabled={props.isDisabled}
|
|
155
|
+
isActive={props.isActive}
|
|
156
|
+
overrideBorderColor={props.overrideBorderColor}
|
|
157
|
+
>
|
|
158
|
+
{props.noCalendar ? (
|
|
159
|
+
<Box pr={3} pl={0.5} mr={0.5}>
|
|
160
|
+
<CalendarOutline24Icon />
|
|
161
|
+
</Box>
|
|
162
|
+
) : (
|
|
163
|
+
<ChakraPopover.Trigger asChild>
|
|
164
|
+
<CalendarTriggerButton
|
|
165
|
+
paddingLeft={1}
|
|
166
|
+
paddingRight={1}
|
|
167
|
+
variant={variant}
|
|
168
|
+
ref={ref}
|
|
169
|
+
{...buttonProps}
|
|
170
|
+
/>
|
|
171
|
+
</ChakraPopover.Trigger>
|
|
172
|
+
)}
|
|
173
|
+
|
|
174
|
+
<DateField
|
|
175
|
+
label={props.label}
|
|
176
|
+
labelProps={labelProps}
|
|
177
|
+
name={props.name}
|
|
178
|
+
{...fieldProps}
|
|
179
|
+
/>
|
|
180
|
+
</StyledField>
|
|
181
|
+
</PopoverAnchor>
|
|
182
|
+
</Field>
|
|
183
|
+
|
|
184
|
+
{shouldShowCalendar &&
|
|
185
|
+
(withPortal ? <Portal>{popoverContent}</Portal> : popoverContent)}
|
|
186
|
+
</ChakraPopover.Root>
|
|
187
|
+
</Box>
|
|
188
|
+
</I18nProvider>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Box, useSlotRecipe } from "@chakra-ui/react";
|
|
3
|
-
import {
|
|
3
|
+
import { PropsWithChildren, RefObject, useRef } from "react";
|
|
4
4
|
import { useDateSegment } from "react-aria";
|
|
5
5
|
import { DateFieldState, DateSegment } from "react-stately";
|
|
6
6
|
|
|
@@ -19,49 +19,53 @@ type DateTimeSegmentProps = PropsWithChildren<DatePickerVariantProps> & {
|
|
|
19
19
|
*
|
|
20
20
|
* This component should be used with the react-aria library, and is not meant to be used directly.
|
|
21
21
|
* */
|
|
22
|
-
export const DateTimeSegment =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export const DateTimeSegment = ({
|
|
23
|
+
ref: externalRef,
|
|
24
|
+
segment,
|
|
25
|
+
state,
|
|
26
|
+
ariaLabel,
|
|
27
|
+
ariaDescription,
|
|
28
|
+
variant,
|
|
29
|
+
}: DateTimeSegmentProps & {
|
|
30
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
31
|
+
}) => {
|
|
32
|
+
const internalRef = useRef(null);
|
|
33
|
+
const ref = externalRef ?? internalRef;
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
const { segmentProps } = useDateSegment(
|
|
36
|
+
segment,
|
|
37
|
+
state,
|
|
38
|
+
ref as RefObject<HTMLDivElement>,
|
|
39
|
+
);
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
const recipe = useSlotRecipe({
|
|
42
|
+
key: "datePicker",
|
|
43
|
+
});
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
const styles = recipe({
|
|
46
|
+
variant,
|
|
47
|
+
});
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
},
|
|
63
|
-
);
|
|
64
|
-
DateTimeSegment.displayName = "DateTimeSegment";
|
|
49
|
+
return (
|
|
50
|
+
<Box
|
|
51
|
+
{...segmentProps}
|
|
52
|
+
ref={ref}
|
|
53
|
+
style={{
|
|
54
|
+
...segmentProps.style,
|
|
55
|
+
boxSizing: "content-box",
|
|
56
|
+
}}
|
|
57
|
+
textAlign="center"
|
|
58
|
+
outline="none"
|
|
59
|
+
borderRadius="xs"
|
|
60
|
+
fontSize={["mobile.sm", "desktop.sm"]}
|
|
61
|
+
css={styles.dateTimeSegment}
|
|
62
|
+
aria-label={ariaDescription}
|
|
63
|
+
aria-labelledby={ariaLabel}
|
|
64
|
+
>
|
|
65
|
+
{isPaddable(segment.type) ? segment.text.padStart(2, "0") : segment.text}
|
|
66
|
+
</Box>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
65
69
|
|
|
66
70
|
const isPaddable = (segmentType: DateSegment["type"]) =>
|
|
67
71
|
segmentType === "month" ||
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useFieldContext,
|
|
6
6
|
useSlotRecipe,
|
|
7
7
|
} from "@chakra-ui/react";
|
|
8
|
-
import {
|
|
8
|
+
import { PropsWithChildren } from "react";
|
|
9
9
|
|
|
10
10
|
import { DatePickerVariantProps } from "./DatePicker";
|
|
11
11
|
import { CalendarVariants } from "./types";
|
|
@@ -17,40 +17,43 @@ type StyledFieldProps = BoxProps &
|
|
|
17
17
|
isActive?: boolean;
|
|
18
18
|
overrideBorderColor?: string;
|
|
19
19
|
};
|
|
20
|
-
export const StyledField =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
export const StyledField = function StyledField({
|
|
21
|
+
ref,
|
|
22
|
+
...props
|
|
23
|
+
}: StyledFieldProps & {
|
|
24
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
25
|
+
}) {
|
|
26
|
+
const {
|
|
27
|
+
children,
|
|
28
|
+
variant,
|
|
29
|
+
isDisabled,
|
|
30
|
+
isActive,
|
|
31
|
+
overrideBorderColor,
|
|
32
|
+
...otherProps
|
|
33
|
+
} = props;
|
|
34
|
+
const { invalid } = useFieldContext() ?? {
|
|
35
|
+
isInvalid: false,
|
|
36
|
+
};
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const recipe = useSlotRecipe({
|
|
39
|
+
key: "datePicker",
|
|
40
|
+
});
|
|
41
|
+
const styles = recipe({ variant });
|
|
38
42
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
);
|
|
43
|
+
return (
|
|
44
|
+
<Box
|
|
45
|
+
{...otherProps}
|
|
46
|
+
css={{
|
|
47
|
+
...styles.wrapper,
|
|
48
|
+
outlineColor: overrideBorderColor || undefined,
|
|
49
|
+
}}
|
|
50
|
+
data-active={isActive ? "" : undefined}
|
|
51
|
+
ref={ref}
|
|
52
|
+
aria-invalid={invalid}
|
|
53
|
+
aria-disabled={isDisabled}
|
|
54
|
+
fontSize={["mobile.md", "desktop.md"]}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</Box>
|
|
58
|
+
);
|
|
59
|
+
};
|
package/src/dialog/Dialog.tsx
CHANGED
|
@@ -11,10 +11,12 @@ interface DialogContentProps extends ChakraDialog.ContentProps {
|
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const DialogContent =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export const DialogContent = ({
|
|
15
|
+
ref,
|
|
16
|
+
...props
|
|
17
|
+
}: DialogContentProps & {
|
|
18
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
19
|
+
}) => {
|
|
18
20
|
const {
|
|
19
21
|
children,
|
|
20
22
|
portalled = true,
|
|
@@ -33,19 +35,20 @@ export const DialogContent = React.forwardRef<
|
|
|
33
35
|
</ChakraDialog.Positioner>
|
|
34
36
|
</Portal>
|
|
35
37
|
);
|
|
36
|
-
}
|
|
37
|
-
DialogContent.displayName = "DialogContent";
|
|
38
|
+
};
|
|
38
39
|
|
|
39
|
-
export const DialogCloseTrigger =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
export const DialogCloseTrigger = function DialogCloseTrigger({
|
|
41
|
+
ref,
|
|
42
|
+
...props
|
|
43
|
+
}: ChakraDialog.CloseTriggerProps & {
|
|
44
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
45
|
+
}) {
|
|
43
46
|
return (
|
|
44
47
|
<ChakraDialog.CloseTrigger ref={ref} position="absolute" {...props} asChild>
|
|
45
48
|
<CloseButton size="md" />
|
|
46
49
|
</ChakraDialog.CloseTrigger>
|
|
47
50
|
);
|
|
48
|
-
}
|
|
51
|
+
};
|
|
49
52
|
|
|
50
53
|
export const DialogRoot = ChakraDialog.Root;
|
|
51
54
|
export const DialogFooter = ChakraDialog.Footer;
|