@xaui/native 0.0.40 → 0.1.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.
@@ -21,7 +21,7 @@ var styles = _reactnative.StyleSheet.create({
21
21
  },
22
22
  text: {
23
23
  textAlign: "center",
24
- fontWeight: "600",
24
+ fontWeight: "700",
25
25
  includeFontPadding: false,
26
26
  textAlignVertical: "center"
27
27
  }
@@ -75,28 +75,29 @@ function useBadgeVariantStyles(themeColor, variant) {
75
75
  const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
76
76
  const colorScheme = theme.colors[safeThemeColor];
77
77
  return _react.useMemo.call(void 0, () => {
78
+ const isDark = theme.mode === "dark";
78
79
  if (variant === "flat") {
79
80
  return {
80
- backgroundColor: colorScheme.background,
81
+ backgroundColor: isDark ? _core.withOpacity.call(void 0, colorScheme.background, 0.5) : colorScheme.background,
81
82
  color: colorScheme.main
82
83
  };
83
84
  }
84
85
  if (variant === "faded") {
85
86
  return {
86
- backgroundColor: _core.withOpacity.call(void 0, colorScheme.background, 0.7),
87
+ backgroundColor: isDark ? _core.withOpacity.call(void 0, colorScheme.background, 0.35) : _core.withOpacity.call(void 0, colorScheme.background, 0.7),
87
88
  color: colorScheme.main
88
89
  };
89
90
  }
90
91
  if (variant === "shadow") {
91
92
  return {
92
- backgroundColor: colorScheme.main,
93
- color: colorScheme.foreground,
93
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
94
+ color: isDark ? colorScheme.main : colorScheme.foreground,
94
95
  shadow: theme.shadows.sm
95
96
  };
96
97
  }
97
98
  return {
98
- backgroundColor: colorScheme.main,
99
- color: colorScheme.foreground
99
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
100
+ color: isDark ? colorScheme.main : colorScheme.foreground
100
101
  };
101
102
  }, [colorScheme, theme, variant]);
102
103
  }
@@ -21,7 +21,7 @@ var styles = StyleSheet.create({
21
21
  },
22
22
  text: {
23
23
  textAlign: "center",
24
- fontWeight: "600",
24
+ fontWeight: "700",
25
25
  includeFontPadding: false,
26
26
  textAlignVertical: "center"
27
27
  }
@@ -75,28 +75,29 @@ function useBadgeVariantStyles(themeColor, variant) {
75
75
  const safeThemeColor = getSafeThemeColor(themeColor);
76
76
  const colorScheme = theme.colors[safeThemeColor];
77
77
  return useMemo(() => {
78
+ const isDark = theme.mode === "dark";
78
79
  if (variant === "flat") {
79
80
  return {
80
- backgroundColor: colorScheme.background,
81
+ backgroundColor: isDark ? withOpacity(colorScheme.background, 0.5) : colorScheme.background,
81
82
  color: colorScheme.main
82
83
  };
83
84
  }
84
85
  if (variant === "faded") {
85
86
  return {
86
- backgroundColor: withOpacity(colorScheme.background, 0.7),
87
+ backgroundColor: isDark ? withOpacity(colorScheme.background, 0.35) : withOpacity(colorScheme.background, 0.7),
87
88
  color: colorScheme.main
88
89
  };
89
90
  }
90
91
  if (variant === "shadow") {
91
92
  return {
92
- backgroundColor: colorScheme.main,
93
- color: colorScheme.foreground,
93
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
94
+ color: isDark ? colorScheme.main : colorScheme.foreground,
94
95
  shadow: theme.shadows.sm
95
96
  };
96
97
  }
97
98
  return {
98
- backgroundColor: colorScheme.main,
99
- color: colorScheme.foreground
99
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
100
+ color: isDark ? colorScheme.main : colorScheme.foreground
100
101
  };
101
102
  }, [colorScheme, theme, variant]);
102
103
  }
@@ -60,11 +60,12 @@ var useTextStyles = (themeColor, variant) => {
60
60
  const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
61
61
  const colorScheme = theme.colors[safeThemeColor];
62
62
  const textColor = _react.useMemo.call(void 0, () => {
63
+ const isDark = theme.mode === "dark";
63
64
  if (variant === "solid") {
64
- return colorScheme.foreground;
65
+ return isDark ? colorScheme.main : colorScheme.foreground;
65
66
  }
66
67
  return colorScheme.main;
67
- }, [variant, colorScheme]);
68
+ }, [variant, colorScheme, theme]);
68
69
  return {
69
70
  textColor
70
71
  };
@@ -116,9 +117,10 @@ function useVariantSizesStyles(themeColor, variant, elevation = 0) {
116
117
  const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
117
118
  const colorScheme = theme.colors[safeThemeColor];
118
119
  const variantStyles = _react.useMemo.call(void 0, () => {
120
+ const isDark = theme.mode === "dark";
119
121
  const styles2 = {
120
122
  solid: {
121
- backgroundColor: colorScheme.main,
123
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
122
124
  borderWidth: 0
123
125
  },
124
126
  outlined: {
@@ -127,7 +129,7 @@ function useVariantSizesStyles(themeColor, variant, elevation = 0) {
127
129
  borderColor: colorScheme.main
128
130
  },
129
131
  flat: {
130
- backgroundColor: colorScheme.background,
132
+ backgroundColor: isDark ? _core.withOpacity.call(void 0, colorScheme.background, 0.5) : colorScheme.background,
131
133
  borderWidth: 0
132
134
  },
133
135
  light: {
@@ -54,17 +54,18 @@ var styles = StyleSheet.create({
54
54
 
55
55
  // src/components/button/button.hook.ts
56
56
  import { useMemo } from "react";
57
- import { getSafeThemeColor } from "@xaui/core";
57
+ import { getSafeThemeColor, withOpacity } from "@xaui/core";
58
58
  var useTextStyles = (themeColor, variant) => {
59
59
  const theme = useXUITheme();
60
60
  const safeThemeColor = getSafeThemeColor(themeColor);
61
61
  const colorScheme = theme.colors[safeThemeColor];
62
62
  const textColor = useMemo(() => {
63
+ const isDark = theme.mode === "dark";
63
64
  if (variant === "solid") {
64
- return colorScheme.foreground;
65
+ return isDark ? colorScheme.main : colorScheme.foreground;
65
66
  }
66
67
  return colorScheme.main;
67
- }, [variant, colorScheme]);
68
+ }, [variant, colorScheme, theme]);
68
69
  return {
69
70
  textColor
70
71
  };
@@ -116,9 +117,10 @@ function useVariantSizesStyles(themeColor, variant, elevation = 0) {
116
117
  const safeThemeColor = getSafeThemeColor(themeColor);
117
118
  const colorScheme = theme.colors[safeThemeColor];
118
119
  const variantStyles = useMemo(() => {
120
+ const isDark = theme.mode === "dark";
119
121
  const styles2 = {
120
122
  solid: {
121
- backgroundColor: colorScheme.main,
123
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
122
124
  borderWidth: 0
123
125
  },
124
126
  outlined: {
@@ -127,7 +129,7 @@ function useVariantSizesStyles(themeColor, variant, elevation = 0) {
127
129
  borderColor: colorScheme.main
128
130
  },
129
131
  flat: {
130
- backgroundColor: colorScheme.background,
132
+ backgroundColor: isDark ? withOpacity(colorScheme.background, 0.5) : colorScheme.background,
131
133
  borderWidth: 0
132
134
  },
133
135
  light: {
@@ -99,13 +99,14 @@ function useFabVariantStyles(themeColor, variant, elevation = 0) {
99
99
  const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
100
100
  const colorScheme = theme.colors[safeThemeColor];
101
101
  const variantStyles = _react.useMemo.call(void 0, () => {
102
+ const isDark = theme.mode === "dark";
102
103
  const variantMap = {
103
104
  solid: {
104
- backgroundColor: colorScheme.main,
105
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
105
106
  borderWidth: 0
106
107
  },
107
108
  flat: {
108
- backgroundColor: colorScheme.background,
109
+ backgroundColor: isDark ? _core.withOpacity.call(void 0, colorScheme.background, 0.5) : colorScheme.background,
109
110
  borderWidth: 0
110
111
  },
111
112
  outlined: {
@@ -130,11 +131,12 @@ function useFabIconColor(themeColor, variant) {
130
131
  const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
131
132
  const colorScheme = theme.colors[safeThemeColor];
132
133
  const iconColor = _react.useMemo.call(void 0, () => {
134
+ const isDark = theme.mode === "dark";
133
135
  if (variant === "solid") {
134
- return colorScheme.foreground;
136
+ return isDark ? colorScheme.main : colorScheme.foreground;
135
137
  }
136
138
  return colorScheme.main;
137
- }, [variant, colorScheme]);
139
+ }, [variant, colorScheme, theme]);
138
140
  return { iconColor };
139
141
  }
140
142
  function useFabRadiusValue(radius, fallback) {
@@ -37,7 +37,7 @@ var styles = StyleSheet.create({
37
37
 
38
38
  // src/components/fab/fab.hook.ts
39
39
  import { useMemo } from "react";
40
- import { getSafeThemeColor } from "@xaui/core";
40
+ import { getSafeThemeColor, withOpacity } from "@xaui/core";
41
41
  function useFabSizeStyles(size) {
42
42
  const theme = useXUITheme();
43
43
  const sizeStyles = useMemo(() => {
@@ -99,13 +99,14 @@ function useFabVariantStyles(themeColor, variant, elevation = 0) {
99
99
  const safeThemeColor = getSafeThemeColor(themeColor);
100
100
  const colorScheme = theme.colors[safeThemeColor];
101
101
  const variantStyles = useMemo(() => {
102
+ const isDark = theme.mode === "dark";
102
103
  const variantMap = {
103
104
  solid: {
104
- backgroundColor: colorScheme.main,
105
+ backgroundColor: isDark ? colorScheme.background : colorScheme.main,
105
106
  borderWidth: 0
106
107
  },
107
108
  flat: {
108
- backgroundColor: colorScheme.background,
109
+ backgroundColor: isDark ? withOpacity(colorScheme.background, 0.5) : colorScheme.background,
109
110
  borderWidth: 0
110
111
  },
111
112
  outlined: {
@@ -130,11 +131,12 @@ function useFabIconColor(themeColor, variant) {
130
131
  const safeThemeColor = getSafeThemeColor(themeColor);
131
132
  const colorScheme = theme.colors[safeThemeColor];
132
133
  const iconColor = useMemo(() => {
134
+ const isDark = theme.mode === "dark";
133
135
  if (variant === "solid") {
134
- return colorScheme.foreground;
136
+ return isDark ? colorScheme.main : colorScheme.foreground;
135
137
  }
136
138
  return colorScheme.main;
137
- }, [variant, colorScheme]);
139
+ }, [variant, colorScheme, theme]);
138
140
  return { iconColor };
139
141
  }
140
142
  function useFabRadiusValue(radius, fallback) {
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXQED3KRWcjs = require('../chunk-XQED3KRW.cjs');
3
+ var _chunkHYL4EU3Ycjs = require('../chunk-HYL4EU3Y.cjs');
4
4
  require('../chunk-FBTBWI3P.cjs');
5
5
  require('../chunk-56RPWZD2.cjs');
6
6
  require('../chunk-RZJFCDFS.cjs');
7
7
 
8
8
 
9
- exports.Fab = _chunkXQED3KRWcjs.Fab;
9
+ exports.Fab = _chunkHYL4EU3Ycjs.Fab;
package/dist/fab/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Fab
3
- } from "../chunk-UVI56OO5.js";
3
+ } from "../chunk-WGWXGIZ3.js";
4
4
  import "../chunk-J3BOFXIH.js";
5
5
  import "../chunk-SHBDANQN.js";
6
6
  import "../chunk-LVNBYERF.js";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkXQED3KRWcjs = require('../chunk-XQED3KRW.cjs');
3
+ var _chunkHYL4EU3Ycjs = require('../chunk-HYL4EU3Y.cjs');
4
4
  require('../chunk-FBTBWI3P.cjs');
5
5
  require('../chunk-56RPWZD2.cjs');
6
6
 
@@ -209,7 +209,7 @@ var FabMenu = ({
209
209
  }
210
210
  },
211
211
  /* @__PURE__ */ _react2.default.createElement(
212
- _chunkXQED3KRWcjs.Fab,
212
+ _chunkHYL4EU3Ycjs.Fab,
213
213
  {
214
214
  icon: currentIcon,
215
215
  label,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Fab
3
- } from "../chunk-UVI56OO5.js";
3
+ } from "../chunk-WGWXGIZ3.js";
4
4
  import "../chunk-J3BOFXIH.js";
5
5
  import "../chunk-SHBDANQN.js";
6
6
  import {
@@ -589,6 +589,94 @@ var getTimeMaxLength = (granularity, hourCycle) => {
589
589
  var getDateTimeMaxLength = (separator, granularity, hourCycle) => {
590
590
  return getDateMaxLength(separator) + 1 + getTimeMaxLength(granularity, hourCycle);
591
591
  };
592
+ var pad = (n) => String(n).padStart(2, "0");
593
+ var dateInputValueToDate = (value, dateOrder, separator) => {
594
+ const parts = value.split(separator);
595
+ if (parts.length !== 3) return null;
596
+ let year, month, day;
597
+ if (dateOrder === "YMD") {
598
+ year = parseInt(parts[0], 10);
599
+ month = parseInt(parts[1], 10);
600
+ day = parseInt(parts[2], 10);
601
+ } else if (dateOrder === "MDY") {
602
+ month = parseInt(parts[0], 10);
603
+ day = parseInt(parts[1], 10);
604
+ year = parseInt(parts[2], 10);
605
+ } else {
606
+ day = parseInt(parts[0], 10);
607
+ month = parseInt(parts[1], 10);
608
+ year = parseInt(parts[2], 10);
609
+ }
610
+ if (isNaN(year) || isNaN(month) || isNaN(day)) return null;
611
+ const date = new Date(year, month - 1, day);
612
+ if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day)
613
+ return null;
614
+ return date;
615
+ };
616
+ var dateToDateInputValue = (date, dateOrder, separator) => {
617
+ const d = typeof date === "string" ? new Date(date) : date;
618
+ if (isNaN(d.getTime())) return "";
619
+ const year = String(d.getFullYear());
620
+ const month = pad(d.getMonth() + 1);
621
+ const day = pad(d.getDate());
622
+ if (dateOrder === "YMD") return [year, month, day].join(separator);
623
+ if (dateOrder === "MDY") return [month, day, year].join(separator);
624
+ return [day, month, year].join(separator);
625
+ };
626
+ var timeInputValueToDate = (value, options = {}) => {
627
+ const { hourCycle = 24 } = options;
628
+ const isPM = /pm$/i.test(value);
629
+ const isAM = /am$/i.test(value);
630
+ const cleaned = value.replace(/\s*(am|pm)$/i, "").trim();
631
+ const segments = cleaned.split(":");
632
+ let hours = parseInt(segments[0], 10);
633
+ const minutes = parseInt(_nullishCoalesce(segments[1], () => ( "0")), 10);
634
+ const seconds = parseInt(_nullishCoalesce(segments[2], () => ( "0")), 10);
635
+ if (isNaN(hours) || isNaN(minutes) || isNaN(seconds)) return null;
636
+ if (hourCycle === 12) {
637
+ if (isPM && hours !== 12) hours += 12;
638
+ if (isAM && hours === 12) hours = 0;
639
+ }
640
+ const date = /* @__PURE__ */ new Date();
641
+ date.setHours(hours, minutes, seconds, 0);
642
+ return date;
643
+ };
644
+ var dateToTimeInputValue = (date, options = {}) => {
645
+ const { granularity = "minute", hourCycle = 24 } = options;
646
+ const d = typeof date === "string" ? new Date(date) : date;
647
+ if (isNaN(d.getTime())) return "";
648
+ let hours = d.getHours();
649
+ const minutes = pad(d.getMinutes());
650
+ const seconds = pad(d.getSeconds());
651
+ if (hourCycle === 12) {
652
+ const period = hours >= 12 ? "PM" : "AM";
653
+ hours = hours % 12 || 12;
654
+ const base2 = `${pad(hours)}:${minutes}`;
655
+ return granularity === "second" ? `${base2}:${seconds} ${period}` : `${base2} ${period}`;
656
+ }
657
+ const base = `${pad(hours)}:${minutes}`;
658
+ return granularity === "second" ? `${base}:${seconds}` : base;
659
+ };
660
+ var dateTimeInputValueToDate = (value, dateOrder, options = {}) => {
661
+ const { separator = "-", hourCycle = 24 } = options;
662
+ const spaceIndex = value.indexOf(" ");
663
+ if (spaceIndex === -1) return null;
664
+ const date = dateInputValueToDate(value.slice(0, spaceIndex), dateOrder, separator);
665
+ if (!date) return null;
666
+ const timePart = value.slice(spaceIndex + 1);
667
+ const timed = timeInputValueToDate(timePart, { hourCycle });
668
+ if (!timed) return null;
669
+ date.setHours(timed.getHours(), timed.getMinutes(), timed.getSeconds(), 0);
670
+ return date;
671
+ };
672
+ var dateToDateTimeInputValue = (date, dateOrder, options = {}) => {
673
+ const { separator = "-", granularity = "minute", hourCycle = 24 } = options;
674
+ const d = typeof date === "string" ? new Date(date) : date;
675
+ if (isNaN(d.getTime())) return "";
676
+ const datePart = dateToDateInputValue(d, dateOrder, separator);
677
+ const timePart = dateToTimeInputValue(d, { granularity, hourCycle });
678
+ return `${datePart} ${timePart}`;
679
+ };
592
680
 
593
681
  // src/components/input/date-time-input.tsx
594
682
  var DateInput = _react.forwardRef.call(void 0,
@@ -1347,4 +1435,10 @@ NumberInput.displayName = "NumberInput";
1347
1435
 
1348
1436
 
1349
1437
 
1350
- exports.DateInput = DateInput; exports.DateTimeInput = DateTimeInput; exports.NumberInput = NumberInput; exports.OTPInput = OTPInput; exports.TextArea = TextArea; exports.TextInput = TextInput; exports.TimeInput = TimeInput; exports.getDateOrder = getDateOrder;
1438
+
1439
+
1440
+
1441
+
1442
+
1443
+
1444
+ exports.DateInput = DateInput; exports.DateTimeInput = DateTimeInput; exports.NumberInput = NumberInput; exports.OTPInput = OTPInput; exports.TextArea = TextArea; exports.TextInput = TextInput; exports.TimeInput = TimeInput; exports.dateInputValueToDate = dateInputValueToDate; exports.dateTimeInputValueToDate = dateTimeInputValueToDate; exports.dateToDateInputValue = dateToDateInputValue; exports.dateToDateTimeInputValue = dateToDateTimeInputValue; exports.dateToTimeInputValue = dateToTimeInputValue; exports.getDateOrder = getDateOrder; exports.timeInputValueToDate = timeInputValueToDate;
@@ -148,6 +148,15 @@ declare const TextArea: React.FC<TextAreaProps>;
148
148
  type DateSeparator = '-' | '/' | '.';
149
149
  type DateOrder = 'YMD' | 'DMY' | 'MDY';
150
150
  type TimeInputGranularity = 'minute' | 'second';
151
+ type TimeInputConvertOptions = {
152
+ granularity?: TimeInputGranularity;
153
+ hourCycle?: 12 | 24;
154
+ };
155
+ type DateTimeInputConvertOptions = {
156
+ separator?: DateSeparator;
157
+ granularity?: TimeInputGranularity;
158
+ hourCycle?: 12 | 24;
159
+ };
151
160
  type DateInputProps = TextInputProps & {
152
161
  /**
153
162
  * Separator character between date segments.
@@ -502,5 +511,11 @@ type NumberInputProps = {
502
511
  declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<TextInput$1>>;
503
512
 
504
513
  declare const getDateOrder: (locale: string) => DateOrder;
514
+ declare const dateInputValueToDate: (value: string, dateOrder: DateOrder, separator: DateSeparator) => Date | null;
515
+ declare const dateToDateInputValue: (date: Date | string, dateOrder: DateOrder, separator: DateSeparator) => string;
516
+ declare const timeInputValueToDate: (value: string, options?: TimeInputConvertOptions) => Date | null;
517
+ declare const dateToTimeInputValue: (date: Date | string, options?: TimeInputConvertOptions) => string;
518
+ declare const dateTimeInputValueToDate: (value: string, dateOrder: DateOrder, options?: DateTimeInputConvertOptions) => Date | null;
519
+ declare const dateToDateTimeInputValue: (date: Date | string, dateOrder: DateOrder, options?: DateTimeInputConvertOptions) => string;
505
520
 
506
- export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
521
+ export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputConvertOptions, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputConvertOptions, type TimeInputGranularity, type TimeInputProps, dateInputValueToDate, dateTimeInputValueToDate, dateToDateInputValue, dateToDateTimeInputValue, dateToTimeInputValue, getDateOrder, timeInputValueToDate };
@@ -148,6 +148,15 @@ declare const TextArea: React.FC<TextAreaProps>;
148
148
  type DateSeparator = '-' | '/' | '.';
149
149
  type DateOrder = 'YMD' | 'DMY' | 'MDY';
150
150
  type TimeInputGranularity = 'minute' | 'second';
151
+ type TimeInputConvertOptions = {
152
+ granularity?: TimeInputGranularity;
153
+ hourCycle?: 12 | 24;
154
+ };
155
+ type DateTimeInputConvertOptions = {
156
+ separator?: DateSeparator;
157
+ granularity?: TimeInputGranularity;
158
+ hourCycle?: 12 | 24;
159
+ };
151
160
  type DateInputProps = TextInputProps & {
152
161
  /**
153
162
  * Separator character between date segments.
@@ -502,5 +511,11 @@ type NumberInputProps = {
502
511
  declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<TextInput$1>>;
503
512
 
504
513
  declare const getDateOrder: (locale: string) => DateOrder;
514
+ declare const dateInputValueToDate: (value: string, dateOrder: DateOrder, separator: DateSeparator) => Date | null;
515
+ declare const dateToDateInputValue: (date: Date | string, dateOrder: DateOrder, separator: DateSeparator) => string;
516
+ declare const timeInputValueToDate: (value: string, options?: TimeInputConvertOptions) => Date | null;
517
+ declare const dateToTimeInputValue: (date: Date | string, options?: TimeInputConvertOptions) => string;
518
+ declare const dateTimeInputValueToDate: (value: string, dateOrder: DateOrder, options?: DateTimeInputConvertOptions) => Date | null;
519
+ declare const dateToDateTimeInputValue: (date: Date | string, dateOrder: DateOrder, options?: DateTimeInputConvertOptions) => string;
505
520
 
506
- export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
521
+ export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputConvertOptions, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputConvertOptions, type TimeInputGranularity, type TimeInputProps, dateInputValueToDate, dateTimeInputValueToDate, dateToDateInputValue, dateToDateTimeInputValue, dateToTimeInputValue, getDateOrder, timeInputValueToDate };
@@ -589,6 +589,94 @@ var getTimeMaxLength = (granularity, hourCycle) => {
589
589
  var getDateTimeMaxLength = (separator, granularity, hourCycle) => {
590
590
  return getDateMaxLength(separator) + 1 + getTimeMaxLength(granularity, hourCycle);
591
591
  };
592
+ var pad = (n) => String(n).padStart(2, "0");
593
+ var dateInputValueToDate = (value, dateOrder, separator) => {
594
+ const parts = value.split(separator);
595
+ if (parts.length !== 3) return null;
596
+ let year, month, day;
597
+ if (dateOrder === "YMD") {
598
+ year = parseInt(parts[0], 10);
599
+ month = parseInt(parts[1], 10);
600
+ day = parseInt(parts[2], 10);
601
+ } else if (dateOrder === "MDY") {
602
+ month = parseInt(parts[0], 10);
603
+ day = parseInt(parts[1], 10);
604
+ year = parseInt(parts[2], 10);
605
+ } else {
606
+ day = parseInt(parts[0], 10);
607
+ month = parseInt(parts[1], 10);
608
+ year = parseInt(parts[2], 10);
609
+ }
610
+ if (isNaN(year) || isNaN(month) || isNaN(day)) return null;
611
+ const date = new Date(year, month - 1, day);
612
+ if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day)
613
+ return null;
614
+ return date;
615
+ };
616
+ var dateToDateInputValue = (date, dateOrder, separator) => {
617
+ const d = typeof date === "string" ? new Date(date) : date;
618
+ if (isNaN(d.getTime())) return "";
619
+ const year = String(d.getFullYear());
620
+ const month = pad(d.getMonth() + 1);
621
+ const day = pad(d.getDate());
622
+ if (dateOrder === "YMD") return [year, month, day].join(separator);
623
+ if (dateOrder === "MDY") return [month, day, year].join(separator);
624
+ return [day, month, year].join(separator);
625
+ };
626
+ var timeInputValueToDate = (value, options = {}) => {
627
+ const { hourCycle = 24 } = options;
628
+ const isPM = /pm$/i.test(value);
629
+ const isAM = /am$/i.test(value);
630
+ const cleaned = value.replace(/\s*(am|pm)$/i, "").trim();
631
+ const segments = cleaned.split(":");
632
+ let hours = parseInt(segments[0], 10);
633
+ const minutes = parseInt(segments[1] ?? "0", 10);
634
+ const seconds = parseInt(segments[2] ?? "0", 10);
635
+ if (isNaN(hours) || isNaN(minutes) || isNaN(seconds)) return null;
636
+ if (hourCycle === 12) {
637
+ if (isPM && hours !== 12) hours += 12;
638
+ if (isAM && hours === 12) hours = 0;
639
+ }
640
+ const date = /* @__PURE__ */ new Date();
641
+ date.setHours(hours, minutes, seconds, 0);
642
+ return date;
643
+ };
644
+ var dateToTimeInputValue = (date, options = {}) => {
645
+ const { granularity = "minute", hourCycle = 24 } = options;
646
+ const d = typeof date === "string" ? new Date(date) : date;
647
+ if (isNaN(d.getTime())) return "";
648
+ let hours = d.getHours();
649
+ const minutes = pad(d.getMinutes());
650
+ const seconds = pad(d.getSeconds());
651
+ if (hourCycle === 12) {
652
+ const period = hours >= 12 ? "PM" : "AM";
653
+ hours = hours % 12 || 12;
654
+ const base2 = `${pad(hours)}:${minutes}`;
655
+ return granularity === "second" ? `${base2}:${seconds} ${period}` : `${base2} ${period}`;
656
+ }
657
+ const base = `${pad(hours)}:${minutes}`;
658
+ return granularity === "second" ? `${base}:${seconds}` : base;
659
+ };
660
+ var dateTimeInputValueToDate = (value, dateOrder, options = {}) => {
661
+ const { separator = "-", hourCycle = 24 } = options;
662
+ const spaceIndex = value.indexOf(" ");
663
+ if (spaceIndex === -1) return null;
664
+ const date = dateInputValueToDate(value.slice(0, spaceIndex), dateOrder, separator);
665
+ if (!date) return null;
666
+ const timePart = value.slice(spaceIndex + 1);
667
+ const timed = timeInputValueToDate(timePart, { hourCycle });
668
+ if (!timed) return null;
669
+ date.setHours(timed.getHours(), timed.getMinutes(), timed.getSeconds(), 0);
670
+ return date;
671
+ };
672
+ var dateToDateTimeInputValue = (date, dateOrder, options = {}) => {
673
+ const { separator = "-", granularity = "minute", hourCycle = 24 } = options;
674
+ const d = typeof date === "string" ? new Date(date) : date;
675
+ if (isNaN(d.getTime())) return "";
676
+ const datePart = dateToDateInputValue(d, dateOrder, separator);
677
+ const timePart = dateToTimeInputValue(d, { granularity, hourCycle });
678
+ return `${datePart} ${timePart}`;
679
+ };
592
680
 
593
681
  // src/components/input/date-time-input.tsx
594
682
  var DateInput = forwardRef2(
@@ -1346,5 +1434,11 @@ export {
1346
1434
  TextArea,
1347
1435
  TextInput,
1348
1436
  TimeInput,
1349
- getDateOrder
1437
+ dateInputValueToDate,
1438
+ dateTimeInputValueToDate,
1439
+ dateToDateInputValue,
1440
+ dateToDateTimeInputValue,
1441
+ dateToTimeInputValue,
1442
+ getDateOrder,
1443
+ timeInputValueToDate
1350
1444
  };
@@ -108,9 +108,9 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
108
108
  containerBackground: colorScheme.background,
109
109
  containerBorderWidth: 0,
110
110
  containerBorderColor: "transparent",
111
- selectedBackground: selectedBackgroundColor,
111
+ selectedBackground: _core.withOpacity.call(void 0, colorScheme.main, 0.2),
112
112
  unselectedBackground: "transparent",
113
- selectedTextColor: colorScheme.foreground,
113
+ selectedTextColor: colorScheme.main,
114
114
  unselectedTextColor: colorScheme.main
115
115
  },
116
116
  light: {
@@ -126,9 +126,9 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
126
126
  containerBackground: `${colorScheme.background}95`,
127
127
  containerBorderWidth: theme.borderWidth.md,
128
128
  containerBorderColor: `${colorScheme.main}90`,
129
- selectedBackground: selectedBackgroundColor,
129
+ selectedBackground: _core.withOpacity.call(void 0, colorScheme.main, 0.2),
130
130
  unselectedBackground: "transparent",
131
- selectedTextColor: colorScheme.foreground,
131
+ selectedTextColor: colorScheme.main,
132
132
  unselectedTextColor: colorScheme.main
133
133
  }
134
134
  };
@@ -51,7 +51,7 @@ var styles = StyleSheet.create({
51
51
 
52
52
  // src/components/segment-button/segment-button.hook.ts
53
53
  import { useMemo } from "react";
54
- import { getSafeThemeColor, withPaletteNumber } from "@xaui/core";
54
+ import { getSafeThemeColor, withOpacity, withPaletteNumber } from "@xaui/core";
55
55
  function useSegmentSizeStyles(size) {
56
56
  const theme = useXUITheme();
57
57
  return useMemo(() => {
@@ -108,9 +108,9 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
108
108
  containerBackground: colorScheme.background,
109
109
  containerBorderWidth: 0,
110
110
  containerBorderColor: "transparent",
111
- selectedBackground: selectedBackgroundColor,
111
+ selectedBackground: withOpacity(colorScheme.main, 0.2),
112
112
  unselectedBackground: "transparent",
113
- selectedTextColor: colorScheme.foreground,
113
+ selectedTextColor: colorScheme.main,
114
114
  unselectedTextColor: colorScheme.main
115
115
  },
116
116
  light: {
@@ -126,9 +126,9 @@ function useSegmentVariantStyles(themeColor, variant, elevation = 0) {
126
126
  containerBackground: `${colorScheme.background}95`,
127
127
  containerBorderWidth: theme.borderWidth.md,
128
128
  containerBorderColor: `${colorScheme.main}90`,
129
- selectedBackground: selectedBackgroundColor,
129
+ selectedBackground: withOpacity(colorScheme.main, 0.2),
130
130
  unselectedBackground: "transparent",
131
- selectedTextColor: colorScheme.foreground,
131
+ selectedTextColor: colorScheme.main,
132
132
  unselectedTextColor: colorScheme.main
133
133
  }
134
134
  };
@@ -70,6 +70,26 @@ var styles = _reactnative.StyleSheet.create({
70
70
  fontWeight: "600",
71
71
  includeFontPadding: false
72
72
  },
73
+ inlineSnippet: {
74
+ flexDirection: "row",
75
+ alignItems: "center",
76
+ paddingHorizontal: 10,
77
+ paddingVertical: 8,
78
+ gap: 10
79
+ },
80
+ inlineCopyButton: {
81
+ flexShrink: 0,
82
+ flexDirection: "row",
83
+ alignItems: "center",
84
+ gap: 6,
85
+ borderWidth: 1,
86
+ paddingHorizontal: 10,
87
+ paddingVertical: 6
88
+ },
89
+ inlineContent: {
90
+ flex: 1,
91
+ justifyContent: "center"
92
+ },
73
93
  disabled: {
74
94
  opacity: 0.55
75
95
  }
@@ -119,7 +139,8 @@ var useCopyButtonPositionStyles = (position) => {
119
139
  return _react.useMemo.call(void 0,
120
140
  () => ({
121
141
  isTop: position.startsWith("top"),
122
- isLeft: position.endsWith("left")
142
+ isLeft: position.endsWith("left"),
143
+ isInline: position.startsWith("inline")
123
144
  }),
124
145
  [position]
125
146
  );
@@ -149,6 +170,7 @@ var Snippet = ({
149
170
  copyButtonPosition = "top-right",
150
171
  copyLabel = "Copy",
151
172
  copiedLabel = "Copied",
173
+ hideCopyLabel = false,
152
174
  copyResetDelay = 1500,
153
175
  fullWidth = true,
154
176
  isDisabled = false,
@@ -162,7 +184,7 @@ var Snippet = ({
162
184
  const resetTimerRef = _react2.default.useRef(null);
163
185
  const radiusStyles = _chunkRZJFCDFScjs.useBorderRadiusStyles.call(void 0, radius);
164
186
  const colors = useSnippetColors(themeColor, variant, isDisabled);
165
- const { isTop, isLeft } = useCopyButtonPositionStyles(copyButtonPosition);
187
+ const { isTop, isLeft, isInline } = useCopyButtonPositionStyles(copyButtonPosition);
166
188
  _react2.default.useEffect(() => {
167
189
  return () => {
168
190
  if (resetTimerRef.current) {
@@ -192,6 +214,39 @@ var Snippet = ({
192
214
  setIsCopied(false);
193
215
  }, copyResetDelay);
194
216
  }, [copyResetDelay, isDisabled, onCopy, value]);
217
+ const copyButtonColors = {
218
+ backgroundColor: colors.copyButtonBackground,
219
+ borderColor: colors.copyButtonBorder
220
+ };
221
+ const copyButton = /* @__PURE__ */ _react2.default.createElement(
222
+ _reactnative.Pressable,
223
+ {
224
+ onPress: handleCopy,
225
+ accessibilityRole: "button",
226
+ accessibilityLabel: isCopied ? copiedLabel : copyLabel,
227
+ disabled: isDisabled,
228
+ style: isInline ? [styles.inlineCopyButton, radiusStyles, copyButtonColors, _optionalChain([customAppearance, 'optionalAccess', _9 => _9.copyButton])] : [
229
+ styles.copyButton,
230
+ radiusStyles,
231
+ isTop ? styles.top : styles.bottom,
232
+ isLeft ? styles.left : styles.right,
233
+ copyButtonColors,
234
+ _optionalChain([customAppearance, 'optionalAccess', _10 => _10.copyButton])
235
+ ]
236
+ },
237
+ /* @__PURE__ */ _react2.default.createElement(_icons.CopyIcon, { size: 14, color: colors.copyButtonText }),
238
+ !hideCopyLabel && /* @__PURE__ */ _react2.default.createElement(
239
+ _reactnative.Text,
240
+ {
241
+ style: [
242
+ styles.copyButtonText,
243
+ { color: colors.copyButtonText },
244
+ _optionalChain([customAppearance, 'optionalAccess', _11 => _11.copyButtonText])
245
+ ]
246
+ },
247
+ isCopied ? copiedLabel : copyLabel
248
+ )
249
+ );
195
250
  return /* @__PURE__ */ _react2.default.createElement(
196
251
  _reactnative.View,
197
252
  {
@@ -199,7 +254,7 @@ var Snippet = ({
199
254
  styles.container,
200
255
  !fullWidth && styles.noFullWidth,
201
256
  isDisabled && styles.disabled,
202
- _optionalChain([customAppearance, 'optionalAccess', _9 => _9.container])
257
+ _optionalChain([customAppearance, 'optionalAccess', _12 => _12.container])
203
258
  ]
204
259
  },
205
260
  /* @__PURE__ */ _react2.default.createElement(
@@ -207,6 +262,7 @@ var Snippet = ({
207
262
  {
208
263
  style: [
209
264
  styles.snippet,
265
+ isInline && styles.inlineSnippet,
210
266
  radiusStyles,
211
267
  {
212
268
  backgroundColor: colors.containerBackground,
@@ -214,45 +270,15 @@ var Snippet = ({
214
270
  }
215
271
  ]
216
272
  },
217
- /* @__PURE__ */ _react2.default.createElement(
218
- _reactnative.Pressable,
219
- {
220
- onPress: handleCopy,
221
- accessibilityRole: "button",
222
- accessibilityLabel: isCopied ? copiedLabel : copyLabel,
223
- disabled: isDisabled,
224
- style: [
225
- styles.copyButton,
226
- radiusStyles,
227
- isTop ? styles.top : styles.bottom,
228
- isLeft ? styles.left : styles.right,
229
- {
230
- backgroundColor: colors.copyButtonBackground,
231
- borderColor: colors.copyButtonBorder
232
- },
233
- _optionalChain([customAppearance, 'optionalAccess', _10 => _10.copyButton])
234
- ]
235
- },
236
- /* @__PURE__ */ _react2.default.createElement(_icons.CopyIcon, { size: 14, color: colors.copyButtonText }),
237
- /* @__PURE__ */ _react2.default.createElement(
238
- _reactnative.Text,
239
- {
240
- style: [
241
- styles.copyButtonText,
242
- { color: colors.copyButtonText },
243
- _optionalChain([customAppearance, 'optionalAccess', _11 => _11.copyButtonText])
244
- ]
245
- },
246
- isCopied ? copiedLabel : copyLabel
247
- )
248
- ),
273
+ isInline && isLeft && copyButton,
274
+ !isInline && copyButton,
249
275
  /* @__PURE__ */ _react2.default.createElement(
250
276
  _reactnative.View,
251
277
  {
252
278
  style: [
253
- styles.content,
254
- isTop ? styles.topInset : styles.bottomInset,
255
- _optionalChain([customAppearance, 'optionalAccess', _12 => _12.content])
279
+ isInline ? styles.inlineContent : styles.content,
280
+ !isInline && (isTop ? styles.topInset : styles.bottomInset),
281
+ _optionalChain([customAppearance, 'optionalAccess', _13 => _13.content])
256
282
  ]
257
283
  },
258
284
  /* @__PURE__ */ _react2.default.createElement(
@@ -268,12 +294,13 @@ var Snippet = ({
268
294
  lineHeight: Math.round(fontSize * 1.45),
269
295
  fontWeight
270
296
  },
271
- _optionalChain([customAppearance, 'optionalAccess', _13 => _13.text])
297
+ _optionalChain([customAppearance, 'optionalAccess', _14 => _14.text])
272
298
  ]
273
299
  },
274
300
  value
275
301
  )
276
- )
302
+ ),
303
+ isInline && !isLeft && copyButton
277
304
  )
278
305
  );
279
306
  };
@@ -3,7 +3,7 @@ import { TextStyle, StyleProp, ViewStyle } from 'react-native';
3
3
  import { T as ThemeColor, R as Radius } from '../index-DyU3sW3_.cjs';
4
4
 
5
5
  type SnippetVariant = 'outlined' | 'flat' | 'light';
6
- type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inline-left' | 'inline-right';
7
7
  type SnippetCustomAppearance = {
8
8
  container?: StyleProp<ViewStyle>;
9
9
  content?: StyleProp<ViewStyle>;
@@ -41,6 +41,11 @@ type SnippetProps = {
41
41
  * @default 'Copy'
42
42
  */
43
43
  copyLabel?: string;
44
+ /**
45
+ * Hide the copy/copied text label, showing only the icon.
46
+ * @default false
47
+ */
48
+ hideCopyLabel?: boolean;
44
49
  /**
45
50
  * Label shown after a successful copy action.
46
51
  * @default 'Copied'
@@ -3,7 +3,7 @@ import { TextStyle, StyleProp, ViewStyle } from 'react-native';
3
3
  import { T as ThemeColor, R as Radius } from '../index-DyU3sW3_.js';
4
4
 
5
5
  type SnippetVariant = 'outlined' | 'flat' | 'light';
6
- type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inline-left' | 'inline-right';
7
7
  type SnippetCustomAppearance = {
8
8
  container?: StyleProp<ViewStyle>;
9
9
  content?: StyleProp<ViewStyle>;
@@ -41,6 +41,11 @@ type SnippetProps = {
41
41
  * @default 'Copy'
42
42
  */
43
43
  copyLabel?: string;
44
+ /**
45
+ * Hide the copy/copied text label, showing only the icon.
46
+ * @default false
47
+ */
48
+ hideCopyLabel?: boolean;
44
49
  /**
45
50
  * Label shown after a successful copy action.
46
51
  * @default 'Copied'
@@ -70,6 +70,26 @@ var styles = StyleSheet.create({
70
70
  fontWeight: "600",
71
71
  includeFontPadding: false
72
72
  },
73
+ inlineSnippet: {
74
+ flexDirection: "row",
75
+ alignItems: "center",
76
+ paddingHorizontal: 10,
77
+ paddingVertical: 8,
78
+ gap: 10
79
+ },
80
+ inlineCopyButton: {
81
+ flexShrink: 0,
82
+ flexDirection: "row",
83
+ alignItems: "center",
84
+ gap: 6,
85
+ borderWidth: 1,
86
+ paddingHorizontal: 10,
87
+ paddingVertical: 6
88
+ },
89
+ inlineContent: {
90
+ flex: 1,
91
+ justifyContent: "center"
92
+ },
73
93
  disabled: {
74
94
  opacity: 0.55
75
95
  }
@@ -119,7 +139,8 @@ var useCopyButtonPositionStyles = (position) => {
119
139
  return useMemo(
120
140
  () => ({
121
141
  isTop: position.startsWith("top"),
122
- isLeft: position.endsWith("left")
142
+ isLeft: position.endsWith("left"),
143
+ isInline: position.startsWith("inline")
123
144
  }),
124
145
  [position]
125
146
  );
@@ -149,6 +170,7 @@ var Snippet = ({
149
170
  copyButtonPosition = "top-right",
150
171
  copyLabel = "Copy",
151
172
  copiedLabel = "Copied",
173
+ hideCopyLabel = false,
152
174
  copyResetDelay = 1500,
153
175
  fullWidth = true,
154
176
  isDisabled = false,
@@ -162,7 +184,7 @@ var Snippet = ({
162
184
  const resetTimerRef = React.useRef(null);
163
185
  const radiusStyles = useBorderRadiusStyles(radius);
164
186
  const colors = useSnippetColors(themeColor, variant, isDisabled);
165
- const { isTop, isLeft } = useCopyButtonPositionStyles(copyButtonPosition);
187
+ const { isTop, isLeft, isInline } = useCopyButtonPositionStyles(copyButtonPosition);
166
188
  React.useEffect(() => {
167
189
  return () => {
168
190
  if (resetTimerRef.current) {
@@ -192,6 +214,39 @@ var Snippet = ({
192
214
  setIsCopied(false);
193
215
  }, copyResetDelay);
194
216
  }, [copyResetDelay, isDisabled, onCopy, value]);
217
+ const copyButtonColors = {
218
+ backgroundColor: colors.copyButtonBackground,
219
+ borderColor: colors.copyButtonBorder
220
+ };
221
+ const copyButton = /* @__PURE__ */ React.createElement(
222
+ Pressable,
223
+ {
224
+ onPress: handleCopy,
225
+ accessibilityRole: "button",
226
+ accessibilityLabel: isCopied ? copiedLabel : copyLabel,
227
+ disabled: isDisabled,
228
+ style: isInline ? [styles.inlineCopyButton, radiusStyles, copyButtonColors, customAppearance?.copyButton] : [
229
+ styles.copyButton,
230
+ radiusStyles,
231
+ isTop ? styles.top : styles.bottom,
232
+ isLeft ? styles.left : styles.right,
233
+ copyButtonColors,
234
+ customAppearance?.copyButton
235
+ ]
236
+ },
237
+ /* @__PURE__ */ React.createElement(CopyIcon, { size: 14, color: colors.copyButtonText }),
238
+ !hideCopyLabel && /* @__PURE__ */ React.createElement(
239
+ Text,
240
+ {
241
+ style: [
242
+ styles.copyButtonText,
243
+ { color: colors.copyButtonText },
244
+ customAppearance?.copyButtonText
245
+ ]
246
+ },
247
+ isCopied ? copiedLabel : copyLabel
248
+ )
249
+ );
195
250
  return /* @__PURE__ */ React.createElement(
196
251
  View,
197
252
  {
@@ -207,6 +262,7 @@ var Snippet = ({
207
262
  {
208
263
  style: [
209
264
  styles.snippet,
265
+ isInline && styles.inlineSnippet,
210
266
  radiusStyles,
211
267
  {
212
268
  backgroundColor: colors.containerBackground,
@@ -214,44 +270,14 @@ var Snippet = ({
214
270
  }
215
271
  ]
216
272
  },
217
- /* @__PURE__ */ React.createElement(
218
- Pressable,
219
- {
220
- onPress: handleCopy,
221
- accessibilityRole: "button",
222
- accessibilityLabel: isCopied ? copiedLabel : copyLabel,
223
- disabled: isDisabled,
224
- style: [
225
- styles.copyButton,
226
- radiusStyles,
227
- isTop ? styles.top : styles.bottom,
228
- isLeft ? styles.left : styles.right,
229
- {
230
- backgroundColor: colors.copyButtonBackground,
231
- borderColor: colors.copyButtonBorder
232
- },
233
- customAppearance?.copyButton
234
- ]
235
- },
236
- /* @__PURE__ */ React.createElement(CopyIcon, { size: 14, color: colors.copyButtonText }),
237
- /* @__PURE__ */ React.createElement(
238
- Text,
239
- {
240
- style: [
241
- styles.copyButtonText,
242
- { color: colors.copyButtonText },
243
- customAppearance?.copyButtonText
244
- ]
245
- },
246
- isCopied ? copiedLabel : copyLabel
247
- )
248
- ),
273
+ isInline && isLeft && copyButton,
274
+ !isInline && copyButton,
249
275
  /* @__PURE__ */ React.createElement(
250
276
  View,
251
277
  {
252
278
  style: [
253
- styles.content,
254
- isTop ? styles.topInset : styles.bottomInset,
279
+ isInline ? styles.inlineContent : styles.content,
280
+ !isInline && (isTop ? styles.topInset : styles.bottomInset),
255
281
  customAppearance?.content
256
282
  ]
257
283
  },
@@ -273,7 +299,8 @@ var Snippet = ({
273
299
  },
274
300
  value
275
301
  )
276
- )
302
+ ),
303
+ isInline && !isLeft && copyButton
277
304
  )
278
305
  );
279
306
  };
@@ -179,6 +179,7 @@ var Typography = ({
179
179
  variantStyles,
180
180
  resolvedAlign && { textAlign: resolvedAlign },
181
181
  textStyleOverrides,
182
+ inheritedStyle.spacing != null ? { marginRight: inheritedStyle.spacing } : void 0,
182
183
  style
183
184
  ]
184
185
  },
@@ -189,11 +190,11 @@ var Typography = ({
189
190
  // src/components/typography/text-span.tsx
190
191
 
191
192
 
192
- var alignToJustifyContent = {
193
- left: "flex-start",
193
+ var alignToTextAlign = {
194
+ left: "left",
194
195
  center: "center",
195
- right: "flex-end",
196
- justify: "space-between"
196
+ right: "right",
197
+ justify: "justify"
197
198
  };
198
199
  var TextSpan = ({
199
200
  children,
@@ -211,18 +212,15 @@ var TextSpan = ({
211
212
  fontWeight,
212
213
  fontStyle,
213
214
  textTransform,
214
- align
215
+ align,
216
+ spacing
215
217
  };
216
218
  return /* @__PURE__ */ _react2.default.createElement(TextSpanContext.Provider, { value: inheritedTextStyle }, /* @__PURE__ */ _react2.default.createElement(
217
- _reactnative.View,
219
+ _reactnative.Text,
218
220
  {
219
221
  style: [
220
222
  {
221
- flexDirection: "row",
222
- flexWrap: "wrap",
223
- alignItems: "center",
224
- ...align ? { justifyContent: alignToJustifyContent[align] } : {},
225
- ...typeof spacing === "number" ? { gap: spacing } : {},
223
+ ...align ? { textAlign: alignToTextAlign[align] } : {},
226
224
  ...backgroundColor ? { backgroundColor } : {}
227
225
  },
228
226
  style
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import { StyleProp, TextStyle } from 'react-native';
3
3
  import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
4
4
 
5
5
  type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
@@ -97,11 +97,11 @@ type TextSpanProps = {
97
97
  /**
98
98
  * Background color for the text span container.
99
99
  */
100
- backgroundColor?: ViewStyle['backgroundColor'];
100
+ backgroundColor?: TextStyle['backgroundColor'];
101
101
  /**
102
102
  * Custom styles for the text span container.
103
103
  */
104
- style?: StyleProp<ViewStyle>;
104
+ style?: StyleProp<TextStyle>;
105
105
  };
106
106
 
107
107
  declare const TextSpan: React.FC<TextSpanProps>;
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import { StyleProp, TextStyle } from 'react-native';
3
3
  import { T as ThemeColor } from '../index-BOw6tbkc.js';
4
4
 
5
5
  type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
@@ -97,11 +97,11 @@ type TextSpanProps = {
97
97
  /**
98
98
  * Background color for the text span container.
99
99
  */
100
- backgroundColor?: ViewStyle['backgroundColor'];
100
+ backgroundColor?: TextStyle['backgroundColor'];
101
101
  /**
102
102
  * Custom styles for the text span container.
103
103
  */
104
- style?: StyleProp<ViewStyle>;
104
+ style?: StyleProp<TextStyle>;
105
105
  };
106
106
 
107
107
  declare const TextSpan: React.FC<TextSpanProps>;
@@ -179,6 +179,7 @@ var Typography = ({
179
179
  variantStyles,
180
180
  resolvedAlign && { textAlign: resolvedAlign },
181
181
  textStyleOverrides,
182
+ inheritedStyle.spacing != null ? { marginRight: inheritedStyle.spacing } : void 0,
182
183
  style
183
184
  ]
184
185
  },
@@ -188,12 +189,12 @@ var Typography = ({
188
189
 
189
190
  // src/components/typography/text-span.tsx
190
191
  import React2 from "react";
191
- import { View } from "react-native";
192
- var alignToJustifyContent = {
193
- left: "flex-start",
192
+ import { Text as Text2 } from "react-native";
193
+ var alignToTextAlign = {
194
+ left: "left",
194
195
  center: "center",
195
- right: "flex-end",
196
- justify: "space-between"
196
+ right: "right",
197
+ justify: "justify"
197
198
  };
198
199
  var TextSpan = ({
199
200
  children,
@@ -211,18 +212,15 @@ var TextSpan = ({
211
212
  fontWeight,
212
213
  fontStyle,
213
214
  textTransform,
214
- align
215
+ align,
216
+ spacing
215
217
  };
216
218
  return /* @__PURE__ */ React2.createElement(TextSpanContext.Provider, { value: inheritedTextStyle }, /* @__PURE__ */ React2.createElement(
217
- View,
219
+ Text2,
218
220
  {
219
221
  style: [
220
222
  {
221
- flexDirection: "row",
222
- flexWrap: "wrap",
223
- alignItems: "center",
224
- ...align ? { justifyContent: alignToJustifyContent[align] } : {},
225
- ...typeof spacing === "number" ? { gap: spacing } : {},
223
+ ...align ? { textAlign: alignToTextAlign[align] } : {},
226
224
  ...backgroundColor ? { backgroundColor } : {}
227
225
  },
228
226
  style
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaui/native",
3
- "version": "0.0.40",
3
+ "version": "0.1.0",
4
4
  "description": "Flutter-inspired React Native UI components with native animations powered by React Native Reanimated",
5
5
  "keywords": [
6
6
  "react-native",