elseware-ui 3.0.13 → 3.0.15
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/LICENSE +20 -20
- package/README.md +289 -289
- package/dist/index.css +2 -34
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +357 -360
- package/dist/index.d.ts +357 -360
- package/dist/index.js +248 -392
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -395
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.mts +15 -15
- package/dist/index.native.d.ts +15 -15
- package/dist/index.native.js +53 -33
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +54 -34
- package/dist/index.native.mjs.map +1 -1
- package/dist/{resolveGlobalConfigs-TVdFbK-t.d.mts → resolveGlobalConfigs-ClQlBbvH.d.mts} +6 -4
- package/dist/{resolveGlobalConfigs-TVdFbK-t.d.ts → resolveGlobalConfigs-ClQlBbvH.d.ts} +6 -4
- package/package.json +173 -173
- package/tailwind.preset.js +116 -116
package/dist/index.native.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, forwardRef, useContext, useState, useRef, useEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View, ActivityIndicator, Text, Pressable, Animated, Easing, TextInput, Modal, ScrollView } from 'react-native';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx as jsx$1 } from 'react/jsx-runtime';
|
|
5
5
|
import { jsx, jsxs } from 'nativewind/jsx-runtime';
|
|
@@ -215,6 +215,7 @@ function useButton(props) {
|
|
|
215
215
|
const {
|
|
216
216
|
// Consumed by the shared model
|
|
217
217
|
icon,
|
|
218
|
+
iconPosition = "leading",
|
|
218
219
|
text,
|
|
219
220
|
children,
|
|
220
221
|
loading = false,
|
|
@@ -242,7 +243,19 @@ function useButton(props) {
|
|
|
242
243
|
onMouseMove: _onMouseMove,
|
|
243
244
|
...rootRest
|
|
244
245
|
} = props;
|
|
245
|
-
const {
|
|
246
|
+
const {
|
|
247
|
+
shape: resolvedShape,
|
|
248
|
+
size: resolvedSize,
|
|
249
|
+
variant: resolvedVariant,
|
|
250
|
+
appearance: resolvedAppearance
|
|
251
|
+
} = useResolvedButtonConfig({
|
|
252
|
+
compact,
|
|
253
|
+
mode,
|
|
254
|
+
variant,
|
|
255
|
+
appearance,
|
|
256
|
+
shape,
|
|
257
|
+
size
|
|
258
|
+
});
|
|
246
259
|
const tokens = buttonSizeTokens[resolvedSize];
|
|
247
260
|
const variantClassName = resolveButtonVariantStyles({
|
|
248
261
|
appearance: resolvedAppearance,
|
|
@@ -262,6 +275,7 @@ function useButton(props) {
|
|
|
262
275
|
loading,
|
|
263
276
|
iconSize: tokens.icon,
|
|
264
277
|
icon: resolvedIcon,
|
|
278
|
+
iconPosition,
|
|
265
279
|
label,
|
|
266
280
|
hasTextLabel: typeof label === "string" || typeof label === "number",
|
|
267
281
|
variantClassName,
|
|
@@ -288,6 +302,38 @@ var Button = forwardRef(
|
|
|
288
302
|
testID
|
|
289
303
|
} = props;
|
|
290
304
|
const model = useButton(props);
|
|
305
|
+
const trailing = model.iconPosition === "trailing";
|
|
306
|
+
const iconSlot = model.loading || model.icon ? /* @__PURE__ */ jsx(
|
|
307
|
+
View,
|
|
308
|
+
{
|
|
309
|
+
className: cn(
|
|
310
|
+
"shrink-0 items-center justify-center",
|
|
311
|
+
model.tokens.slot
|
|
312
|
+
),
|
|
313
|
+
children: model.loading ? /* @__PURE__ */ jsx(
|
|
314
|
+
ActivityIndicator,
|
|
315
|
+
{
|
|
316
|
+
className: model.labelColorClassName,
|
|
317
|
+
size: "small"
|
|
318
|
+
}
|
|
319
|
+
) : model.icon
|
|
320
|
+
}
|
|
321
|
+
) : null;
|
|
322
|
+
const labelNode = model.hasTextLabel ? /* @__PURE__ */ jsx(
|
|
323
|
+
Text,
|
|
324
|
+
{
|
|
325
|
+
className: cn(
|
|
326
|
+
"font-bold",
|
|
327
|
+
model.tokens.text,
|
|
328
|
+
model.tokens.leading,
|
|
329
|
+
model.labelColorClassName,
|
|
330
|
+
labelClassName
|
|
331
|
+
),
|
|
332
|
+
numberOfLines: 1,
|
|
333
|
+
style: nativeLabelBaseStyle,
|
|
334
|
+
children: model.label
|
|
335
|
+
}
|
|
336
|
+
) : model.label;
|
|
291
337
|
return /* @__PURE__ */ jsx(
|
|
292
338
|
Pressable,
|
|
293
339
|
{
|
|
@@ -295,7 +341,10 @@ var Button = forwardRef(
|
|
|
295
341
|
ref,
|
|
296
342
|
accessibilityLabel,
|
|
297
343
|
accessibilityRole,
|
|
298
|
-
accessibilityState: {
|
|
344
|
+
accessibilityState: {
|
|
345
|
+
disabled: model.isBusy,
|
|
346
|
+
selected: model.selected
|
|
347
|
+
},
|
|
299
348
|
testID,
|
|
300
349
|
disabled: model.isBusy,
|
|
301
350
|
onPress: model.onPress,
|
|
@@ -319,37 +368,8 @@ var Button = forwardRef(
|
|
|
319
368
|
contentClassName
|
|
320
369
|
),
|
|
321
370
|
children: [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
{
|
|
325
|
-
className: cn(
|
|
326
|
-
"shrink-0 items-center justify-center",
|
|
327
|
-
model.tokens.slot
|
|
328
|
-
),
|
|
329
|
-
children: model.loading ? /* @__PURE__ */ jsx(
|
|
330
|
-
ActivityIndicator,
|
|
331
|
-
{
|
|
332
|
-
className: model.labelColorClassName,
|
|
333
|
-
size: "small"
|
|
334
|
-
}
|
|
335
|
-
) : model.icon
|
|
336
|
-
}
|
|
337
|
-
),
|
|
338
|
-
model.hasTextLabel ? /* @__PURE__ */ jsx(
|
|
339
|
-
Text,
|
|
340
|
-
{
|
|
341
|
-
className: cn(
|
|
342
|
-
"font-bold",
|
|
343
|
-
model.tokens.text,
|
|
344
|
-
model.tokens.leading,
|
|
345
|
-
model.labelColorClassName,
|
|
346
|
-
labelClassName
|
|
347
|
-
),
|
|
348
|
-
numberOfLines: 1,
|
|
349
|
-
style: nativeLabelBaseStyle,
|
|
350
|
-
children: model.label
|
|
351
|
-
}
|
|
352
|
-
) : model.label
|
|
371
|
+
trailing ? labelNode : iconSlot,
|
|
372
|
+
trailing ? iconSlot : labelNode
|
|
353
373
|
]
|
|
354
374
|
}
|
|
355
375
|
)
|