@knitui/dates 0.14.0 → 1.0.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/lib/commonjs/Calendar/Calendar.js +4 -4
- package/lib/commonjs/Calendar/Calendar.js.map +1 -1
- package/lib/commonjs/CalendarHeader/CalendarHeader.js +24 -152
- package/lib/commonjs/CalendarHeader/CalendarHeader.js.map +1 -1
- package/lib/commonjs/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/commonjs/DateTimePicker/DateTimePicker.js +1 -1
- package/lib/commonjs/DatesProvider/DatesProvider.js +1 -1
- package/lib/commonjs/Day/Day.js +74 -142
- package/lib/commonjs/Day/Day.js.map +1 -1
- package/lib/commonjs/DecadeLevel/DecadeLevel.js +5 -5
- package/lib/commonjs/DecadeLevel/DecadeLevel.js.map +1 -1
- package/lib/commonjs/InlineDateTimePicker/InlineDateTimePicker.js +16 -7
- package/lib/commonjs/InlineDateTimePicker/InlineDateTimePicker.js.map +1 -1
- package/lib/commonjs/LevelsGroup/LevelsGroup.js +3 -3
- package/lib/commonjs/LevelsGroup/LevelsGroup.js.map +1 -1
- package/lib/commonjs/MiniCalendar/MiniCalendar.js +37 -173
- package/lib/commonjs/MiniCalendar/MiniCalendar.js.map +1 -1
- package/lib/commonjs/Month/Month.js +15 -62
- package/lib/commonjs/Month/Month.js.map +1 -1
- package/lib/commonjs/MonthLevel/MonthLevel.js +5 -5
- package/lib/commonjs/MonthLevel/MonthLevel.js.map +1 -1
- package/lib/commonjs/MonthPicker/MonthPicker.js +1 -1
- package/lib/commonjs/MonthPickerInput/MonthPickerInput.js +1 -1
- package/lib/commonjs/MonthsList/MonthsList.js +8 -9
- package/lib/commonjs/MonthsList/MonthsList.js.map +1 -1
- package/lib/commonjs/PickerControl/PickerControl.js +41 -121
- package/lib/commonjs/PickerControl/PickerControl.js.map +1 -1
- package/lib/commonjs/PickerInputBase/PickerInputBase.js +1 -1
- package/lib/commonjs/TimeControlsList/TimeControl.js +19 -48
- package/lib/commonjs/TimeControlsList/TimeControl.js.map +1 -1
- package/lib/commonjs/TimeControlsList/TimeControlsList.js +1 -1
- package/lib/commonjs/TimeControlsList/TimeControlsList.js.map +1 -1
- package/lib/commonjs/TimeGrid/TimeGrid.js +50 -97
- package/lib/commonjs/TimeGrid/TimeGrid.js.map +1 -1
- package/lib/commonjs/TimeInput/TimeInput.js +1 -1
- package/lib/commonjs/TimePicker/TimePicker.js +20 -20
- package/lib/commonjs/TimePicker/TimePicker.js.map +1 -1
- package/lib/commonjs/TimePresets/TimePresetControl.js +32 -62
- package/lib/commonjs/TimePresets/TimePresetControl.js.map +1 -1
- package/lib/commonjs/TimePresets/TimePresetGroup.js +5 -5
- package/lib/commonjs/TimePresets/TimePresetGroup.js.map +1 -1
- package/lib/commonjs/TimePresets/TimePresets.js +4 -4
- package/lib/commonjs/TimePresets/TimePresets.js.map +1 -1
- package/lib/commonjs/TimeValue/TimeValue.js +2 -2
- package/lib/commonjs/WeekdaysRow/WeekdaysRow.js +7 -38
- package/lib/commonjs/WeekdaysRow/WeekdaysRow.js.map +1 -1
- package/lib/commonjs/YearLevel/YearLevel.js +5 -5
- package/lib/commonjs/YearLevel/YearLevel.js.map +1 -1
- package/lib/commonjs/YearPicker/YearPicker.js +1 -1
- package/lib/commonjs/YearPickerInput/YearPickerInput.js +1 -1
- package/lib/commonjs/YearsList/YearsList.js +8 -9
- package/lib/commonjs/YearsList/YearsList.js.map +1 -1
- package/lib/commonjs/_reference/ExampleControl.js +26 -91
- package/lib/commonjs/_reference/ExampleControl.js.map +1 -1
- package/lib/commonjs/_reference/README.md +3 -3
- package/lib/commonjs/cell-metrics.js +167 -37
- package/lib/commonjs/cell-metrics.js.map +1 -1
- package/lib/commonjs/internal/a11y.js +5 -3
- package/lib/commonjs/internal/a11y.js.map +1 -1
- package/lib/commonjs/internal/get-input-default-date.js +1 -1
- package/lib/commonjs/internal/select-on-focus.js +1 -1
- package/lib/module/Calendar/Calendar.js +5 -5
- package/lib/module/Calendar/Calendar.js.map +1 -1
- package/lib/module/CalendarHeader/CalendarHeader.js +26 -155
- package/lib/module/CalendarHeader/CalendarHeader.js.map +1 -1
- package/lib/module/DatePicker/DatePicker.js +1 -1
- package/lib/module/DatePickerInput/DatePickerInput.js +1 -1
- package/lib/module/DateTimePicker/DateTimePicker.js +1 -1
- package/lib/module/DatesProvider/DatesProvider.js +1 -1
- package/lib/module/Day/Day.js +76 -144
- package/lib/module/Day/Day.js.map +1 -1
- package/lib/module/DecadeLevel/DecadeLevel.js +6 -6
- package/lib/module/DecadeLevel/DecadeLevel.js.map +1 -1
- package/lib/module/InlineDateTimePicker/InlineDateTimePicker.js +16 -7
- package/lib/module/InlineDateTimePicker/InlineDateTimePicker.js.map +1 -1
- package/lib/module/LevelsGroup/LevelsGroup.js +4 -4
- package/lib/module/LevelsGroup/LevelsGroup.js.map +1 -1
- package/lib/module/MiniCalendar/MiniCalendar.js +39 -175
- package/lib/module/MiniCalendar/MiniCalendar.js.map +1 -1
- package/lib/module/Month/Month.js +17 -64
- package/lib/module/Month/Month.js.map +1 -1
- package/lib/module/MonthLevel/MonthLevel.js +6 -6
- package/lib/module/MonthLevel/MonthLevel.js.map +1 -1
- package/lib/module/MonthPicker/MonthPicker.js +1 -1
- package/lib/module/MonthPickerInput/MonthPickerInput.js +1 -1
- package/lib/module/MonthsList/MonthsList.js +9 -10
- package/lib/module/MonthsList/MonthsList.js.map +1 -1
- package/lib/module/PickerControl/PickerControl.js +42 -122
- package/lib/module/PickerControl/PickerControl.js.map +1 -1
- package/lib/module/PickerInputBase/PickerInputBase.js +1 -1
- package/lib/module/TimeControlsList/TimeControl.js +20 -49
- package/lib/module/TimeControlsList/TimeControl.js.map +1 -1
- package/lib/module/TimeControlsList/TimeControlsList.js +1 -1
- package/lib/module/TimeControlsList/TimeControlsList.js.map +1 -1
- package/lib/module/TimeGrid/TimeGrid.js +53 -100
- package/lib/module/TimeGrid/TimeGrid.js.map +1 -1
- package/lib/module/TimeInput/TimeInput.js +1 -1
- package/lib/module/TimePicker/TimePicker.js +20 -20
- package/lib/module/TimePicker/TimePicker.js.map +1 -1
- package/lib/module/TimePresets/TimePresetControl.js +36 -65
- package/lib/module/TimePresets/TimePresetControl.js.map +1 -1
- package/lib/module/TimePresets/TimePresetGroup.js +6 -6
- package/lib/module/TimePresets/TimePresetGroup.js.map +1 -1
- package/lib/module/TimePresets/TimePresets.js +4 -4
- package/lib/module/TimePresets/TimePresets.js.map +1 -1
- package/lib/module/TimeValue/TimeValue.js +2 -2
- package/lib/module/WeekdaysRow/WeekdaysRow.js +8 -39
- package/lib/module/WeekdaysRow/WeekdaysRow.js.map +1 -1
- package/lib/module/YearLevel/YearLevel.js +6 -6
- package/lib/module/YearLevel/YearLevel.js.map +1 -1
- package/lib/module/YearPicker/YearPicker.js +1 -1
- package/lib/module/YearPickerInput/YearPickerInput.js +1 -1
- package/lib/module/YearsList/YearsList.js +9 -10
- package/lib/module/YearsList/YearsList.js.map +1 -1
- package/lib/module/_reference/ExampleControl.js +28 -93
- package/lib/module/_reference/ExampleControl.js.map +1 -1
- package/lib/module/_reference/README.md +3 -3
- package/lib/module/cell-metrics.js +166 -36
- package/lib/module/cell-metrics.js.map +1 -1
- package/lib/module/internal/a11y.js +5 -3
- package/lib/module/internal/a11y.js.map +1 -1
- package/lib/module/internal/get-input-default-date.js +1 -1
- package/lib/module/internal/select-on-focus.js +1 -1
- package/lib/typescript/Calendar/Calendar.d.ts +28 -21
- package/lib/typescript/Calendar/Calendar.d.ts.map +1 -1
- package/lib/typescript/Calendar/pick-calendar-props/pick-calendar-props.d.ts +1 -1
- package/lib/typescript/CalendarHeader/CalendarHeader.d.ts +190 -53
- package/lib/typescript/CalendarHeader/CalendarHeader.d.ts.map +1 -1
- package/lib/typescript/Day/Day.d.ts +103 -84
- package/lib/typescript/Day/Day.d.ts.map +1 -1
- package/lib/typescript/DecadeLevel/DecadeLevel.d.ts +172 -71
- package/lib/typescript/DecadeLevel/DecadeLevel.d.ts.map +1 -1
- package/lib/typescript/DecadeLevelGroup/DecadeLevelGroup.d.ts +171 -86
- package/lib/typescript/DecadeLevelGroup/DecadeLevelGroup.d.ts.map +1 -1
- package/lib/typescript/InlineDateTimePicker/InlineDateTimePicker.d.ts +64 -12
- package/lib/typescript/InlineDateTimePicker/InlineDateTimePicker.d.ts.map +1 -1
- package/lib/typescript/LevelsGroup/LevelsGroup.d.ts +27 -20
- package/lib/typescript/LevelsGroup/LevelsGroup.d.ts.map +1 -1
- package/lib/typescript/MiniCalendar/MiniCalendar.d.ts +247 -61
- package/lib/typescript/MiniCalendar/MiniCalendar.d.ts.map +1 -1
- package/lib/typescript/Month/Month.d.ts +164 -43
- package/lib/typescript/Month/Month.d.ts.map +1 -1
- package/lib/typescript/MonthLevel/MonthLevel.d.ts +208 -79
- package/lib/typescript/MonthLevel/MonthLevel.d.ts.map +1 -1
- package/lib/typescript/MonthLevelGroup/MonthLevelGroup.d.ts +207 -94
- package/lib/typescript/MonthLevelGroup/MonthLevelGroup.d.ts.map +1 -1
- package/lib/typescript/MonthsList/MonthsList.d.ts +91 -26
- package/lib/typescript/MonthsList/MonthsList.d.ts.map +1 -1
- package/lib/typescript/PickerControl/PickerControl.d.ts +79 -59
- package/lib/typescript/PickerControl/PickerControl.d.ts.map +1 -1
- package/lib/typescript/TimeControlsList/TimeControl.d.ts +19 -4
- package/lib/typescript/TimeControlsList/TimeControl.d.ts.map +1 -1
- package/lib/typescript/TimeControlsList/TimeControlsList.d.ts +66 -12
- package/lib/typescript/TimeControlsList/TimeControlsList.d.ts.map +1 -1
- package/lib/typescript/TimeGrid/TimeGrid.d.ts +98 -34
- package/lib/typescript/TimeGrid/TimeGrid.d.ts.map +1 -1
- package/lib/typescript/TimePicker/TimePicker.d.ts +43 -7
- package/lib/typescript/TimePicker/TimePicker.d.ts.map +1 -1
- package/lib/typescript/TimePresets/TimePresetControl.d.ts +65 -10
- package/lib/typescript/TimePresets/TimePresetControl.d.ts.map +1 -1
- package/lib/typescript/TimePresets/TimePresetGroup.d.ts +132 -44
- package/lib/typescript/TimePresets/TimePresetGroup.d.ts.map +1 -1
- package/lib/typescript/TimePresets/TimePresets.d.ts +237 -64
- package/lib/typescript/TimePresets/TimePresets.d.ts.map +1 -1
- package/lib/typescript/WeekdaysRow/WeekdaysRow.d.ts +81 -27
- package/lib/typescript/WeekdaysRow/WeekdaysRow.d.ts.map +1 -1
- package/lib/typescript/YearLevel/YearLevel.d.ts +172 -71
- package/lib/typescript/YearLevel/YearLevel.d.ts.map +1 -1
- package/lib/typescript/YearLevelGroup/YearLevelGroup.d.ts +171 -86
- package/lib/typescript/YearLevelGroup/YearLevelGroup.d.ts.map +1 -1
- package/lib/typescript/YearsList/YearsList.d.ts +91 -26
- package/lib/typescript/YearsList/YearsList.d.ts.map +1 -1
- package/lib/typescript/_reference/ExampleControl.d.ts +163 -43
- package/lib/typescript/_reference/ExampleControl.d.ts.map +1 -1
- package/lib/typescript/cell-metrics.d.ts +120 -0
- package/lib/typescript/cell-metrics.d.ts.map +1 -1
- package/lib/typescript/internal/a11y.d.ts +0 -14
- package/lib/typescript/internal/a11y.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Calendar/Calendar.tsx +6 -5
- package/src/CalendarHeader/CalendarHeader.tsx +32 -74
- package/src/DatePicker/DatePicker.tsx +1 -1
- package/src/DatePickerInput/DatePickerInput.tsx +1 -1
- package/src/DateTimePicker/DateTimePicker.tsx +1 -1
- package/src/DatesProvider/DatesProvider.tsx +1 -1
- package/src/Day/Day.tsx +85 -82
- package/src/DecadeLevel/DecadeLevel.tsx +7 -5
- package/src/InlineDateTimePicker/InlineDateTimePicker.tsx +14 -7
- package/src/LevelsGroup/LevelsGroup.tsx +13 -13
- package/src/MiniCalendar/MiniCalendar.tsx +47 -91
- package/src/Month/Month.tsx +21 -37
- package/src/MonthLevel/MonthLevel.tsx +7 -5
- package/src/MonthPicker/MonthPicker.tsx +1 -1
- package/src/MonthPickerInput/MonthPickerInput.tsx +1 -1
- package/src/MonthsList/MonthsList.tsx +9 -10
- package/src/PickerControl/PickerControl.tsx +44 -89
- package/src/PickerInputBase/PickerInputBase.tsx +1 -1
- package/src/TimeControlsList/TimeControl.tsx +17 -28
- package/src/TimeControlsList/TimeControlsList.tsx +1 -1
- package/src/TimeGrid/TimeGrid.tsx +71 -61
- package/src/TimeInput/TimeInput.tsx +1 -1
- package/src/TimePicker/TimePicker.tsx +15 -15
- package/src/TimePresets/TimePresetControl.tsx +30 -45
- package/src/TimePresets/TimePresetGroup.tsx +7 -5
- package/src/TimePresets/TimePresets.tsx +4 -4
- package/src/TimeValue/TimeValue.tsx +2 -2
- package/src/WeekdaysRow/WeekdaysRow.tsx +9 -17
- package/src/YearLevel/YearLevel.tsx +121 -117
- package/src/YearPicker/YearPicker.tsx +1 -1
- package/src/YearPickerInput/YearPickerInput.tsx +1 -1
- package/src/YearsList/YearsList.tsx +142 -141
- package/src/_reference/ExampleControl.tsx +29 -53
- package/src/_reference/README.md +3 -3
- package/src/cell-metrics.ts +110 -36
- package/src/internal/a11y.ts +6 -3
- package/src/internal/get-input-default-date.ts +1 -1
- package/src/internal/select-on-focus.ts +1 -1
- package/lib/commonjs/internal/web-cursor.js +0 -24
- package/lib/commonjs/internal/web-cursor.js.map +0 -1
- package/lib/module/internal/web-cursor.js +0 -20
- package/lib/module/internal/web-cursor.js.map +0 -1
- package/lib/typescript/internal/web-cursor.d.ts +0 -10
- package/lib/typescript/internal/web-cursor.d.ts.map +0 -1
- package/src/internal/web-cursor.ts +0 -15
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// 1. File header documenting provenance + cross-platform stance.
|
|
14
14
|
// 2. `createStyledContext` to share `size` across every styled part.
|
|
15
15
|
// 3. Sizing DERIVED from the shared `cell-metrics` ladders (no magic numbers).
|
|
16
|
-
// 4. Theme-ramp colors only (
|
|
16
|
+
// 4. Theme-ramp colors only (colorN) — `theme="red"` recolors, zero per-comp logic.
|
|
17
17
|
// 5. A styled Frame + leaf parts, each carrying the context.
|
|
18
18
|
// 6. Marker-slot composition (`createSlot`/`defineSlots` from `@knitui/core`).
|
|
19
19
|
// 7. Per-slot `styles={{…}}` sugar (`SlotStyles` + `slotStyles().merge`) PLUS the
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
// 9. Locale + date formatting via `useDatesContext` + dayjs.
|
|
23
23
|
// 10. min/max bounds via the shared date utils.
|
|
24
24
|
// 11. Native + web a11y set side-by-side (`controlA11yProps` + `aria-*`).
|
|
25
|
-
// 12. `
|
|
26
|
-
// 13.
|
|
25
|
+
// 12. `web:` cursor clauses, real `hover:`/`press:` clauses, a `disabled` variant.
|
|
26
|
+
// 13. `styleable()` wrapper forwarding a ref + style props (the dates norm).
|
|
27
27
|
// 14. `withStaticProperties` exposing parts + slot markers.
|
|
28
28
|
// 15. A documented "compiler-safe styling" pitfall (the `_o-0` trap).
|
|
29
29
|
//
|
|
@@ -42,15 +42,15 @@ import {
|
|
|
42
42
|
type GetProps,
|
|
43
43
|
slotStyles,
|
|
44
44
|
type SlotStyles,
|
|
45
|
+
styleable,
|
|
45
46
|
styled,
|
|
46
47
|
withStaticProperties,
|
|
47
48
|
} from "@knitui/core";
|
|
48
49
|
import { useUncontrolled } from "@knitui/hooks";
|
|
49
50
|
|
|
50
|
-
import { type CalendarSize,
|
|
51
|
+
import { type CalendarSize, cellFontVariant, cellMinWidthVariant } from "../cell-metrics";
|
|
51
52
|
import { useDatesContext } from "../DatesProvider";
|
|
52
53
|
import { controlA11yProps } from "../internal/a11y";
|
|
53
|
-
import { webCursor } from "../internal/web-cursor";
|
|
54
54
|
import type { DateStringValue } from "../types";
|
|
55
55
|
import { isAfterMinDate, isBeforeMaxDate, toDateString } from "../utils";
|
|
56
56
|
|
|
@@ -67,77 +67,53 @@ const ExampleControlContext = createStyledContext<{ size: CalendarSize }>({ size
|
|
|
67
67
|
// Each variant maps the `xxs…xxl` keys onto a metric so retuning the ladder moves
|
|
68
68
|
// every component together. Express these with raw values from the ladder (they
|
|
69
69
|
// resolve at module-load) — NOT `getTokenValue`, which needs the live config.
|
|
70
|
-
const optionMinWidthVariant = {
|
|
71
|
-
xxs: { minWidth: CELL_WIDTH.xxs },
|
|
72
|
-
xs: { minWidth: CELL_WIDTH.xs },
|
|
73
|
-
sm: { minWidth: CELL_WIDTH.sm },
|
|
74
|
-
md: { minWidth: CELL_WIDTH.md },
|
|
75
|
-
lg: { minWidth: CELL_WIDTH.lg },
|
|
76
|
-
xl: { minWidth: CELL_WIDTH.xl },
|
|
77
|
-
xxl: { minWidth: CELL_WIDTH.xxl },
|
|
78
|
-
} as const;
|
|
79
|
-
|
|
80
|
-
const optionFontVariant = {
|
|
81
|
-
xxs: { fontSize: CELL_FONT.xxs },
|
|
82
|
-
xs: { fontSize: CELL_FONT.xs },
|
|
83
|
-
sm: { fontSize: CELL_FONT.sm },
|
|
84
|
-
md: { fontSize: CELL_FONT.md },
|
|
85
|
-
lg: { fontSize: CELL_FONT.lg },
|
|
86
|
-
xl: { fontSize: CELL_FONT.xl },
|
|
87
|
-
xxl: { fontSize: CELL_FONT.xxl },
|
|
88
|
-
} as const;
|
|
89
|
-
|
|
90
70
|
// ── 5. Styled parts ───────────────────────────────────────────────────────────
|
|
91
71
|
|
|
92
72
|
/** The root row: optional lead · option strip · optional trail. */
|
|
93
73
|
const ExampleControlFrame = styled(Box, {
|
|
94
|
-
|
|
74
|
+
displayName: "ExampleControl",
|
|
95
75
|
context: ExampleControlContext,
|
|
96
76
|
flexDirection: "row",
|
|
97
77
|
alignItems: "center",
|
|
98
|
-
gap: "
|
|
78
|
+
gap: "xs",
|
|
99
79
|
});
|
|
100
80
|
|
|
101
81
|
/** The strip wrapping the option buttons. */
|
|
102
82
|
const ExampleControlOptions = styled(Box, {
|
|
103
|
-
|
|
83
|
+
displayName: "ExampleControlOptions",
|
|
104
84
|
flexDirection: "row",
|
|
105
85
|
alignItems: "stretch",
|
|
106
|
-
gap: "
|
|
86
|
+
gap: "xxs",
|
|
107
87
|
});
|
|
108
88
|
|
|
109
89
|
/**
|
|
110
90
|
* A single selectable option button.
|
|
111
91
|
*
|
|
112
|
-
* 4. Colors are theme-ramp tokens ONLY: idle text is the neutral
|
|
113
|
-
* selected fill is the accent
|
|
92
|
+
* 4. Colors are theme-ramp tokens ONLY: idle text is the neutral `color`, the
|
|
93
|
+
* selected fill is the accent `color9` with `color1` contrast text. No hex,
|
|
114
94
|
* no `color` prop — `theme="red"` on (or above) the control recolors it.
|
|
115
|
-
* 12. Interaction lives in real Tamagui pseudo-state (`
|
|
95
|
+
* 12. Interaction lives in real Tamagui pseudo-state (`hover:`/`press:` clauses)
|
|
116
96
|
* and a `disabled` variant (Mantine parity: 0.3 + non-interactive), never a
|
|
117
97
|
* runtime `onHoverIn` state machine.
|
|
118
98
|
*/
|
|
119
99
|
const ExampleControlOption = styled(UnstyledButton.Frame, {
|
|
120
|
-
|
|
100
|
+
displayName: "ExampleControlOption",
|
|
121
101
|
context: ExampleControlContext,
|
|
122
102
|
alignItems: "center",
|
|
123
103
|
justifyContent: "center",
|
|
124
|
-
paddingVertical: "
|
|
125
|
-
paddingHorizontal: "
|
|
126
|
-
borderRadius: "
|
|
127
|
-
backgroundColor: "transparent",
|
|
128
|
-
|
|
129
|
-
hoverStyle: { backgroundColor: "$color2" },
|
|
130
|
-
pressStyle: { backgroundColor: "$color3" },
|
|
104
|
+
paddingVertical: "xs",
|
|
105
|
+
paddingHorizontal: "xs",
|
|
106
|
+
borderRadius: "sm",
|
|
107
|
+
backgroundColor: "transparent hover:color2 press:color3",
|
|
108
|
+
cursor: "web:pointer",
|
|
131
109
|
|
|
132
110
|
variants: {
|
|
133
|
-
size:
|
|
111
|
+
size: cellMinWidthVariant,
|
|
134
112
|
|
|
135
113
|
/** Selected option — solid accent fill. */
|
|
136
114
|
selected: {
|
|
137
115
|
true: {
|
|
138
|
-
backgroundColor: "
|
|
139
|
-
hoverStyle: { backgroundColor: "$color10" },
|
|
140
|
-
pressStyle: { backgroundColor: "$color8" },
|
|
116
|
+
backgroundColor: "color9 hover:color10 press:color8",
|
|
141
117
|
},
|
|
142
118
|
},
|
|
143
119
|
|
|
@@ -146,9 +122,8 @@ const ExampleControlOption = styled(UnstyledButton.Frame, {
|
|
|
146
122
|
true: {
|
|
147
123
|
opacity: 0.3,
|
|
148
124
|
pointerEvents: "none",
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
pressStyle: { backgroundColor: "transparent" },
|
|
125
|
+
cursor: "web:not-allowed",
|
|
126
|
+
backgroundColor: "hover:transparent press:transparent",
|
|
152
127
|
},
|
|
153
128
|
},
|
|
154
129
|
} as const,
|
|
@@ -170,22 +145,22 @@ const ExampleControlOption = styled(UnstyledButton.Frame, {
|
|
|
170
145
|
* a per-render dynamic `opacity`/`display` style prop.
|
|
171
146
|
*/
|
|
172
147
|
const ExampleControlLabel = styled(Text, {
|
|
173
|
-
|
|
148
|
+
displayName: "ExampleControlLabel",
|
|
174
149
|
context: ExampleControlContext,
|
|
175
150
|
userSelect: "none",
|
|
176
|
-
color: "
|
|
151
|
+
color: "color",
|
|
177
152
|
variants: {
|
|
178
|
-
size:
|
|
153
|
+
size: cellFontVariant,
|
|
179
154
|
|
|
180
155
|
/** On the selected accent fill, the label flips to the contrast color. */
|
|
181
|
-
selected: { true: { color: "
|
|
156
|
+
selected: { true: { color: "color1" } },
|
|
182
157
|
} as const,
|
|
183
158
|
defaultVariants: { size: "md" },
|
|
184
159
|
});
|
|
185
160
|
|
|
186
161
|
/** Lead/trail section wrapper — a real styled part for the section props to land on. */
|
|
187
162
|
const ExampleControlSection = styled(Box, {
|
|
188
|
-
|
|
163
|
+
displayName: "ExampleControlSection",
|
|
189
164
|
context: ExampleControlContext,
|
|
190
165
|
flexDirection: "row",
|
|
191
166
|
alignItems: "center",
|
|
@@ -304,7 +279,8 @@ export interface ExampleControlProps extends ExampleControlFrameProps {
|
|
|
304
279
|
* onChange={setValue}
|
|
305
280
|
* />
|
|
306
281
|
*/
|
|
307
|
-
const ExampleControlComponent =
|
|
282
|
+
const ExampleControlComponent = styleable<ExampleControlProps>(
|
|
283
|
+
ExampleControlFrame,
|
|
308
284
|
function ExampleControl(props, ref) {
|
|
309
285
|
const {
|
|
310
286
|
data,
|
package/src/_reference/README.md
CHANGED
|
@@ -19,7 +19,7 @@ The numbered rules below map 1:1 onto the numbered comments in
|
|
|
19
19
|
(`CELL_WIDTH`/`CELL_FONT`) — the calendar twin of components' `controlMetrics`.
|
|
20
20
|
No magic pixels. Express variants with raw ladder values at module-load (never
|
|
21
21
|
`getTokenValue`, which needs the live config).
|
|
22
|
-
4. **Theme-ramp colors only.**
|
|
22
|
+
4. **Theme-ramp colors only.** `color1…color12` / semantic neutrals — never hex,
|
|
23
23
|
never a Mantine-style `color` prop. Accent is the Tamagui `theme=` prop, so
|
|
24
24
|
`theme="red"` recolors with zero per-component logic.
|
|
25
25
|
5. **Styled Frame + leaf parts**, each opting into the context.
|
|
@@ -38,10 +38,10 @@ props on a composed part` — **explicit beats sugar**.
|
|
|
38
38
|
normalized through `toDateString` once.
|
|
39
39
|
11. **A11y on both axes.** Web (`role`/`aria-*`) and native (`accessibility*` via
|
|
40
40
|
`internal/a11y` `controlA11yProps`) set side-by-side — neither replaces the other.
|
|
41
|
-
12. **Interaction in style, not state.** `
|
|
41
|
+
12. **Interaction in style, not state.** `web:` cursor clauses, real `hover:`/`press:` clauses,
|
|
42
42
|
a `disabled` variant (Mantine parity: 0.3 + `pointerEvents: "none"`). No runtime
|
|
43
43
|
hover state machines.
|
|
44
|
-
13.
|
|
44
|
+
13. **`styleable()` wrapper** forwarding a ref + the frame's style props (the dates norm).
|
|
45
45
|
14. **`withStaticProperties`** exposing the slot markers (single source of truth) and
|
|
46
46
|
the styled parts, so consumers can compose and `styled(X.Part, …)`.
|
|
47
47
|
15. **Compiler-safe styling.** The `apps/web` build runs the Tamagui optimizing
|
package/src/cell-metrics.ts
CHANGED
|
@@ -1,52 +1,126 @@
|
|
|
1
1
|
// Shared cell-size ladders for every calendar grid component (Day, WeekdaysRow,
|
|
2
|
-
// Month, PickerControl
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// Month, PickerControl, CalendarHeader, MiniCalendar, TimeGrid, TimeControlsList,
|
|
3
|
+
// TimePresets). ONE source of truth: `CELL_METRICS` below — the calendar twin of
|
|
4
|
+
// components' `controlMetrics` — and every per-part variant map is DERIVED from it
|
|
5
|
+
// at module load into a plain, exact-key, literal-shaped object (Tamagui v3's
|
|
6
|
+
// fastest variant shape: static bodies, per-clause friendly, compiler-evaluable).
|
|
7
|
+
// INTERNAL — deliberately NOT re-exported from the public `src/index.ts` barrel.
|
|
5
8
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// month
|
|
9
|
+
// Why raw pixels, not control-height tokens: a calendar cell is not a control.
|
|
10
|
+
// It mirrors @mantine/dates' grid sizing (square cell per size, label ≈ size / 2.8),
|
|
11
|
+
// so a 7-column month at `md` is 7 × 42 = 294px. `controlMetrics`' heights
|
|
12
|
+
// (18…96) would make an `xxl` month 672px wide. The KEY scale (`xxs…xxl`,
|
|
13
|
+
// default `md`) is the kit's; only the numbers are calendar-specific.
|
|
9
14
|
//
|
|
10
15
|
// ─── THEMING: the accent palette-ramp convention (read before styling a cell) ───
|
|
11
16
|
// Accent colour is ALWAYS the Tamagui `theme=` prop (e.g. `<DatePicker theme="blue" />`)
|
|
12
17
|
// — there is NO Mantine-style `color` prop, and palette hex is NEVER hard-coded.
|
|
13
|
-
// Every cell
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
18
|
+
// Every cell reads the ACTIVE theme's ramp with this fixed mapping so they don't
|
|
19
|
+
// drift (v3 flat values — conditions live inside the property they change):
|
|
20
|
+
// color9 hover:color10 press:color8 solid accent — selected cell background
|
|
21
|
+
// color1 contrast text ON the solid accent
|
|
22
|
+
// color4 hover:color5 press:color5 subtle accent tint — in-range background
|
|
23
|
+
// transparent hover:color2 press:color3 idle cell background
|
|
24
|
+
// color7 accent borders (the "today" outline)
|
|
25
|
+
// color11 muted / accented label text
|
|
26
|
+
// background / color / borderColor semantic neutrals
|
|
27
|
+
// States are `hover:` / `press:` clauses + a `disabled` variant — never runtime
|
|
28
|
+
// hover state, never a Pressable wrapper. `cursor` is a `web:` clause (dropped on
|
|
29
|
+
// native by the style engine, no `isWeb` branching at module load).
|
|
25
30
|
|
|
26
31
|
/** Calendar grid size — the kit's shared control size scale. */
|
|
27
32
|
export type CalendarSize = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
|
|
28
33
|
|
|
34
|
+
/** The size keys in ascending order. */
|
|
35
|
+
export const CALENDAR_SIZES = ["xxs", "xs", "sm", "md", "lg", "xl", "xxl"] as const;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* THE canonical calendar-cell table. Every column is a raw px number.
|
|
39
|
+
*
|
|
40
|
+
* key cell font picker(7/3) header icon
|
|
41
|
+
* xxs 24 11 56 9 13
|
|
42
|
+
* xs 30 13 70 12 17
|
|
43
|
+
* sm 36 14 84 14 20
|
|
44
|
+
* md 42 15 98 16 23
|
|
45
|
+
* lg 48 17 112 18 26
|
|
46
|
+
* xl 54 19 126 21 30
|
|
47
|
+
* xxl 60 21 140 23 33
|
|
48
|
+
*
|
|
49
|
+
* `cell` is the square day cell (and the header control / column width), `font`
|
|
50
|
+
* the cell label (≈ cell / 2.8), `picker` the wide month/year cell
|
|
51
|
+
* (Mantine: width = height × 7/3, so a 3-column grid spans a 7-column month),
|
|
52
|
+
* `header` the level label (≈ cell / 2.6) and `icon` the chevron glyph (≈ 55%).
|
|
53
|
+
*/
|
|
54
|
+
export const CELL_METRICS = {
|
|
55
|
+
xxs: { cell: 24, font: 11, picker: 56, header: 9, icon: 13 },
|
|
56
|
+
xs: { cell: 30, font: 13, picker: 70, header: 12, icon: 17 },
|
|
57
|
+
sm: { cell: 36, font: 14, picker: 84, header: 14, icon: 20 },
|
|
58
|
+
md: { cell: 42, font: 15, picker: 98, header: 16, icon: 23 },
|
|
59
|
+
lg: { cell: 48, font: 17, picker: 112, header: 18, icon: 26 },
|
|
60
|
+
xl: { cell: 54, font: 19, picker: 126, header: 21, icon: 30 },
|
|
61
|
+
xxl: { cell: 60, font: 21, picker: 140, header: 23, icon: 33 },
|
|
62
|
+
} as const satisfies Record<CalendarSize, Record<string, number>>;
|
|
63
|
+
|
|
29
64
|
/** Square column/cell width per `size`, shared so every grid's columns align. */
|
|
30
|
-
export const CELL_WIDTH: Record<CalendarSize, number> =
|
|
31
|
-
xxs: 24,
|
|
32
|
-
xs: 30,
|
|
33
|
-
sm: 36,
|
|
34
|
-
md: 42,
|
|
35
|
-
lg: 48,
|
|
36
|
-
xl: 54,
|
|
37
|
-
xxl: 60,
|
|
38
|
-
};
|
|
65
|
+
export const CELL_WIDTH: Record<CalendarSize, number> = ladder((k) => CELL_METRICS[k].cell);
|
|
39
66
|
|
|
40
67
|
/** Cell label font per `size` (≈ size / 2.8, matching the day label). */
|
|
41
|
-
export const CELL_FONT: Record<CalendarSize, number> =
|
|
42
|
-
xxs: 11,
|
|
43
|
-
xs: 13,
|
|
44
|
-
sm: 14,
|
|
45
|
-
md: 15,
|
|
46
|
-
lg: 17,
|
|
47
|
-
xl: 19,
|
|
48
|
-
xxl: 21,
|
|
49
|
-
};
|
|
68
|
+
export const CELL_FONT: Record<CalendarSize, number> = ladder((k) => CELL_METRICS[k].font);
|
|
50
69
|
|
|
51
70
|
/** Gap inserted between cells/rows when `withCellSpacing` is on. */
|
|
52
71
|
export const CELL_SPACING = 2;
|
|
72
|
+
|
|
73
|
+
/** Build one exact-key `xxs…xxl` table at module scope. */
|
|
74
|
+
function ladder<T>(body: (key: CalendarSize) => T): Record<CalendarSize, T> {
|
|
75
|
+
const out = {} as Record<CalendarSize, T>;
|
|
76
|
+
for (const key of CALENDAR_SIZES) out[key] = body(key);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ── Derived variant maps (static exact-key bodies; spread only at module scope) ──
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Square cell. `minHeight` mirrors `height` so it acts as a FLOOR: when
|
|
84
|
+
* `fullWidth` swaps `height` to `"100%"` to fill a constrained calendar height,
|
|
85
|
+
* an UNCONSTRAINED parent resolves that percentage to "auto" and the cell would
|
|
86
|
+
* otherwise collapse to its label's line-height.
|
|
87
|
+
*/
|
|
88
|
+
export const cellSquareVariant = ladder((k) => ({
|
|
89
|
+
width: CELL_METRICS[k].cell,
|
|
90
|
+
height: CELL_METRICS[k].cell,
|
|
91
|
+
minHeight: CELL_METRICS[k].cell,
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
/** The wide month/year cell (`PickerControl`), with the same `minHeight` floor. */
|
|
95
|
+
export const pickerCellVariant = ladder((k) => ({
|
|
96
|
+
width: CELL_METRICS[k].picker,
|
|
97
|
+
height: CELL_METRICS[k].cell,
|
|
98
|
+
minHeight: CELL_METRICS[k].cell,
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
/** Cell height only (header level control). */
|
|
102
|
+
export const cellHeightVariant = ladder((k) => ({ height: CELL_METRICS[k].cell }));
|
|
103
|
+
|
|
104
|
+
/** Cell min-height only (time-grid controls grow with their label). */
|
|
105
|
+
export const cellMinHeightVariant = ladder((k) => ({ minHeight: CELL_METRICS[k].cell }));
|
|
106
|
+
|
|
107
|
+
/** Column width only (week-number column). */
|
|
108
|
+
export const cellWidthVariant = ladder((k) => ({ width: CELL_METRICS[k].cell }));
|
|
109
|
+
|
|
110
|
+
/** Column min-width only (mini-calendar days, example options). */
|
|
111
|
+
export const cellMinWidthVariant = ladder((k) => ({ minWidth: CELL_METRICS[k].cell }));
|
|
112
|
+
|
|
113
|
+
/** Cell label font. */
|
|
114
|
+
export const cellFontVariant = ladder((k) => ({ fontSize: CELL_METRICS[k].font }));
|
|
115
|
+
|
|
116
|
+
/** Weekday header column: cell width + label font, so it lines up with the days. */
|
|
117
|
+
export const weekdayCellVariant = ladder((k) => ({
|
|
118
|
+
width: CELL_METRICS[k].cell,
|
|
119
|
+
fontSize: CELL_METRICS[k].font,
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
/** Header level label font. */
|
|
123
|
+
export const headerFontVariant = ladder((k) => ({ fontSize: CELL_METRICS[k].header }));
|
|
124
|
+
|
|
125
|
+
/** Chevron glyph font. */
|
|
126
|
+
export const iconFontVariant = ladder((k) => ({ fontSize: CELL_METRICS[k].icon }));
|
package/src/internal/a11y.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// barrel. Shared by every interactive leaf (`Day`, `PickerControl`, `TimeGrid`'s
|
|
3
3
|
// control, `CalendarHeader`, `MiniCalendar`) so the React-Native `accessibility*`
|
|
4
4
|
// shape lives in ONE place and can't drift across call sites — the same
|
|
5
|
-
// extraction discipline as `
|
|
5
|
+
// extraction discipline as `has-prevent-default`.
|
|
6
6
|
//
|
|
7
7
|
// Web screen readers are driven by the existing `role`/`aria-*` attributes; these
|
|
8
8
|
// `accessibility*` props are their NATIVE counterparts (VoiceOver/TalkBack). Both
|
|
@@ -54,13 +54,16 @@ export interface ControlA11yProps {
|
|
|
54
54
|
* On WEB this returns nothing: every call site already sets the equivalent
|
|
55
55
|
* `role`/`aria-*` attributes (the kit's cross-platform web a11y axis), and
|
|
56
56
|
* react-native-web does not translate these RN `accessibility*` props on the
|
|
57
|
-
* `
|
|
57
|
+
* `styleable()` hosts these controls use — so emitting them would only
|
|
58
58
|
* leak unrecognised `accessibility*` attributes onto the DOM. They are the
|
|
59
59
|
* VoiceOver/TalkBack counterparts, needed on native only.
|
|
60
60
|
*/
|
|
61
|
+
/** The web result: one frozen empty object, so 42 cells per grid allocate nothing. */
|
|
62
|
+
const NO_NATIVE_A11Y: Partial<ControlA11yProps> = Object.freeze({});
|
|
63
|
+
|
|
61
64
|
export function controlA11yProps(options: ControlA11yOptions = {}): Partial<ControlA11yProps> {
|
|
62
65
|
if (isWeb) {
|
|
63
|
-
return
|
|
66
|
+
return NO_NATIVE_A11Y;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
const { label, selected, disabled, role = "button" } = options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Internal cross-platform helper — NOT exported from the public `src/index.ts`
|
|
2
|
-
// barrel (same discipline as `
|
|
2
|
+
// barrel (same discipline as `focus-element`/`picker-presets`).
|
|
3
3
|
// Shared by the `*PickerInput` wrappers so the inline picker's `defaultDate`
|
|
4
4
|
// computation lives in one place instead of being copied per wrapper.
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Internal cross-platform helper — NOT exported from the public `src/index.ts`
|
|
2
2
|
// barrel. Shared by the time-segment leaves (`SpinInput`, `AmPmInput`) so the
|
|
3
3
|
// web `.select()`-on-focus narrowing lives in one place (the same extraction
|
|
4
|
-
// pattern as `
|
|
4
|
+
// pattern as `focus-element` and `has-prevent-default`).
|
|
5
5
|
|
|
6
6
|
import { isWeb } from "@knitui/core";
|
|
7
7
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.webCursor = void 0;
|
|
7
|
-
var _core = require("@knitui/core");
|
|
8
|
-
// Internal cross-platform helper — NOT exported from the public `src/index.ts`
|
|
9
|
-
// barrel. Shared by `Day`, `PickerControl` and `CalendarHeader` (and any future
|
|
10
|
-
// grid control) so the web-only cursor narrowing lives in one place instead of
|
|
11
|
-
// being copied per component (the same extraction pattern as `cell-metrics` and
|
|
12
|
-
// `has-prevent-default`).
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Cursor is a web-only affordance — passing it on native leaks to the RN host
|
|
16
|
-
* node. `isWeb` is a module-load constant, so this is safe to call inside a
|
|
17
|
-
* static styled-variant definition. Mirrors the kit's internal `webCursor`,
|
|
18
|
-
* which is not exported from `@knitui/components`.
|
|
19
|
-
*/
|
|
20
|
-
const webCursor = cursor => _core.isWeb ? {
|
|
21
|
-
cursor
|
|
22
|
-
} : {};
|
|
23
|
-
exports.webCursor = webCursor;
|
|
24
|
-
//# sourceMappingURL=web-cursor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","webCursor","cursor","isWeb","exports"],"sourceRoot":"../../../src","sources":["internal/web-cursor.ts"],"mappings":";;;;;;AAMA,IAAAA,KAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GAAsBC,MAAS,IAAsBC,WAAK,GAAG;EAAED;AAAO,CAAC,GAAG,CAAC,CAAE;AAACE,OAAA,CAAAH,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// Internal cross-platform helper — NOT exported from the public `src/index.ts`
|
|
4
|
-
// barrel. Shared by `Day`, `PickerControl` and `CalendarHeader` (and any future
|
|
5
|
-
// grid control) so the web-only cursor narrowing lives in one place instead of
|
|
6
|
-
// being copied per component (the same extraction pattern as `cell-metrics` and
|
|
7
|
-
// `has-prevent-default`).
|
|
8
|
-
|
|
9
|
-
import { isWeb } from "@knitui/core";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Cursor is a web-only affordance — passing it on native leaks to the RN host
|
|
13
|
-
* node. `isWeb` is a module-load constant, so this is safe to call inside a
|
|
14
|
-
* static styled-variant definition. Mirrors the kit's internal `webCursor`,
|
|
15
|
-
* which is not exported from `@knitui/components`.
|
|
16
|
-
*/
|
|
17
|
-
export const webCursor = cursor => isWeb ? {
|
|
18
|
-
cursor
|
|
19
|
-
} : {};
|
|
20
|
-
//# sourceMappingURL=web-cursor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["isWeb","webCursor","cursor"],"sourceRoot":"../../../src","sources":["internal/web-cursor.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,cAAc;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAsBC,MAAS,IAAsBF,KAAK,GAAG;EAAEE;AAAO,CAAC,GAAG,CAAC,CAAE","ignoreList":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cursor is a web-only affordance — passing it on native leaks to the RN host
|
|
3
|
-
* node. `isWeb` is a module-load constant, so this is safe to call inside a
|
|
4
|
-
* static styled-variant definition. Mirrors the kit's internal `webCursor`,
|
|
5
|
-
* which is not exported from `@knitui/components`.
|
|
6
|
-
*/
|
|
7
|
-
export declare const webCursor: <T extends string>(cursor: T) => {
|
|
8
|
-
cursor?: T;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=web-cursor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-cursor.d.ts","sourceRoot":"","sources":["../../../src/internal/web-cursor.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,QAAQ,CAAC,KAAG;IAAE,MAAM,CAAC,EAAE,CAAC,CAAA;CAA+B,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Internal cross-platform helper — NOT exported from the public `src/index.ts`
|
|
2
|
-
// barrel. Shared by `Day`, `PickerControl` and `CalendarHeader` (and any future
|
|
3
|
-
// grid control) so the web-only cursor narrowing lives in one place instead of
|
|
4
|
-
// being copied per component (the same extraction pattern as `cell-metrics` and
|
|
5
|
-
// `has-prevent-default`).
|
|
6
|
-
|
|
7
|
-
import { isWeb } from "@knitui/core";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Cursor is a web-only affordance — passing it on native leaks to the RN host
|
|
11
|
-
* node. `isWeb` is a module-load constant, so this is safe to call inside a
|
|
12
|
-
* static styled-variant definition. Mirrors the kit's internal `webCursor`,
|
|
13
|
-
* which is not exported from `@knitui/components`.
|
|
14
|
-
*/
|
|
15
|
-
export const webCursor = <T extends string>(cursor: T): { cursor?: T } => (isWeb ? { cursor } : {});
|