@xaui/native 0.0.41 → 0.1.1
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/input/index.cjs +95 -1
- package/dist/input/index.d.cts +16 -1
- package/dist/input/index.d.ts +16 -1
- package/dist/input/index.js +95 -1
- package/dist/snippet/index.cjs +67 -40
- package/dist/snippet/index.d.cts +6 -1
- package/dist/snippet/index.d.ts +6 -1
- package/dist/snippet/index.js +64 -37
- package/dist/typography/index.cjs +9 -11
- package/dist/typography/index.d.cts +3 -3
- package/dist/typography/index.d.ts +3 -3
- package/dist/typography/index.js +10 -12
- package/dist/view/index.cjs +42 -6
- package/dist/view/index.d.cts +24 -1
- package/dist/view/index.d.ts +24 -1
- package/dist/view/index.js +77 -41
- package/package.json +1 -1
package/dist/input/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/dist/input/index.d.cts
CHANGED
|
@@ -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 };
|
package/dist/input/index.d.ts
CHANGED
|
@@ -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 };
|
package/dist/input/index.js
CHANGED
|
@@ -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
|
-
|
|
1437
|
+
dateInputValueToDate,
|
|
1438
|
+
dateTimeInputValueToDate,
|
|
1439
|
+
dateToDateInputValue,
|
|
1440
|
+
dateToDateTimeInputValue,
|
|
1441
|
+
dateToTimeInputValue,
|
|
1442
|
+
getDateOrder,
|
|
1443
|
+
timeInputValueToDate
|
|
1350
1444
|
};
|
package/dist/snippet/index.cjs
CHANGED
|
@@ -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',
|
|
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
|
-
|
|
218
|
-
|
|
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',
|
|
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',
|
|
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
|
};
|
package/dist/snippet/index.d.cts
CHANGED
|
@@ -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'
|
package/dist/snippet/index.d.ts
CHANGED
|
@@ -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'
|
package/dist/snippet/index.js
CHANGED
|
@@ -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
|
-
|
|
218
|
-
|
|
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
|
|
193
|
-
left: "
|
|
193
|
+
var alignToTextAlign = {
|
|
194
|
+
left: "left",
|
|
194
195
|
center: "center",
|
|
195
|
-
right: "
|
|
196
|
-
justify: "
|
|
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.
|
|
219
|
+
_reactnative.Text,
|
|
218
220
|
{
|
|
219
221
|
style: [
|
|
220
222
|
{
|
|
221
|
-
|
|
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
|
|
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?:
|
|
100
|
+
backgroundColor?: TextStyle['backgroundColor'];
|
|
101
101
|
/**
|
|
102
102
|
* Custom styles for the text span container.
|
|
103
103
|
*/
|
|
104
|
-
style?: StyleProp<
|
|
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
|
|
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?:
|
|
100
|
+
backgroundColor?: TextStyle['backgroundColor'];
|
|
101
101
|
/**
|
|
102
102
|
* Custom styles for the text span container.
|
|
103
103
|
*/
|
|
104
|
-
style?: StyleProp<
|
|
104
|
+
style?: StyleProp<TextStyle>;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
declare const TextSpan: React.FC<TextSpanProps>;
|
package/dist/typography/index.js
CHANGED
|
@@ -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 {
|
|
192
|
-
var
|
|
193
|
-
left: "
|
|
192
|
+
import { Text as Text2 } from "react-native";
|
|
193
|
+
var alignToTextAlign = {
|
|
194
|
+
left: "left",
|
|
194
195
|
center: "center",
|
|
195
|
-
right: "
|
|
196
|
-
justify: "
|
|
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
|
-
|
|
219
|
+
Text2,
|
|
218
220
|
{
|
|
219
221
|
style: [
|
|
220
222
|
{
|
|
221
|
-
|
|
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/dist/view/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var Column = ({
|
|
|
42
42
|
style
|
|
43
43
|
}) => {
|
|
44
44
|
const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
|
|
45
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
45
|
+
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%", flexGrow: 1 } : { flexGrow: 1 };
|
|
46
46
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
47
47
|
_reactnative.View,
|
|
48
48
|
{
|
|
@@ -74,7 +74,7 @@ var Row = ({
|
|
|
74
74
|
style
|
|
75
75
|
}) => {
|
|
76
76
|
const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
|
|
77
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
77
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
78
78
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
79
79
|
_reactnative.View,
|
|
80
80
|
{
|
|
@@ -128,7 +128,7 @@ var Padding = ({
|
|
|
128
128
|
fullWidth,
|
|
129
129
|
style
|
|
130
130
|
}) => {
|
|
131
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
131
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
132
132
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
133
133
|
_reactnative.View,
|
|
134
134
|
{
|
|
@@ -166,7 +166,7 @@ var Margin = ({
|
|
|
166
166
|
fullWidth,
|
|
167
167
|
style
|
|
168
168
|
}) => {
|
|
169
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
169
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
170
170
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
171
171
|
_reactnative.View,
|
|
172
172
|
{
|
|
@@ -369,6 +369,9 @@ var RoundedView = ({
|
|
|
369
369
|
};
|
|
370
370
|
var styles2 = _reactnative.StyleSheet.create({
|
|
371
371
|
fullWidth: {
|
|
372
|
+
flexGrow: 1,
|
|
373
|
+
flexShrink: 1,
|
|
374
|
+
flexBasis: "auto",
|
|
372
375
|
width: "100%"
|
|
373
376
|
}
|
|
374
377
|
});
|
|
@@ -400,6 +403,7 @@ var Surface = ({
|
|
|
400
403
|
themeColor = "background",
|
|
401
404
|
padding,
|
|
402
405
|
radius = "none",
|
|
406
|
+
fullWidth = false,
|
|
403
407
|
style
|
|
404
408
|
}) => {
|
|
405
409
|
const theme = _chunkRZJFCDFScjs.useXUITheme.call(void 0, );
|
|
@@ -410,8 +414,13 @@ var Surface = ({
|
|
|
410
414
|
{
|
|
411
415
|
style: [
|
|
412
416
|
radiusStyle,
|
|
417
|
+
fullWidth && {
|
|
418
|
+
flexShrink: 1,
|
|
419
|
+
flexBasis: "auto",
|
|
420
|
+
width: "100%",
|
|
421
|
+
flexGrow: 1
|
|
422
|
+
},
|
|
413
423
|
{
|
|
414
|
-
flex: 1,
|
|
415
424
|
backgroundColor: background,
|
|
416
425
|
padding
|
|
417
426
|
},
|
|
@@ -423,6 +432,32 @@ var Surface = ({
|
|
|
423
432
|
};
|
|
424
433
|
Surface.displayName = "Surface";
|
|
425
434
|
|
|
435
|
+
// src/components/view/center/center.tsx
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
var Center = ({
|
|
439
|
+
children,
|
|
440
|
+
fullWidth = false,
|
|
441
|
+
style
|
|
442
|
+
}) => {
|
|
443
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
444
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
445
|
+
_reactnative.View,
|
|
446
|
+
{
|
|
447
|
+
style: [
|
|
448
|
+
{
|
|
449
|
+
alignItems: "center",
|
|
450
|
+
justifyContent: "center"
|
|
451
|
+
},
|
|
452
|
+
fullWidthStyle,
|
|
453
|
+
style
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
children
|
|
457
|
+
);
|
|
458
|
+
};
|
|
459
|
+
Center.displayName = "Center";
|
|
460
|
+
|
|
426
461
|
// src/components/view/grid/grid.tsx
|
|
427
462
|
|
|
428
463
|
|
|
@@ -1058,4 +1093,5 @@ MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
|
1058
1093
|
|
|
1059
1094
|
|
|
1060
1095
|
|
|
1061
|
-
|
|
1096
|
+
|
|
1097
|
+
exports.AspectRatio = AspectRatio; exports.BlurView = BlurView; exports.Center = Center; exports.Column = Column; exports.ConditionalView = ConditionalView; exports.Grid = Grid; exports.GridBuilder = GridBuilder; exports.GridItem = GridItem; exports.Margin = Margin; exports.MasonryGrid = MasonryGrid; exports.MasonryGridBuilder = MasonryGridBuilder; exports.MasonryGridItem = MasonryGridItem; exports.Padding = Padding; exports.PositionedView = PositionedView; exports.RoundedView = RoundedView; exports.Row = Row; exports.SizedBox = SizedBox; exports.Spacer = Spacer; exports.Surface = Surface;
|
package/dist/view/index.d.cts
CHANGED
|
@@ -312,6 +312,11 @@ type SurfaceProps = {
|
|
|
312
312
|
* @default 'none'
|
|
313
313
|
*/
|
|
314
314
|
radius?: Radius;
|
|
315
|
+
/**
|
|
316
|
+
* Force the surface to take the full width.
|
|
317
|
+
* @default false
|
|
318
|
+
*/
|
|
319
|
+
fullWidth?: boolean;
|
|
315
320
|
/**
|
|
316
321
|
* Additional container styles.
|
|
317
322
|
*/
|
|
@@ -320,6 +325,24 @@ type SurfaceProps = {
|
|
|
320
325
|
|
|
321
326
|
declare const Surface: React.FC<SurfaceProps>;
|
|
322
327
|
|
|
328
|
+
type CenterProps = {
|
|
329
|
+
/**
|
|
330
|
+
* Content to render inside the centered container.
|
|
331
|
+
*/
|
|
332
|
+
children: ReactNode;
|
|
333
|
+
/**
|
|
334
|
+
* Force the container to take the full width.
|
|
335
|
+
* @default false
|
|
336
|
+
*/
|
|
337
|
+
fullWidth?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Additional style for the container.
|
|
340
|
+
*/
|
|
341
|
+
style?: StyleProp<ViewStyle>;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
declare const Center: React.FC<CenterProps>;
|
|
345
|
+
|
|
323
346
|
type GridProps = {
|
|
324
347
|
/**
|
|
325
348
|
* The grid items to render.
|
|
@@ -631,4 +654,4 @@ declare const MasonryGridBuilder: {
|
|
|
631
654
|
displayName: string;
|
|
632
655
|
};
|
|
633
656
|
|
|
634
|
-
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
|
657
|
+
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
package/dist/view/index.d.ts
CHANGED
|
@@ -312,6 +312,11 @@ type SurfaceProps = {
|
|
|
312
312
|
* @default 'none'
|
|
313
313
|
*/
|
|
314
314
|
radius?: Radius;
|
|
315
|
+
/**
|
|
316
|
+
* Force the surface to take the full width.
|
|
317
|
+
* @default false
|
|
318
|
+
*/
|
|
319
|
+
fullWidth?: boolean;
|
|
315
320
|
/**
|
|
316
321
|
* Additional container styles.
|
|
317
322
|
*/
|
|
@@ -320,6 +325,24 @@ type SurfaceProps = {
|
|
|
320
325
|
|
|
321
326
|
declare const Surface: React.FC<SurfaceProps>;
|
|
322
327
|
|
|
328
|
+
type CenterProps = {
|
|
329
|
+
/**
|
|
330
|
+
* Content to render inside the centered container.
|
|
331
|
+
*/
|
|
332
|
+
children: ReactNode;
|
|
333
|
+
/**
|
|
334
|
+
* Force the container to take the full width.
|
|
335
|
+
* @default false
|
|
336
|
+
*/
|
|
337
|
+
fullWidth?: boolean;
|
|
338
|
+
/**
|
|
339
|
+
* Additional style for the container.
|
|
340
|
+
*/
|
|
341
|
+
style?: StyleProp<ViewStyle>;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
declare const Center: React.FC<CenterProps>;
|
|
345
|
+
|
|
323
346
|
type GridProps = {
|
|
324
347
|
/**
|
|
325
348
|
* The grid items to render.
|
|
@@ -631,4 +654,4 @@ declare const MasonryGridBuilder: {
|
|
|
631
654
|
displayName: string;
|
|
632
655
|
};
|
|
633
656
|
|
|
634
|
-
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
|
657
|
+
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Center, type CenterProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
package/dist/view/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var Column = ({
|
|
|
42
42
|
style
|
|
43
43
|
}) => {
|
|
44
44
|
const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
|
|
45
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
45
|
+
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%", flexGrow: 1 } : { flexGrow: 1 };
|
|
46
46
|
return /* @__PURE__ */ React.createElement(
|
|
47
47
|
View,
|
|
48
48
|
{
|
|
@@ -74,7 +74,7 @@ var Row = ({
|
|
|
74
74
|
style
|
|
75
75
|
}) => {
|
|
76
76
|
const gapStyle = spacing === void 0 ? void 0 : { gap: spacing };
|
|
77
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
77
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
78
78
|
return /* @__PURE__ */ React2.createElement(
|
|
79
79
|
View2,
|
|
80
80
|
{
|
|
@@ -128,7 +128,7 @@ var Padding = ({
|
|
|
128
128
|
fullWidth,
|
|
129
129
|
style
|
|
130
130
|
}) => {
|
|
131
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
131
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
132
132
|
return /* @__PURE__ */ React4.createElement(
|
|
133
133
|
View4,
|
|
134
134
|
{
|
|
@@ -166,7 +166,7 @@ var Margin = ({
|
|
|
166
166
|
fullWidth,
|
|
167
167
|
style
|
|
168
168
|
}) => {
|
|
169
|
-
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } :
|
|
169
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
170
170
|
return /* @__PURE__ */ React5.createElement(
|
|
171
171
|
View5,
|
|
172
172
|
{
|
|
@@ -369,6 +369,9 @@ var RoundedView = ({
|
|
|
369
369
|
};
|
|
370
370
|
var styles2 = StyleSheet2.create({
|
|
371
371
|
fullWidth: {
|
|
372
|
+
flexGrow: 1,
|
|
373
|
+
flexShrink: 1,
|
|
374
|
+
flexBasis: "auto",
|
|
372
375
|
width: "100%"
|
|
373
376
|
}
|
|
374
377
|
});
|
|
@@ -400,6 +403,7 @@ var Surface = ({
|
|
|
400
403
|
themeColor = "background",
|
|
401
404
|
padding,
|
|
402
405
|
radius = "none",
|
|
406
|
+
fullWidth = false,
|
|
403
407
|
style
|
|
404
408
|
}) => {
|
|
405
409
|
const theme = useXUITheme();
|
|
@@ -410,8 +414,13 @@ var Surface = ({
|
|
|
410
414
|
{
|
|
411
415
|
style: [
|
|
412
416
|
radiusStyle,
|
|
417
|
+
fullWidth && {
|
|
418
|
+
flexShrink: 1,
|
|
419
|
+
flexBasis: "auto",
|
|
420
|
+
width: "100%",
|
|
421
|
+
flexGrow: 1
|
|
422
|
+
},
|
|
413
423
|
{
|
|
414
|
-
flex: 1,
|
|
415
424
|
backgroundColor: background,
|
|
416
425
|
padding
|
|
417
426
|
},
|
|
@@ -423,17 +432,43 @@ var Surface = ({
|
|
|
423
432
|
};
|
|
424
433
|
Surface.displayName = "Surface";
|
|
425
434
|
|
|
435
|
+
// src/components/view/center/center.tsx
|
|
436
|
+
import React12 from "react";
|
|
437
|
+
import { View as View12 } from "react-native";
|
|
438
|
+
var Center = ({
|
|
439
|
+
children,
|
|
440
|
+
fullWidth = false,
|
|
441
|
+
style
|
|
442
|
+
}) => {
|
|
443
|
+
const fullWidthStyle = fullWidth ? { flexGrow: 1, flexShrink: 1, flexBasis: "auto", width: "100%" } : { flexGrow: 1 };
|
|
444
|
+
return /* @__PURE__ */ React12.createElement(
|
|
445
|
+
View12,
|
|
446
|
+
{
|
|
447
|
+
style: [
|
|
448
|
+
{
|
|
449
|
+
alignItems: "center",
|
|
450
|
+
justifyContent: "center"
|
|
451
|
+
},
|
|
452
|
+
fullWidthStyle,
|
|
453
|
+
style
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
children
|
|
457
|
+
);
|
|
458
|
+
};
|
|
459
|
+
Center.displayName = "Center";
|
|
460
|
+
|
|
426
461
|
// src/components/view/grid/grid.tsx
|
|
427
|
-
import
|
|
462
|
+
import React14, { useMemo as useMemo2, useState } from "react";
|
|
428
463
|
import {
|
|
429
|
-
View as
|
|
464
|
+
View as View14
|
|
430
465
|
} from "react-native";
|
|
431
466
|
|
|
432
467
|
// src/components/view/grid/grid-item.tsx
|
|
433
|
-
import
|
|
434
|
-
import { View as
|
|
468
|
+
import React13 from "react";
|
|
469
|
+
import { View as View13 } from "react-native";
|
|
435
470
|
var GridItem = ({ children, style }) => {
|
|
436
|
-
return /* @__PURE__ */
|
|
471
|
+
return /* @__PURE__ */ React13.createElement(View13, { style }, children);
|
|
437
472
|
};
|
|
438
473
|
GridItem.displayName = "GridItem";
|
|
439
474
|
|
|
@@ -447,7 +482,7 @@ var getSafeSpan = (span, columns) => {
|
|
|
447
482
|
return Math.min(Math.floor(span), columns);
|
|
448
483
|
};
|
|
449
484
|
var isGridItemElement = (child) => {
|
|
450
|
-
if (!
|
|
485
|
+
if (!React14.isValidElement(child)) return false;
|
|
451
486
|
if (child.type === GridItem) return true;
|
|
452
487
|
const displayName = child.type.displayName;
|
|
453
488
|
return displayName === "GridItem";
|
|
@@ -466,15 +501,15 @@ var Grid = ({
|
|
|
466
501
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
467
502
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
468
503
|
const itemWidth = `${100 / safeColumns}%`;
|
|
469
|
-
const items =
|
|
504
|
+
const items = React14.Children.toArray(children);
|
|
470
505
|
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
471
506
|
const baseItemWidth = useMemo2(() => {
|
|
472
507
|
if (!containerWidth) return void 0;
|
|
473
508
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
474
509
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
475
510
|
let currentColumn = 0;
|
|
476
|
-
return /* @__PURE__ */
|
|
477
|
-
|
|
511
|
+
return /* @__PURE__ */ React14.createElement(
|
|
512
|
+
View14,
|
|
478
513
|
{
|
|
479
514
|
style: [
|
|
480
515
|
{
|
|
@@ -491,7 +526,7 @@ var Grid = ({
|
|
|
491
526
|
}
|
|
492
527
|
},
|
|
493
528
|
items.map((child, index) => {
|
|
494
|
-
const key =
|
|
529
|
+
const key = React14.isValidElement(child) && child.key ? child.key : `grid-${index}`;
|
|
495
530
|
const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
|
|
496
531
|
const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
|
|
497
532
|
if (currentColumn + span > safeColumns) {
|
|
@@ -511,7 +546,7 @@ var Grid = ({
|
|
|
511
546
|
itemStyle,
|
|
512
547
|
child.props.style
|
|
513
548
|
];
|
|
514
|
-
const element2 =
|
|
549
|
+
const element2 = React14.cloneElement(child, {
|
|
515
550
|
key,
|
|
516
551
|
style: mergedStyle
|
|
517
552
|
});
|
|
@@ -519,8 +554,8 @@ var Grid = ({
|
|
|
519
554
|
return element2;
|
|
520
555
|
}
|
|
521
556
|
const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
|
|
522
|
-
const element = /* @__PURE__ */
|
|
523
|
-
|
|
557
|
+
const element = /* @__PURE__ */ React14.createElement(
|
|
558
|
+
View14,
|
|
524
559
|
{
|
|
525
560
|
key,
|
|
526
561
|
style: [
|
|
@@ -543,11 +578,11 @@ var Grid = ({
|
|
|
543
578
|
};
|
|
544
579
|
|
|
545
580
|
// src/components/view/grid/grid-builder.tsx
|
|
546
|
-
import
|
|
581
|
+
import React15, { useMemo as useMemo3 } from "react";
|
|
547
582
|
import {
|
|
548
583
|
FlatList,
|
|
549
584
|
StyleSheet as StyleSheet3,
|
|
550
|
-
View as
|
|
585
|
+
View as View15
|
|
551
586
|
} from "react-native";
|
|
552
587
|
var getSafeColumns2 = (columns) => {
|
|
553
588
|
if (!columns || columns <= 0) return 1;
|
|
@@ -634,7 +669,7 @@ var GridBuilder = ({
|
|
|
634
669
|
},
|
|
635
670
|
itemStyle
|
|
636
671
|
];
|
|
637
|
-
return /* @__PURE__ */
|
|
672
|
+
return /* @__PURE__ */ React15.createElement(View15, { style: placeholderStyle, pointerEvents: "none" });
|
|
638
673
|
}
|
|
639
674
|
const element = resolvedRenderer({ item: item.item, index: item.index });
|
|
640
675
|
if (element === null) return null;
|
|
@@ -650,7 +685,7 @@ var GridBuilder = ({
|
|
|
650
685
|
},
|
|
651
686
|
itemStyle
|
|
652
687
|
];
|
|
653
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ React15.createElement(View15, { style: wrapperStyle }, element);
|
|
654
689
|
};
|
|
655
690
|
const flattenedStyle = StyleSheet3.flatten(style) ?? {};
|
|
656
691
|
const {
|
|
@@ -671,7 +706,7 @@ var GridBuilder = ({
|
|
|
671
706
|
...columnGap !== void 0 ? { columnGap } : {}
|
|
672
707
|
};
|
|
673
708
|
const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
|
|
674
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ React15.createElement(
|
|
675
710
|
FlatList,
|
|
676
711
|
{
|
|
677
712
|
data: paddedData,
|
|
@@ -691,7 +726,7 @@ var GridBuilder = ({
|
|
|
691
726
|
GridBuilder.displayName = "GridBuilder";
|
|
692
727
|
|
|
693
728
|
// src/components/view/conditional/conditional-view.tsx
|
|
694
|
-
import
|
|
729
|
+
import React16, { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
|
|
695
730
|
import { Animated as Animated3 } from "react-native";
|
|
696
731
|
|
|
697
732
|
// src/components/view/conditional/conditional-view.utils.ts
|
|
@@ -843,18 +878,18 @@ var ConditionalView = ({
|
|
|
843
878
|
if (!shouldRender) {
|
|
844
879
|
return null;
|
|
845
880
|
}
|
|
846
|
-
return /* @__PURE__ */
|
|
881
|
+
return /* @__PURE__ */ React16.createElement(Animated3.View, { style: animatedStyle }, children);
|
|
847
882
|
};
|
|
848
883
|
|
|
849
884
|
// src/components/view/masonry-grid/masonry-grid.tsx
|
|
850
|
-
import
|
|
851
|
-
import { View as
|
|
885
|
+
import React17, { useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
|
|
886
|
+
import { View as View16 } from "react-native";
|
|
852
887
|
var getSafeColumns3 = (columns) => {
|
|
853
888
|
if (!columns || columns <= 0) return 1;
|
|
854
889
|
return Math.floor(columns);
|
|
855
890
|
};
|
|
856
891
|
var getItemKey = (child, index) => {
|
|
857
|
-
return
|
|
892
|
+
return React17.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
|
|
858
893
|
};
|
|
859
894
|
var MasonryGrid = ({
|
|
860
895
|
children,
|
|
@@ -877,7 +912,7 @@ var MasonryGrid = ({
|
|
|
877
912
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
878
913
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
879
914
|
const items = useMemo5(
|
|
880
|
-
() =>
|
|
915
|
+
() => React17.Children.toArray(children).map((child, index) => ({
|
|
881
916
|
key: getItemKey(child, index),
|
|
882
917
|
element: child
|
|
883
918
|
})),
|
|
@@ -894,8 +929,8 @@ var MasonryGrid = ({
|
|
|
894
929
|
});
|
|
895
930
|
return buckets;
|
|
896
931
|
}, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
|
|
897
|
-
return /* @__PURE__ */
|
|
898
|
-
|
|
932
|
+
return /* @__PURE__ */ React17.createElement(
|
|
933
|
+
View16,
|
|
899
934
|
{
|
|
900
935
|
style: [
|
|
901
936
|
{
|
|
@@ -918,10 +953,10 @@ var MasonryGrid = ({
|
|
|
918
953
|
},
|
|
919
954
|
columnStyle
|
|
920
955
|
];
|
|
921
|
-
return /* @__PURE__ */
|
|
956
|
+
return /* @__PURE__ */ React17.createElement(View16, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
|
|
922
957
|
const isLastRow = index === column.length - 1;
|
|
923
|
-
return /* @__PURE__ */
|
|
924
|
-
|
|
958
|
+
return /* @__PURE__ */ React17.createElement(
|
|
959
|
+
View16,
|
|
925
960
|
{
|
|
926
961
|
key: item.key,
|
|
927
962
|
style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
|
|
@@ -940,18 +975,18 @@ var MasonryGrid = ({
|
|
|
940
975
|
};
|
|
941
976
|
|
|
942
977
|
// src/components/view/masonry-grid/masonry-grid-item.tsx
|
|
943
|
-
import
|
|
944
|
-
import { View as
|
|
978
|
+
import React18 from "react";
|
|
979
|
+
import { View as View17 } from "react-native";
|
|
945
980
|
var MasonryGridItem = ({
|
|
946
981
|
children,
|
|
947
982
|
style
|
|
948
983
|
}) => {
|
|
949
|
-
return /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ React18.createElement(View17, { style }, children);
|
|
950
985
|
};
|
|
951
986
|
MasonryGridItem.displayName = "MasonryGridItem";
|
|
952
987
|
|
|
953
988
|
// src/components/view/masonry-grid/masonry-grid-builder.tsx
|
|
954
|
-
import
|
|
989
|
+
import React19, { useMemo as useMemo6, useRef as useRef4 } from "react";
|
|
955
990
|
import {
|
|
956
991
|
ScrollView
|
|
957
992
|
} from "react-native";
|
|
@@ -1011,7 +1046,7 @@ var MasonryGridBuilder = ({
|
|
|
1011
1046
|
onEndReached();
|
|
1012
1047
|
}
|
|
1013
1048
|
};
|
|
1014
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1015
1050
|
ScrollView,
|
|
1016
1051
|
{
|
|
1017
1052
|
scrollEventThrottle: 16,
|
|
@@ -1023,7 +1058,7 @@ var MasonryGridBuilder = ({
|
|
|
1023
1058
|
onScroll: handleScroll
|
|
1024
1059
|
},
|
|
1025
1060
|
header,
|
|
1026
|
-
/* @__PURE__ */
|
|
1061
|
+
/* @__PURE__ */ React19.createElement(
|
|
1027
1062
|
MasonryGrid,
|
|
1028
1063
|
{
|
|
1029
1064
|
columns,
|
|
@@ -1033,7 +1068,7 @@ var MasonryGridBuilder = ({
|
|
|
1033
1068
|
style: [{ width: "100%" }, style],
|
|
1034
1069
|
columnStyle
|
|
1035
1070
|
},
|
|
1036
|
-
resolvedData.map((item, index) => /* @__PURE__ */
|
|
1071
|
+
resolvedData.map((item, index) => /* @__PURE__ */ React19.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
|
|
1037
1072
|
),
|
|
1038
1073
|
footer
|
|
1039
1074
|
);
|
|
@@ -1042,6 +1077,7 @@ MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
|
1042
1077
|
export {
|
|
1043
1078
|
AspectRatio,
|
|
1044
1079
|
BlurView,
|
|
1080
|
+
Center,
|
|
1045
1081
|
Column,
|
|
1046
1082
|
ConditionalView,
|
|
1047
1083
|
Grid,
|