panelui-native 0.25.0 → 0.30.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/README.md +18 -1
- package/lib/module/components/accordion/index.js +8 -8
- package/lib/module/components/accordion/index.js.map +1 -1
- package/lib/module/components/alert/index.js +2 -2
- package/lib/module/components/alert/index.js.map +1 -1
- package/lib/module/components/area-chart/index.js +182 -50
- package/lib/module/components/area-chart/index.js.map +1 -1
- package/lib/module/components/attachment/index.js +2 -1
- package/lib/module/components/attachment/index.js.map +1 -1
- package/lib/module/components/avatar/index.js +3 -3
- package/lib/module/components/avatar/index.js.map +1 -1
- package/lib/module/components/badge/index.js +4 -4
- package/lib/module/components/badge/index.js.map +1 -1
- package/lib/module/components/bar-chart/index.js +197 -56
- package/lib/module/components/bar-chart/index.js.map +1 -1
- package/lib/module/components/bottom-sheet/index.js +15 -10
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/breadcrumb/index.js +6 -6
- package/lib/module/components/breadcrumb/index.js.map +1 -1
- package/lib/module/components/button/index.js +11 -6
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/calendar/index.js +792 -0
- package/lib/module/components/calendar/index.js.map +1 -0
- package/lib/module/components/carousel/index.js +680 -0
- package/lib/module/components/carousel/index.js.map +1 -0
- package/lib/module/components/chip/index.js +4 -4
- package/lib/module/components/chip/index.js.map +1 -1
- package/lib/module/components/code-block/highlight.js +363 -0
- package/lib/module/components/code-block/highlight.js.map +1 -0
- package/lib/module/components/code-block/index.js +313 -0
- package/lib/module/components/code-block/index.js.map +1 -0
- package/lib/module/components/date-picker/index.js +165 -0
- package/lib/module/components/date-picker/index.js.map +1 -0
- package/lib/module/components/dialog/index.js +7 -2
- package/lib/module/components/dialog/index.js.map +1 -1
- package/lib/module/components/direction/index.js +2 -1
- package/lib/module/components/direction/index.js.map +1 -1
- package/lib/module/components/empty-state/index.js +2 -2
- package/lib/module/components/empty-state/index.js.map +1 -1
- package/lib/module/components/field/index.js +5 -5
- package/lib/module/components/field/index.js.map +1 -1
- package/lib/module/components/flow/index.js +3 -3
- package/lib/module/components/flow/index.js.map +1 -1
- package/lib/module/components/frame/index.js +5 -5
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/input-group/index.js +3 -2
- package/lib/module/components/input-group/index.js.map +1 -1
- package/lib/module/components/item/index.js +9 -9
- package/lib/module/components/item/index.js.map +1 -1
- package/lib/module/components/label/index.js +4 -4
- package/lib/module/components/label/index.js.map +1 -1
- package/lib/module/components/line-chart/index.js +167 -44
- package/lib/module/components/line-chart/index.js.map +1 -1
- package/lib/module/components/map/index.js +7 -7
- package/lib/module/components/map/index.js.map +1 -1
- package/lib/module/components/marker/index.js +3 -3
- package/lib/module/components/marker/index.js.map +1 -1
- package/lib/module/components/menu/index.js +714 -0
- package/lib/module/components/menu/index.js.map +1 -0
- package/lib/module/components/message/index.js +7 -7
- package/lib/module/components/message/index.js.map +1 -1
- package/lib/module/components/message-scroller/index.js +5 -4
- package/lib/module/components/message-scroller/index.js.map +1 -1
- package/lib/module/components/plan/index.js +296 -0
- package/lib/module/components/plan/index.js.map +1 -0
- package/lib/module/components/popover/index.js +73 -10
- package/lib/module/components/popover/index.js.map +1 -1
- package/lib/module/components/radio-group/index.js +15 -10
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/reasoning/index.js +244 -0
- package/lib/module/components/reasoning/index.js.map +1 -0
- package/lib/module/components/section-rail/index.js +4 -4
- package/lib/module/components/section-rail/index.js.map +1 -1
- package/lib/module/components/select/index.js +10 -4
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/sources/index.js +221 -0
- package/lib/module/components/sources/index.js.map +1 -0
- package/lib/module/components/steps/index.js +4 -4
- package/lib/module/components/steps/index.js.map +1 -1
- package/lib/module/components/tabs/index.js +7 -7
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/task/index.js +300 -0
- package/lib/module/components/task/index.js.map +1 -0
- package/lib/module/components/textarea/index.js +295 -0
- package/lib/module/components/textarea/index.js.map +1 -0
- package/lib/module/components/timeline/index.js +4 -4
- package/lib/module/components/timeline/index.js.map +1 -1
- package/lib/module/components/toast/index.js +2 -2
- package/lib/module/components/toast/index.js.map +1 -1
- package/lib/module/components/toggle-button/index.js +5 -5
- package/lib/module/components/toggle-button/index.js.map +1 -1
- package/lib/module/components/tooltip/index.js +648 -0
- package/lib/module/components/tooltip/index.js.map +1 -0
- package/lib/module/components/typography/index.js +2 -2
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-back-handler.js +37 -0
- package/lib/module/hooks/use-back-handler.js.map +1 -0
- package/lib/module/icons/index.js +202 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +13 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/collapse.js +112 -0
- package/lib/module/primitives/collapse.js.map +1 -0
- package/lib/module/primitives/keyboard-avoider.js +2 -1
- package/lib/module/primitives/keyboard-avoider.js.map +1 -1
- package/lib/module/primitives/text.js +25 -1
- package/lib/module/primitives/text.js.map +1 -1
- package/lib/module/utils/date.js +386 -0
- package/lib/module/utils/date.js.map +1 -0
- package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
- package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
- package/lib/typescript/src/components/area-chart/index.d.ts +41 -1
- package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/attachment/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bar-chart/index.d.ts +44 -2
- package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/breadcrumb/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/calendar/index.d.ts +173 -0
- package/lib/typescript/src/components/calendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/carousel/index.d.ts +179 -0
- package/lib/typescript/src/components/carousel/index.d.ts.map +1 -0
- package/lib/typescript/src/components/chip/index.d.ts.map +1 -1
- package/lib/typescript/src/components/code-block/highlight.d.ts +39 -0
- package/lib/typescript/src/components/code-block/highlight.d.ts.map +1 -0
- package/lib/typescript/src/components/code-block/index.d.ts +113 -0
- package/lib/typescript/src/components/code-block/index.d.ts.map +1 -0
- package/lib/typescript/src/components/date-picker/index.d.ts +97 -0
- package/lib/typescript/src/components/date-picker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/components/direction/index.d.ts.map +1 -1
- package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
- package/lib/typescript/src/components/field/index.d.ts.map +1 -1
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/item/index.d.ts.map +1 -1
- package/lib/typescript/src/components/label/index.d.ts.map +1 -1
- package/lib/typescript/src/components/line-chart/index.d.ts +41 -2
- package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/components/map/index.d.ts.map +1 -1
- package/lib/typescript/src/components/marker/index.d.ts.map +1 -1
- package/lib/typescript/src/components/menu/index.d.ts +261 -0
- package/lib/typescript/src/components/menu/index.d.ts.map +1 -0
- package/lib/typescript/src/components/message/index.d.ts.map +1 -1
- package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -1
- package/lib/typescript/src/components/plan/index.d.ts +127 -0
- package/lib/typescript/src/components/plan/index.d.ts.map +1 -0
- package/lib/typescript/src/components/popover/index.d.ts +35 -1
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/reasoning/index.d.ts +97 -0
- package/lib/typescript/src/components/reasoning/index.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/sources/index.d.ts +85 -0
- package/lib/typescript/src/components/sources/index.d.ts.map +1 -0
- package/lib/typescript/src/components/steps/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/components/task/index.d.ts +103 -0
- package/lib/typescript/src/components/task/index.d.ts.map +1 -0
- package/lib/typescript/src/components/textarea/index.d.ts +175 -0
- package/lib/typescript/src/components/textarea/index.d.ts.map +1 -0
- package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tooltip/index.d.ts +180 -0
- package/lib/typescript/src/components/tooltip/index.d.ts.map +1 -0
- package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-back-handler.d.ts +19 -0
- package/lib/typescript/src/hooks/use-back-handler.d.ts.map +1 -0
- package/lib/typescript/src/icons/index.d.ts +17 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +16 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/collapse.d.ts +42 -0
- package/lib/typescript/src/primitives/collapse.d.ts.map +1 -0
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
- package/lib/typescript/src/primitives/text.d.ts +20 -0
- package/lib/typescript/src/primitives/text.d.ts.map +1 -1
- package/lib/typescript/src/utils/date.d.ts +116 -0
- package/lib/typescript/src/utils/date.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/accordion/index.tsx +8 -12
- package/src/components/alert/index.tsx +2 -2
- package/src/components/area-chart/index.tsx +208 -55
- package/src/components/attachment/index.tsx +2 -2
- package/src/components/avatar/index.tsx +3 -3
- package/src/components/badge/index.tsx +6 -6
- package/src/components/bar-chart/index.tsx +214 -54
- package/src/components/bottom-sheet/index.tsx +17 -16
- package/src/components/breadcrumb/index.tsx +6 -8
- package/src/components/button/index.tsx +12 -8
- package/src/components/calendar/index.tsx +970 -0
- package/src/components/carousel/index.tsx +788 -0
- package/src/components/chip/index.tsx +4 -6
- package/src/components/code-block/highlight.ts +278 -0
- package/src/components/code-block/index.tsx +341 -0
- package/src/components/date-picker/index.tsx +255 -0
- package/src/components/dialog/index.tsx +7 -2
- package/src/components/direction/index.tsx +2 -1
- package/src/components/empty-state/index.tsx +2 -2
- package/src/components/field/index.tsx +3 -5
- package/src/components/flow/index.tsx +3 -3
- package/src/components/frame/index.tsx +5 -7
- package/src/components/input-group/index.tsx +3 -2
- package/src/components/item/index.tsx +9 -9
- package/src/components/label/index.tsx +2 -2
- package/src/components/line-chart/index.tsx +189 -50
- package/src/components/map/index.tsx +7 -9
- package/src/components/marker/index.tsx +3 -3
- package/src/components/menu/index.tsx +812 -0
- package/src/components/message/index.tsx +7 -7
- package/src/components/message-scroller/index.tsx +5 -4
- package/src/components/plan/index.tsx +325 -0
- package/src/components/popover/index.tsx +111 -8
- package/src/components/radio-group/index.tsx +13 -4
- package/src/components/reasoning/index.tsx +297 -0
- package/src/components/section-rail/index.tsx +4 -4
- package/src/components/select/index.tsx +10 -4
- package/src/components/sources/index.tsx +278 -0
- package/src/components/steps/index.tsx +4 -4
- package/src/components/tabs/index.tsx +7 -9
- package/src/components/task/index.tsx +329 -0
- package/src/components/textarea/index.tsx +381 -0
- package/src/components/timeline/index.tsx +4 -4
- package/src/components/toast/index.tsx +2 -2
- package/src/components/toggle-button/index.tsx +5 -7
- package/src/components/tooltip/index.tsx +793 -0
- package/src/components/typography/index.tsx +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-back-handler.ts +37 -0
- package/src/icons/index.tsx +147 -0
- package/src/index.ts +116 -0
- package/src/primitives/collapse.tsx +128 -0
- package/src/primitives/keyboard-avoider.tsx +2 -1
- package/src/primitives/text.tsx +28 -1
- package/src/utils/date.ts +446 -0
- package/theme.css +112 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collapse — a body that opens and closes by animating its own height.
|
|
5
|
+
*
|
|
6
|
+
* Height cannot be animated from `auto`, so the content is measured first and
|
|
7
|
+
* the measurement is what gets animated to. While that is happening the content
|
|
8
|
+
* is taken out of the flow, because a child of a view whose height is
|
|
9
|
+
* mid-animation reports that animated height back and the panel then settles on
|
|
10
|
+
* whatever it happened to measure.
|
|
11
|
+
*
|
|
12
|
+
* The moment the animation finishes, both go away and the content lays out
|
|
13
|
+
* normally again. That is what lets a Collapse hold another Collapse — or hold
|
|
14
|
+
* content that is still streaming in — without either of them being clipped to
|
|
15
|
+
* a number that was true a frame ago.
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Collapse open={open}>
|
|
19
|
+
* <Text>Anything, of any height.</Text>
|
|
20
|
+
* </Collapse>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* The alternative — unmounting the body and letting a layout transition on the
|
|
24
|
+
* parent carry the change — is what `Accordion` does, and it is right when the
|
|
25
|
+
* closed state should cost nothing. This is for a body that opens and closes
|
|
26
|
+
* repeatedly and often while its content is still arriving, where remounting
|
|
27
|
+
* would throw away scroll position and restart every animation inside it.
|
|
28
|
+
*/
|
|
29
|
+
import { useEffect, useRef, useState } from 'react';
|
|
30
|
+
import { View } from 'react-native';
|
|
31
|
+
import Animated, { runOnJS, useAnimatedStyle, useReducedMotion, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
32
|
+
import { cn } from "../utils/cn.js";
|
|
33
|
+
|
|
34
|
+
/** Long enough to read as the panel opening, short enough not to be waited on. */
|
|
35
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
|
+
export const COLLAPSE_DURATION = 200;
|
|
37
|
+
export function Collapse({
|
|
38
|
+
open,
|
|
39
|
+
className,
|
|
40
|
+
duration = COLLAPSE_DURATION,
|
|
41
|
+
children,
|
|
42
|
+
...props
|
|
43
|
+
}) {
|
|
44
|
+
const reducedMotion = useReducedMotion();
|
|
45
|
+
const [height, setHeight] = useState(0);
|
|
46
|
+
const [animating, setAnimating] = useState(false);
|
|
47
|
+
const progress = useSharedValue(open ? 1 : 0);
|
|
48
|
+
const mounted = useRef(false);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
// The first pass is not a transition — a body that starts open should be
|
|
51
|
+
// open, not play its own entrance at nobody.
|
|
52
|
+
if (!mounted.current) {
|
|
53
|
+
mounted.current = true;
|
|
54
|
+
progress.value = open ? 1 : 0;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (reducedMotion) {
|
|
58
|
+
progress.value = open ? 1 : 0;
|
|
59
|
+
setAnimating(false);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
setAnimating(true);
|
|
63
|
+
progress.value = withTiming(open ? 1 : 0, {
|
|
64
|
+
duration
|
|
65
|
+
}, finished => {
|
|
66
|
+
if (finished) runOnJS(setAnimating)(false);
|
|
67
|
+
});
|
|
68
|
+
}, [open, reducedMotion, duration, progress]);
|
|
69
|
+
const style = useAnimatedStyle(() => ({
|
|
70
|
+
height: progress.value * height,
|
|
71
|
+
opacity: progress.value
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
// Re-measured rather than measured once: a body whose content is still
|
|
75
|
+
// streaming in grows, and a height captured on the first frame would crop it.
|
|
76
|
+
const onLayout = event => {
|
|
77
|
+
const next = event.nativeEvent.layout.height;
|
|
78
|
+
setHeight(current => Math.abs(current - next) < 1 ? current : next);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/*
|
|
82
|
+
* Once it has finished opening, the measured height and the absolute
|
|
83
|
+
* positioning are both dropped and the content lays out normally.
|
|
84
|
+
*
|
|
85
|
+
* They are only needed *while* the height is being animated to a number, and
|
|
86
|
+
* keeping them costs real bugs: a Collapse whose content is itself a Collapse
|
|
87
|
+
* measures a child that has not settled yet, and settles on that wrong
|
|
88
|
+
* number, so the inner body ends up clipped to nothing. Content that is still
|
|
89
|
+
* streaming in has the same problem against itself. In natural flow both are
|
|
90
|
+
* simply laid out, and the measurement carries on in the background against
|
|
91
|
+
* the next time it closes.
|
|
92
|
+
*/
|
|
93
|
+
const natural = open && !animating;
|
|
94
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
95
|
+
style: natural ? undefined : style,
|
|
96
|
+
className: natural ? undefined : 'overflow-hidden',
|
|
97
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
98
|
+
onLayout: onLayout,
|
|
99
|
+
style: natural ? undefined : {
|
|
100
|
+
position: 'absolute',
|
|
101
|
+
left: 0,
|
|
102
|
+
right: 0,
|
|
103
|
+
top: 0
|
|
104
|
+
},
|
|
105
|
+
className: cn(className),
|
|
106
|
+
...props,
|
|
107
|
+
children: children
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
Collapse.displayName = 'Collapse';
|
|
112
|
+
//# sourceMappingURL=collapse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","View","Animated","runOnJS","useAnimatedStyle","useReducedMotion","useSharedValue","withTiming","cn","jsx","_jsx","COLLAPSE_DURATION","Collapse","open","className","duration","children","props","reducedMotion","height","setHeight","animating","setAnimating","progress","mounted","current","value","finished","style","opacity","onLayout","event","next","nativeEvent","layout","Math","abs","natural","undefined","position","left","right","top","displayName"],"sourceRoot":"../../../src","sources":["primitives/collapse.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAwB,OAAO;AACnE,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
|
|
25
25
|
|
|
26
26
|
import Animated from 'react-native-reanimated';
|
|
27
27
|
import { useKeyboardAvoidance } from "../hooks/use-keyboard-avoidance.js";
|
|
28
|
+
import { textChildren } from "./text.js";
|
|
28
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
30
|
export function KeyboardAvoider({
|
|
30
31
|
className,
|
|
@@ -54,7 +55,7 @@ export function KeyboardAvoider({
|
|
|
54
55
|
},
|
|
55
56
|
className: className,
|
|
56
57
|
style: [style, avoidance.animatedStyle],
|
|
57
|
-
children: children
|
|
58
|
+
children: textChildren(children)
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
KeyboardAvoider.displayName = 'KeyboardAvoider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Animated","useKeyboardAvoidance","jsx","_jsx","KeyboardAvoider","className","enabled","active","mode","offset","bottomInset","children","style","onLayout","props","avoidance","View","ref","event","animatedStyle","displayName"],"sourceRoot":"../../../src","sources":["primitives/keyboard-avoider.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,QAAQ,MAAM,yBAAyB;AAC9C,SACEC,oBAAoB,QAEf,oCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["Animated","useKeyboardAvoidance","textChildren","jsx","_jsx","KeyboardAvoider","className","enabled","active","mode","offset","bottomInset","children","style","onLayout","props","avoidance","View","ref","event","animatedStyle","displayName"],"sourceRoot":"../../../src","sources":["primitives/keyboard-avoider.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,QAAQ,MAAM,yBAAyB;AAC9C,SACEC,oBAAoB,QAEf,oCAAiC;AACxC,SAASC,YAAY,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA6BtC,OAAO,SAASC,eAAeA,CAAC;EAC9BC,SAAS;EACTC,OAAO,GAAG,IAAI;EACdC,MAAM,GAAG,IAAI;EACbC,IAAI,GAAG,MAAM;EACbC,MAAM,GAAG,EAAE;EACXC,WAAW,GAAG,CAAC;EACfC,QAAQ;EACRC,KAAK;EACLC,QAAQ;EACR,GAAGC;AACiB,CAAC,EAAE;EACvB,MAAMC,SAAS,GAAGf,oBAAoB,CAAC;IACrCM,OAAO;IACPC,MAAM;IACNC,IAAI;IACJC,MAAM;IACNC;EACF,CAAC,CAAC;EAEF,oBACEP,IAAA,CAACJ,QAAQ,CAACiB,IAAI;IAAA,GACRF,KAAK;IACTG,GAAG,EAAEF,SAAS,CAACE,GAAI;IACnBJ,QAAQ,EAAGK,KAAK,IAAK;MACnBH,SAAS,CAACF,QAAQ,CAACK,KAAK,CAAC;MACzBL,QAAQ,GAAGK,KAAK,CAAC;IACnB,CAAE;IACFb,SAAS,EAAEA,SAAU;IACrBO,KAAK,EAAE,CAACA,KAAK,EAAEG,SAAS,CAACI,aAAa,CAAE;IAAAR,QAAA,EAEvCV,YAAY,CAACU,QAAQ;EAAC,CACV,CAAC;AAEpB;AAEAP,eAAe,CAACgB,WAAW,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
3
|
+
import { Children, forwardRef } from 'react';
|
|
4
4
|
import { Text as RNText } from 'react-native';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
6
6
|
import { useDirection } from "../hooks/use-direction.js";
|
|
@@ -68,4 +68,28 @@ export const Text = /*#__PURE__*/forwardRef(({
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
Text.displayName = 'Text';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Wraps the bare text among `children` so it can live in a plain view.
|
|
74
|
+
*
|
|
75
|
+
* React Native will not render a string outside a `<Text>`, and a component
|
|
76
|
+
* that takes `children` has no say in whether it is handed one — so anything
|
|
77
|
+
* putting `children` into a `View`, a `Pressable` or a scroller has to allow
|
|
78
|
+
* for it. Every part in the library that does runs its children through here.
|
|
79
|
+
*
|
|
80
|
+
* Per child, and not all-or-nothing. A part is nearly always given an element
|
|
81
|
+
* and some text together — an icon and a label, an arrow and a line of text —
|
|
82
|
+
* which makes `children` an *array*, so a `typeof children === 'string'` check
|
|
83
|
+
* never matches and the text underneath reaches the view bare. That is the
|
|
84
|
+
* shape this exists to make impossible.
|
|
85
|
+
*
|
|
86
|
+
* `render` is there because the wrapper is rarely the plain default: a button
|
|
87
|
+
* wants its own label variant, a sheet header wants a heading. Pass one, and
|
|
88
|
+
* the text arrives dressed the way the part would have dressed it anyway.
|
|
89
|
+
*/
|
|
90
|
+
export function textChildren(children, render = text => /*#__PURE__*/_jsx(Text, {
|
|
91
|
+
children: text
|
|
92
|
+
})) {
|
|
93
|
+
return Children.map(children, child => typeof child === 'string' || typeof child === 'number' ? render(child) : child);
|
|
94
|
+
}
|
|
71
95
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Text","RNText","tv","useDirection","jsx","_jsx","textVariants","base","variants","size","xs","sm","lg","xl","weight","normal","medium","semibold","bold","muted","true","defaultVariants","className","style","props","ref","direction","writingDirection","displayName"],"sourceRoot":"../../../src","sources":["primitives/text.tsx"],"mappings":";;AAAA,SAASA,UAAU,
|
|
1
|
+
{"version":3,"names":["Children","forwardRef","Text","RNText","tv","useDirection","jsx","_jsx","textVariants","base","variants","size","xs","sm","lg","xl","weight","normal","medium","semibold","bold","muted","true","defaultVariants","className","style","props","ref","direction","writingDirection","displayName","textChildren","children","render","text","map","child"],"sourceRoot":"../../../src","sources":["primitives/text.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,UAAU,QAA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C;AAEN,CACF,CAAC;AAEDxB,IAAI,CAAC4B,WAAW,GAAG,MAAM;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC1BC,QAAmB,EACnBC,MAA+C,GAAIC,IAAI,iBAAK3B,IAAA,CAACL,IAAI;EAAA8B,QAAA,EAAEE;AAAI,CAAO,CAAC,EACpE;EACX,OAAOlC,QAAQ,CAACmC,GAAG,CAACH,QAAQ,EAAGI,KAAK,IAClC,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAAGH,MAAM,CAACG,KAAK,CAAC,GAAGA,KAC3E,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Date helpers for the calendar.
|
|
5
|
+
*
|
|
6
|
+
* No date library. Everything a month grid needs is arithmetic on `Date`, and
|
|
7
|
+
* a dependency that ships a full timezone database to render seven columns is
|
|
8
|
+
* a poor trade for a library whose whole runtime is three small packages.
|
|
9
|
+
*
|
|
10
|
+
* Two rules hold throughout:
|
|
11
|
+
*
|
|
12
|
+
* - **Days are compared at local midnight.** A `Date` carries a time, and two
|
|
13
|
+
* values on the same day are not equal unless that time is stripped. Every
|
|
14
|
+
* comparison here goes through `startOfDay`.
|
|
15
|
+
* - **Month arithmetic is done with `setMonth`, not by adding days.** The
|
|
16
|
+
* platform already knows that a month is 28, 29, 30 or 31 days long.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Names of the weekdays and months, in the caller's locale. */
|
|
20
|
+
|
|
21
|
+
export function startOfDay(date) {
|
|
22
|
+
const copy = new Date(date);
|
|
23
|
+
copy.setHours(0, 0, 0, 0);
|
|
24
|
+
return copy;
|
|
25
|
+
}
|
|
26
|
+
export function isSameDay(a, b) {
|
|
27
|
+
if (!a || !b) return false;
|
|
28
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
29
|
+
}
|
|
30
|
+
export function isSameMonth(a, b) {
|
|
31
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
32
|
+
}
|
|
33
|
+
export function startOfMonth(date) {
|
|
34
|
+
return new Date(date.getFullYear(), date.getMonth(), 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Day 0 of the *next* month, which the platform resolves to the last day of
|
|
39
|
+
* this one — so a leap February needs no special case.
|
|
40
|
+
*/
|
|
41
|
+
export function endOfMonth(date) {
|
|
42
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
43
|
+
}
|
|
44
|
+
export function addMonths(date, months) {
|
|
45
|
+
const copy = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
46
|
+
copy.setMonth(copy.getMonth() + months);
|
|
47
|
+
return copy;
|
|
48
|
+
}
|
|
49
|
+
export function addDays(date, days) {
|
|
50
|
+
const copy = new Date(date);
|
|
51
|
+
copy.setDate(copy.getDate() + days);
|
|
52
|
+
return copy;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Whole days from `a` to `b`, ignoring the time of day on both. */
|
|
56
|
+
export function daysBetween(a, b) {
|
|
57
|
+
const MS = 24 * 60 * 60 * 1000;
|
|
58
|
+
return Math.round((startOfDay(b).getTime() - startOfDay(a).getTime()) / MS);
|
|
59
|
+
}
|
|
60
|
+
export function isBefore(a, b) {
|
|
61
|
+
return startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
62
|
+
}
|
|
63
|
+
export function isAfter(a, b) {
|
|
64
|
+
return startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Inclusive at both ends, which is what a selected range means to a reader. */
|
|
68
|
+
export function isWithin(date, from, to) {
|
|
69
|
+
const time = startOfDay(date).getTime();
|
|
70
|
+
const start = startOfDay(from).getTime();
|
|
71
|
+
const end = startOfDay(to).getTime();
|
|
72
|
+
return time >= Math.min(start, end) && time <= Math.max(start, end);
|
|
73
|
+
}
|
|
74
|
+
export function clampDate(date, min, max) {
|
|
75
|
+
if (min && isBefore(date, min)) return min;
|
|
76
|
+
if (max && isAfter(date, max)) return max;
|
|
77
|
+
return date;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The six-week grid for a month.
|
|
82
|
+
*
|
|
83
|
+
* Always six rows, and always starting on the chosen first day of the week, so
|
|
84
|
+
* the calendar does not change height as the months are paged through. A grid
|
|
85
|
+
* that grows a row in March and loses it again in April makes everything below
|
|
86
|
+
* it jump, and the days themselves appear to move between months.
|
|
87
|
+
*
|
|
88
|
+
* The leading and trailing cells belong to the neighbouring months; whether
|
|
89
|
+
* they are drawn or left blank is the caller's decision.
|
|
90
|
+
*/
|
|
91
|
+
export function monthGrid(month, weekStartsOn) {
|
|
92
|
+
const first = startOfMonth(month);
|
|
93
|
+
// How far back to the most recent `weekStartsOn`. The `+ 7` keeps the
|
|
94
|
+
// modulo positive when the week starts later than the first of the month.
|
|
95
|
+
const lead = (first.getDay() - weekStartsOn + 7) % 7;
|
|
96
|
+
const start = addDays(first, -lead);
|
|
97
|
+
return Array.from({
|
|
98
|
+
length: 6
|
|
99
|
+
}, (_unusedWeek, week) => Array.from({
|
|
100
|
+
length: 7
|
|
101
|
+
}, (_unusedDay, day) => addDays(start, week * 7 + day)));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Formatting, guarded.
|
|
106
|
+
*
|
|
107
|
+
* `Intl` is on modern Hermes, but the data behind it is not guaranteed —
|
|
108
|
+
* builds without the full ICU set throw or return something unusable for
|
|
109
|
+
* locales they do not carry. Every formatter here falls back to English rather
|
|
110
|
+
* than taking the screen down over a month name.
|
|
111
|
+
*/
|
|
112
|
+
function format(date, locale, options) {
|
|
113
|
+
try {
|
|
114
|
+
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A locale tag carrying an explicit calendar and Latin digits.
|
|
122
|
+
*
|
|
123
|
+
* The calendar has to go in the *tag*, not in the options bag. Hermes builds
|
|
124
|
+
* its `Intl` on the platform's own date formatter, which reads the Unicode
|
|
125
|
+
* extension on a locale identifier but does not reliably honour `calendar` as
|
|
126
|
+
* an option — so `{ calendar: 'gregory' }` was quietly ignored and an Arabic
|
|
127
|
+
* device kept answering in Hijri. Any extension already on the tag is dropped
|
|
128
|
+
* first, so a caller passing `ar-u-ca-islamic` cannot end up with two.
|
|
129
|
+
*/
|
|
130
|
+
function withCalendar(locale, calendar) {
|
|
131
|
+
const base = (locale ?? 'en').split('-u-')[0] || 'en';
|
|
132
|
+
return `${base}-u-ca-${calendar}-nu-latn`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Gregorian formatting, pinned.
|
|
137
|
+
*
|
|
138
|
+
* Asking for a month name in Arabic without saying which calendar gets a Hijri
|
|
139
|
+
* one back, because that is what the locale resolves to — right for the
|
|
140
|
+
* language, wrong for a grid whose cells are counting Gregorian days. The
|
|
141
|
+
* digits are pinned too, so the caption and the numbers under it are in one
|
|
142
|
+
* set.
|
|
143
|
+
*/
|
|
144
|
+
function formatGregory(date, locale, options) {
|
|
145
|
+
return format(date, withCalendar(locale, 'gregory'), options) ??
|
|
146
|
+
// A build that cannot parse the extension at all still gets asked, in the
|
|
147
|
+
// hope that it honours the option instead.
|
|
148
|
+
format(date, locale, {
|
|
149
|
+
...options,
|
|
150
|
+
calendar: 'gregory',
|
|
151
|
+
numberingSystem: 'latn'
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* -------------------------------------------------------------------------- */
|
|
156
|
+
/* Calendar systems */
|
|
157
|
+
/* -------------------------------------------------------------------------- */
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Which calendar the months and day numbers are counted in.
|
|
161
|
+
*
|
|
162
|
+
* `auto` takes whatever the locale resolves to, which on an Arabic device is
|
|
163
|
+
* usually islamic. It is not the default: a grid whose month boundaries move
|
|
164
|
+
* with the device's language is a surprise, and the caller who wants that can
|
|
165
|
+
* ask for it.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
/** Year, month and day as the chosen calendar counts them. 1-based month. */
|
|
169
|
+
|
|
170
|
+
/** What `auto` resolves to for a locale, falling back to the Gregorian. */
|
|
171
|
+
export function resolveCalendar(system, locale) {
|
|
172
|
+
if (system !== 'auto') return system;
|
|
173
|
+
try {
|
|
174
|
+
const resolved = new Intl.DateTimeFormat(locale).resolvedOptions().calendar ?? '';
|
|
175
|
+
return resolved.startsWith('islamic') ? 'islamic' : 'gregory';
|
|
176
|
+
} catch {
|
|
177
|
+
return 'gregory';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A date's year, month and day in the given calendar.
|
|
183
|
+
*
|
|
184
|
+
* `formatToParts` rather than a parsed string, because the order and the
|
|
185
|
+
* separators are the locale's business and we only want the numbers. The
|
|
186
|
+
* numbering system is pinned to Latin so the parts come back parseable
|
|
187
|
+
* whatever language is on the device, and so the cells and the caption above
|
|
188
|
+
* them end up in one set of digits.
|
|
189
|
+
*/
|
|
190
|
+
export function calendarParts(date, system, locale) {
|
|
191
|
+
if (system === 'gregory') {
|
|
192
|
+
return {
|
|
193
|
+
year: date.getFullYear(),
|
|
194
|
+
month: date.getMonth() + 1,
|
|
195
|
+
day: date.getDate()
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const parts = new Intl.DateTimeFormat(withCalendar(locale, 'islamic'), {
|
|
200
|
+
year: 'numeric',
|
|
201
|
+
month: 'numeric',
|
|
202
|
+
day: 'numeric'
|
|
203
|
+
}).formatToParts(date);
|
|
204
|
+
const read = type => Number(parts.find(part => part.type === type)?.value);
|
|
205
|
+
const year = read('year');
|
|
206
|
+
const month = read('month');
|
|
207
|
+
const day = read('day');
|
|
208
|
+
if (!Number.isFinite(year) || !Number.isFinite(month) || !Number.isFinite(day)) {
|
|
209
|
+
throw new Error('unusable');
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
year,
|
|
213
|
+
month,
|
|
214
|
+
day
|
|
215
|
+
};
|
|
216
|
+
} catch {
|
|
217
|
+
// No islamic data in this build. Gregorian is wrong, but it is coherent —
|
|
218
|
+
// the grid, the caption and the cells will at least agree with each other.
|
|
219
|
+
return {
|
|
220
|
+
year: date.getFullYear(),
|
|
221
|
+
month: date.getMonth() + 1,
|
|
222
|
+
day: date.getDate()
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export function isSameCalendarMonth(a, b, system, locale) {
|
|
227
|
+
if (system === 'gregory') return isSameMonth(a, b);
|
|
228
|
+
const one = calendarParts(a, system, locale);
|
|
229
|
+
const two = calendarParts(b, system, locale);
|
|
230
|
+
return one.year === two.year && one.month === two.month;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The first day of the calendar month `date` falls in.
|
|
235
|
+
*
|
|
236
|
+
* Walked back a day at a time rather than computed. A Hijri month is 29 or 30
|
|
237
|
+
* days depending on the year, and the platform's own calendar data already
|
|
238
|
+
* knows which — stepping until the day number reads 1 asks it, instead of
|
|
239
|
+
* shipping a table that will disagree with the device.
|
|
240
|
+
*/
|
|
241
|
+
export function startOfCalendarMonth(date, system, locale) {
|
|
242
|
+
if (system === 'gregory') return startOfMonth(date);
|
|
243
|
+
let cursor = startOfDay(date);
|
|
244
|
+
for (let step = 0; step < 31; step += 1) {
|
|
245
|
+
if (calendarParts(cursor, system, locale).day === 1) return cursor;
|
|
246
|
+
cursor = addDays(cursor, -1);
|
|
247
|
+
}
|
|
248
|
+
return cursor;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Days in the calendar month `date` falls in. */
|
|
252
|
+
export function daysInCalendarMonth(date, system, locale) {
|
|
253
|
+
if (system === 'gregory') return endOfMonth(date).getDate();
|
|
254
|
+
const start = startOfCalendarMonth(date, system, locale);
|
|
255
|
+
for (let length = 28; length <= 31; length += 1) {
|
|
256
|
+
if (calendarParts(addDays(start, length), system, locale).day === 1) return length;
|
|
257
|
+
}
|
|
258
|
+
return 30;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** Page by whole calendar months, forwards or back. */
|
|
262
|
+
export function addCalendarMonths(date, months, system, locale) {
|
|
263
|
+
if (system === 'gregory') return addMonths(date, months);
|
|
264
|
+
let cursor = startOfCalendarMonth(date, system, locale);
|
|
265
|
+
for (let step = 0; step < Math.abs(months); step += 1) {
|
|
266
|
+
cursor = months > 0 ?
|
|
267
|
+
// One past the end of this month is the first of the next.
|
|
268
|
+
addDays(cursor, daysInCalendarMonth(cursor, system, locale)) :
|
|
269
|
+
// One before the start of this month is somewhere in the previous
|
|
270
|
+
// one, which then gets walked back to its own first day.
|
|
271
|
+
startOfCalendarMonth(addDays(cursor, -1), system, locale);
|
|
272
|
+
}
|
|
273
|
+
return cursor;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** The day-of-month a cell shows. */
|
|
277
|
+
export function calendarDayNumber(date, system, locale) {
|
|
278
|
+
return system === 'gregory' ? date.getDate() : calendarParts(date, system, locale).day;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** "Ramadan 1447" or "March 2026", in whichever calendar is in force. */
|
|
282
|
+
export function calendarMonthLabel(date, system, locale) {
|
|
283
|
+
if (system === 'gregory') return monthLabel(date, locale);
|
|
284
|
+
return format(date, withCalendar(locale, 'islamic'), {
|
|
285
|
+
month: 'long',
|
|
286
|
+
year: 'numeric'
|
|
287
|
+
}) ?? monthLabel(date, locale);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The names of a calendar's months, in order, for the dropdown.
|
|
292
|
+
*
|
|
293
|
+
* Sampled from a real year in that calendar rather than from twelve Gregorian
|
|
294
|
+
* firsts — the old code did the latter and got twelve arbitrary Hijri names in
|
|
295
|
+
* whatever order the Gregorian 1sts happened to fall, then indexed them by
|
|
296
|
+
* Gregorian month, which meant nothing at all.
|
|
297
|
+
*/
|
|
298
|
+
export function calendarMonthNames(reference, system, locale, style = 'short') {
|
|
299
|
+
if (system === 'gregory') return monthNames(locale, style);
|
|
300
|
+
const names = [];
|
|
301
|
+
let cursor = startOfCalendarMonth(reference, system, locale);
|
|
302
|
+
// Back to month 1 of this year, then forward through all twelve.
|
|
303
|
+
cursor = addCalendarMonths(cursor, -(calendarParts(cursor, system, locale).month - 1), system, locale);
|
|
304
|
+
for (let month = 0; month < 12; month += 1) {
|
|
305
|
+
names.push(format(cursor, withCalendar(locale, 'islamic'), {
|
|
306
|
+
month: style
|
|
307
|
+
}) ?? String(month + 1));
|
|
308
|
+
cursor = addCalendarMonths(cursor, 1, system, locale);
|
|
309
|
+
}
|
|
310
|
+
return names;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** The whole date read out, in whichever calendar is in force. */
|
|
314
|
+
export function calendarLongDate(date, system, locale) {
|
|
315
|
+
if (system === 'gregory') return longDate(date, locale);
|
|
316
|
+
return format(date, withCalendar(locale, 'islamic'), {
|
|
317
|
+
weekday: 'long',
|
|
318
|
+
day: 'numeric',
|
|
319
|
+
month: 'long',
|
|
320
|
+
year: 'numeric'
|
|
321
|
+
}) ?? longDate(date, locale);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** The compact form a trigger shows, in whichever calendar is in force. */
|
|
325
|
+
export function calendarShortDate(date, system, locale) {
|
|
326
|
+
if (system === 'gregory') return shortDate(date, locale);
|
|
327
|
+
return format(date, withCalendar(locale, 'islamic'), {
|
|
328
|
+
day: 'numeric',
|
|
329
|
+
month: 'short',
|
|
330
|
+
year: 'numeric'
|
|
331
|
+
}) ?? shortDate(date, locale);
|
|
332
|
+
}
|
|
333
|
+
const MONTHS_EN = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
334
|
+
const WEEKDAYS_EN = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
335
|
+
|
|
336
|
+
/** Month names in order, for the caption and its dropdown. */
|
|
337
|
+
export function monthNames(locale, style = 'long') {
|
|
338
|
+
return MONTHS_EN.map((fallback, month) => {
|
|
339
|
+
const formatted = formatGregory(new Date(2021, month, 1), locale, {
|
|
340
|
+
month: style
|
|
341
|
+
});
|
|
342
|
+
return formatted ?? (style === 'short' ? fallback.slice(0, 3) : fallback);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Column headings, rotated so the first one is `weekStartsOn`. */
|
|
347
|
+
export function weekdayNames(locale, weekStartsOn) {
|
|
348
|
+
// 2021-08-01 was a Sunday, so adding the index lands on each weekday in turn.
|
|
349
|
+
return Array.from({
|
|
350
|
+
length: 7
|
|
351
|
+
}, (_unused, day) => {
|
|
352
|
+
const index = (day + weekStartsOn) % 7;
|
|
353
|
+
const formatted = formatGregory(new Date(2021, 7, 1 + index), locale, {
|
|
354
|
+
weekday: 'short'
|
|
355
|
+
});
|
|
356
|
+
return formatted ?? WEEKDAYS_EN[index];
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** "March 2026", for the caption. */
|
|
361
|
+
export function monthLabel(date, locale) {
|
|
362
|
+
return formatGregory(date, locale, {
|
|
363
|
+
month: 'long',
|
|
364
|
+
year: 'numeric'
|
|
365
|
+
}) ?? `${MONTHS_EN[date.getMonth()]} ${date.getFullYear()}`;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** "12 March 2026" — the whole date, for a screen reader to read out. */
|
|
369
|
+
export function longDate(date, locale) {
|
|
370
|
+
return formatGregory(date, locale, {
|
|
371
|
+
weekday: 'long',
|
|
372
|
+
day: 'numeric',
|
|
373
|
+
month: 'long',
|
|
374
|
+
year: 'numeric'
|
|
375
|
+
}) ?? `${WEEKDAYS_EN[date.getDay()]} ${date.getDate()} ${MONTHS_EN[date.getMonth()]} ${date.getFullYear()}`;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** "12 Mar 2026" — the compact form a trigger shows. */
|
|
379
|
+
export function shortDate(date, locale) {
|
|
380
|
+
return formatGregory(date, locale, {
|
|
381
|
+
day: 'numeric',
|
|
382
|
+
month: 'short',
|
|
383
|
+
year: 'numeric'
|
|
384
|
+
}) ?? `${date.getDate()} ${MONTHS_EN[date.getMonth()].slice(0, 3)} ${date.getFullYear()}`;
|
|
385
|
+
}
|
|
386
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["startOfDay","date","copy","Date","setHours","isSameDay","a","b","getFullYear","getMonth","getDate","isSameMonth","startOfMonth","endOfMonth","addMonths","months","setMonth","addDays","days","setDate","daysBetween","MS","Math","round","getTime","isBefore","isAfter","isWithin","from","to","time","start","end","min","max","clampDate","monthGrid","month","weekStartsOn","first","lead","getDay","Array","length","_unusedWeek","week","_unusedDay","day","format","locale","options","Intl","DateTimeFormat","withCalendar","calendar","base","split","formatGregory","numberingSystem","resolveCalendar","system","resolved","resolvedOptions","startsWith","calendarParts","year","parts","formatToParts","read","type","Number","find","part","value","isFinite","Error","isSameCalendarMonth","one","two","startOfCalendarMonth","cursor","step","daysInCalendarMonth","addCalendarMonths","abs","calendarDayNumber","calendarMonthLabel","monthLabel","calendarMonthNames","reference","style","monthNames","names","push","String","calendarLongDate","longDate","weekday","calendarShortDate","shortDate","MONTHS_EN","WEEKDAYS_EN","map","fallback","formatted","slice","weekdayNames","_unused","index"],"sourceRoot":"../../../src","sources":["utils/date.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASpF,OAAO,EAAQ,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/accordion/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASpF,OAAO,EAAQ,KAAK,SAAS,EAAgB,MAAM,0BAAuB,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AA0E3D,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,2DAA2D;IAC3D,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA0ED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA6BD,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA4BD,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AA4BD,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAiCD,eAAO,MAAM,SAAS;;;;;;CAMpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/alert/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAQ,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/alert/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1D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