@xaui/native 0.0.32 → 0.0.34

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.
Files changed (101) hide show
  1. package/dist/alert/index.cjs +1 -1
  2. package/dist/alert/index.js +1 -1
  3. package/dist/app-bar/index.cjs +1 -1
  4. package/dist/app-bar/index.js +1 -1
  5. package/dist/autocomplete/index.cjs +1 -1
  6. package/dist/autocomplete/index.js +1 -1
  7. package/dist/avatar/index.cjs +1 -1
  8. package/dist/avatar/index.js +1 -1
  9. package/dist/badge/index.cjs +1 -1
  10. package/dist/badge/index.js +1 -1
  11. package/dist/bottom-sheet/index.cjs +5 -4
  12. package/dist/bottom-sheet/index.js +3 -2
  13. package/dist/bottom-tab-bar/index.cjs +1 -1
  14. package/dist/bottom-tab-bar/index.js +1 -1
  15. package/dist/button/index.cjs +1 -1
  16. package/dist/button/index.js +1 -1
  17. package/dist/card/index.cjs +1 -1
  18. package/dist/card/index.js +1 -1
  19. package/dist/checkbox/index.cjs +1 -1
  20. package/dist/checkbox/index.js +1 -1
  21. package/dist/chip/index.cjs +1 -1
  22. package/dist/chip/index.js +1 -1
  23. package/dist/chunk-2ANGPYCP.cjs +308 -0
  24. package/dist/{chunk-HSPTLUFA.cjs → chunk-56RPWZD2.cjs} +3 -1
  25. package/dist/chunk-DECMUMCI.js +0 -0
  26. package/dist/chunk-E4DOPNVW.js +308 -0
  27. package/dist/chunk-EUQDGTST.cjs +1 -0
  28. package/dist/{chunk-DXXNBF5P.js → chunk-SHBDANQN.js} +3 -1
  29. package/dist/color-picker/index.cjs +460 -0
  30. package/dist/color-picker/index.d.cts +124 -0
  31. package/dist/color-picker/index.d.ts +124 -0
  32. package/dist/color-picker/index.js +460 -0
  33. package/dist/core/index.cjs +4 -2
  34. package/dist/core/index.d.cts +1 -0
  35. package/dist/core/index.d.ts +1 -0
  36. package/dist/core/index.js +3 -1
  37. package/dist/datepicker/index.cjs +1 -1
  38. package/dist/datepicker/index.js +1 -1
  39. package/dist/divider/index.cjs +1 -1
  40. package/dist/divider/index.js +1 -1
  41. package/dist/drawer/index.cjs +1 -1
  42. package/dist/drawer/index.js +1 -1
  43. package/dist/expansion-panel/index.cjs +1 -1
  44. package/dist/expansion-panel/index.js +1 -1
  45. package/dist/fab/index.cjs +1 -1
  46. package/dist/fab/index.js +1 -1
  47. package/dist/fab-menu/index.cjs +1 -1
  48. package/dist/fab-menu/index.js +1 -1
  49. package/dist/feature-discovery/index.cjs +1 -1
  50. package/dist/feature-discovery/index.js +1 -1
  51. package/dist/indicator/index.cjs +1 -1
  52. package/dist/indicator/index.js +1 -1
  53. package/dist/input/index.cjs +1 -1
  54. package/dist/input/index.js +1 -1
  55. package/dist/input-trigger/index.cjs +8 -0
  56. package/dist/input-trigger/index.d.cts +9 -0
  57. package/dist/input-trigger/index.d.ts +9 -0
  58. package/dist/input-trigger/index.js +8 -0
  59. package/dist/input-trigger.type-BL70fHE9.d.cts +97 -0
  60. package/dist/input-trigger.type-BODYStHk.d.ts +97 -0
  61. package/dist/list/index.cjs +1 -1
  62. package/dist/list/index.js +1 -1
  63. package/dist/menu/index.cjs +1 -1
  64. package/dist/menu/index.js +1 -1
  65. package/dist/menubox/index.cjs +1 -1
  66. package/dist/menubox/index.js +1 -1
  67. package/dist/picker/index.cjs +250 -0
  68. package/dist/picker/index.d.cts +121 -0
  69. package/dist/picker/index.d.ts +121 -0
  70. package/dist/picker/index.js +250 -0
  71. package/dist/progress/index.cjs +1 -1
  72. package/dist/progress/index.js +1 -1
  73. package/dist/radio/index.cjs +1 -1
  74. package/dist/radio/index.js +1 -1
  75. package/dist/segment-button/index.cjs +1 -1
  76. package/dist/segment-button/index.js +1 -1
  77. package/dist/select/index.cjs +1 -1
  78. package/dist/select/index.js +1 -1
  79. package/dist/skeleton/index.cjs +1 -1
  80. package/dist/skeleton/index.js +1 -1
  81. package/dist/slider/index.cjs +1 -1
  82. package/dist/slider/index.js +1 -1
  83. package/dist/snackbar/index.cjs +1 -1
  84. package/dist/snackbar/index.js +1 -1
  85. package/dist/snippet/index.cjs +1 -1
  86. package/dist/snippet/index.js +1 -1
  87. package/dist/stepper/index.cjs +1 -1
  88. package/dist/stepper/index.js +1 -1
  89. package/dist/switch/index.cjs +1 -1
  90. package/dist/switch/index.js +1 -1
  91. package/dist/tabs/index.cjs +1 -1
  92. package/dist/tabs/index.js +1 -1
  93. package/dist/timepicker/index.cjs +5 -4
  94. package/dist/timepicker/index.js +3 -2
  95. package/dist/toolbar/index.cjs +1 -1
  96. package/dist/toolbar/index.js +1 -1
  97. package/dist/typography/index.cjs +1 -1
  98. package/dist/typography/index.js +1 -1
  99. package/package.json +16 -1
  100. /package/dist/{chunk-HC2SSHNU.js → chunk-ED22WCCI.js} +0 -0
  101. /package/dist/{chunk-XFPPR2VB.cjs → chunk-RVR42THG.cjs} +0 -0
@@ -0,0 +1,308 @@
1
+ import {
2
+ useXUITheme
3
+ } from "./chunk-LTKYHG5V.js";
4
+
5
+ // src/components/input-trigger/input-trigger.tsx
6
+ import React from "react";
7
+ import { Pressable, Text, View } from "react-native";
8
+
9
+ // src/components/input-trigger/input-trigger.hook.ts
10
+ import { useMemo } from "react";
11
+ import { getSafeThemeColor, withOpacity, withPaletteNumber } from "@xaui/core";
12
+ var sizeMap = {
13
+ sm: {
14
+ minHeight: 40,
15
+ fontSize: 14,
16
+ paddingHorizontal: 12,
17
+ paddingVertical: 8,
18
+ slotGap: 8,
19
+ labelSize: 13,
20
+ helperSize: 12
21
+ },
22
+ md: {
23
+ minHeight: 46,
24
+ fontSize: 16,
25
+ paddingHorizontal: 14,
26
+ paddingVertical: 10,
27
+ slotGap: 10,
28
+ labelSize: 14,
29
+ helperSize: 13
30
+ },
31
+ lg: {
32
+ minHeight: 52,
33
+ fontSize: 17,
34
+ paddingHorizontal: 16,
35
+ paddingVertical: 12,
36
+ slotGap: 12,
37
+ labelSize: 15,
38
+ helperSize: 15
39
+ }
40
+ };
41
+ var useInputTriggerSizeStyles = (size) => useMemo(() => sizeMap[size], [size]);
42
+ var useInputTriggerRadiusStyles = (radius) => {
43
+ const theme = useXUITheme();
44
+ return useMemo(() => {
45
+ if (radius === "full") {
46
+ return { borderRadius: theme.borderRadius.full };
47
+ }
48
+ return { borderRadius: theme.borderRadius[radius] };
49
+ }, [radius, theme.borderRadius]);
50
+ };
51
+ var useInputTriggerVariantStyles = ({
52
+ themeColor,
53
+ variant,
54
+ isInvalid,
55
+ isDisabled
56
+ }) => {
57
+ const theme = useXUITheme();
58
+ const safeThemeColor = getSafeThemeColor(themeColor);
59
+ const colorScheme = theme.colors[safeThemeColor];
60
+ return useMemo(() => {
61
+ const neutralBorder = withOpacity(theme.colors.foreground, 0.1);
62
+ const textColor = isDisabled ? withOpacity(theme.colors.foreground, 0.55) : theme.colors.foreground;
63
+ const placeholderColor = withOpacity(theme.colors.foreground, 0.45);
64
+ const labelColor = isInvalid ? theme.colors.danger.main : withOpacity(theme.colors.foreground, 0.8);
65
+ const helperColor = isInvalid ? theme.colors.danger.main : withOpacity(theme.colors.foreground, 0.72);
66
+ if (variant === "underlined") {
67
+ return {
68
+ container: {
69
+ backgroundColor: "transparent",
70
+ borderBottomWidth: isInvalid ? 2 : 1,
71
+ borderColor: isInvalid ? theme.colors.danger.main : withPaletteNumber(colorScheme.main, 500)
72
+ },
73
+ unfocusedBorderColor: neutralBorder,
74
+ textColor,
75
+ placeholderColor,
76
+ labelColor,
77
+ helperColor
78
+ };
79
+ }
80
+ if (variant === "bordered") {
81
+ return {
82
+ container: {
83
+ backgroundColor: theme.colors.background,
84
+ borderColor: isInvalid ? theme.colors.danger.main : neutralBorder,
85
+ borderWidth: theme.borderWidth.md
86
+ },
87
+ unfocusedBorderColor: neutralBorder,
88
+ textColor,
89
+ placeholderColor,
90
+ labelColor,
91
+ helperColor
92
+ };
93
+ }
94
+ if (variant === "faded") {
95
+ return {
96
+ container: {
97
+ backgroundColor: withOpacity(colorScheme.background, 0.68),
98
+ borderColor: isInvalid ? theme.colors.danger.main : "transparent",
99
+ borderWidth: isInvalid ? theme.borderWidth.md : 0
100
+ },
101
+ unfocusedBorderColor: "transparent",
102
+ textColor,
103
+ placeholderColor,
104
+ labelColor,
105
+ helperColor
106
+ };
107
+ }
108
+ return {
109
+ container: {
110
+ backgroundColor: colorScheme.background,
111
+ borderColor: isInvalid ? withPaletteNumber(theme.colors.danger.main, 500) : "transparent",
112
+ borderWidth: isInvalid ? theme.borderWidth.md : 0
113
+ },
114
+ unfocusedBorderColor: "transparent",
115
+ textColor,
116
+ placeholderColor,
117
+ labelColor,
118
+ helperColor
119
+ };
120
+ }, [colorScheme, isDisabled, isInvalid, theme, variant]);
121
+ };
122
+
123
+ // src/components/input-trigger/input-trigger.style.ts
124
+ import { StyleSheet } from "react-native";
125
+ var styles = StyleSheet.create({
126
+ container: {
127
+ width: "100%",
128
+ gap: 6
129
+ },
130
+ noFullWidth: {
131
+ alignSelf: "flex-start"
132
+ },
133
+ inputContainer: {
134
+ gap: 6
135
+ },
136
+ label: {
137
+ fontWeight: "500"
138
+ },
139
+ inputWrapper: {
140
+ flexDirection: "row",
141
+ alignItems: "center"
142
+ },
143
+ underlinedWrapper: {
144
+ borderBottomLeftRadius: 0,
145
+ borderBottomRightRadius: 0,
146
+ paddingHorizontal: 0
147
+ },
148
+ slot: {
149
+ justifyContent: "center",
150
+ alignItems: "center"
151
+ },
152
+ content: {
153
+ flex: 1,
154
+ padding: 0
155
+ },
156
+ helperText: {
157
+ fontWeight: "400"
158
+ },
159
+ disabled: {
160
+ opacity: 0.6
161
+ }
162
+ });
163
+
164
+ // src/components/input-trigger/input-trigger.tsx
165
+ var InputTrigger = ({
166
+ value,
167
+ placeholder = "Select...",
168
+ label,
169
+ labelPlacement = "outside",
170
+ description,
171
+ errorMessage,
172
+ startContent,
173
+ endContent,
174
+ themeColor = "primary",
175
+ variant = "flat",
176
+ size = "md",
177
+ radius = "md",
178
+ isDisabled = false,
179
+ isInvalid = false,
180
+ fullWidth = true,
181
+ customAppearance,
182
+ onPress
183
+ }) => {
184
+ const sizeStyles = useInputTriggerSizeStyles(size);
185
+ const radiusStyles = useInputTriggerRadiusStyles(radius);
186
+ const variantStyles = useInputTriggerVariantStyles({
187
+ themeColor,
188
+ variant,
189
+ isInvalid,
190
+ isDisabled
191
+ });
192
+ const hasValue = value !== void 0 && value !== null && value !== "";
193
+ const helperText = isInvalid && errorMessage ? errorMessage : description;
194
+ const renderLabel = label ? typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ React.createElement(
195
+ Text,
196
+ {
197
+ style: [
198
+ styles.label,
199
+ {
200
+ color: variantStyles.labelColor,
201
+ fontSize: sizeStyles.labelSize
202
+ },
203
+ customAppearance?.label
204
+ ]
205
+ },
206
+ label
207
+ ) : /* @__PURE__ */ React.createElement(View, null, label) : null;
208
+ return /* @__PURE__ */ React.createElement(
209
+ View,
210
+ {
211
+ style: [
212
+ styles.container,
213
+ !fullWidth && styles.noFullWidth,
214
+ isDisabled && styles.disabled,
215
+ customAppearance?.container
216
+ ]
217
+ },
218
+ /* @__PURE__ */ React.createElement(View, { style: [styles.inputContainer, customAppearance?.inputContainer] }, label && labelPlacement === "outside" && renderLabel, /* @__PURE__ */ React.createElement(
219
+ Pressable,
220
+ {
221
+ onPress: isDisabled ? void 0 : onPress,
222
+ disabled: isDisabled,
223
+ accessibilityRole: "button"
224
+ },
225
+ /* @__PURE__ */ React.createElement(
226
+ View,
227
+ {
228
+ style: [
229
+ styles.inputWrapper,
230
+ {
231
+ minHeight: sizeStyles.minHeight,
232
+ paddingVertical: sizeStyles.paddingVertical,
233
+ paddingHorizontal: variant === "underlined" ? 0 : sizeStyles.paddingHorizontal,
234
+ gap: sizeStyles.slotGap,
235
+ backgroundColor: variantStyles.container.backgroundColor,
236
+ borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
237
+ ...variant === "underlined" && {
238
+ borderBottomWidth: variantStyles.container.borderBottomWidth
239
+ },
240
+ borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
241
+ borderColor: variant === "underlined" ? variantStyles.container.borderColor : variantStyles.container.borderColor
242
+ },
243
+ variant === "underlined" && styles.underlinedWrapper,
244
+ customAppearance?.inputWrapper
245
+ ]
246
+ },
247
+ startContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, startContent),
248
+ /* @__PURE__ */ React.createElement(
249
+ View,
250
+ {
251
+ style: {
252
+ flex: 1,
253
+ gap: labelPlacement === "inside" && label ? 2 : 0
254
+ }
255
+ },
256
+ label && labelPlacement === "inside" && renderLabel,
257
+ typeof value === "string" || typeof value === "number" ? /* @__PURE__ */ React.createElement(
258
+ Text,
259
+ {
260
+ numberOfLines: 1,
261
+ style: [
262
+ styles.content,
263
+ {
264
+ color: hasValue ? variantStyles.textColor : variantStyles.placeholderColor,
265
+ fontSize: sizeStyles.fontSize
266
+ },
267
+ customAppearance?.content
268
+ ]
269
+ },
270
+ hasValue ? value : placeholder
271
+ ) : hasValue ? /* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }, value) : /* @__PURE__ */ React.createElement(
272
+ Text,
273
+ {
274
+ style: [
275
+ styles.content,
276
+ {
277
+ color: variantStyles.placeholderColor,
278
+ fontSize: sizeStyles.fontSize
279
+ },
280
+ customAppearance?.content
281
+ ]
282
+ },
283
+ placeholder
284
+ )
285
+ ),
286
+ endContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, endContent)
287
+ )
288
+ )),
289
+ helperText ? typeof helperText === "string" || typeof helperText === "number" ? /* @__PURE__ */ React.createElement(
290
+ Text,
291
+ {
292
+ style: [
293
+ styles.helperText,
294
+ {
295
+ color: variantStyles.helperColor,
296
+ fontSize: sizeStyles.helperSize
297
+ },
298
+ customAppearance?.helperText
299
+ ]
300
+ },
301
+ helperText
302
+ ) : /* @__PURE__ */ React.createElement(View, null, helperText) : null
303
+ );
304
+ };
305
+
306
+ export {
307
+ InputTrigger
308
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,7 +1,9 @@
1
1
  // src/core/index.ts
2
2
  import { defaultDarkTheme, defaultTheme } from "@xaui/core/theme";
3
+ import { colors } from "@xaui/core/palette";
3
4
 
4
5
  export {
5
6
  defaultDarkTheme,
6
- defaultTheme
7
+ defaultTheme,
8
+ colors
7
9
  };