@recursica/mantine-adapter 0.22.0 → 0.23.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/CHANGELOG.md +11 -0
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.css +1 -1
- package/dist/mantine-adapter.js +1682 -1410
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts +8 -2
- package/dist/src/components/Slider/Slider.d.ts +24 -2
- package/dist/test.html +1 -0
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/DatePicker/DATEPICKER_IMPLEMENTATION_NOTES.md +16 -0
- package/src/components/DatePicker/DatePicker.module.css +282 -41
- package/src/components/DatePicker/DatePicker.stories.tsx +127 -4
- package/src/components/DatePicker/DatePicker.tsx +166 -5
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -0
- package/src/components/Loader/LOADER_IMPLEMENTATION_NOTES.md +1 -2
- package/src/components/Loader/Loader.module.css +3 -9
- package/src/components/Slider/IMPLEMENTATION_NOTES.md +49 -0
- package/src/components/Slider/Slider.module.css +495 -86
- package/src/components/Slider/Slider.stories.tsx +159 -4
- package/src/components/Slider/Slider.tsx +283 -4
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { DatePickerInputProps } from '@mantine/dates';
|
|
3
|
+
import { ReadOnlyControlProps } from '@recursica/adapter-common';
|
|
4
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
5
|
+
import { RecursicaFormControlWrapperProps } from '../FormControlWrapper/FormControlWrapper';
|
|
6
|
+
export interface RecursicaDatePickerProps extends Omit<DatePickerInputProps, "size" | "variant" | "radius" | "wrapperProps" | "label" | "error" | "required" | "withAsterisk" | "id" | "description">, Pick<DatePickerInputProps, "label" | "error" | "required" | "withAsterisk" | "id">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, ReadOnlyControlProps {
|
|
7
|
+
}
|
|
8
|
+
export type DatePickerProps = RecursicaOverStyled<RecursicaDatePickerProps>;
|
|
9
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { SliderProps as MantineSliderProps, InputWrapperProps } from '@mantine/core';
|
|
3
|
+
import { ReadOnlyControlProps } from '@recursica/adapter-common';
|
|
4
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
5
|
+
import { RecursicaFormControlWrapperProps } from '../FormControlWrapper/FormControlWrapper';
|
|
6
|
+
export interface RecursicaSliderProps extends Omit<MantineSliderProps, "size" | "variant" | "radius" | "wrapperProps" | "classNames" | "styles" | "label">, Omit<RecursicaFormControlWrapperProps, "controlMaxWidth" | "controlMinWidth">, Pick<InputWrapperProps, "error" | "required" | "withAsterisk">, ReadOnlyControlProps {
|
|
7
|
+
/** The form control label displayed above or beside the slider track. */
|
|
8
|
+
label?: React.ReactNode;
|
|
9
|
+
/** Floating tooltip shown above the thumb when dragging. Replaces Mantine's `label`. */
|
|
10
|
+
tooltipLabel?: MantineSliderProps["label"];
|
|
11
|
+
/** An optional icon rendered to the left of the slider track. */
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
/** Whether to render a numeric input field side-by-side or stacked with the track. Defaults to false. */
|
|
14
|
+
showInput?: boolean;
|
|
15
|
+
/** Whether to render min and max labels below the track. Defaults to true. */
|
|
16
|
+
showMinMaxLabels?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type SliderProps = RecursicaOverStyled<RecursicaSliderProps>;
|
|
19
|
+
/**
|
|
20
|
+
* Recursica Slider component wrapping Mantine's Slider.
|
|
21
|
+
*
|
|
22
|
+
* Implements a bidirectional text input field next to the slider track, responsive layouts,
|
|
23
|
+
* custom typography-bound min/max labels, an optional leading icon, and an explicit read-only layout.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/test.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h1>Hello Public</h1>
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://github.com/borderux/recursica.git",
|
|
14
14
|
"directory": "packages/mantine-adapter"
|
|
15
15
|
},
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.23.0",
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "./dist/mantine-adapter.cjs",
|
|
19
19
|
"module": "./dist/mantine-adapter.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"build": "vite build --mode library",
|
|
48
48
|
"build-storybook": "storybook build -o storybook-static",
|
|
49
49
|
"lint": "eslint .",
|
|
50
|
-
"storybook": "storybook dev -p
|
|
50
|
+
"storybook": "storybook dev -p 6011",
|
|
51
51
|
"analyze-tokens": "analyze-tokens --css recursica_variables_scoped.css --dir src/components --output token-analysis.json",
|
|
52
52
|
"prebuild": "npm run analyze-tokens"
|
|
53
53
|
},
|
|
@@ -117,7 +117,7 @@ const _Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
|
117
117
|
: styles.root;
|
|
118
118
|
|
|
119
119
|
const userLoaderProps = restRecord.loaderProps as
|
|
120
|
-
| Record<string,
|
|
120
|
+
| Record<string, unknown>
|
|
121
121
|
| undefined;
|
|
122
122
|
|
|
123
123
|
const resolvedLoaderSize =
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# DatePicker Implementation Notes
|
|
2
|
+
|
|
3
|
+
## Architecture Overview
|
|
4
|
+
|
|
5
|
+
The `DatePicker` component is a wrapper around the `@mantine/dates` `DatePickerInput` component, implementing the `FormControlWrapper` macro structure for Recursica. This ensures that the component visually and structurally aligns with standard Recursica input primitives.
|
|
6
|
+
|
|
7
|
+
## Structural Constraints
|
|
8
|
+
|
|
9
|
+
1. **Naked Input Usage**: We intentionally pass `label={undefined}`, `description={undefined}`, and `error={undefined}` to the Mantine `DatePickerInput` component. This suppresses Mantine's internal macro form wrapping and ensures that only our `WithReadOnlyWrapper` > `FormControlWrapper` orchestrates labels, description text, and ARIA state error boundaries.
|
|
10
|
+
2. **Read-Only Implementation**: Since the value type for `DatePickerInput` can be a date object, string, or array, the `WithReadOnlyWrapper` attempts to safely cast the output value using standard `String(value)`. For production apps utilizing heavy date formatting logic, developers can pass a custom `readOnlyComponent` explicitly to bypass this default cast.
|
|
11
|
+
3. **Calendar Portal/Dropdown (Figma Token Issue)**: The Recursica UI Kit's `date-picker` component in Figma fails to export any explicit structural or color properties for the calendar popover itself (e.g. elevation, surface background, selected day colors). To solve this organically within the framework without breaking strict token adherence, we manually override the Mantine `.dropdown` and `.day[data-selected]` classes using `--recursica_ui-kit_components_hover-card-popover` tokens for elevation/padding/surfaces, and `--recursica_ui-kit_components_button_variants_styles_solid` tokens for the selected primary blue day. This guarantees strict visual adherence to the system until explicitly mapped tokens are provided in the UI Kit.
|
|
12
|
+
|
|
13
|
+
## Styling Quirks
|
|
14
|
+
|
|
15
|
+
- The `DatePickerInput` mimics Mantine's `Input` structure natively (`.input`, `.wrapper`, `.section`). We attach our `styles.input` and `styles.root` classes exactly like `TextField`.
|
|
16
|
+
- The global layout margin override (`.layoutOverride`) utilizes `--form-control-margin-bottom` driven by specific stacked/side-by-side design tokens.
|
|
@@ -1,45 +1,286 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* - It renders a placeholder and has no active implementation or CSS stylesheet yet.
|
|
5
|
-
* - The following tokens generated by Figma are ignored until the component is fully built.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_border-radius */
|
|
9
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_horizontal-padding */
|
|
10
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_icon-size */
|
|
11
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_icon-text-gap */
|
|
12
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_min-height */
|
|
13
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_placeholder-opacity */
|
|
14
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_font-family */
|
|
15
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_font-size */
|
|
16
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_font-style */
|
|
17
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_font-weight */
|
|
18
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_letter-spacing */
|
|
19
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_line-height */
|
|
20
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_text-decoration */
|
|
21
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_text_text-transform */
|
|
22
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_vertical-padding */
|
|
23
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_properties_width */
|
|
24
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_layouts_side-by-side_properties_top-bottom-margin */
|
|
25
|
-
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_layouts_stacked_properties_top-bottom-margin */
|
|
1
|
+
/* EXEMPTIONS:
|
|
2
|
+
- state-specific border-size variables are ignored because a uniform 1px border is applied globally to prevent
|
|
3
|
+
unexpected layout shift or flickering during focus, disabled, or error state transitions. */
|
|
26
4
|
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_states_default_properties_border-size */
|
|
27
5
|
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_states_disabled_properties_border-size */
|
|
28
6
|
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_states_error_properties_border-size */
|
|
29
7
|
/* recursica-ignore: --recursica_ui-kit_components_date-picker_variants_states_focus_properties_border-size */
|
|
30
|
-
|
|
31
|
-
/*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/*
|
|
8
|
+
|
|
9
|
+
/* LAYOUT SPACING OVERRIDES:
|
|
10
|
+
- Sets the --form-control-margin-bottom spacing hook to map component-specific layout tokens. */
|
|
11
|
+
.layoutOverride {
|
|
12
|
+
--form-control-margin-bottom: var(
|
|
13
|
+
--recursica_ui-kit_components_date-picker_variants_layouts_stacked_properties_top-bottom-margin
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.layoutOverride[data-form-layout="side-by-side"] {
|
|
18
|
+
--form-control-margin-bottom: var(
|
|
19
|
+
--recursica_ui-kit_components_date-picker_variants_layouts_side-by-side_properties_top-bottom-margin
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* HARDCODED VALUES:
|
|
24
|
+
- border-width: 1px. Native geometric boundary for the input box.
|
|
25
|
+
- border-style: solid. Native structural rendering rule.
|
|
26
|
+
- outline: none. Bypassing browser focus rings to rely strictly on Recursica focus states natively.
|
|
27
|
+
- flex/layout: display: flex on the root wrapper safely encapsulating internal section rendering.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
.root {
|
|
31
|
+
display: flex;
|
|
32
|
+
position: relative;
|
|
33
|
+
width: var(--recursica_ui-kit_components_date-picker_properties_width, 100%);
|
|
34
|
+
min-height: var(
|
|
35
|
+
--recursica_ui-kit_components_date-picker_properties_min-height
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/* Override Mantine native Input variables governing section spacing padding mathematics safely */
|
|
39
|
+
--input-left-section-size: calc(
|
|
40
|
+
var(
|
|
41
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
42
|
+
) +
|
|
43
|
+
var(--recursica_ui-kit_components_date-picker_properties_icon-size) +
|
|
44
|
+
var(--recursica_ui-kit_components_date-picker_properties_icon-text-gap)
|
|
45
|
+
);
|
|
46
|
+
--input-right-section-size: calc(
|
|
47
|
+
var(
|
|
48
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
49
|
+
) +
|
|
50
|
+
var(--recursica_ui-kit_components_date-picker_properties_icon-size) +
|
|
51
|
+
var(--recursica_ui-kit_components_date-picker_properties_icon-text-gap)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.input {
|
|
56
|
+
/* Structural Overrides */
|
|
57
|
+
width: 100%;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
margin: 0;
|
|
60
|
+
|
|
61
|
+
/* Box Geometry */
|
|
62
|
+
min-height: var(
|
|
63
|
+
--recursica_ui-kit_components_date-picker_properties_min-height
|
|
64
|
+
);
|
|
65
|
+
padding-top: var(
|
|
66
|
+
--recursica_ui-kit_components_date-picker_properties_vertical-padding
|
|
67
|
+
);
|
|
68
|
+
padding-bottom: var(
|
|
69
|
+
--recursica_ui-kit_components_date-picker_properties_vertical-padding
|
|
70
|
+
);
|
|
71
|
+
padding-left: var(
|
|
72
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
73
|
+
);
|
|
74
|
+
padding-right: var(
|
|
75
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
76
|
+
);
|
|
77
|
+
border-radius: var(
|
|
78
|
+
--recursica_ui-kit_components_date-picker_properties_border-radius
|
|
79
|
+
);
|
|
80
|
+
border-width: 1px;
|
|
81
|
+
border-style: solid;
|
|
82
|
+
|
|
83
|
+
/* Strict Typography Unification */
|
|
84
|
+
font-family: var(
|
|
85
|
+
--recursica_ui-kit_components_date-picker_properties_text_font-family
|
|
86
|
+
);
|
|
87
|
+
font-size: var(
|
|
88
|
+
--recursica_ui-kit_components_date-picker_properties_text_font-size
|
|
89
|
+
);
|
|
90
|
+
font-style: var(
|
|
91
|
+
--recursica_ui-kit_components_date-picker_properties_text_font-style
|
|
92
|
+
);
|
|
93
|
+
font-weight: var(
|
|
94
|
+
--recursica_ui-kit_components_date-picker_properties_text_font-weight
|
|
95
|
+
);
|
|
96
|
+
letter-spacing: var(
|
|
97
|
+
--recursica_ui-kit_components_date-picker_properties_text_letter-spacing
|
|
98
|
+
);
|
|
99
|
+
line-height: var(
|
|
100
|
+
--recursica_ui-kit_components_date-picker_properties_text_line-height
|
|
101
|
+
);
|
|
102
|
+
text-decoration: var(
|
|
103
|
+
--recursica_ui-kit_components_date-picker_properties_text_text-decoration
|
|
104
|
+
);
|
|
105
|
+
text-transform: var(
|
|
106
|
+
--recursica_ui-kit_components_date-picker_properties_text_text-transform
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
/* Base State Default Execution */
|
|
110
|
+
background-color: var(
|
|
111
|
+
--recursica_ui-kit_components_date-picker_variants_states_default_properties_colors_background
|
|
112
|
+
);
|
|
113
|
+
border-color: var(
|
|
114
|
+
--recursica_ui-kit_components_date-picker_variants_states_default_properties_colors_border-color
|
|
115
|
+
);
|
|
116
|
+
color: var(
|
|
117
|
+
--recursica_ui-kit_components_date-picker_variants_states_default_properties_colors_text
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
outline: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.input::placeholder {
|
|
124
|
+
opacity: var(
|
|
125
|
+
--recursica_ui-kit_components_date-picker_properties_placeholder-opacity
|
|
126
|
+
);
|
|
127
|
+
color: inherit;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* Dynamic Padding Overrides */
|
|
131
|
+
.root[data-with-left-section] .input {
|
|
132
|
+
padding-left: var(--input-left-section-size);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.root[data-with-right-section] .input {
|
|
136
|
+
padding-right: var(--input-right-section-size);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Flexible End-Caps (Icons, actions) */
|
|
140
|
+
.section {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
height: 100%;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.section[data-position="left"] {
|
|
147
|
+
justify-content: flex-start;
|
|
148
|
+
padding-left: var(
|
|
149
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.section[data-position="right"] {
|
|
154
|
+
justify-content: flex-end;
|
|
155
|
+
padding-right: var(
|
|
156
|
+
--recursica_ui-kit_components_date-picker_properties_horizontal-padding
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.section :global(svg) {
|
|
161
|
+
width: var(--recursica_ui-kit_components_date-picker_properties_icon-size);
|
|
162
|
+
height: var(--recursica_ui-kit_components_date-picker_properties_icon-size);
|
|
163
|
+
color: var(
|
|
164
|
+
--recursica_ui-kit_components_date-picker_variants_states_default_properties_colors_leading-icon
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* -------------------------------------
|
|
169
|
+
STATE CASCADE ARCHITECTURE
|
|
170
|
+
-------------------------------------- */
|
|
171
|
+
|
|
172
|
+
/* Focus State Mapping (Triggered internally via browser pseudo-pseudo-class) */
|
|
173
|
+
.input:focus-within,
|
|
174
|
+
.input:focus {
|
|
175
|
+
border-color: var(
|
|
176
|
+
--recursica_ui-kit_components_date-picker_variants_states_focus_properties_colors_border-color
|
|
177
|
+
);
|
|
178
|
+
background-color: var(
|
|
179
|
+
--recursica_ui-kit_components_date-picker_variants_states_focus_properties_colors_background
|
|
180
|
+
);
|
|
181
|
+
color: var(
|
|
182
|
+
--recursica_ui-kit_components_date-picker_variants_states_focus_properties_colors_text
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.root:focus-within .section[data-position="left"] :global(svg) {
|
|
187
|
+
color: var(
|
|
188
|
+
--recursica_ui-kit_components_date-picker_variants_states_focus_properties_colors_leading-icon
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Error State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
193
|
+
.root[data-error] .input {
|
|
194
|
+
border-color: var(
|
|
195
|
+
--recursica_ui-kit_components_date-picker_variants_states_error_properties_colors_border-color
|
|
196
|
+
) !important;
|
|
197
|
+
background-color: var(
|
|
198
|
+
--recursica_ui-kit_components_date-picker_variants_states_error_properties_colors_background
|
|
199
|
+
) !important;
|
|
200
|
+
color: var(
|
|
201
|
+
--recursica_ui-kit_components_date-picker_variants_states_error_properties_colors_text
|
|
202
|
+
) !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.root[data-error] .section[data-position="left"] :global(svg) {
|
|
206
|
+
color: var(
|
|
207
|
+
--recursica_ui-kit_components_date-picker_variants_states_error_properties_colors_leading-icon
|
|
208
|
+
) !important;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Disabled State Mapping (Propagated strictly down from the wrapper DOM context) */
|
|
212
|
+
.root[data-disabled] .input {
|
|
213
|
+
border-color: var(
|
|
214
|
+
--recursica_ui-kit_components_date-picker_variants_states_disabled_properties_colors_border-color
|
|
215
|
+
) !important;
|
|
216
|
+
background-color: var(
|
|
217
|
+
--recursica_ui-kit_components_date-picker_variants_states_disabled_properties_colors_background
|
|
218
|
+
) !important;
|
|
219
|
+
color: var(
|
|
220
|
+
--recursica_ui-kit_components_date-picker_variants_states_disabled_properties_colors_text
|
|
221
|
+
) !important;
|
|
222
|
+
cursor: not-allowed;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.root[data-disabled] .section[data-position="left"] :global(svg) {
|
|
226
|
+
color: var(
|
|
227
|
+
--recursica_ui-kit_components_date-picker_variants_states_disabled_properties_colors_leading-icon
|
|
228
|
+
) !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* =========================================
|
|
232
|
+
CALENDAR POPOVER OVERRIDES
|
|
233
|
+
Maps generic popover & solid button tokens
|
|
234
|
+
to enforce Recursica's global styling.
|
|
235
|
+
========================================= */
|
|
236
|
+
|
|
237
|
+
.dropdown {
|
|
238
|
+
background-color: var(
|
|
239
|
+
--recursica_ui-kit_components_hover-card-popover_properties_colors_background
|
|
240
|
+
);
|
|
241
|
+
border: var(
|
|
242
|
+
--recursica_ui-kit_components_hover-card-popover_properties_border-size
|
|
243
|
+
)
|
|
244
|
+
solid
|
|
245
|
+
var(
|
|
246
|
+
--recursica_ui-kit_components_hover-card-popover_properties_colors_border-color
|
|
247
|
+
);
|
|
248
|
+
border-radius: var(
|
|
249
|
+
--recursica_ui-kit_components_hover-card-popover_properties_border-radius
|
|
250
|
+
);
|
|
251
|
+
box-shadow: var(
|
|
252
|
+
--recursica_ui-kit_components_hover-card-popover_properties_elevation
|
|
253
|
+
);
|
|
254
|
+
padding: var(
|
|
255
|
+
--recursica_ui-kit_components_hover-card-popover_properties_vertical-padding
|
|
256
|
+
)
|
|
257
|
+
var(
|
|
258
|
+
--recursica_ui-kit_components_hover-card-popover_properties_horizontal-padding
|
|
259
|
+
);
|
|
260
|
+
font-family: var(
|
|
261
|
+
--recursica_ui-kit_components_hover-card-popover_properties_content-text_font-family
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.calendarHeader {
|
|
266
|
+
color: var(
|
|
267
|
+
--recursica_ui-kit_components_hover-card-popover_properties_colors_content
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.day {
|
|
272
|
+
color: var(
|
|
273
|
+
--recursica_ui-kit_components_hover-card-popover_properties_colors_content
|
|
274
|
+
);
|
|
275
|
+
border-radius: var(--recursica_brand_dimensions_border-radii_default, 4px);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.day[data-selected],
|
|
279
|
+
.day[data-selected]:hover {
|
|
280
|
+
background-color: var(
|
|
281
|
+
--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_background
|
|
282
|
+
);
|
|
283
|
+
color: var(
|
|
284
|
+
--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_text
|
|
285
|
+
);
|
|
286
|
+
}
|
|
@@ -1,12 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { DatePicker } from "./DatePicker";
|
|
3
|
-
import {
|
|
4
|
+
import { formControlArgTypes } from "../../../.storybook/commonArgTypes";
|
|
4
5
|
|
|
5
6
|
const meta: Meta<typeof DatePicker> = {
|
|
6
|
-
title: "UI-Kit
|
|
7
|
+
title: "UI-Kit/DatePicker",
|
|
7
8
|
component: DatePicker,
|
|
8
9
|
tags: ["autodocs"],
|
|
9
|
-
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: `
|
|
14
|
+
The \`DatePicker\` primitive provides a unified calendar date selection input integrated directly into the \`FormControlWrapper\` architecture.
|
|
15
|
+
|
|
16
|
+
### Architectural Decoupling
|
|
17
|
+
Recursica overrides the internal Mantine \`DatePickerInput\` wrapper defaults, safely injecting the date picker into our rigid structural layout systems. State modifiers (e.g. Focus, Errors, ReadOnly) hook seamlessly back onto our native CSS mapping architecture.
|
|
18
|
+
|
|
19
|
+
### Examples
|
|
20
|
+
Always structure horizontal architectures via the generic \`formLayout\` parameter.
|
|
21
|
+
\`\`\`tsx
|
|
22
|
+
<DatePicker
|
|
23
|
+
label="Start Date"
|
|
24
|
+
assistiveText="Select the deployment kick-off date."
|
|
25
|
+
formLayout="stacked"
|
|
26
|
+
/>
|
|
27
|
+
\`\`\`
|
|
28
|
+
`,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
...formControlArgTypes,
|
|
34
|
+
disabled: {
|
|
35
|
+
control: "boolean",
|
|
36
|
+
description:
|
|
37
|
+
"Maps the formal disabled variable states structurally to the input core.",
|
|
38
|
+
},
|
|
39
|
+
error: {
|
|
40
|
+
control: "text",
|
|
41
|
+
description:
|
|
42
|
+
"Applies the strict error string boundary rendering invalid structures seamlessly.",
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
control: "boolean",
|
|
46
|
+
},
|
|
47
|
+
label: {
|
|
48
|
+
control: "text",
|
|
49
|
+
},
|
|
50
|
+
assistiveText: {
|
|
51
|
+
control: "text",
|
|
52
|
+
},
|
|
53
|
+
readOnly: {
|
|
54
|
+
control: "boolean",
|
|
55
|
+
description:
|
|
56
|
+
"Toggles structural read-only data presentation explicitly blocking standard component bindings.",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
10
59
|
};
|
|
11
60
|
|
|
12
61
|
export default meta;
|
|
@@ -14,5 +63,79 @@ export default meta;
|
|
|
14
63
|
type Story = StoryObj<typeof DatePicker>;
|
|
15
64
|
|
|
16
65
|
export const Default: Story = {
|
|
17
|
-
|
|
66
|
+
args: {
|
|
67
|
+
disabled: false,
|
|
68
|
+
label: "Project Deadline",
|
|
69
|
+
placeholder: "Select a deadline...",
|
|
70
|
+
assistiveText: "Specify the absolute cutoff for code submission.",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const FormsSideBySide: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
label: "Incident Start Date",
|
|
77
|
+
placeholder: "Pick date...",
|
|
78
|
+
assistiveText: "When did the incident originally occur?",
|
|
79
|
+
formLayout: "side-by-side",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const WithLeadingIcon: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
label: "Launch Date",
|
|
86
|
+
placeholder: "Select launch date...",
|
|
87
|
+
leftSection: (
|
|
88
|
+
<svg
|
|
89
|
+
width="24"
|
|
90
|
+
height="24"
|
|
91
|
+
viewBox="0 0 24 24"
|
|
92
|
+
fill="none"
|
|
93
|
+
stroke="currentColor"
|
|
94
|
+
strokeWidth="2"
|
|
95
|
+
strokeLinecap="round"
|
|
96
|
+
strokeLinejoin="round"
|
|
97
|
+
>
|
|
98
|
+
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
|
|
99
|
+
<line x1="16" y1="2" x2="16" y2="6"></line>
|
|
100
|
+
<line x1="8" y1="2" x2="8" y2="6"></line>
|
|
101
|
+
<line x1="3" y1="10" x2="21" y2="10"></line>
|
|
102
|
+
</svg>
|
|
103
|
+
),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const Disabled: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
label: "Disabled Date Range",
|
|
110
|
+
placeholder: "Disabled selection...",
|
|
111
|
+
disabled: true,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const ErrorState: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
label: "Execution Date",
|
|
118
|
+
placeholder: "Pick a valid date...",
|
|
119
|
+
error: "The chosen date conflicts with an existing deployment freeze.",
|
|
120
|
+
required: true,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const StaticReadOnly: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
label: "Static ReadOnly Review",
|
|
127
|
+
placeholder: "Ignored...",
|
|
128
|
+
value: new Date("2026-05-21"),
|
|
129
|
+
readOnly: true,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const EditableReadOnly: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
label: "Editable ReadOnly Review",
|
|
136
|
+
placeholder: "Ignored until active...",
|
|
137
|
+
defaultValue: new Date("2026-06-01"),
|
|
138
|
+
readOnly: true,
|
|
139
|
+
labelWithEditIcon: true,
|
|
140
|
+
},
|
|
18
141
|
};
|