@xaui/native 0.2.8 → 0.9.1-alpha.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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
|
|
4
|
-
type ExpansionPanelVariant = 'light' | 'bordered' | 'splitted';
|
|
5
|
-
type ExpansionPanelSelectionMode = 'toggle' | 'multiple';
|
|
6
|
-
type ExpansionPanelEvents = {
|
|
7
|
-
onSelectionChange?: (selectedKeys: string[]) => void;
|
|
8
|
-
};
|
|
9
|
-
type ExpansionPanelCustomAppearance = {
|
|
10
|
-
/**
|
|
11
|
-
* Custom styles for the container
|
|
12
|
-
*/
|
|
13
|
-
container?: ViewStyle;
|
|
14
|
-
/**
|
|
15
|
-
* Custom styles for individual items
|
|
16
|
-
*/
|
|
17
|
-
item?: ViewStyle;
|
|
18
|
-
};
|
|
19
|
-
type ExpansionPanelProps = {
|
|
20
|
-
/**
|
|
21
|
-
* List of ExpansionPanelItem components
|
|
22
|
-
*/
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
* Visual variant of the expansion-panel
|
|
26
|
-
* @default 'light'
|
|
27
|
-
*/
|
|
28
|
-
variant?: ExpansionPanelVariant;
|
|
29
|
-
/**
|
|
30
|
-
* Selection behavior mode
|
|
31
|
-
* - toggle: Only one expansion-panel item can be expanded at a time
|
|
32
|
-
* - multiple: Multiple expansion-panel items can be expanded simultaneously
|
|
33
|
-
* @default 'toggle'
|
|
34
|
-
*/
|
|
35
|
-
selectionMode?: ExpansionPanelSelectionMode;
|
|
36
|
-
/**
|
|
37
|
-
* Show dividers between expansion-panel items
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
showDivider?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Hide the collapse/expand indicator
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
hideIndicator?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Whether the expansion-panel should take full width
|
|
48
|
-
* @default true
|
|
49
|
-
*/
|
|
50
|
-
fullWidth?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Controlled expanded keys
|
|
53
|
-
*/
|
|
54
|
-
expandedKeys?: string[];
|
|
55
|
-
/**
|
|
56
|
-
* Default expanded keys for uncontrolled mode
|
|
57
|
-
* Items with these keys will be expanded by default
|
|
58
|
-
*/
|
|
59
|
-
defaultExpandedKeys?: string[];
|
|
60
|
-
/**
|
|
61
|
-
* Keys of disabled expansion-panel items
|
|
62
|
-
*/
|
|
63
|
-
disabledKeys?: string[];
|
|
64
|
-
/**
|
|
65
|
-
* Disable animations
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
disableAnimation?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Make the expansion-panel items more compact
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
isCompact?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Custom appearance styles for all expansion-panel parts
|
|
76
|
-
*/
|
|
77
|
-
customAppearance?: ExpansionPanelCustomAppearance;
|
|
78
|
-
} & ExpansionPanelEvents;
|
|
79
|
-
|
|
80
|
-
declare const ExpansionPanel: React.FC<ExpansionPanelProps>;
|
|
81
|
-
|
|
82
|
-
type ExpansionPanelItemEvents = {
|
|
83
|
-
onSelected?: (isSelected: boolean) => void;
|
|
84
|
-
};
|
|
85
|
-
type ExpansionPanelItemCustomAppearance = {
|
|
86
|
-
/**
|
|
87
|
-
* Custom styles for the base container
|
|
88
|
-
*/
|
|
89
|
-
base?: ViewStyle;
|
|
90
|
-
/**
|
|
91
|
-
* Custom styles for the header container
|
|
92
|
-
*/
|
|
93
|
-
heading?: ViewStyle;
|
|
94
|
-
/**
|
|
95
|
-
* Custom styles for the trigger button
|
|
96
|
-
*/
|
|
97
|
-
trigger?: ViewStyle;
|
|
98
|
-
/**
|
|
99
|
-
* Custom styles for the title text
|
|
100
|
-
*/
|
|
101
|
-
title?: TextStyle;
|
|
102
|
-
/**
|
|
103
|
-
* Custom styles for the subtitle text
|
|
104
|
-
*/
|
|
105
|
-
subtitle?: TextStyle;
|
|
106
|
-
/**
|
|
107
|
-
* Custom styles for the content container
|
|
108
|
-
*/
|
|
109
|
-
content?: ViewStyle;
|
|
110
|
-
/**
|
|
111
|
-
* Custom styles for the start content container
|
|
112
|
-
*/
|
|
113
|
-
startContent?: ViewStyle;
|
|
114
|
-
/**
|
|
115
|
-
* Custom styles for the indicator
|
|
116
|
-
*/
|
|
117
|
-
indicator?: ViewStyle;
|
|
118
|
-
};
|
|
119
|
-
type ExpansionPanelItemProps = {
|
|
120
|
-
/**
|
|
121
|
-
* Unique key for the expansion-panel item
|
|
122
|
-
*/
|
|
123
|
-
itemKey?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Content to display when expansion-panel item is expanded
|
|
126
|
-
*/
|
|
127
|
-
children: ReactNode;
|
|
128
|
-
/**
|
|
129
|
-
* Title displayed in the expansion-panel header
|
|
130
|
-
*/
|
|
131
|
-
title: ReactNode;
|
|
132
|
-
/**
|
|
133
|
-
* Optional subtitle displayed below the title
|
|
134
|
-
*/
|
|
135
|
-
subtitle?: ReactNode;
|
|
136
|
-
/**
|
|
137
|
-
* Content displayed at the start of the header (left side)
|
|
138
|
-
*/
|
|
139
|
-
startContent?: ReactNode;
|
|
140
|
-
/**
|
|
141
|
-
* Custom indicator for the expanded/collapsed state
|
|
142
|
-
* @default ChevronRight icon
|
|
143
|
-
*/
|
|
144
|
-
indicator?: ReactNode;
|
|
145
|
-
/**
|
|
146
|
-
* Custom appearance styles for all expansion-panel item parts
|
|
147
|
-
*/
|
|
148
|
-
customAppearance?: ExpansionPanelItemCustomAppearance;
|
|
149
|
-
} & ExpansionPanelItemEvents;
|
|
150
|
-
|
|
151
|
-
declare const ExpansionPanelItem: React.FC<ExpansionPanelItemProps>;
|
|
152
|
-
|
|
153
|
-
export { ExpansionPanel, ExpansionPanelItem };
|
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Divider
|
|
3
|
-
} from "../chunk-ZY7IUTAT.js";
|
|
4
|
-
import "../chunk-SHBDANQN.js";
|
|
5
|
-
import {
|
|
6
|
-
useXUIPalette,
|
|
7
|
-
useXUITheme
|
|
8
|
-
} from "../chunk-RBSA4NH4.js";
|
|
9
|
-
|
|
10
|
-
// src/components/expansion-panel/expansion-panel.tsx
|
|
11
|
-
import React4 from "react";
|
|
12
|
-
import { View as View2 } from "react-native";
|
|
13
|
-
|
|
14
|
-
// src/components/expansion-panel/expansion-panel-context.ts
|
|
15
|
-
import { createContext, useContext } from "react";
|
|
16
|
-
var ExpansionPanelContext = createContext(void 0);
|
|
17
|
-
var useExpansionPanelContext = () => {
|
|
18
|
-
const context = useContext(ExpansionPanelContext);
|
|
19
|
-
if (!context) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
"ExpansionPanelItem must be used within an ExpansionPanel component"
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return context;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// src/components/expansion-panel/expansion-panel.hook.ts
|
|
28
|
-
import { useState, useCallback, useMemo } from "react";
|
|
29
|
-
var useExpansionPanelStyles = ({
|
|
30
|
-
variant,
|
|
31
|
-
fullWidth
|
|
32
|
-
}) => {
|
|
33
|
-
const theme = useXUITheme();
|
|
34
|
-
const palette2 = useXUIPalette();
|
|
35
|
-
const containerStyles = useMemo(() => {
|
|
36
|
-
const base = {};
|
|
37
|
-
if (fullWidth) {
|
|
38
|
-
base.width = "100%";
|
|
39
|
-
}
|
|
40
|
-
if (variant === "bordered") {
|
|
41
|
-
base.borderWidth = theme.borderWidth.md;
|
|
42
|
-
base.borderColor = theme.mode === "dark" ? palette2.gray[800] : theme.palette.gray[200];
|
|
43
|
-
base.borderRadius = theme.borderRadius.md;
|
|
44
|
-
base.paddingHorizontal = theme.spacing.sm;
|
|
45
|
-
base.overflow = "hidden";
|
|
46
|
-
}
|
|
47
|
-
return base;
|
|
48
|
-
}, [variant, fullWidth, theme]);
|
|
49
|
-
const dividerColor = variant === "bordered" ? containerStyles.borderColor : theme.mode === "dark" ? palette2.gray[800] : theme.palette.gray[200];
|
|
50
|
-
const dividerOpacity = variant === "bordered" ? 1 : 0.2;
|
|
51
|
-
return { containerStyles, dividerColor, dividerOpacity };
|
|
52
|
-
};
|
|
53
|
-
var useExpansionPanelSelection = ({
|
|
54
|
-
selectionMode,
|
|
55
|
-
expandedKeys,
|
|
56
|
-
defaultExpandedKeys,
|
|
57
|
-
onSelectionChange
|
|
58
|
-
}) => {
|
|
59
|
-
const [internalExpandedKeys, setInternalExpandedKeys] = useState(defaultExpandedKeys);
|
|
60
|
-
const isControlled = expandedKeys !== void 0;
|
|
61
|
-
const currentExpandedKeys = isControlled ? expandedKeys : internalExpandedKeys;
|
|
62
|
-
const toggleItem = useCallback(
|
|
63
|
-
(key) => {
|
|
64
|
-
const isExpanded = currentExpandedKeys.includes(key);
|
|
65
|
-
const newExpandedKeys = selectionMode === "toggle" ? isExpanded ? [] : [key] : isExpanded ? currentExpandedKeys.filter((k) => k !== key) : [...currentExpandedKeys, key];
|
|
66
|
-
if (!isControlled) {
|
|
67
|
-
setInternalExpandedKeys(newExpandedKeys);
|
|
68
|
-
}
|
|
69
|
-
onSelectionChange?.(newExpandedKeys);
|
|
70
|
-
},
|
|
71
|
-
[selectionMode, currentExpandedKeys, isControlled, onSelectionChange]
|
|
72
|
-
);
|
|
73
|
-
return { currentExpandedKeys, toggleItem };
|
|
74
|
-
};
|
|
75
|
-
var useExpansionPanelContextValue = (config) => {
|
|
76
|
-
const { currentExpandedKeys, toggleItem } = useExpansionPanelSelection({
|
|
77
|
-
selectionMode: config.selectionMode,
|
|
78
|
-
expandedKeys: config.expandedKeys,
|
|
79
|
-
defaultExpandedKeys: config.defaultExpandedKeys,
|
|
80
|
-
onSelectionChange: config.onSelectionChange
|
|
81
|
-
});
|
|
82
|
-
return useMemo(
|
|
83
|
-
() => ({
|
|
84
|
-
variant: config.variant,
|
|
85
|
-
hideIndicator: config.hideIndicator,
|
|
86
|
-
disableAnimation: config.disableAnimation,
|
|
87
|
-
isCompact: config.isCompact,
|
|
88
|
-
showDivider: config.showDivider,
|
|
89
|
-
expandedKeys: currentExpandedKeys,
|
|
90
|
-
disabledKeys: config.disabledKeys,
|
|
91
|
-
toggleItem
|
|
92
|
-
}),
|
|
93
|
-
[
|
|
94
|
-
config.variant,
|
|
95
|
-
config.hideIndicator,
|
|
96
|
-
config.disableAnimation,
|
|
97
|
-
config.isCompact,
|
|
98
|
-
config.showDivider,
|
|
99
|
-
currentExpandedKeys,
|
|
100
|
-
config.disabledKeys,
|
|
101
|
-
toggleItem
|
|
102
|
-
]
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// src/components/expansion-panel/expansion-panel-item.tsx
|
|
107
|
-
import React2 from "react";
|
|
108
|
-
import { View, Text, Pressable, Animated as Animated2 } from "react-native";
|
|
109
|
-
|
|
110
|
-
// src/components/expansion-panel/expansion-panel-item.style.ts
|
|
111
|
-
import { StyleSheet } from "react-native";
|
|
112
|
-
var styles = StyleSheet.create({
|
|
113
|
-
startContent: {
|
|
114
|
-
flexShrink: 0
|
|
115
|
-
},
|
|
116
|
-
titleWrapper: {
|
|
117
|
-
flex: 1
|
|
118
|
-
},
|
|
119
|
-
indicator: {
|
|
120
|
-
flexShrink: 0
|
|
121
|
-
},
|
|
122
|
-
hiddenMeasure: {
|
|
123
|
-
position: "absolute",
|
|
124
|
-
opacity: 0,
|
|
125
|
-
left: 0,
|
|
126
|
-
right: 0,
|
|
127
|
-
zIndex: -999
|
|
128
|
-
},
|
|
129
|
-
contentOverflow: {
|
|
130
|
-
overflow: "hidden"
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// src/components/expansion-panel/expansion-panel-item.hook.ts
|
|
135
|
-
import { useRef, useEffect, useState as useState2, useMemo as useMemo2, useCallback as useCallback2 } from "react";
|
|
136
|
-
import {
|
|
137
|
-
Animated,
|
|
138
|
-
Easing
|
|
139
|
-
} from "react-native";
|
|
140
|
-
import { colors as palette } from "@xaui/core/palette";
|
|
141
|
-
import { withOpacity } from "@xaui/core";
|
|
142
|
-
var useExpansionPanelItemState = (itemKey) => {
|
|
143
|
-
const context = useExpansionPanelContext();
|
|
144
|
-
const resolvedItemKey = itemKey ?? "";
|
|
145
|
-
const isExpanded = resolvedItemKey ? context.expandedKeys.includes(resolvedItemKey) : false;
|
|
146
|
-
const isDisabled = resolvedItemKey ? context.disabledKeys.includes(resolvedItemKey) : false;
|
|
147
|
-
const handlePress = useCallback2(() => {
|
|
148
|
-
if (isDisabled || !resolvedItemKey) return;
|
|
149
|
-
context.toggleItem(resolvedItemKey);
|
|
150
|
-
}, [isDisabled, resolvedItemKey, context]);
|
|
151
|
-
return { ...context, resolvedItemKey, isExpanded, isDisabled, handlePress };
|
|
152
|
-
};
|
|
153
|
-
var useExpansionPanelItemAnimation = (isExpanded, disableAnimation) => {
|
|
154
|
-
const [contentHeight, setContentHeight] = useState2(0);
|
|
155
|
-
const [isMeasured, setIsMeasured] = useState2(false);
|
|
156
|
-
const animatedHeight = useRef(new Animated.Value(isExpanded ? 1 : 0)).current;
|
|
157
|
-
const animatedRotation = useRef(new Animated.Value(isExpanded ? 1 : 0)).current;
|
|
158
|
-
const prevContentHeight = useRef(contentHeight);
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
if (disableAnimation) {
|
|
161
|
-
animatedHeight.setValue(isExpanded ? 1 : 0);
|
|
162
|
-
animatedRotation.setValue(isExpanded ? 1 : 0);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
Animated.parallel([
|
|
166
|
-
Animated.timing(animatedHeight, {
|
|
167
|
-
toValue: isExpanded ? 1 : 0,
|
|
168
|
-
duration: 300,
|
|
169
|
-
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
170
|
-
useNativeDriver: false
|
|
171
|
-
}),
|
|
172
|
-
Animated.timing(animatedRotation, {
|
|
173
|
-
toValue: isExpanded ? 1 : 0,
|
|
174
|
-
duration: 300,
|
|
175
|
-
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
176
|
-
useNativeDriver: true
|
|
177
|
-
})
|
|
178
|
-
]).start();
|
|
179
|
-
}, [isExpanded, disableAnimation, animatedHeight, animatedRotation]);
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
if (contentHeight <= 0 || contentHeight === prevContentHeight.current || !isExpanded)
|
|
182
|
-
return;
|
|
183
|
-
prevContentHeight.current = contentHeight;
|
|
184
|
-
if (!disableAnimation && isMeasured) {
|
|
185
|
-
Animated.timing(animatedHeight, {
|
|
186
|
-
toValue: 1,
|
|
187
|
-
duration: 200,
|
|
188
|
-
easing: Easing.out(Easing.ease),
|
|
189
|
-
useNativeDriver: false
|
|
190
|
-
}).start();
|
|
191
|
-
}
|
|
192
|
-
}, [contentHeight, isExpanded, disableAnimation, isMeasured, animatedHeight]);
|
|
193
|
-
const onContentLayout = useCallback2((event) => {
|
|
194
|
-
const height = event.nativeEvent.layout.height;
|
|
195
|
-
if (height > 0) {
|
|
196
|
-
setContentHeight(height);
|
|
197
|
-
setIsMeasured(true);
|
|
198
|
-
}
|
|
199
|
-
}, []);
|
|
200
|
-
const heightInterpolation = animatedHeight.interpolate({
|
|
201
|
-
inputRange: [0, 1],
|
|
202
|
-
outputRange: [0, contentHeight]
|
|
203
|
-
});
|
|
204
|
-
const rotationInterpolation = animatedRotation.interpolate({
|
|
205
|
-
inputRange: [0, 1],
|
|
206
|
-
outputRange: ["0deg", "90deg"]
|
|
207
|
-
});
|
|
208
|
-
return {
|
|
209
|
-
onContentLayout,
|
|
210
|
-
heightInterpolation,
|
|
211
|
-
rotationInterpolation,
|
|
212
|
-
contentHeight
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
var useBaseStyles = (variant, isDisabled) => {
|
|
216
|
-
const theme = useXUITheme();
|
|
217
|
-
const baseStyles = useMemo2(() => {
|
|
218
|
-
const base = { overflow: "hidden" };
|
|
219
|
-
if (variant === "splitted") {
|
|
220
|
-
base.paddingHorizontal = theme.spacing.md;
|
|
221
|
-
base.backgroundColor = withOpacity(theme.colors.default.container, 0.5);
|
|
222
|
-
base.borderRadius = theme.borderRadius.md;
|
|
223
|
-
base.marginBottom = theme.spacing.xs;
|
|
224
|
-
} else if (variant === "bordered") {
|
|
225
|
-
base.paddingHorizontal = theme.spacing.md;
|
|
226
|
-
}
|
|
227
|
-
if (isDisabled) {
|
|
228
|
-
base.opacity = 0.4;
|
|
229
|
-
}
|
|
230
|
-
return base;
|
|
231
|
-
}, [variant, isDisabled, theme]);
|
|
232
|
-
return baseStyles;
|
|
233
|
-
};
|
|
234
|
-
var useTriggerStyles = (variant, isCompact) => {
|
|
235
|
-
const theme = useXUITheme();
|
|
236
|
-
const triggerStyles = useMemo2(() => {
|
|
237
|
-
const trigger = {
|
|
238
|
-
flexDirection: "row",
|
|
239
|
-
alignItems: "center",
|
|
240
|
-
paddingVertical: isCompact ? theme.spacing.xs : theme.spacing.md,
|
|
241
|
-
gap: theme.spacing.md
|
|
242
|
-
};
|
|
243
|
-
if (variant === "light") {
|
|
244
|
-
trigger.paddingHorizontal = theme.spacing.sm;
|
|
245
|
-
}
|
|
246
|
-
return trigger;
|
|
247
|
-
}, [variant, isCompact, theme]);
|
|
248
|
-
return triggerStyles;
|
|
249
|
-
};
|
|
250
|
-
var useTitleTextStyle = (isCompact) => {
|
|
251
|
-
const theme = useXUITheme();
|
|
252
|
-
const titleTextStyle = useMemo2(
|
|
253
|
-
() => ({
|
|
254
|
-
fontSize: isCompact ? theme.fontSizes.md : theme.fontSizes.lg,
|
|
255
|
-
fontWeight: theme.fontWeights.medium,
|
|
256
|
-
color: theme.colors.foreground
|
|
257
|
-
}),
|
|
258
|
-
[isCompact, theme]
|
|
259
|
-
);
|
|
260
|
-
return titleTextStyle;
|
|
261
|
-
};
|
|
262
|
-
var useSubtitleTextStyle = () => {
|
|
263
|
-
const theme = useXUITheme();
|
|
264
|
-
const subtitleTextStyle = useMemo2(
|
|
265
|
-
() => ({
|
|
266
|
-
fontSize: theme.fontSizes.sm,
|
|
267
|
-
color: palette.gray[500],
|
|
268
|
-
marginTop: theme.spacing.xs
|
|
269
|
-
}),
|
|
270
|
-
[theme]
|
|
271
|
-
);
|
|
272
|
-
return subtitleTextStyle;
|
|
273
|
-
};
|
|
274
|
-
var useContentContainerStyle = (isCompact, variant) => {
|
|
275
|
-
const theme = useXUITheme();
|
|
276
|
-
const contentContainerStyle = useMemo2(
|
|
277
|
-
() => ({
|
|
278
|
-
paddingBottom: isCompact ? theme.spacing.xs : theme.spacing.sm,
|
|
279
|
-
paddingHorizontal: variant === "light" ? theme.spacing.sm : 0
|
|
280
|
-
}),
|
|
281
|
-
[isCompact, variant, theme]
|
|
282
|
-
);
|
|
283
|
-
return contentContainerStyle;
|
|
284
|
-
};
|
|
285
|
-
var useForegroundColor = () => {
|
|
286
|
-
const theme = useXUITheme();
|
|
287
|
-
return theme.colors.foreground;
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
// src/components/expansion-panel/chevron-right-icon.tsx
|
|
291
|
-
import React from "react";
|
|
292
|
-
import Svg, { Path } from "react-native-svg";
|
|
293
|
-
var ChevronRightIcon = ({
|
|
294
|
-
color = "#000",
|
|
295
|
-
size = 20
|
|
296
|
-
}) => {
|
|
297
|
-
return /* @__PURE__ */ React.createElement(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React.createElement(
|
|
298
|
-
Path,
|
|
299
|
-
{
|
|
300
|
-
d: "M9 18l6-6-6-6",
|
|
301
|
-
stroke: color,
|
|
302
|
-
strokeWidth: 2,
|
|
303
|
-
strokeLinecap: "round",
|
|
304
|
-
strokeLinejoin: "round"
|
|
305
|
-
}
|
|
306
|
-
));
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// src/components/expansion-panel/expansion-panel-item.tsx
|
|
310
|
-
var ExpansionPanelItem = ({
|
|
311
|
-
itemKey,
|
|
312
|
-
children,
|
|
313
|
-
title,
|
|
314
|
-
subtitle,
|
|
315
|
-
startContent,
|
|
316
|
-
indicator,
|
|
317
|
-
customAppearance,
|
|
318
|
-
onSelected
|
|
319
|
-
}) => {
|
|
320
|
-
const {
|
|
321
|
-
variant,
|
|
322
|
-
hideIndicator,
|
|
323
|
-
disableAnimation,
|
|
324
|
-
isCompact,
|
|
325
|
-
isExpanded,
|
|
326
|
-
isDisabled,
|
|
327
|
-
handlePress: togglePress
|
|
328
|
-
} = useExpansionPanelItemState(itemKey);
|
|
329
|
-
const handlePress = () => {
|
|
330
|
-
togglePress();
|
|
331
|
-
onSelected?.(!isExpanded);
|
|
332
|
-
};
|
|
333
|
-
const { onContentLayout, heightInterpolation, rotationInterpolation } = useExpansionPanelItemAnimation(isExpanded, disableAnimation);
|
|
334
|
-
const baseStyles = useBaseStyles(variant, isDisabled);
|
|
335
|
-
const triggerStyles = useTriggerStyles(variant, isCompact);
|
|
336
|
-
const titleTextStyle = useTitleTextStyle(isCompact);
|
|
337
|
-
const subtitleTextStyle = useSubtitleTextStyle();
|
|
338
|
-
const contentContainerStyle = useContentContainerStyle(isCompact, variant);
|
|
339
|
-
const foregroundColor = useForegroundColor();
|
|
340
|
-
return /* @__PURE__ */ React2.createElement(View, { style: [baseStyles, customAppearance?.base] }, /* @__PURE__ */ React2.createElement(View, { style: customAppearance?.heading }, /* @__PURE__ */ React2.createElement(
|
|
341
|
-
Pressable,
|
|
342
|
-
{
|
|
343
|
-
style: [triggerStyles, customAppearance?.trigger],
|
|
344
|
-
onPress: handlePress,
|
|
345
|
-
disabled: isDisabled,
|
|
346
|
-
accessibilityRole: "button",
|
|
347
|
-
accessibilityState: { expanded: isExpanded, disabled: isDisabled }
|
|
348
|
-
},
|
|
349
|
-
startContent && /* @__PURE__ */ React2.createElement(View, { style: [styles.startContent, customAppearance?.startContent] }, startContent),
|
|
350
|
-
/* @__PURE__ */ React2.createElement(View, { style: styles.titleWrapper }, typeof title === "string" ? /* @__PURE__ */ React2.createElement(Text, { style: [titleTextStyle, customAppearance?.title] }, title) : title, subtitle && (typeof subtitle === "string" ? /* @__PURE__ */ React2.createElement(Text, { style: [subtitleTextStyle, customAppearance?.subtitle] }, subtitle) : subtitle)),
|
|
351
|
-
!hideIndicator && /* @__PURE__ */ React2.createElement(
|
|
352
|
-
Animated2.View,
|
|
353
|
-
{
|
|
354
|
-
style: [
|
|
355
|
-
styles.indicator,
|
|
356
|
-
customAppearance?.indicator,
|
|
357
|
-
{ transform: [{ rotate: rotationInterpolation }] }
|
|
358
|
-
]
|
|
359
|
-
},
|
|
360
|
-
indicator || /* @__PURE__ */ React2.createElement(ChevronRightIcon, { color: foregroundColor })
|
|
361
|
-
)
|
|
362
|
-
)), /* @__PURE__ */ React2.createElement(View, { style: styles.hiddenMeasure, pointerEvents: "none" }, /* @__PURE__ */ React2.createElement(
|
|
363
|
-
View,
|
|
364
|
-
{
|
|
365
|
-
onLayout: onContentLayout,
|
|
366
|
-
style: [contentContainerStyle, customAppearance?.content]
|
|
367
|
-
},
|
|
368
|
-
children
|
|
369
|
-
)), /* @__PURE__ */ React2.createElement(
|
|
370
|
-
Animated2.View,
|
|
371
|
-
{
|
|
372
|
-
style: [
|
|
373
|
-
styles.contentOverflow,
|
|
374
|
-
disableAnimation ? { height: isExpanded ? void 0 : 0 } : { height: heightInterpolation }
|
|
375
|
-
]
|
|
376
|
-
},
|
|
377
|
-
/* @__PURE__ */ React2.createElement(View, { style: [contentContainerStyle, customAppearance?.content] }, children)
|
|
378
|
-
));
|
|
379
|
-
};
|
|
380
|
-
ExpansionPanelItem.displayName = "ExpansionPanelItem";
|
|
381
|
-
|
|
382
|
-
// src/components/expansion-panel/expansion-panel.utils.ts
|
|
383
|
-
import React3 from "react";
|
|
384
|
-
var getItemKey = (value, fallback) => {
|
|
385
|
-
if (value === null || value === void 0) return String(fallback);
|
|
386
|
-
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
387
|
-
return String(fallback);
|
|
388
|
-
};
|
|
389
|
-
var normalizeElementKey = (value) => {
|
|
390
|
-
if (typeof value !== "string") return value;
|
|
391
|
-
return value.startsWith(".$") ? value.slice(2) : value.startsWith(".") ? value.slice(1) : value;
|
|
392
|
-
};
|
|
393
|
-
var isExpansionPanelItem = (value) => React3.isValidElement(value) && (value.type === ExpansionPanelItem || typeof value.type === "function" && value.type.displayName === "ExpansionPanelItem");
|
|
394
|
-
var buildExpansionPanelContextParams = (props) => {
|
|
395
|
-
return {
|
|
396
|
-
variant: props.variant || "light",
|
|
397
|
-
hideIndicator: Boolean(props.hideIndicator),
|
|
398
|
-
disableAnimation: Boolean(props.disableAnimation),
|
|
399
|
-
isCompact: Boolean(props.isCompact),
|
|
400
|
-
showDivider: Boolean(props.showDivider),
|
|
401
|
-
expandedKeys: props.expandedKeys,
|
|
402
|
-
defaultExpandedKeys: props.defaultExpandedKeys || [],
|
|
403
|
-
disabledKeys: props.disabledKeys || [],
|
|
404
|
-
selectionMode: props.selectionMode || "toggle",
|
|
405
|
-
onSelectionChange: props.onSelectionChange
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
// src/components/expansion-panel/expansion-panel.tsx
|
|
410
|
-
var ExpansionPanel = (props) => {
|
|
411
|
-
const {
|
|
412
|
-
children,
|
|
413
|
-
variant = "light",
|
|
414
|
-
showDivider = false,
|
|
415
|
-
fullWidth = true,
|
|
416
|
-
customAppearance
|
|
417
|
-
} = props;
|
|
418
|
-
const { containerStyles, dividerColor } = useExpansionPanelStyles({
|
|
419
|
-
variant,
|
|
420
|
-
fullWidth
|
|
421
|
-
});
|
|
422
|
-
const contextParams = buildExpansionPanelContextParams(props);
|
|
423
|
-
const contextValue = useExpansionPanelContextValue(contextParams);
|
|
424
|
-
const childrenArray = React4.Children.toArray(children);
|
|
425
|
-
return /* @__PURE__ */ React4.createElement(ExpansionPanelContext.Provider, { value: contextValue }, /* @__PURE__ */ React4.createElement(View2, { style: [containerStyles, customAppearance?.container] }, childrenArray.map((child, index) => {
|
|
426
|
-
const isLast = index === childrenArray.length - 1;
|
|
427
|
-
const showBottomDivider = (showDivider || variant === "bordered") && !isLast && variant !== "splitted";
|
|
428
|
-
const resolvedChildKey = isExpansionPanelItem(child) ? getItemKey(
|
|
429
|
-
child.props.itemKey ?? normalizeElementKey(child.key),
|
|
430
|
-
index
|
|
431
|
-
) : getItemKey(
|
|
432
|
-
React4.isValidElement(child) ? normalizeElementKey(child.key) : void 0,
|
|
433
|
-
index
|
|
434
|
-
);
|
|
435
|
-
return /* @__PURE__ */ React4.createElement(View2, { key: resolvedChildKey, style: customAppearance?.item }, isExpansionPanelItem(child) ? React4.cloneElement(child, { itemKey: resolvedChildKey }) : child, showBottomDivider && /* @__PURE__ */ React4.createElement(Divider, { color: dividerColor, size: 1 }));
|
|
436
|
-
})));
|
|
437
|
-
};
|
|
438
|
-
export {
|
|
439
|
-
ExpansionPanel,
|
|
440
|
-
ExpansionPanelItem
|
|
441
|
-
};
|
package/dist/fab/index.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkUGEINZM7cjs = require('../chunk-UGEINZM7.cjs');
|
|
4
|
-
require('../chunk-YIEUN3G5.cjs');
|
|
5
|
-
require('../chunk-56RPWZD2.cjs');
|
|
6
|
-
require('../chunk-7UFBLUMV.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.Fab = _chunkUGEINZM7cjs.Fab;
|
package/dist/fab/index.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { F as FabProps } from '../fab.type-DN0vtAh6.cjs';
|
|
3
|
-
export { b as FabSize, a as FabVariant } from '../fab.type-DN0vtAh6.cjs';
|
|
4
|
-
import 'react-native';
|
|
5
|
-
import '@xaui/core/types';
|
|
6
|
-
import '../button.type-j1ZdkkSl.cjs';
|
|
7
|
-
|
|
8
|
-
declare const Fab: React.FC<FabProps>;
|
|
9
|
-
|
|
10
|
-
export { Fab, FabProps };
|
package/dist/fab/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { F as FabProps } from '../fab.type-CkUHmXU_.js';
|
|
3
|
-
export { b as FabSize, a as FabVariant } from '../fab.type-CkUHmXU_.js';
|
|
4
|
-
import 'react-native';
|
|
5
|
-
import '@xaui/core/types';
|
|
6
|
-
import '../button.type-j1ZdkkSl.js';
|
|
7
|
-
|
|
8
|
-
declare const Fab: React.FC<FabProps>;
|
|
9
|
-
|
|
10
|
-
export { Fab, FabProps };
|