@seed-design/lynx-react 0.7.1 → 0.9.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/components/Accordion/Accordion.jsx +2 -2
- package/lib/components/ActionButton/ActionButton.jsx +1 -1
- package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
- package/lib/components/AlertDialog/index.d.ts +3 -0
- package/lib/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +14 -1
- package/lib/components/AppBar/AppBar.d.ts.map +1 -1
- package/lib/components/AppBar/AppBar.jsx +42 -16
- package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
- package/lib/components/AppBar/context.d.ts +2 -1
- package/lib/components/AppBar/context.d.ts.map +1 -1
- package/lib/components/AppBar/index.d.ts +1 -1
- package/lib/components/AppBar/index.d.ts.map +1 -1
- package/lib/components/AppBar/useAppBar.d.ts +2 -1
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -1
- package/lib/components/AppBar/useAppBar.js +17 -15
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
- package/lib/components/AttachmentDisplay/index.d.ts +2 -0
- package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
- package/lib/components/AttachmentInput/index.d.ts +2 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
- package/lib/components/Box/Box.d.ts +3 -3
- package/lib/components/Box/Box.d.ts.map +1 -1
- package/lib/components/Callout/Callout.jsx +2 -2
- package/lib/components/Checkbox/Checkbox.jsx +2 -2
- package/lib/components/Chip/Chip.jsx +2 -2
- package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
- package/lib/components/ChipTabs/index.d.ts +3 -0
- package/lib/components/ChipTabs/index.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
- package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
- package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.d.ts +87 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.jsx +147 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.namespace.js +18 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
- package/lib/components/FloatingActionButton/index.d.ts +3 -0
- package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
- package/lib/components/HelpBubble/index.d.ts +3 -0
- package/lib/components/HelpBubble/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +1 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.jsx +2 -1
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
- package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
- package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.d.ts +2 -0
- package/lib/components/InputButton/InputButton.d.ts.map +1 -1
- package/lib/components/InputButton/InputButton.jsx +40 -8
- package/lib/components/List/List.d.ts +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.jsx +26 -12
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.jsx +15 -5
- package/lib/components/PageBanner/PageBanner.d.ts +3 -0
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.jsx +49 -11
- package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
- package/lib/components/QuantityPicker/index.d.ts +3 -0
- package/lib/components/QuantityPicker/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
- package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
- package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
- package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
- package/lib/components/ScrollFog/index.d.ts +2 -0
- package/lib/components/ScrollFog/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
- package/lib/components/Select/Select.d.ts +112 -0
- package/lib/components/Select/Select.d.ts.map +1 -0
- package/lib/components/Select/Select.jsx +885 -0
- package/lib/components/Select/Select.namespace.d.ts +2 -0
- package/lib/components/Select/Select.namespace.d.ts.map +1 -0
- package/lib/components/Select/Select.namespace.js +23 -0
- package/lib/components/Select/index.d.ts +3 -0
- package/lib/components/Select/index.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +15 -0
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.jsx +18 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.d.ts.map +1 -0
- package/lib/components/Slider/Slider.d.ts +101 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -0
- package/lib/components/Slider/Slider.jsx +573 -0
- package/lib/components/Slider/Slider.namespace.d.ts +2 -0
- package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
- package/lib/components/Slider/Slider.namespace.js +19 -0
- package/lib/components/Slider/Slider.utils.d.ts +19 -0
- package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
- package/lib/components/Slider/Slider.utils.js +106 -0
- package/lib/components/Slider/index.d.ts +3 -0
- package/lib/components/Slider/index.d.ts.map +1 -0
- package/lib/components/Stack/Stack.d.ts +7 -9
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +5 -3
- package/lib/components/Tabs/Tabs.d.ts +34 -2
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.jsx +186 -56
- package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
- package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.utils.js +24 -3
- package/lib/components/Tabs/index.d.ts +1 -1
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useControllableState.d.ts +1 -14
- package/lib/hooks/useControllableState.d.ts.map +1 -1
- package/lib/hooks/usePressTap.d.ts +1 -27
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/hooks/useSafeArea.d.ts +8 -4
- package/lib/hooks/useSafeArea.d.ts.map +1 -1
- package/lib/hooks/useSafeArea.js +22 -20
- package/lib/index.js +29 -6
- package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
- package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
- package/lib/types.d.ts +1 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/styled.d.ts +46 -6
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +19 -4
- package/package.json +9 -5
- package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
- package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
- package/src/components/AlertDialog/AlertDialog.tsx +374 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AppBar/AppBar.namespace.ts +1 -0
- package/src/components/AppBar/AppBar.test.tsx +252 -3
- package/src/components/AppBar/AppBar.tsx +108 -25
- package/src/components/AppBar/context.ts +3 -1
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/AppBar/useAppBar.ts +21 -15
- package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
- package/src/components/AttachmentDisplay/index.ts +48 -0
- package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
- package/src/components/AttachmentInput/index.ts +49 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
- package/src/components/BottomSheet/BottomSheet.tsx +1 -19
- package/src/components/Box/Box.test.tsx +104 -0
- package/src/components/Box/Box.tsx +9 -6
- package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
- package/src/components/ChipTabs/ChipTabs.tsx +119 -0
- package/src/components/ChipTabs/index.ts +16 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
- package/src/components/ContextualFloatingButton/index.ts +4 -0
- package/src/components/Dialog/Dialog.namespace.ts +24 -0
- package/src/components/Dialog/Dialog.test.tsx +172 -0
- package/src/components/Dialog/Dialog.tsx +373 -0
- package/src/components/Dialog/index.ts +26 -0
- package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
- package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
- package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
- package/src/components/FloatingActionButton/index.ts +10 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
- package/src/components/HelpBubble/HelpBubble.tsx +998 -0
- package/src/components/HelpBubble/index.ts +26 -0
- package/src/components/Icon/Icon.test.tsx +0 -3
- package/src/components/Icon/Icon.tsx +11 -1
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
- package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
- package/src/components/IdentityPlaceholder/index.ts +8 -0
- package/src/components/InputButton/InputButton.test.tsx +128 -1
- package/src/components/InputButton/InputButton.tsx +60 -9
- package/src/components/List/List.test.tsx +54 -2
- package/src/components/List/List.tsx +43 -10
- package/src/components/Menu/Menu.tsx +14 -4
- package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
- package/src/components/PageBanner/PageBanner.test.tsx +110 -3
- package/src/components/PageBanner/PageBanner.tsx +83 -19
- package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
- package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
- package/src/components/QuantityPicker/index.ts +14 -0
- package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
- package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
- package/src/components/ReactionButton/ReactionButton.tsx +20 -12
- package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
- package/src/components/ScrollFog/ScrollFog.tsx +172 -0
- package/src/components/ScrollFog/index.ts +1 -0
- package/src/components/Select/Select.namespace.ts +34 -0
- package/src/components/Select/Select.test.tsx +297 -0
- package/src/components/Select/Select.tsx +1483 -0
- package/src/components/Select/index.ts +39 -0
- package/src/components/Skeleton/Skeleton.test.tsx +64 -0
- package/src/components/Skeleton/Skeleton.tsx +45 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Slider/Slider.namespace.ts +26 -0
- package/src/components/Slider/Slider.test.tsx +260 -0
- package/src/components/Slider/Slider.tsx +897 -0
- package/src/components/Slider/Slider.utils.ts +167 -0
- package/src/components/Slider/index.ts +30 -0
- package/src/components/Stack/Stack.test.tsx +7 -0
- package/src/components/Stack/Stack.tsx +11 -10
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
- package/src/components/Switch/Switch.tsx +14 -13
- package/src/components/Tabs/Tabs.test.tsx +218 -1
- package/src/components/Tabs/Tabs.tsx +346 -75
- package/src/components/Tabs/Tabs.utils.ts +51 -1
- package/src/components/Tabs/index.ts +17 -1
- package/src/components/index.ts +14 -0
- package/src/hooks/useControllableState.ts +1 -43
- package/src/hooks/usePressTap.test.ts +23 -11
- package/src/hooks/usePressTap.ts +1 -60
- package/src/hooks/useSafeArea.test.ts +13 -1
- package/src/hooks/useSafeArea.ts +25 -23
- package/src/types.ts +1 -0
- package/src/utils/styled.ts +127 -9
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
//#region src/components/Slider/Slider.utils.ts
|
|
2
|
+
function clamp(value, min, max) {
|
|
3
|
+
return Math.min(max, Math.max(min, value));
|
|
4
|
+
}
|
|
5
|
+
function percentageForValue(value, min, max) {
|
|
6
|
+
if (max === min) return 0;
|
|
7
|
+
return clamp((value - min) / (max - min) * 100, 0, 100);
|
|
8
|
+
}
|
|
9
|
+
function valueForPercentage(percent, min, max, dir) {
|
|
10
|
+
const ratio = clamp(percent, 0, 100) / 100;
|
|
11
|
+
return dir === "rtl" ? max - ratio * (max - min) : min + ratio * (max - min);
|
|
12
|
+
}
|
|
13
|
+
function decimalCount(value) {
|
|
14
|
+
const exponent = String(value).toLowerCase().split("e");
|
|
15
|
+
return (exponent[0].split(".")[1]?.length ?? 0) + (exponent[1] ? Math.max(0, -Number(exponent[1])) : 0);
|
|
16
|
+
}
|
|
17
|
+
function roundValue(value, decimals) {
|
|
18
|
+
const factor = 10 ** decimals;
|
|
19
|
+
return Math.round(value * factor) / factor;
|
|
20
|
+
}
|
|
21
|
+
function closestAllowedValue(value, allowedValues) {
|
|
22
|
+
if (allowedValues.length === 0) return value;
|
|
23
|
+
let closest = allowedValues[0];
|
|
24
|
+
let distance = Math.abs(value - closest);
|
|
25
|
+
for (let index = 1; index < allowedValues.length; index += 1) {
|
|
26
|
+
const candidate = allowedValues[index];
|
|
27
|
+
const candidateDistance = Math.abs(value - candidate);
|
|
28
|
+
if (candidateDistance < distance) {
|
|
29
|
+
closest = candidate;
|
|
30
|
+
distance = candidateDistance;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return closest;
|
|
34
|
+
}
|
|
35
|
+
function normalizeValue(value, min, max, step, allowedValues) {
|
|
36
|
+
const safeMin = Math.min(min, max);
|
|
37
|
+
const safeMax = Math.max(min, max);
|
|
38
|
+
const candidate = Number.isFinite(value) ? value : safeMin;
|
|
39
|
+
if (allowedValues && allowedValues.length > 0) return closestAllowedValue(candidate, allowedValues);
|
|
40
|
+
const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
|
|
41
|
+
const decimals = Math.max(decimalCount(safeStep), decimalCount(safeMin));
|
|
42
|
+
return clamp(roundValue(Math.round((candidate - safeMin) / safeStep) * safeStep + safeMin, decimals), safeMin, safeMax);
|
|
43
|
+
}
|
|
44
|
+
function normalizeValues(values, min, max, step, allowedValues) {
|
|
45
|
+
return (values && values.length > 0 ? values : [(min + max) / 2]).map((value) => normalizeValue(value, min, max, step, allowedValues)).sort((a, b) => a - b);
|
|
46
|
+
}
|
|
47
|
+
function nearestValueIndex(values, value) {
|
|
48
|
+
if (values.length < 2) return 0;
|
|
49
|
+
let index = 0;
|
|
50
|
+
let distance = Math.abs(values[0] - value);
|
|
51
|
+
for (let candidate = 1; candidate < values.length; candidate += 1) {
|
|
52
|
+
const candidateDistance = Math.abs(values[candidate] - value);
|
|
53
|
+
if (candidateDistance < distance) {
|
|
54
|
+
index = candidate;
|
|
55
|
+
distance = candidateDistance;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return index;
|
|
59
|
+
}
|
|
60
|
+
function hasMinimumSteps(values, minimumSteps, step) {
|
|
61
|
+
if (minimumSteps <= 0 || values.length < 2) return true;
|
|
62
|
+
const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
|
|
63
|
+
const decimals = decimalCount(safeStep);
|
|
64
|
+
const required = roundValue(minimumSteps * safeStep, decimals);
|
|
65
|
+
for (let index = 1; index < values.length; index += 1) if (roundValue(values[index] - values[index - 1], decimals) < required) return false;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
function getThumbInBoundsOffset(width, percent, direction) {
|
|
69
|
+
if (!width) return 0;
|
|
70
|
+
const halfWidth = width / 2;
|
|
71
|
+
return (halfWidth - clamp(percent, 0, 100) / 50 * halfWidth * direction) * direction;
|
|
72
|
+
}
|
|
73
|
+
function getStickyLabelOffset(labelWidth, percent, thumbWidth, trackWidth, direction) {
|
|
74
|
+
if (!labelWidth || !trackWidth) return 0;
|
|
75
|
+
const thumbOffset = getThumbInBoundsOffset(thumbWidth, percent, direction);
|
|
76
|
+
const naturalCenter = percent / 100 * trackWidth + thumbOffset;
|
|
77
|
+
const halfLabel = labelWidth / 2;
|
|
78
|
+
return (clamp(naturalCenter, halfLabel, trackWidth - halfLabel) - percent / 100 * trackWidth) * direction;
|
|
79
|
+
}
|
|
80
|
+
function eventPageX(event) {
|
|
81
|
+
const target = event;
|
|
82
|
+
const touch = target?.touches?.[0] ?? target?.changedTouches?.[0];
|
|
83
|
+
const candidates = [
|
|
84
|
+
touch?.pageX,
|
|
85
|
+
touch?.clientX,
|
|
86
|
+
target?.pageX,
|
|
87
|
+
target?.clientX,
|
|
88
|
+
target?.detail?.x
|
|
89
|
+
];
|
|
90
|
+
for (const candidate of candidates) {
|
|
91
|
+
const number = Number(candidate);
|
|
92
|
+
if (Number.isFinite(number)) return number;
|
|
93
|
+
}
|
|
94
|
+
return NaN;
|
|
95
|
+
}
|
|
96
|
+
function geometryFromRect(value) {
|
|
97
|
+
const rect = value;
|
|
98
|
+
const left = Number(rect?.left);
|
|
99
|
+
const width = Number(rect?.width);
|
|
100
|
+
return Number.isFinite(left) && Number.isFinite(width) && width > 0 ? {
|
|
101
|
+
left,
|
|
102
|
+
width
|
|
103
|
+
} : null;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { eventPageX, geometryFromRect, getStickyLabelOffset, getThumbInBoundsOffset, hasMinimumSteps, nearestValueIndex, normalizeValue, normalizeValues, percentageForValue, valueForPercentage };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { SliderRoot, SliderControl, SliderTrack, SliderRange, SliderThumb, SliderTick, SliderMarkers, SliderMarker, SliderValueIndicatorRoot, SliderValueIndicatorArrow, SliderValueIndicatorArrowTip, SliderValueIndicatorLabel, type SliderClassNames, type SliderValues, type SliderRootProps, type SliderControlProps, type SliderTrackProps, type SliderRangeProps, type SliderThumbProps, type SliderTickProps, type SliderMarkersProps, type SliderMarkerProps, type SliderValueIndicatorRootProps, type SliderValueIndicatorArrowProps, type SliderValueIndicatorArrowTipProps, type SliderValueIndicatorLabelProps, } from './Slider';
|
|
2
|
+
export * as Slider from './Slider.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,8BAA8B,GACpC,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
2
|
-
import { StyleProps } from '../../utils/styled';
|
|
2
|
+
import { MarginBleedStyleProps, StyleProps } from '../../utils/styled';
|
|
3
3
|
import * as React from "@lynx-js/react";
|
|
4
4
|
type StackStyleProps = "display" | "flexDirection" | "alignItems" | "justifyContent" | "flexWrap" | "flexGrow" | "flexShrink";
|
|
5
5
|
interface StackBaseProps extends StyleProps, LynxStyledElementProps, LynxPressableProps {
|
|
@@ -16,18 +16,16 @@ interface StackBaseProps extends StyleProps, LynxStyledElementProps, LynxPressab
|
|
|
16
16
|
* 패키지 컴포넌트 내부에서는 `Box`를 합성하지 않고 native tag와 recipe className을
|
|
17
17
|
* 사용해 primitive 컴포넌트 비용이 누적되지 않도록 합니다.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type StackProps = Omit<StackBaseProps, StackStyleProps> & MarginBleedStyleProps & {
|
|
20
20
|
align?: StackBaseProps["alignItems"];
|
|
21
21
|
justify?: StackBaseProps["justifyContent"];
|
|
22
22
|
wrap?: StackBaseProps["flexWrap"];
|
|
23
23
|
grow?: StackBaseProps["flexGrow"];
|
|
24
24
|
shrink?: StackBaseProps["flexShrink"];
|
|
25
|
-
}
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
export declare const VStack: React.ForwardRefExoticComponent<VStackProps & React.RefAttributes<unknown>>;
|
|
31
|
-
export declare const HStack: React.ForwardRefExoticComponent<HStackProps & React.RefAttributes<unknown>>;
|
|
25
|
+
};
|
|
26
|
+
export type VStackProps = StackProps;
|
|
27
|
+
export type HStackProps = StackProps;
|
|
28
|
+
export declare const VStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<unknown>>;
|
|
29
|
+
export declare const HStack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<unknown>>;
|
|
32
30
|
export {};
|
|
33
31
|
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../../src/components/Stack/Stack.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAiB,KAAK,qBAAqB,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhG,KAAK,eAAe,GAChB,SAAS,GACT,eAAe,GACf,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEjB,UAAU,cAAe,SAAQ,UAAU,EAAE,sBAAsB,EAAE,kBAAkB;IACrF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,GAC5D,qBAAqB,GAAG;IACtB,KAAK,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC;CACvC,CAAC;AAEJ,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC;AAuDrC,eAAO,MAAM,MAAM,4EAIjB,CAAC;AAIH,eAAO,MAAM,MAAM,4EAIjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwipeableMenuSheet.d.ts","sourceRoot":"","sources":["../../../src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEtF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SwipeableMenuSheet.d.ts","sourceRoot":"","sources":["../../../src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx"],"names":[],"mappings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usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
2
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
2
3
|
import { toArray } from "../../utils/children.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
3
5
|
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
4
6
|
import { useSafeArea } from "../../hooks/useSafeArea.js";
|
|
5
7
|
import { IconSlotProvider } from "../Icon/Icon.jsx";
|
|
@@ -165,9 +167,9 @@ SwipeableMenuSheetGroup.displayName = "SwipeableMenuSheetGroup";
|
|
|
165
167
|
var SwipeableMenuSheetFooter = createViewSlot("footer");
|
|
166
168
|
SwipeableMenuSheetFooter.displayName = "SwipeableMenuSheetFooter";
|
|
167
169
|
var SwipeableMenuSheetCloseButton = forwardRef((props, ref) => {
|
|
168
|
-
const { children, className, style, bindtap: userBindtap, "main-thread:bindtap": userMainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel = "Close", "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, "accessibility-elements-hidden": accessibilityElementsHidden, "accessibility-heading": accessibilityHeading, "accessibility-actions": accessibilityActions, "accessibility-exclusive-focus": accessibilityExclusiveFocus, "ios-platform-accessibility-id": iosPlatformAccessibilityId } = props;
|
|
170
|
+
const { children, className, style, bindtap: userBindtap, "main-thread:bindtap": userMainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel = "Close", "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, "accessibility-elements-hidden": accessibilityElementsHidden, "accessibility-heading": accessibilityHeading, "accessibility-actions": accessibilityActions, "accessibility-exclusive-focus": accessibilityExclusiveFocus, "ios-platform-accessibility-id": iosPlatformAccessibilityId, ...nativeProps } = props;
|
|
169
171
|
const { rootRef, setPendingReason, skipAnimation } = useSwipeableMenuSheetContext();
|
|
170
|
-
const { pressed, ...pressHandlers } = usePressTap({
|
|
172
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
171
173
|
onTap: React.useCallback((event, instance) => {
|
|
172
174
|
setPendingReason("closeButton");
|
|
173
175
|
closeSheet(rootRef, skipAnimation);
|
|
@@ -180,11 +182,16 @@ var SwipeableMenuSheetCloseButton = forwardRef((props, ref) => {
|
|
|
180
182
|
]),
|
|
181
183
|
mainThreadOnTap: userMainThreadBindtap
|
|
182
184
|
});
|
|
185
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
186
|
+
onTouchStart: bindtouchstart,
|
|
187
|
+
onTouchEnd: bindtouchend,
|
|
188
|
+
onTouchCancel: bindtouchcancel
|
|
189
|
+
});
|
|
183
190
|
const classNames = menuSheet({
|
|
184
191
|
skipAnimation,
|
|
185
192
|
closeButtonPressed: pressed
|
|
186
193
|
});
|
|
187
|
-
return <view {...ref ? { ref } : {}} {...pressHandlers} className={clsx(classNames.closeButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits} accessibility-value={accessibilityValue} accessibility-elements-hidden={accessibilityElementsHidden} accessibility-heading={accessibilityHeading} accessibility-actions={accessibilityActions} accessibility-exclusive-focus={accessibilityExclusiveFocus} ios-platform-accessibility-id={iosPlatformAccessibilityId}>
|
|
194
|
+
return <view {...ref ? { ref } : {}} {...mergeProps(scaleFeedbackTriggerProps, scaleFeedbackTargetProps, pressHandlers, nativeProps)} className={clsx(classNames.closeButton, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits} accessibility-value={accessibilityValue} accessibility-elements-hidden={accessibilityElementsHidden} accessibility-heading={accessibilityHeading} accessibility-actions={accessibilityActions} accessibility-exclusive-focus={accessibilityExclusiveFocus} ios-platform-accessibility-id={iosPlatformAccessibilityId}>
|
|
188
195
|
<text className={classNames.closeButtonLabel}>{children}</text>
|
|
189
196
|
</view>;
|
|
190
197
|
});
|
|
@@ -196,15 +203,20 @@ function useSwipeableMenuSheetItemContext() {
|
|
|
196
203
|
return context;
|
|
197
204
|
}
|
|
198
205
|
var SwipeableMenuSheetItem = forwardRef((props, ref) => {
|
|
199
|
-
const { children, className, style, tone = "neutral", labelAlign, bindtap: userBindtap, "main-thread:bindtap": userMainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, "accessibility-elements-hidden": accessibilityElementsHidden, "accessibility-heading": accessibilityHeading, "accessibility-actions": accessibilityActions, "accessibility-exclusive-focus": accessibilityExclusiveFocus, "ios-platform-accessibility-id": iosPlatformAccessibilityId } = props;
|
|
206
|
+
const { children, className, style, tone = "neutral", labelAlign, bindtap: userBindtap, "main-thread:bindtap": userMainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, "accessibility-elements-hidden": accessibilityElementsHidden, "accessibility-heading": accessibilityHeading, "accessibility-actions": accessibilityActions, "accessibility-exclusive-focus": accessibilityExclusiveFocus, "ios-platform-accessibility-id": iosPlatformAccessibilityId, ...nativeProps } = props;
|
|
200
207
|
const groupLabelAlign = React.useContext(GroupLabelAlignContext);
|
|
201
208
|
const contentLabelAlign = React.useContext(ContentLabelAlignContext);
|
|
202
209
|
const { isLast } = React.useContext(SwipeableMenuSheetItemPositionContext);
|
|
203
210
|
const resolvedLabelAlign = labelAlign ?? groupLabelAlign ?? contentLabelAlign ?? "left";
|
|
204
|
-
const { pressed, ...pressHandlers } = usePressTap({
|
|
211
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
205
212
|
onTap: userBindtap,
|
|
206
213
|
mainThreadOnTap: userMainThreadBindtap
|
|
207
214
|
});
|
|
215
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
216
|
+
onTouchStart: bindtouchstart,
|
|
217
|
+
onTouchEnd: bindtouchend,
|
|
218
|
+
onTouchCancel: bindtouchcancel
|
|
219
|
+
});
|
|
208
220
|
const classNames = menuSheetItem({
|
|
209
221
|
tone,
|
|
210
222
|
labelAlign: resolvedLabelAlign,
|
|
@@ -220,8 +232,10 @@ var SwipeableMenuSheetItem = forwardRef((props, ref) => {
|
|
|
220
232
|
pressed
|
|
221
233
|
]
|
|
222
234
|
}}>
|
|
223
|
-
<view {...ref ? { ref } : {}} {...pressHandlers} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits} accessibility-value={accessibilityValue} accessibility-elements-hidden={accessibilityElementsHidden} accessibility-heading={accessibilityHeading} accessibility-actions={accessibilityActions} accessibility-exclusive-focus={accessibilityExclusiveFocus} ios-platform-accessibility-id={iosPlatformAccessibilityId}>
|
|
224
|
-
{
|
|
235
|
+
<view {...ref ? { ref } : {}} {...mergeProps(scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits} accessibility-value={accessibilityValue} accessibility-elements-hidden={accessibilityElementsHidden} accessibility-heading={accessibilityHeading} accessibility-actions={accessibilityActions} accessibility-exclusive-focus={accessibilityExclusiveFocus} ios-platform-accessibility-id={iosPlatformAccessibilityId}>
|
|
236
|
+
<view className={classNames.scaleContent} {...scaleFeedbackTargetProps}>
|
|
237
|
+
{children}
|
|
238
|
+
</view>
|
|
225
239
|
</view>
|
|
226
240
|
{!isLast ? <view className={classNames.divider} accessibility-elements-hidden={true} /> : null}
|
|
227
241
|
</IconSlotProvider>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAIxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAKvF,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAIxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAKvF,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAI/F;;;;;;;;;;;GAWG;AAEH,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,wBAAwB,EAAE,wBAAwB,CAAC;CACpD;AAID,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAMrE;AAmBD,MAAM,WAAW,eACf,SAAQ,kBAAkB,EACxB,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,EACpC,sBAAsB,EACtB,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,UAAU,iFAiFrB,CAAC;AAKH,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,CAAC,EAEnD,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC;CAAG;AAE9C,eAAO,MAAM,aAAa,oFA8BxB,CAAC;AAKH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,OAAO,CAAC;CAAG;AAEhG,eAAO,MAAM,WAAW,kFAUtB,CAAC;AAKH,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;CAAG;AAEnE,eAAO,MAAM,WAAW,kFAgBtB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useControllableState } from "../../
|
|
2
|
-
import { usePressTap } from "../../
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
3
|
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
4
|
import { mergeProps } from "../../utils/merge-props.js";
|
|
5
|
+
import { ScaleFeedbackContentContext } from "../../contexts/ScaleFeedbackContentContext.js";
|
|
5
6
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
6
7
|
import * as React from "@lynx-js/react";
|
|
7
8
|
import clsx from "clsx";
|
|
@@ -75,6 +76,7 @@ var SwitchControl = React.forwardRef((props, ref) => {
|
|
|
75
76
|
const [variantProps, restProps] = switchmark.splitVariantProps(props);
|
|
76
77
|
const { children, className, ...nativeProps } = restProps;
|
|
77
78
|
const context = useSwitchContext("SwitchControl");
|
|
79
|
+
const hasScaledContent = React.useContext(ScaleFeedbackContentContext);
|
|
78
80
|
const switchmarkVariantProps = {
|
|
79
81
|
...context.switchmarkVariantProps,
|
|
80
82
|
...variantProps,
|
|
@@ -86,7 +88,7 @@ var SwitchControl = React.forwardRef((props, ref) => {
|
|
|
86
88
|
thumbClassName: classes.thumb,
|
|
87
89
|
switchmarkVariantProps
|
|
88
90
|
}}>
|
|
89
|
-
<view {...mergeProps(ref ? { ref } : {}, context.scaleFeedbackTargetProps, nativeProps)} className={clsx(classes.root, className)} flatten={false}>
|
|
91
|
+
<view {...mergeProps(ref ? { ref } : {}, !hasScaledContent ? context.scaleFeedbackTargetProps : {}, nativeProps)} className={clsx(classes.root, className)} flatten={false}>
|
|
90
92
|
{children}
|
|
91
93
|
</view>
|
|
92
94
|
</SwitchmarkControlContext.Provider>;
|
|
@@ -3,6 +3,29 @@ import { IntrinsicElements } from '@lynx-js/types';
|
|
|
3
3
|
import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
4
4
|
import * as React from "@lynx-js/react";
|
|
5
5
|
type NativeViewPagerProps = IntrinsicElements["viewpager"];
|
|
6
|
+
type NativeScrollViewProps = IntrinsicElements["scroll-view"];
|
|
7
|
+
type TabsSharedClassNames = {
|
|
8
|
+
root: string;
|
|
9
|
+
list: string;
|
|
10
|
+
listContent: string;
|
|
11
|
+
carousel: string;
|
|
12
|
+
carouselCamera: string;
|
|
13
|
+
content: string;
|
|
14
|
+
trigger: string;
|
|
15
|
+
triggerLabel: string;
|
|
16
|
+
};
|
|
17
|
+
type TabsRecipeState = {
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
pressed?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
inCarousel?: boolean;
|
|
22
|
+
transitionEnabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type TabsRecipeAdapter = {
|
|
25
|
+
getClassNames: (state?: TabsRecipeState) => TabsSharedClassNames;
|
|
26
|
+
getIndicatorClassName?: (state?: TabsRecipeState) => string;
|
|
27
|
+
triggerGap: number;
|
|
28
|
+
};
|
|
6
29
|
type TabsPublicVariantProps = Omit<TabsVariantProps, "selected" | "disabled" | "inCarousel" | "transitionEnabled">;
|
|
7
30
|
/**
|
|
8
31
|
* @platform Lynx
|
|
@@ -17,10 +40,17 @@ export interface TabsRootProps extends TabsPublicVariantProps, LynxStyledElement
|
|
|
17
40
|
defaultValue?: string;
|
|
18
41
|
onValueChange?: (value: string) => void;
|
|
19
42
|
}
|
|
43
|
+
interface TabsRootPrimitiveProps extends Omit<TabsRootProps, keyof TabsPublicVariantProps> {
|
|
44
|
+
recipe: TabsRecipeAdapter;
|
|
45
|
+
inlineNotification?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare const TabsRootPrimitive: React.ForwardRefExoticComponent<TabsRootPrimitiveProps & React.RefAttributes<unknown>>;
|
|
20
48
|
export declare const TabsRoot: React.ForwardRefExoticComponent<TabsRootProps & React.RefAttributes<unknown>>;
|
|
21
|
-
export interface TabsListProps extends LynxStyledElementProps {
|
|
49
|
+
export interface TabsListProps extends LynxStyledElementProps, Omit<NativeScrollViewProps, "children" | "className" | "style" | "scroll-orientation" | "scroll-bar-enable" | "bindlayoutchange" | "bindscroll" | "bindcontentsizechanged"> {
|
|
50
|
+
/** 선택한 tab을 목록 안에서 정렬할 방식입니다. @defaultValue "start" */
|
|
51
|
+
scrollAlign?: "nearest" | "start" | "center" | "end";
|
|
22
52
|
}
|
|
23
|
-
export declare const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<unknown>>;
|
|
53
|
+
export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & React.RefAttributes<unknown>>;
|
|
24
54
|
export interface TabsTriggerProps extends Omit<LynxStyledElementProps, "children" | "flatten">, Pick<LynxPressableProps, "bindtap"> {
|
|
25
55
|
children: string | number;
|
|
26
56
|
value: string;
|
|
@@ -47,7 +77,9 @@ export interface TabsCarouselProps extends LynxStyledElementProps {
|
|
|
47
77
|
/** iOS 뒤로가기 제스처를 우선하는 화면 왼쪽 가장자리 너비입니다. */
|
|
48
78
|
iosBackGestureEdgeWidth?: number;
|
|
49
79
|
onSettle?: () => void;
|
|
80
|
+
/** 네이티브 pager가 drag를 감지했을 때 호출합니다. */
|
|
50
81
|
onSwipeStart?: () => void;
|
|
82
|
+
/** 시작된 스와이프가 끝나거나 취소되면 호출합니다. */
|
|
51
83
|
onSwipeEnd?: () => void;
|
|
52
84
|
}
|
|
53
85
|
export declare const TabsCarousel: React.ForwardRefExoticComponent<TabsCarouselProps & React.RefAttributes<unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEjF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EACV,iBAAiB,EAMlB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAerB,KAAK,oBAAoB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAI3D,KAAK,qBAAqB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAsC9D,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MA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