@astryx-vue/core 0.1.0 → 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.
Files changed (177) hide show
  1. package/README.md +1 -1
  2. package/dist/AvatarGroup/index.d.ts +1 -1
  3. package/dist/Banner/index.d.ts +1 -1
  4. package/dist/Button/index.d.ts +1 -1
  5. package/dist/ButtonGroup/index.d.ts +1 -1
  6. package/dist/Calendar/index.js +1 -1
  7. package/dist/{Calendar-DpYFXwgb.js → Calendar-BEyrkUtr.js} +2 -1
  8. package/dist/Chat/index.js +1 -1
  9. package/dist/{Chat-Bfd-YPAK.js → Chat-CO3mCs9A.js} +2 -2
  10. package/dist/CheckboxInput/index.d.ts +1 -1
  11. package/dist/CheckboxList/index.d.ts +2 -0
  12. package/dist/CheckboxList/index.js +2 -0
  13. package/dist/CheckboxList-BL2sDOWK.js +174 -0
  14. package/dist/Citation/index.js +1 -1
  15. package/dist/{Citation-DaDd1teb.js → Citation-BqwJvw7o.js} +2 -2
  16. package/dist/Code/index.js +1 -1
  17. package/dist/{CodeBlock-CK-NWM_1.js → CodeBlock-BQdooQy2.js} +1 -1
  18. package/dist/Collapsible/index.js +1 -1
  19. package/dist/{Collapsible-ByXCGhT8.js → Collapsible-BYg9soTk.js} +1 -1
  20. package/dist/ContextMenu/index.d.ts +1 -1
  21. package/dist/ContextMenu/index.js +1 -1
  22. package/dist/{ContextMenu-BJh99Exj.js → ContextMenu-dA-ppaRQ.js} +284 -12
  23. package/dist/DateInput/index.d.ts +1 -1
  24. package/dist/DateInput/index.js +1 -1
  25. package/dist/{DateInput-zJAdXByM.js → DateInput-BOIb0zAp.js} +18 -10
  26. package/dist/DateRangeInput/index.d.ts +2 -0
  27. package/dist/DateRangeInput/index.js +2 -0
  28. package/dist/DateRangeInput-DLcbgUBi.js +385 -0
  29. package/dist/DateTimeInput/index.d.ts +2 -0
  30. package/dist/DateTimeInput/index.js +2 -0
  31. package/dist/DateTimeInput-RitYX_Yx.js +196 -0
  32. package/dist/Divider/index.d.ts +1 -1
  33. package/dist/DropdownMenu/index.d.ts +1 -1
  34. package/dist/DropdownMenu/index.js +1 -1
  35. package/dist/{DropdownMenu-C3j2zaEn.js → DropdownMenu-B0gogrvG.js} +2 -2
  36. package/dist/Field/index.d.ts +2 -2
  37. package/dist/Field/index.js +1 -2
  38. package/dist/FieldStatus/index.d.ts +2 -0
  39. package/dist/FieldStatus/index.js +2 -0
  40. package/dist/FileInput/index.d.ts +2 -0
  41. package/dist/FileInput/index.js +2 -0
  42. package/dist/FileInput-CYvEV503.js +238 -0
  43. package/dist/{Icon-B6qNgBP9.js → Icon-5MdZQ18k.js} +10 -2
  44. package/dist/List/index.d.ts +1 -1
  45. package/dist/Markdown/index.d.ts +1 -1
  46. package/dist/Markdown/index.js +1 -1
  47. package/dist/{Markdown-DyKIwAL_.js → Markdown-Dnlp8cVx.js} +2 -2
  48. package/dist/MetadataList/index.d.ts +2 -0
  49. package/dist/MetadataList/index.js +2 -0
  50. package/dist/MetadataList-DIsqS1Qb.js +124 -0
  51. package/dist/MobileNav/index.js +1 -1
  52. package/dist/{MobileNavToggle-BK2iRJF-.js → MobileNavToggle-aUZiDwHm.js} +1 -1
  53. package/dist/MoreMenu/index.d.ts +1 -1
  54. package/dist/MoreMenu/index.js +1 -1
  55. package/dist/{MoreMenu-BjUsVWWk.js → MoreMenu-BXL6Dqsu.js} +2 -2
  56. package/dist/MultiSelector/index.d.ts +1 -1
  57. package/dist/MultiSelector/index.js +1 -1
  58. package/dist/{MultiSelector-CKTbTj1A.js → MultiSelector-Bh8or2S6.js} +2 -2
  59. package/dist/NavItem/index.d.ts +1 -1
  60. package/dist/NavMenu/index.d.ts +1 -1
  61. package/dist/NumberInput/index.d.ts +1 -1
  62. package/dist/NumberInput/index.js +1 -1
  63. package/dist/{NumberInput-DU3_rw7z.js → NumberInput-C3S-4dIu.js} +1 -1
  64. package/dist/OverflowList/index.d.ts +1 -1
  65. package/dist/OverflowList/index.js +1 -1
  66. package/dist/{OverflowList-B2T5UtiQ.js → OverflowList-Kr4iJrNV.js} +1 -1
  67. package/dist/Pagination/index.js +1 -1
  68. package/dist/{Pagination-qCgNwwhr.js → Pagination-BRStpeSB.js} +2 -2
  69. package/dist/Popover/index.d.ts +1 -1
  70. package/dist/Radio/index.d.ts +2 -2
  71. package/dist/Radio/index.js +2 -2
  72. package/dist/{Radio-BioQfwHQ.js → RadioGroup-DS6oTV_j.js} +21 -88
  73. package/dist/RadioList/index.d.ts +2 -0
  74. package/dist/RadioList/index.js +2 -0
  75. package/dist/RadioList-pwr93I-z.js +122 -0
  76. package/dist/SegmentedControl/index.d.ts +1 -1
  77. package/dist/Selector/index.d.ts +1 -1
  78. package/dist/Selector/index.js +1 -1
  79. package/dist/{Selector-C6sPJMtH.js → Selector-DvEUIVEC.js} +1 -1
  80. package/dist/SideNav/index.d.ts +1 -1
  81. package/dist/SideNav/index.js +1 -1
  82. package/dist/{SideNav-D9lnn-sM.js → SideNav-B7LX4RcP.js} +2 -2
  83. package/dist/Stack/index.d.ts +1 -1
  84. package/dist/Switch/index.d.ts +1 -1
  85. package/dist/Table/index.d.ts +2 -0
  86. package/dist/Table/index.js +2 -0
  87. package/dist/Table-D5zWaITo.js +967 -0
  88. package/dist/Text/index.d.ts +1 -1
  89. package/dist/TextArea/index.d.ts +1 -1
  90. package/dist/TextInput/index.d.ts +1 -1
  91. package/dist/Thumbnail/index.d.ts +2 -0
  92. package/dist/Thumbnail/index.js +2 -0
  93. package/dist/Thumbnail-DMOgWncm.js +163 -0
  94. package/dist/TimeField-DeQ1ukHl.js +214 -0
  95. package/dist/TimeInput/index.d.ts +2 -0
  96. package/dist/TimeInput/index.js +2 -0
  97. package/dist/TimeInput-jb1nLqZk.js +121 -0
  98. package/dist/Timestamp/index.d.ts +2 -0
  99. package/dist/Timestamp/index.js +2 -0
  100. package/dist/Timestamp-DrWwVQBL.js +465 -0
  101. package/dist/ToggleButton/index.d.ts +1 -1
  102. package/dist/Token/index.d.ts +1 -1
  103. package/dist/Token/index.js +1 -1
  104. package/dist/{Token-Ctf9jekS.js → Token-CV2J94bn.js} +1 -1
  105. package/dist/Tokenizer/index.d.ts +1 -1
  106. package/dist/Tokenizer/index.js +1 -1
  107. package/dist/{Tokenizer-D5MPgau0.js → Tokenizer-DF9r4hTW.js} +2 -2
  108. package/dist/Toolbar/index.d.ts +1 -1
  109. package/dist/TopNav/index.d.ts +1 -1
  110. package/dist/TopNav/index.js +1 -1
  111. package/dist/{TopNav-CjbMCbkC.js → TopNav-BH_s3uap.js} +3 -3
  112. package/dist/TreeList/index.d.ts +2 -0
  113. package/dist/TreeList/index.js +2 -0
  114. package/dist/TreeList-D9cR-w7r.js +506 -0
  115. package/dist/Typeahead/index.d.ts +1 -1
  116. package/dist/Typeahead/index.js +1 -1
  117. package/dist/{Typeahead-BMoU3hfx.js → Typeahead-s4DC1Qem.js} +2 -2
  118. package/dist/composables/index.d.ts +2 -2
  119. package/dist/composables/index.js +4 -1
  120. package/dist/{locale-56lkR7OK.js → context-BshXcNYX.js} +183 -18
  121. package/dist/{index-DjOdQv5B.d.ts → index--dh0s8Li.d.ts} +1 -1
  122. package/dist/{index-Cdi82rTW.d.ts → index-12ObcW99.d.ts} +6 -2
  123. package/dist/{index-JeZ0YTyd.d.ts → index-5R_pi3eT.d.ts} +2 -2
  124. package/dist/{index-Cc2HGODZ.d.ts → index-AkMWQ97a.d.ts} +3 -3
  125. package/dist/{index-CvLlWLIZ.d.ts → index-B4OOtNP8.d.ts} +4 -4
  126. package/dist/{index-_1-uvr27.d.ts → index-B8MbfMwV.d.ts} +1 -1
  127. package/dist/{index-MPcg1Pm4.d.ts → index-BKr7yvVv.d.ts} +1 -1
  128. package/dist/{index-CxspvLBl.d.ts → index-Bc0dgVM5.d.ts} +5 -5
  129. package/dist/{index-4FM5lQdV.d.ts → index-BlWLperN.d.ts} +1 -1
  130. package/dist/{index-DBcbfStA.d.ts → index-BnNh5Iml.d.ts} +84 -1
  131. package/dist/{index-Cp0NlzQv.d.ts → index-Bovw9_8d.d.ts} +1 -1
  132. package/dist/{index-CnVbMebA.d.ts → index-Bqb_Fyju.d.ts} +3 -3
  133. package/dist/{index-HV6W3xCx.d.ts → index-Byar3h1e.d.ts} +1 -1
  134. package/dist/{index-BQuN_dWR.d.ts → index-BzqRns96.d.ts} +1 -1
  135. package/dist/{index-C0S2Xzoi.d.ts → index-CNcQmDrK.d.ts} +93 -0
  136. package/dist/{index-CaHXYQ_E.d.ts → index-CQ9F1f_F.d.ts} +535 -137
  137. package/dist/index-CR6sUmRT.d.ts +356 -0
  138. package/dist/index-C_2Z65Rp.d.ts +67 -0
  139. package/dist/{index-Dw21t7Uf.d.ts → index-CsJpQElv.d.ts} +1 -1
  140. package/dist/index-CtlkhQ55.d.ts +36 -0
  141. package/dist/{index-C8NW9xre.d.ts → index-D3V7yRUP.d.ts} +7 -7
  142. package/dist/index-Da7Jm8Ht.d.ts +10 -0
  143. package/dist/{index-CPhDtlv-.d.ts → index-FEy8qFSD.d.ts} +3 -3
  144. package/dist/{index-BeJqhW4l.d.ts → index-Q4gqBSIZ.d.ts} +2 -2
  145. package/dist/{index-Cz9ZHVf6.d.ts → index-g03bmR4K.d.ts} +3 -3
  146. package/dist/{index-COxy6LEW.d.ts → index-gW0HW02U.d.ts} +1 -1
  147. package/dist/{index-BQa836Vz.d.ts → index-iBLzInje.d.ts} +6 -14
  148. package/dist/index-utZGF4GR.d.ts +79 -0
  149. package/dist/index.d.ts +54 -49
  150. package/dist/index.js +86 -64
  151. package/dist/locale/index.d.ts +1 -1
  152. package/dist/locale/index.js +2 -1
  153. package/dist/locale-Cpk_nrLA.js +18 -0
  154. package/dist/useFileSelection-BPtaegqK.js +58 -0
  155. package/dist/useMonthGrid-CmJsZTcB.js +139 -0
  156. package/dist/useTimeValue-DWk6oTAZ.js +113 -0
  157. package/package.json +49 -1
  158. package/styles/bordered-control.css +87 -0
  159. package/styles/calendar.css +8 -2
  160. package/styles/checkbox-list.css +15 -0
  161. package/styles/date-range-input.css +163 -0
  162. package/styles/date-time-input.css +40 -0
  163. package/styles/field.css +2 -3
  164. package/styles/file-input.css +87 -0
  165. package/styles/icon.css +32 -0
  166. package/styles/metadata-list.css +107 -0
  167. package/styles/number-input.css +6 -0
  168. package/styles/radio.css +32 -0
  169. package/styles/selector.css +10 -0
  170. package/styles/table.css +256 -0
  171. package/styles/text-area.css +6 -1
  172. package/styles/text-input.css +6 -0
  173. package/styles/thumbnail.css +151 -0
  174. package/styles/time-input.css +51 -0
  175. package/styles/timestamp.css +93 -0
  176. package/styles/tree-list.css +229 -0
  177. package/styles.css +11 -0
@@ -1,2 +1,3 @@
1
- import { a as useAstryxMessages, i as useAstryxLocale, n as normalizeLocale, o as formatCalendarMonth, r as provideAstryxLocale, s as weekdayNames, t as astryxLocaleKey } from "../locale-56lkR7OK.js";
1
+ import { n as weekdayNames, t as formatCalendarMonth } from "../locale-Cpk_nrLA.js";
2
+ import { a as useAstryxMessages, i as useAstryxLocale, n as normalizeLocale, r as provideAstryxLocale, t as astryxLocaleKey } from "../context-BshXcNYX.js";
2
3
  export { astryxLocaleKey, formatCalendarMonth, normalizeLocale, provideAstryxLocale, useAstryxLocale, useAstryxMessages, weekdayNames };
@@ -0,0 +1,18 @@
1
+ //#region src/locale/format.ts
2
+ const weekdayStart = new Date(2023, 0, 1);
3
+ function formatCalendarMonth(year, month, locale) {
4
+ return new Intl.DateTimeFormat(locale, {
5
+ month: "long",
6
+ year: "numeric"
7
+ }).format(new Date(year, month - 1, 1));
8
+ }
9
+ function weekdayNames(locale, style) {
10
+ const formatter = new Intl.DateTimeFormat(locale, { weekday: style });
11
+ return Array.from({ length: 7 }, (_, index) => {
12
+ const date = new Date(weekdayStart);
13
+ date.setDate(weekdayStart.getDate() + index);
14
+ return formatter.format(date);
15
+ });
16
+ }
17
+ //#endregion
18
+ export { weekdayNames as n, formatCalendarMonth as t };
@@ -0,0 +1,58 @@
1
+ //#region src/composables/useFileSelection.ts
2
+ function matchesAccept(file, accept) {
3
+ if (accept == null || accept.trim() === "") return true;
4
+ const tokens = accept.split(",").map((token) => token.trim().toLowerCase()).filter(Boolean);
5
+ if (tokens.length === 0) return true;
6
+ const name = file.name.toLowerCase();
7
+ const type = file.type.toLowerCase();
8
+ return tokens.some((token) => {
9
+ if (token.startsWith(".")) return name.endsWith(token);
10
+ if (token.endsWith("/*")) return type.startsWith(token.slice(0, -1));
11
+ return type === token;
12
+ });
13
+ }
14
+ function formatFileSize(bytes) {
15
+ if (bytes < 1024) return `${bytes} B`;
16
+ if (bytes < 1048576) return `${Math.max(1, Math.round(bytes / 1024))} KB`;
17
+ const megabytes = bytes / 1048576;
18
+ return `${megabytes >= 10 ? Math.round(megabytes) : Math.round(megabytes * 10) / 10} MB`;
19
+ }
20
+ function selectFiles(list, options) {
21
+ const incoming = list == null ? [] : [...list];
22
+ const rejections = [];
23
+ let accepted = incoming.filter((file) => {
24
+ if (!matchesAccept(file, options.accept)) {
25
+ rejections.push({
26
+ code: "type",
27
+ fileName: file.name
28
+ });
29
+ return false;
30
+ }
31
+ if (options.maxSize != null && file.size > options.maxSize) {
32
+ rejections.push({
33
+ code: "size",
34
+ fileName: file.name,
35
+ maxSize: options.maxSize
36
+ });
37
+ return false;
38
+ }
39
+ return true;
40
+ });
41
+ if (options.isMultiple && options.maxFiles != null && accepted.length > options.maxFiles) {
42
+ rejections.push({
43
+ code: "count",
44
+ maxFiles: options.maxFiles
45
+ });
46
+ accepted = accepted.slice(0, options.maxFiles);
47
+ }
48
+ if (!options.isMultiple) return {
49
+ files: accepted[0] ?? null,
50
+ rejections
51
+ };
52
+ return {
53
+ files: accepted,
54
+ rejections
55
+ };
56
+ }
57
+ //#endregion
58
+ export { selectFiles as n, formatFileSize as t };
@@ -0,0 +1,139 @@
1
+ import { CalendarDate } from "@internationalized/date";
2
+ //#region src/composables/useDateRange.ts
3
+ const WEEKDAY_INDEX = {
4
+ sun: 0,
5
+ mon: 1,
6
+ tue: 2,
7
+ wed: 3,
8
+ thu: 4,
9
+ fri: 5,
10
+ sat: 6
11
+ };
12
+ function resolveWeekStart(value) {
13
+ if (value == null) return 0;
14
+ if (typeof value === "number") return (value % 7 + 7) % 7;
15
+ return WEEKDAY_INDEX[value.toLowerCase()] ?? 0;
16
+ }
17
+ function compareISODate(a, b) {
18
+ return a < b ? -1 : a > b ? 1 : 0;
19
+ }
20
+ function spanDays(start, end) {
21
+ const [startYear, startMonth, startDay] = start.split("-").map(Number);
22
+ const [endYear, endMonth, endDay] = end.split("-").map(Number);
23
+ const startUtc = Date.UTC(startYear, startMonth - 1, startDay);
24
+ const endUtc = Date.UTC(endYear, endMonth - 1, endDay);
25
+ return Math.round((endUtc - startUtc) / 864e5) + 1;
26
+ }
27
+ function orderRange(a, b) {
28
+ return compareISODate(a, b) <= 0 ? {
29
+ start: a,
30
+ end: b
31
+ } : {
32
+ start: b,
33
+ end: a
34
+ };
35
+ }
36
+ function isSameRange(a, b) {
37
+ if (a == null || b == null) return a === b;
38
+ return a.start === b.start && a.end === b.end;
39
+ }
40
+ function isRangeWithinSpan(range, minRangeSpan = 1, maxRangeSpan) {
41
+ const span = spanDays(range.start, range.end);
42
+ if (span < minRangeSpan) return false;
43
+ if (maxRangeSpan != null && span > maxRangeSpan) return false;
44
+ return true;
45
+ }
46
+ /**
47
+ * 第一次点击记下起点。第二次点击在跨度合法时提交区间。
48
+ * 再次点击起点时,最短跨度允许单日就提交单日,否则取消这次选择。
49
+ */
50
+ function applyRangeClick(pending, day, minRangeSpan = 1, maxRangeSpan) {
51
+ if (pending == null) return {
52
+ pending: day,
53
+ commit: null
54
+ };
55
+ if (pending === day) {
56
+ if (minRangeSpan <= 1) return {
57
+ pending: null,
58
+ commit: {
59
+ start: day,
60
+ end: day
61
+ }
62
+ };
63
+ return {
64
+ pending: null,
65
+ commit: null
66
+ };
67
+ }
68
+ const range = orderRange(pending, day);
69
+ if (!isRangeWithinSpan(range, minRangeSpan, maxRangeSpan)) return {
70
+ pending,
71
+ commit: null
72
+ };
73
+ return {
74
+ pending: null,
75
+ commit: range
76
+ };
77
+ }
78
+ function isDayOutsideSpan(pending, day, minRangeSpan = 1, maxRangeSpan) {
79
+ if (pending == null || pending === day) return false;
80
+ return !isRangeWithinSpan(orderRange(pending, day), minRangeSpan, maxRangeSpan);
81
+ }
82
+ function formatDateRange(range, locale) {
83
+ if (range == null) return "";
84
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
85
+ const startYear = Number(range.start.slice(0, 4));
86
+ const withYear = !(startYear === Number(range.end.slice(0, 4)) && startYear === currentYear);
87
+ const formatter = new Intl.DateTimeFormat(locale === "zh-CN" ? "zh-CN" : "en", {
88
+ month: "short",
89
+ day: "numeric",
90
+ year: withYear ? "numeric" : void 0
91
+ });
92
+ const format = (iso) => {
93
+ const [year, month, day] = iso.split("-").map(Number);
94
+ return formatter.format(new Date(year, month - 1, day));
95
+ };
96
+ return `${format(range.start)} – ${format(range.end)}`;
97
+ }
98
+ //#endregion
99
+ //#region src/composables/useMonthGrid.ts
100
+ function toISODate(date) {
101
+ const month = String(date.month).padStart(2, "0");
102
+ const day = String(date.day).padStart(2, "0");
103
+ return `${date.year}-${month}-${day}`;
104
+ }
105
+ function parseISODate(value) {
106
+ const [year, month, day] = value.split("-").map(Number);
107
+ return new CalendarDate(year, month, day);
108
+ }
109
+ function buildMonthGrid(year, month, weekStartsOn) {
110
+ const first = new CalendarDate(year, month, 1);
111
+ const start = resolveWeekStart(weekStartsOn);
112
+ const offset = (first.toDate("UTC").getUTCDay() - start + 7) % 7;
113
+ let cursor = first.subtract({ days: offset });
114
+ const weeks = [];
115
+ for (let week = 0; week < 6; week += 1) {
116
+ const days = [];
117
+ for (let day = 0; day < 7; day += 1) {
118
+ days.push(toISODate(cursor));
119
+ cursor = cursor.add({ days: 1 });
120
+ }
121
+ weeks.push(days);
122
+ }
123
+ return weeks;
124
+ }
125
+ function addMonths(year, month, amount) {
126
+ const date = new CalendarDate(year, month, 1).add({ months: amount });
127
+ return {
128
+ year: date.year,
129
+ month: date.month
130
+ };
131
+ }
132
+ function todayISODate() {
133
+ const now = /* @__PURE__ */ new Date();
134
+ const month = String(now.getMonth() + 1).padStart(2, "0");
135
+ const day = String(now.getDate()).padStart(2, "0");
136
+ return `${now.getFullYear()}-${month}-${day}`;
137
+ }
138
+ //#endregion
139
+ export { todayISODate as a, formatDateRange as c, isSameRange as d, orderRange as f, toISODate as i, isDayOutsideSpan as l, spanDays as m, buildMonthGrid as n, applyRangeClick as o, resolveWeekStart as p, parseISODate as r, compareISODate as s, addMonths as t, isRangeWithinSpan as u };
@@ -0,0 +1,113 @@
1
+ import { computed, onMounted, onScopeDispose, shallowRef } from "vue";
2
+ //#region src/composables/useCoarsePointer.ts
3
+ /** 粗指针(触摸)为 true。服务端和细指针设备为 false。 */
4
+ function useCoarsePointer() {
5
+ const coarse = shallowRef(false);
6
+ let query;
7
+ function update() {
8
+ coarse.value = query?.matches ?? false;
9
+ }
10
+ onMounted(() => {
11
+ query = window.matchMedia("(pointer: coarse)");
12
+ update();
13
+ query.addEventListener("change", update);
14
+ });
15
+ onScopeDispose(() => {
16
+ query?.removeEventListener("change", update);
17
+ });
18
+ return computed(() => coarse.value);
19
+ }
20
+ //#endregion
21
+ //#region src/composables/useTimeValue.ts
22
+ const DISPLAY_TIME = /^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*([ap])\.?m\.?$/i;
23
+ const COMPACT_TIME = /^(\d{2})(\d{2})(\d{2})?$/;
24
+ const ISO_TIME = /^(\d{2}):(\d{2})(?::(\d{2}))?$/;
25
+ function clampPart(value, max) {
26
+ return Number.isInteger(value) && value >= 0 && value <= max;
27
+ }
28
+ function parseISOTime(value) {
29
+ const match = ISO_TIME.exec(value.trim());
30
+ if (!match) return null;
31
+ const hours = Number(match[1]);
32
+ const minutes = Number(match[2]);
33
+ const seconds = match[3] == null ? 0 : Number(match[3]);
34
+ if (!clampPart(hours, 23) || !clampPart(minutes, 59) || !clampPart(seconds, 59)) return null;
35
+ return {
36
+ hours,
37
+ minutes,
38
+ seconds
39
+ };
40
+ }
41
+ function formatISOTime(time, hasSeconds) {
42
+ const hours = String(time.hours).padStart(2, "0");
43
+ const minutes = String(time.minutes).padStart(2, "0");
44
+ const seconds = String(time.seconds).padStart(2, "0");
45
+ return hasSeconds ? `${hours}:${minutes}:${seconds}` : `${hours}:${minutes}`;
46
+ }
47
+ function formatDisplayTime(value, hourFormat, hasSeconds) {
48
+ const parsed = parseISOTime(value);
49
+ if (!parsed) return value;
50
+ if (hourFormat === "24h") return formatISOTime(parsed, hasSeconds);
51
+ const suffix = parsed.hours < 12 ? "AM" : "PM";
52
+ return `${parsed.hours % 12 || 12}:${String(parsed.minutes).padStart(2, "0")}${hasSeconds ? `:${String(parsed.seconds).padStart(2, "0")}` : ""} ${suffix}`;
53
+ }
54
+ function parseDisplayTime(text, hasSeconds) {
55
+ const trimmed = text.trim();
56
+ if (!trimmed) return null;
57
+ const meridiem = DISPLAY_TIME.exec(trimmed);
58
+ if (meridiem) {
59
+ let hours = Number(meridiem[1]);
60
+ const minutes = meridiem[2] == null ? 0 : Number(meridiem[2]);
61
+ const seconds = meridiem[3] == null ? 0 : Number(meridiem[3]);
62
+ if (!clampPart(hours, 12) || hours === 0 || !clampPart(minutes, 59) || !clampPart(seconds, 59)) return null;
63
+ const isPm = meridiem[4].toLowerCase() === "p";
64
+ if (hours === 12) hours = isPm ? 12 : 0;
65
+ else if (isPm) hours += 12;
66
+ return formatISOTime({
67
+ hours,
68
+ minutes,
69
+ seconds
70
+ }, hasSeconds);
71
+ }
72
+ const compact = COMPACT_TIME.exec(trimmed);
73
+ if (compact) return parseDisplayTime(`${compact[1]}:${compact[2]}${compact[3] ? `:${compact[3]}` : ""}`, hasSeconds);
74
+ const iso = parseISOTime(trimmed);
75
+ if (!iso) return null;
76
+ return formatISOTime(iso, hasSeconds);
77
+ }
78
+ function shiftTime(value, minuteDelta, hasSeconds) {
79
+ const parsed = parseISOTime(value) ?? {
80
+ hours: 0,
81
+ minutes: 0,
82
+ seconds: 0
83
+ };
84
+ const total = parsed.hours * 60 + parsed.minutes + minuteDelta;
85
+ const day = 1440;
86
+ const normalized = (total % day + day) % day;
87
+ return formatISOTime({
88
+ hours: Math.floor(normalized / 60),
89
+ minutes: normalized % 60,
90
+ seconds: parsed.seconds
91
+ }, hasSeconds);
92
+ }
93
+ function comparable(value) {
94
+ const parsed = parseISOTime(value);
95
+ if (!parsed) return value;
96
+ return formatISOTime(parsed, true);
97
+ }
98
+ function isTimeInRange(value, min, max) {
99
+ const current = comparable(value);
100
+ if (min && current < comparable(min)) return false;
101
+ if (max && current > comparable(max)) return false;
102
+ return true;
103
+ }
104
+ function resolveTimeSurface(options) {
105
+ const presentation = options.presentation ?? (options.nativePicker === "always" ? "native" : options.nativePicker === "never" ? "text-input" : "adaptive-native");
106
+ const needsTypedField = options.hasSeconds || options.increment !== 1;
107
+ if (presentation === "text-input" || presentation === "popover" || presentation === "bottom-sheet") return "text";
108
+ if (needsTypedField) return "text";
109
+ if (presentation === "native") return "native";
110
+ return options.coarse ? "native" : "text";
111
+ }
112
+ //#endregion
113
+ export { parseISOTime as a, useCoarsePointer as c, parseDisplayTime as i, formatISOTime as n, resolveTimeSurface as o, isTimeInRange as r, shiftTime as s, formatDisplayTime as t };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astryx-vue/core",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "description": "Vue components for the unofficial astryx-vue community project.",
6
6
  "author": "ShenQingchuan",
7
7
  "license": "MIT",
@@ -36,6 +36,34 @@
36
36
  "types": "./dist/AvatarGroup/index.d.ts",
37
37
  "import": "./dist/AvatarGroup/index.js"
38
38
  },
39
+ "./CheckboxList": {
40
+ "types": "./dist/CheckboxList/index.d.ts",
41
+ "import": "./dist/CheckboxList/index.js"
42
+ },
43
+ "./DateRangeInput": {
44
+ "types": "./dist/DateRangeInput/index.d.ts",
45
+ "import": "./dist/DateRangeInput/index.js"
46
+ },
47
+ "./DateTimeInput": {
48
+ "types": "./dist/DateTimeInput/index.d.ts",
49
+ "import": "./dist/DateTimeInput/index.js"
50
+ },
51
+ "./FieldStatus": {
52
+ "types": "./dist/FieldStatus/index.d.ts",
53
+ "import": "./dist/FieldStatus/index.js"
54
+ },
55
+ "./FileInput": {
56
+ "types": "./dist/FileInput/index.d.ts",
57
+ "import": "./dist/FileInput/index.js"
58
+ },
59
+ "./MetadataList": {
60
+ "types": "./dist/MetadataList/index.d.ts",
61
+ "import": "./dist/MetadataList/index.js"
62
+ },
63
+ "./RadioList": {
64
+ "types": "./dist/RadioList/index.d.ts",
65
+ "import": "./dist/RadioList/index.js"
66
+ },
39
67
  "./StatusDot": {
40
68
  "types": "./dist/StatusDot/index.d.ts",
41
69
  "import": "./dist/StatusDot/index.js"
@@ -88,6 +116,22 @@
88
116
  "types": "./dist/Radio/index.d.ts",
89
117
  "import": "./dist/Radio/index.js"
90
118
  },
119
+ "./Table": {
120
+ "types": "./dist/Table/index.d.ts",
121
+ "import": "./dist/Table/index.js"
122
+ },
123
+ "./Thumbnail": {
124
+ "types": "./dist/Thumbnail/index.d.ts",
125
+ "import": "./dist/Thumbnail/index.js"
126
+ },
127
+ "./TimeInput": {
128
+ "types": "./dist/TimeInput/index.d.ts",
129
+ "import": "./dist/TimeInput/index.js"
130
+ },
131
+ "./Timestamp": {
132
+ "types": "./dist/Timestamp/index.d.ts",
133
+ "import": "./dist/Timestamp/index.js"
134
+ },
91
135
  "./Tooltip": {
92
136
  "types": "./dist/Tooltip/index.d.ts",
93
137
  "import": "./dist/Tooltip/index.js"
@@ -136,6 +180,10 @@
136
180
  "types": "./dist/Toast/index.d.ts",
137
181
  "import": "./dist/Toast/index.js"
138
182
  },
183
+ "./TreeList": {
184
+ "types": "./dist/TreeList/index.d.ts",
185
+ "import": "./dist/TreeList/index.js"
186
+ },
139
187
  "./VisuallyHidden": {
140
188
  "types": "./dist/VisuallyHidden/index.d.ts",
141
189
  "import": "./dist/VisuallyHidden/index.js"
@@ -0,0 +1,87 @@
1
+ @layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
2
+
3
+ @layer astryx.components {
4
+ .astryx-bordered-control {
5
+ box-sizing: border-box;
6
+ position: relative;
7
+ z-index: 1;
8
+ display: flex;
9
+ align-items: center;
10
+ gap: var(--astryx-spacing-2, 8px);
11
+ min-width: 0;
12
+ height: var(--astryx-input-height-md, 32px);
13
+ padding: var(--astryx-spacing-1, 4px) var(--astryx-spacing-2, 8px);
14
+ border: 1px solid var(--astryx-input-status-color, var(--astryx-input-border, #d4d4d4));
15
+ border-radius: var(--astryx-radius-element, 0.625rem);
16
+ color: var(--astryx-color-text-primary, #171717);
17
+ background: var(--astryx-input-background, #fff);
18
+ font-family: inherit;
19
+ font-size: var(--astryx-text-body-size, 14px);
20
+ font-weight: 400;
21
+ line-height: 1.4286;
22
+ transition: border-color 130ms cubic-bezier(0.24, 1, 0.4, 1), box-shadow 130ms cubic-bezier(0.24, 1, 0.4, 1);
23
+ }
24
+
25
+ .astryx-bordered-control[data-size='sm'] {
26
+ height: var(--astryx-input-height-sm, 28px);
27
+ }
28
+
29
+ .astryx-bordered-control[data-size='lg'] {
30
+ height: var(--astryx-input-height-lg, 36px);
31
+ }
32
+
33
+ .astryx-bordered-control[data-status='error'],
34
+ .astryx-date-time-input[data-status='error'] {
35
+ --astryx-input-status-color: var(--astryx-input-error, #e33f4a);
36
+ }
37
+
38
+ .astryx-bordered-control[data-status='warning'],
39
+ .astryx-date-time-input[data-status='warning'] {
40
+ --astryx-input-status-color: var(--astryx-input-warning, #a67a00);
41
+ }
42
+
43
+ .astryx-bordered-control[data-status='success'],
44
+ .astryx-date-time-input[data-status='success'] {
45
+ --astryx-input-status-color: var(--astryx-input-success, #198100);
46
+ }
47
+
48
+ @media (hover: hover) {
49
+ .astryx-bordered-control:not([data-disabled='true']):hover:not(:focus-within) {
50
+ box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--astryx-input-status-color, var(--astryx-input-border, #d4d4d4)) 30%, transparent);
51
+ }
52
+ }
53
+
54
+ .astryx-bordered-control:focus-within {
55
+ border-color: var(--astryx-input-status-color, var(--astryx-input-focus, #262626));
56
+ box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--astryx-input-status-color, var(--astryx-input-focus, #262626)) 15%, transparent);
57
+ }
58
+
59
+ .astryx-bordered-control[data-disabled='true'] {
60
+ opacity: 0.5;
61
+ box-shadow: none;
62
+ cursor: default;
63
+ }
64
+
65
+ .astryx-bordered-control > .astryx-field-icon {
66
+ color: var(--astryx-input-status-color);
67
+ }
68
+
69
+ @media (prefers-reduced-motion: reduce) {
70
+ .astryx-bordered-control {
71
+ transition: none;
72
+ }
73
+ }
74
+
75
+ @media (forced-colors: active) {
76
+ .astryx-bordered-control {
77
+ border-color: ButtonText;
78
+ color: CanvasText;
79
+ background: Canvas;
80
+ box-shadow: none;
81
+ }
82
+
83
+ .astryx-bordered-control:focus-within {
84
+ border-color: Highlight;
85
+ }
86
+ }
87
+ }
@@ -115,8 +115,12 @@
115
115
  }
116
116
 
117
117
  .astryx-calendar-cell.is-selected {
118
- background: var(--astryx-button-primary-background, light-dark(#262626, #ebebeb));
119
- color: var(--astryx-button-primary-foreground, light-dark(#ffffff, #171717));
118
+ background: light-dark(#1b1b1b, #f1f1f1);
119
+ color: light-dark(#ffffff, #111111);
120
+ }
121
+
122
+ .astryx-calendar-cell.is-today.is-selected {
123
+ box-shadow: inset 0 0 0 1px light-dark(#000000, #ffffff);
120
124
  }
121
125
 
122
126
  .astryx-calendar-cell.is-disabled {
@@ -126,6 +130,8 @@
126
130
  }
127
131
 
128
132
  .astryx-calendar-day {
133
+ position: relative;
134
+ z-index: 1;
129
135
  font-size: var(--astryx-text-body-size, 0.875rem);
130
136
  }
131
137
 
@@ -0,0 +1,15 @@
1
+ @layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
2
+
3
+ @layer astryx.components {
4
+ .astryx-checkbox-list {
5
+ min-width: 0;
6
+ }
7
+
8
+ .astryx-checkbox-list .astryx-item[data-selected='true'] {
9
+ background-color: var(--astryx-color-accent-muted, light-dark(#f1f1f1, #262626));
10
+ }
11
+
12
+ .astryx-checkbox-list .astryx-checkbox-input {
13
+ gap: 0;
14
+ }
15
+ }