@astryx-vue/core 0.2.0 → 0.2.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 (220) hide show
  1. package/dist/AppShell/index.js +1 -1
  2. package/dist/{AppShell-EiGyPFbA.js → AppShell-1wNIEtK_.js} +2 -2
  3. package/dist/Avatar/index.d.ts +1 -1
  4. package/dist/Avatar/index.js +1 -1
  5. package/dist/Avatar-jmHInHwj.js +244 -0
  6. package/dist/AvatarGroup/index.d.ts +1 -1
  7. package/dist/AvatarGroup/index.js +1 -1
  8. package/dist/{AvatarGroup-CZcgAMjM.js → AvatarGroup-QyzSrpYA.js} +8 -7
  9. package/dist/Badge/index.d.ts +1 -1
  10. package/dist/Badge/index.js +1 -1
  11. package/dist/Badge-CjDQPF5g.js +30 -0
  12. package/dist/Banner/index.d.ts +1 -1
  13. package/dist/Breadcrumbs/index.d.ts +2 -2
  14. package/dist/Breadcrumbs/index.js +1 -1
  15. package/dist/{Breadcrumbs-C3YZFQ9w.js → Breadcrumbs-C97HmjkC.js} +45 -11
  16. package/dist/Button/index.d.ts +1 -1
  17. package/dist/ButtonGroup/index.d.ts +1 -1
  18. package/dist/Calendar/index.d.ts +2 -2
  19. package/dist/Calendar/index.js +1 -1
  20. package/dist/Calendar-DqC3EDN1.js +352 -0
  21. package/dist/Card/index.d.ts +1 -1
  22. package/dist/Carousel/index.js +1 -1
  23. package/dist/{Carousel-BTtHkKea.js → Carousel-BGUnskjo.js} +2 -2
  24. package/dist/Chat/index.js +1 -1
  25. package/dist/{Chat-DjNxw5gv.js → Chat-DCjXRiOF.js} +8 -8
  26. package/dist/CheckboxInput/index.d.ts +1 -1
  27. package/dist/CheckboxList/index.d.ts +1 -1
  28. package/dist/CheckboxList/index.js +1 -1
  29. package/dist/Citation/index.js +1 -1
  30. package/dist/{Citation-DijdbUUu.js → Citation-DunoAqVH.js} +2 -2
  31. package/dist/ClickableCard/index.d.ts +1 -1
  32. package/dist/Code/index.js +1 -1
  33. package/dist/{CodeBlock-CxTb6j9_.js → CodeBlock-CAF-VJnh.js} +1 -1
  34. package/dist/Collapsible/index.js +1 -1
  35. package/dist/{Collapsible-9MC08X39.js → Collapsible-DvMiYJp7.js} +1 -1
  36. package/dist/CommandPalette/index.js +1 -1
  37. package/dist/{CommandPalette-BD2iODF5.js → CommandPalette-xfm9ldUI.js} +1 -1
  38. package/dist/ComplexSelector/index.d.ts +1 -1
  39. package/dist/ComplexSelector/index.js +1 -1
  40. package/dist/{ComplexSelector-D9iXd5cH.js → ComplexSelector-B6lBTRhP.js} +2 -2
  41. package/dist/ContextMenu/index.d.ts +2 -2
  42. package/dist/ContextMenu/index.js +1 -1
  43. package/dist/{ContextMenu-HS_WqYIg.js → ContextMenu-DUkED3Z3.js} +101 -63
  44. package/dist/DateInput/index.d.ts +2 -2
  45. package/dist/DateInput/index.js +1 -1
  46. package/dist/DateInput-Crcg-CCj.js +376 -0
  47. package/dist/DateRangeInput/index.d.ts +1 -1
  48. package/dist/DateRangeInput/index.js +1 -1
  49. package/dist/{DateRangeInput-1bhPGG2s.js → DateRangeInput-e9KSxBBK.js} +2 -2
  50. package/dist/DateTimeInput/index.d.ts +1 -1
  51. package/dist/DateTimeInput/index.js +1 -1
  52. package/dist/{DateTimeInput-SnPdgk6P.js → DateTimeInput-fSOfuLex.js} +5 -3
  53. package/dist/Divider/index.d.ts +1 -1
  54. package/dist/DropdownMenu/index.d.ts +3 -2
  55. package/dist/DropdownMenu/index.js +3 -2
  56. package/dist/{DropdownMenu-UJGych6v.js → DropdownMenu-8G0B1UND.js} +63 -16
  57. package/dist/DropdownMenu-XvW4BJob.js +164 -0
  58. package/dist/FileInput/index.d.ts +1 -1
  59. package/dist/FileInput/index.js +1 -1
  60. package/dist/{FileInput-BQiwE-GB.js → FileInput-D-fchyQH.js} +2 -2
  61. package/dist/Icon/index.d.ts +4 -3
  62. package/dist/Icon/index.js +3 -2
  63. package/dist/Icon/plugin.d.ts +45 -0
  64. package/dist/Icon/plugin.js +177 -0
  65. package/dist/Icon-Bku25g_K.js +193 -0
  66. package/dist/Lightbox/index.js +1 -1
  67. package/dist/{Lightbox-CshKoB0r.js → Lightbox-uuVGgHxW.js} +2 -2
  68. package/dist/Link/index.d.ts +1 -1
  69. package/dist/Link/index.js +1 -1
  70. package/dist/Link-DqdQZ37C.js +141 -0
  71. package/dist/List/index.d.ts +1 -1
  72. package/dist/Markdown/index.js +1 -1
  73. package/dist/{Markdown-D-Ua055V.js → Markdown-DLICa3db.js} +3 -3
  74. package/dist/MetadataList/index.d.ts +1 -1
  75. package/dist/MetadataList/index.js +1 -1
  76. package/dist/{MetadataList-sYph_d8Q.js → MetadataList-h492rqEN.js} +1 -1
  77. package/dist/MobileNav/index.js +1 -1
  78. package/dist/{MobileNavToggle-DD9D01aj.js → MobileNavToggle-BMj3Wtuq.js} +1 -1
  79. package/dist/MoreMenu/index.d.ts +1 -1
  80. package/dist/MoreMenu/index.js +1 -1
  81. package/dist/{MoreMenu-BVrK5kkk.js → MoreMenu-DkYi5az5.js} +2 -2
  82. package/dist/MultiSelector/index.d.ts +1 -1
  83. package/dist/MultiSelector/index.js +1 -1
  84. package/dist/{MultiSelector-DiYov9sF.js → MultiSelector-C2IS-EaU.js} +2 -2
  85. package/dist/NavItem/index.d.ts +1 -1
  86. package/dist/NumberInput/index.d.ts +2 -2
  87. package/dist/NumberInput/index.js +1 -1
  88. package/dist/NumberInput-CjfAsFwj.js +210 -0
  89. package/dist/Outline/index.js +1 -1
  90. package/dist/{Outline-DQfEBxlc.js → Outline-BTmrtvXR.js} +1 -1
  91. package/dist/OverflowList/index.d.ts +1 -1
  92. package/dist/OverflowList/index.js +1 -1
  93. package/dist/{OverflowList-BU5VCntl.js → OverflowList-CRE8BE7V.js} +1 -1
  94. package/dist/Overlay/index.d.ts +1 -1
  95. package/dist/Pagination/index.d.ts +2 -2
  96. package/dist/Pagination/index.js +1 -1
  97. package/dist/{Pagination-HdhtykeF.js → Pagination-BpGXPmc7.js} +76 -22
  98. package/dist/ProgressBar/index.d.ts +1 -1
  99. package/dist/ProgressBar/index.js +1 -1
  100. package/dist/{ProgressBar-ChDp-7oe.js → ProgressBar-DO9Chic6.js} +31 -11
  101. package/dist/Radio/index.d.ts +1 -1
  102. package/dist/RadioList/index.d.ts +1 -1
  103. package/dist/Resizable/index.js +1 -1
  104. package/dist/{Resizable-BhSMfO5B.js → Resizable-CE8XQDL2.js} +1 -1
  105. package/dist/ScrollableArea/index.d.ts +1 -1
  106. package/dist/SegmentedControl/index.d.ts +1 -1
  107. package/dist/SelectableCard/index.d.ts +1 -1
  108. package/dist/Selector/index.d.ts +2 -2
  109. package/dist/Selector/index.js +1 -1
  110. package/dist/Selector-DkJOLZSR.js +468 -0
  111. package/dist/SideNav/index.d.ts +1 -1
  112. package/dist/SideNav/index.js +1 -1
  113. package/dist/{SideNav-B-Om6Bz3.js → SideNav-DcDWBnXJ.js} +17 -17
  114. package/dist/Stepper/index.d.ts +1 -1
  115. package/dist/Stepper/index.js +1 -1
  116. package/dist/{Stepper-BZ_8SEZt.js → Stepper-DZKaqEoz.js} +1 -1
  117. package/dist/Switch/index.d.ts +1 -1
  118. package/dist/TabList/index.d.ts +1 -1
  119. package/dist/TabList/index.js +1 -1
  120. package/dist/{TabList-Cnc2Hs1H.js → TabList-hm06QPiW.js} +10 -3
  121. package/dist/Table/index.js +1 -1
  122. package/dist/{Table-D-LhAy_J.js → Table-DwehtMap.js} +4 -4
  123. package/dist/TextArea/index.d.ts +1 -1
  124. package/dist/TextArea/index.js +1 -1
  125. package/dist/{TextArea-Cv9UVbzS.js → TextArea-CPwSytdO.js} +12 -6
  126. package/dist/TextInput/index.d.ts +1 -1
  127. package/dist/Thumbnail/index.js +1 -1
  128. package/dist/{Thumbnail-Dc1UpykG.js → Thumbnail-CAOYds8t.js} +11 -11
  129. package/dist/{TimeField-C7t9Knq9.js → TimeField-BGbxCoKU.js} +2 -2
  130. package/dist/TimeInput/index.d.ts +1 -1
  131. package/dist/TimeInput/index.js +1 -1
  132. package/dist/{TimeInput-BXxCOY98.js → TimeInput-DJP3l4ZS.js} +1 -1
  133. package/dist/Timestamp/index.d.ts +1 -1
  134. package/dist/Timestamp/index.js +2 -1
  135. package/dist/{Timestamp-DlZSmgCJ.js → Timestamp-BzRp8uWc.js} +4 -121
  136. package/dist/Toast/index.d.ts +2 -2
  137. package/dist/Toast/index.js +1 -1
  138. package/dist/{Toast-BKXPvEMp.js → Toast-C2ML-bmi.js} +37 -7
  139. package/dist/ToggleButton/index.d.ts +1 -1
  140. package/dist/Token/index.js +1 -1
  141. package/dist/{Token-wt4e80IM.js → Token-CjocuhzE.js} +1 -1
  142. package/dist/Tokenizer/index.js +1 -1
  143. package/dist/{Tokenizer-nmTqdS9n.js → Tokenizer-mYES5SPM.js} +2 -2
  144. package/dist/Toolbar/index.d.ts +1 -1
  145. package/dist/TopNav/index.d.ts +1 -1
  146. package/dist/TopNav/index.js +1 -1
  147. package/dist/{TopNav-notp-mJx.js → TopNav-C2t6JkZb.js} +3 -3
  148. package/dist/TreeList/index.d.ts +1 -1
  149. package/dist/TreeList/index.js +1 -1
  150. package/dist/{TreeList-s1xBQ0qq.js → TreeList-THJ0KamE.js} +3 -3
  151. package/dist/Typeahead/index.js +1 -1
  152. package/dist/{Typeahead-VAuiCurV.js → Typeahead-D7VnvRpK.js} +2 -2
  153. package/dist/{context-Dbo22sck.js → context-DzcK4T_C.js} +4 -2
  154. package/dist/formatInstant-BDWUIxS7.js +119 -0
  155. package/dist/{index-Bainr_3n.d.ts → index-3p2BDVHq.d.ts} +1 -1
  156. package/dist/{index-BuubzuE8.d.ts → index-BDZCJ9ri.d.ts} +2 -2
  157. package/dist/{index-CTolyeii.d.ts → index-BLOEjvaM.d.ts} +16 -2
  158. package/dist/{index-z4p2k9VR.d.ts → index-Bgv4ZmBl.d.ts} +20 -2
  159. package/dist/{index-BoRIw-bP.d.ts → index-Bt7ewoz2.d.ts} +32 -2
  160. package/dist/{index-uQrLBZfF.d.ts → index-Bu3oXIIS.d.ts} +24 -0
  161. package/dist/{index-HV6W3xCx.d.ts → index-Byar3h1e.d.ts} +1 -1
  162. package/dist/{index-C59PdX9L.d.ts → index-CBym0hSq.d.ts} +1 -1
  163. package/dist/index-CJlBAXwj.d.ts +100 -0
  164. package/dist/{index-DT9S92sh.d.ts → index-CNjbOgty.d.ts} +15 -0
  165. package/dist/{index-gW0HW02U.d.ts → index-COxy6LEW.d.ts} +1 -1
  166. package/dist/{index-DoFCm2Q2.d.ts → index-Clmz00IK.d.ts} +2 -0
  167. package/dist/{index-DRmb-oUa.d.ts → index-CuFLztiI.d.ts} +6 -1
  168. package/dist/{index-fa72tWIU.d.ts → index-D2bSSSBP.d.ts} +1 -1
  169. package/dist/{index-NzLDrOkk.d.ts → index-DAiGhkNZ.d.ts} +15 -2
  170. package/dist/{index-DOUEn7V0.d.ts → index-DQAnGHu7.d.ts} +2 -2
  171. package/dist/{index-BfOtLyNH.d.ts → index-D_nYxnNv.d.ts} +1 -1
  172. package/dist/{index-C6iJwTL0.d.ts → index-DeOftUMq.d.ts} +181 -72
  173. package/dist/{index-Bn_odHQ9.d.ts → index-Dg3ZmwEg.d.ts} +12 -1
  174. package/dist/{index-BiMGXtD-.d.ts → index-DimuSES0.d.ts} +14 -1
  175. package/dist/{index-C_2Z65Rp.d.ts → index-DnEh-HA0.d.ts} +1 -1
  176. package/dist/{index-D-ZuubCK.d.ts → index-DnSrjbjP.d.ts} +1 -1
  177. package/dist/{index-BtPZKO20.d.ts → index-I4J7gwa1.d.ts} +49 -7
  178. package/dist/{index-utZGF4GR.d.ts → index-NOXYEdOI.d.ts} +1 -1
  179. package/dist/{index-C7mxUcDR.d.ts → index-Z_onS2lR.d.ts} +2 -2
  180. package/dist/{index-CVn0GBdB.d.ts → index-cG1E0U2s.d.ts} +1 -1
  181. package/dist/{index-DEeJowZf.d.ts → index-cGagYM1g.d.ts} +15 -2
  182. package/dist/{index-Ck8qy6Rf.d.ts → index-c_TaW8mM.d.ts} +24 -2
  183. package/dist/index.d.ts +68 -67
  184. package/dist/index.js +98 -95
  185. package/dist/locale/index.d.ts +1 -1
  186. package/dist/locale/index.js +1 -1
  187. package/dist/registry-B1ObuP--.d.ts +45 -0
  188. package/dist/registry-C7OZb0PJ.js +135 -0
  189. package/dist/{types-DZoEm_DG.d.ts → types-BKcxXW--.d.ts} +22 -5
  190. package/dist/{index-B8MbfMwV.d.ts → types-DDAAT1Xd.d.ts} +36 -82
  191. package/package.json +6 -1
  192. package/styles/avatar.css +14 -0
  193. package/styles/badge.css +8 -0
  194. package/styles/breadcrumbs.css +6 -1
  195. package/styles/button.css +13 -0
  196. package/styles/calendar.css +16 -0
  197. package/styles/card.css +2 -0
  198. package/styles/chat.css +5 -2
  199. package/styles/dropdown-menu.css +11 -0
  200. package/styles/icon.css +38 -8
  201. package/styles/link.css +5 -0
  202. package/styles/number-input.css +22 -0
  203. package/styles/pagination.css +45 -1
  204. package/styles/progress-bar.css +4 -0
  205. package/styles/selector.css +58 -0
  206. package/styles/tab-list.css +15 -0
  207. package/styles/text-area.css +17 -0
  208. package/styles/text-input.css +5 -0
  209. package/styles/toast.css +7 -0
  210. package/styles/toolbar.css +11 -0
  211. package/dist/Avatar-5s3HSrtN.js +0 -136
  212. package/dist/Badge-Ba0EwsTj.js +0 -19
  213. package/dist/Calendar-BG7wEsro.js +0 -277
  214. package/dist/DateInput-DE2TN1Rq.js +0 -250
  215. package/dist/Icon-Dfr4k6-S.js +0 -86
  216. package/dist/Link-CprjOuTI.js +0 -92
  217. package/dist/NumberInput-CTYiQxHq.js +0 -147
  218. package/dist/Selector-Da-2BO3q.js +0 -325
  219. package/dist/index-DtjAdYEc.d.ts +0 -68
  220. package/dist/{CheckboxList-EsIEXjK_.js → CheckboxList-BbCPiend.js} +1 -1
@@ -1,136 +0,0 @@
1
- import { n as AvatarGroupContext, t as resolveSize } from "./utils-C9r3UD_y.js";
2
- import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, inject, mergeProps, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref } from "vue";
3
- import "../styles/avatar.css";
4
- //#region src/Avatar/Avatar.vue
5
- const _hoisted_1$1 = { class: "astryx-avatar__content" };
6
- const _hoisted_2 = ["src"];
7
- const _hoisted_3 = ["src"];
8
- const _hoisted_4 = {
9
- key: 0,
10
- class: "astryx-avatar__status"
11
- };
12
- const INITIALS_FONT_SIZE_RATIO = 16 / 36;
13
- const DEFAULT_ICON_RATIO = .6;
14
- const _sfc_main$1 = /*@__PURE__*/ defineComponent({
15
- __name: "Avatar",
16
- props: {
17
- alt: {},
18
- fallbackSrc: {},
19
- name: {},
20
- size: { default: "md" },
21
- shape: { default: "circle" },
22
- src: {}
23
- },
24
- emits: ["error"],
25
- setup(__props, { emit: __emit }) {
26
- const props = __props;
27
- const emit = __emit;
28
- const erroredSrc = ref(void 0);
29
- const erroredFallbackSrc = ref(void 0);
30
- const avatarGroup = inject(AvatarGroupContext, void 0);
31
- const resolvedSize = computed(() => avatarGroup?.size.value ?? props.size);
32
- const resolvedShape = computed(() => avatarGroup?.shape.value ?? props.shape);
33
- const numericSize = computed(() => resolveSize(resolvedSize.value));
34
- const groupStyle = computed(() => {
35
- if (!avatarGroup) return {};
36
- return {
37
- marginInlineStart: `${-avatarGroup.overlap.value}px`,
38
- borderWidth: "2px"
39
- };
40
- });
41
- const rootStyle = computed(() => ({
42
- width: `${numericSize.value}px`,
43
- height: `${numericSize.value}px`
44
- }));
45
- const showImage = computed(() => props.src && erroredSrc.value !== props.src);
46
- const showFallbackImage = computed(() => !showImage.value && props.fallbackSrc && erroredFallbackSrc.value !== props.fallbackSrc);
47
- const meaningfulName = computed(() => {
48
- return typeof props.name === "string" && props.name.trim() !== "" ? props.name.trim() : void 0;
49
- });
50
- const meaningfulAlt = computed(() => {
51
- return typeof props.alt === "string" && props.alt.trim() !== "" ? props.alt.trim() : void 0;
52
- });
53
- const initials = computed(() => {
54
- if (!meaningfulName.value) return "";
55
- const words = meaningfulName.value.split(/\s+/);
56
- const first = words.at(0);
57
- const last = words.length > 1 ? words.at(-1) : void 0;
58
- const initial = (word) => {
59
- if (!word) return "";
60
- const match = word.match(/[\p{L}\p{N}]/u);
61
- return match ? match[0].toUpperCase() : "";
62
- };
63
- return `${initial(first)}${initial(last)}`;
64
- });
65
- const showInitials = computed(() => !showImage.value && !showFallbackImage.value && initials.value !== "");
66
- const showIcon = computed(() => !showImage.value && !showFallbackImage.value && initials.value === "");
67
- const accessibleName = computed(() => {
68
- return meaningfulAlt.value || meaningfulName.value;
69
- });
70
- const a11yProps = computed(() => {
71
- if (accessibleName.value) return {
72
- "role": "img",
73
- "aria-label": accessibleName.value
74
- };
75
- return {
76
- "role": "presentation",
77
- "aria-hidden": "true"
78
- };
79
- });
80
- function handleImageError(event) {
81
- if (props.src) erroredSrc.value = props.src;
82
- emit("error", event);
83
- }
84
- function handleFallbackError() {
85
- if (props.fallbackSrc) erroredFallbackSrc.value = props.fallbackSrc;
86
- }
87
- return (_ctx, _cache) => {
88
- return openBlock(), createElementBlock("span", mergeProps({
89
- class: ["astryx-avatar", [`astryx-avatar--${resolvedShape.value}`, { "astryx-avatar--group-item": unref(avatarGroup) }]],
90
- style: [rootStyle.value, groupStyle.value]
91
- }, a11yProps.value), [createElementVNode("span", _hoisted_1$1, [showImage.value ? (openBlock(), createElementBlock("img", {
92
- key: 0,
93
- class: "astryx-avatar__image",
94
- src: __props.src,
95
- alt: "",
96
- onError: handleImageError
97
- }, null, 40, _hoisted_2)) : showFallbackImage.value ? (openBlock(), createElementBlock("img", {
98
- key: 1,
99
- class: "astryx-avatar__image",
100
- src: __props.fallbackSrc,
101
- alt: "",
102
- onError: handleFallbackError
103
- }, null, 40, _hoisted_3)) : showInitials.value ? (openBlock(), createElementBlock("span", {
104
- key: 2,
105
- class: "astryx-avatar__fallback astryx-avatar__fallback--initials",
106
- style: normalizeStyle({ fontSize: `${numericSize.value * INITIALS_FONT_SIZE_RATIO}px` })
107
- }, toDisplayString(initials.value), 5)) : showIcon.value ? (openBlock(), createElementBlock("span", {
108
- key: 3,
109
- class: "astryx-avatar__fallback astryx-avatar__fallback--icon",
110
- style: normalizeStyle({ fontSize: `${numericSize.value * DEFAULT_ICON_RATIO}px` })
111
- }, [renderSlot(_ctx.$slots, "default", {}, () => [_cache[0] || (_cache[0] = createElementVNode("svg", {
112
- viewBox: "0 0 24 24",
113
- fill: "currentColor",
114
- "aria-hidden": "true"
115
- }, [createElementVNode("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })], -1))])], 4)) : createCommentVNode("v-if", true)]), _ctx.$slots.status ? (openBlock(), createElementBlock("span", _hoisted_4, [renderSlot(_ctx.$slots, "status")])) : createCommentVNode("v-if", true)], 16);
116
- };
117
- }
118
- });
119
- //#endregion
120
- //#region src/Avatar/AvatarStatusDot.vue
121
- const _hoisted_1 = ["data-variant"];
122
- const _sfc_main = /*@__PURE__*/ defineComponent({
123
- __name: "AvatarStatusDot",
124
- props: { variant: { default: "neutral" } },
125
- setup(__props) {
126
- return (_ctx, _cache) => {
127
- return openBlock(), createElementBlock("span", {
128
- class: "astryx-avatar-status-dot",
129
- "data-variant": __props.variant,
130
- "aria-hidden": "true"
131
- }, null, 8, _hoisted_1);
132
- };
133
- }
134
- });
135
- //#endregion
136
- export { _sfc_main$1 as n, _sfc_main as t };
@@ -1,19 +0,0 @@
1
- import { createElementBlock, defineComponent, openBlock, renderSlot } from "vue";
2
- import "../styles/badge.css";
3
- //#region src/Badge/Badge.vue
4
- const _hoisted_1 = ["data-variant"];
5
- const _sfc_main = /*@__PURE__*/ defineComponent({
6
- name: "Badge",
7
- __name: "Badge",
8
- props: { variant: { default: "neutral" } },
9
- setup(__props) {
10
- return (_ctx, _cache) => {
11
- return openBlock(), createElementBlock("span", {
12
- class: "astryx-badge",
13
- "data-variant": __props.variant
14
- }, [renderSlot(_ctx.$slots, "icon"), renderSlot(_ctx.$slots, "default")], 8, _hoisted_1);
15
- };
16
- }
17
- });
18
- //#endregion
19
- export { _sfc_main as t };
@@ -1,277 +0,0 @@
1
- import { t as useGridRovingFocus } from "./useGridRovingFocus-DQQAOYH5.js";
2
- import { a as useAstryxMessages, i as useAstryxLocale } from "./context-Dbo22sck.js";
3
- import { n as weekdayNames, t as formatCalendarMonth } from "./locale-Cpk_nrLA.js";
4
- import { Fragment, computed, createElementBlock, createElementVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, withKeys } from "vue";
5
- import { CalendarDate, getLocalTimeZone, today } from "@internationalized/date";
6
- import "../styles/calendar.css";
7
- //#region src/composables/useCalendar.ts
8
- function calendarDateToJSDate(date) {
9
- return new Date(date.year, date.month - 1, date.day);
10
- }
11
- function jsDateToCalendarDate(date) {
12
- return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
13
- }
14
- /**
15
- * 日历逻辑:日期计算、月份导航、日期选择。
16
- */
17
- function useCalendar(options) {
18
- const { value, min, max, isDateDisabled, onChange } = options;
19
- const timeZone = getLocalTimeZone();
20
- const focusedDate = ref(value.value ? jsDateToCalendarDate(value.value) : today(timeZone));
21
- const dates = computed(() => {
22
- const year = focusedDate.value.year;
23
- const month = focusedDate.value.month;
24
- const firstDay = new CalendarDate(year, month, 1);
25
- const firstDayOfWeek = firstDay.toDate(timeZone).getDay();
26
- const startDate = firstDay.subtract({ days: firstDayOfWeek });
27
- const weeks = [];
28
- let currentDate = startDate;
29
- for (let week = 0; week < 6; week++) {
30
- const weekDates = [];
31
- for (let day = 0; day < 7; day++) {
32
- weekDates.push(currentDate);
33
- currentDate = currentDate.add({ days: 1 });
34
- }
35
- weeks.push(weekDates);
36
- }
37
- return weeks;
38
- });
39
- function select(date) {
40
- if (isDisabled(date)) return;
41
- onChange(calendarDateToJSDate(date));
42
- }
43
- function previousMonth() {
44
- focusedDate.value = focusedDate.value.subtract({ months: 1 });
45
- }
46
- function nextMonth() {
47
- focusedDate.value = focusedDate.value.add({ months: 1 });
48
- }
49
- function isSelected(date) {
50
- if (!value.value) return false;
51
- const selected = jsDateToCalendarDate(value.value);
52
- return date.compare(selected) === 0;
53
- }
54
- function isDisabled(date) {
55
- const jsDate = calendarDateToJSDate(date);
56
- if (min && jsDate < min) return true;
57
- if (max && jsDate > max) return true;
58
- if (isDateDisabled?.(jsDate)) return true;
59
- return false;
60
- }
61
- function isInMonth(date) {
62
- return date.month === focusedDate.value.month;
63
- }
64
- return {
65
- focusedDate,
66
- dates,
67
- select,
68
- previousMonth,
69
- nextMonth,
70
- isSelected,
71
- isDisabled,
72
- isInMonth
73
- };
74
- }
75
- //#endregion
76
- //#region src/Calendar/Calendar.vue
77
- const _hoisted_1 = ["aria-label"];
78
- const _hoisted_2 = { class: "astryx-calendar-header" };
79
- const _hoisted_3 = ["disabled", "aria-label"];
80
- const _hoisted_4 = { class: "astryx-calendar-month-year" };
81
- const _hoisted_5 = ["disabled", "aria-label"];
82
- const _hoisted_6 = {
83
- class: "astryx-calendar-weekdays",
84
- role: "row"
85
- };
86
- const _hoisted_7 = ["aria-label"];
87
- const _hoisted_8 = ["aria-activedescendant"];
88
- const _hoisted_9 = [
89
- "id",
90
- "aria-selected",
91
- "aria-disabled",
92
- "aria-current",
93
- "onClick",
94
- "onKeydown"
95
- ];
96
- const _hoisted_10 = { class: "astryx-calendar-day" };
97
- const _sfc_main = /*@__PURE__*/ defineComponent({
98
- name: "AstryxCalendar",
99
- __name: "Calendar",
100
- props: {
101
- modelValue: { default: null },
102
- min: {},
103
- max: {},
104
- isDateDisabled: {},
105
- label: {},
106
- disabled: {
107
- type: Boolean,
108
- default: false
109
- }
110
- },
111
- emits: ["update:modelValue", "change"],
112
- setup(__props, { emit: __emit }) {
113
- const props = __props;
114
- const emit = __emit;
115
- const calendarId = `astryx-calendar-${useId()}`;
116
- const locale = useAstryxLocale();
117
- const messages = useAstryxMessages();
118
- const resolvedLabel = computed(() => props.label ?? messages.value.calendar.label);
119
- const weekDays = computed(() => weekdayNames(locale.value, "narrow"));
120
- const weekDayLabels = computed(() => weekdayNames(locale.value, "long"));
121
- const modelValueRef = computed({
122
- get: () => props.modelValue,
123
- set: (value) => {
124
- emit("update:modelValue", value);
125
- emit("change", value);
126
- }
127
- });
128
- const calendar = useCalendar({
129
- value: modelValueRef,
130
- min: props.min,
131
- max: props.max,
132
- isDateDisabled: props.isDateDisabled,
133
- onChange: (value) => {
134
- modelValueRef.value = value;
135
- }
136
- });
137
- const timeZone = getLocalTimeZone();
138
- const todayDate = today(timeZone);
139
- const monthYear = computed(() => {
140
- const date = calendar.focusedDate.value;
141
- return formatCalendarMonth(date.year, date.month, locale.value);
142
- });
143
- const activeIndex = ref(0);
144
- const isEnabled = computed(() => !props.disabled);
145
- const grid = useGridRovingFocus({
146
- rows: computed(() => 6),
147
- columns: computed(() => 7),
148
- activeIndex,
149
- isEnabled,
150
- isDisabled: (row, col) => {
151
- const dateIndex = row * 7 + col;
152
- const date = calendar.dates.value.flat()[dateIndex];
153
- return date ? calendar.isDisabled(date) : true;
154
- },
155
- onChange: (index) => {
156
- activeIndex.value = index;
157
- }
158
- });
159
- function getCellId(rowIndex, colIndex) {
160
- return `${calendarId}-cell-${rowIndex}-${colIndex}`;
161
- }
162
- function isToday(date) {
163
- return date.compare(todayDate) === 0;
164
- }
165
- function onDateClick(date, rowIndex, colIndex) {
166
- if (props.disabled || calendar.isDisabled(date)) return;
167
- activeIndex.value = rowIndex * 7 + colIndex;
168
- calendar.select(date);
169
- }
170
- function onKeyDown(event) {
171
- if (props.disabled) return;
172
- grid.onKeyDown(event);
173
- if (event.key === "Enter" || event.key === " ") {
174
- event.preventDefault();
175
- const date = calendar.dates.value.flat()[activeIndex.value];
176
- if (date && !calendar.isDisabled(date)) calendar.select(date);
177
- }
178
- }
179
- return (_ctx, _cache) => {
180
- return openBlock(), createElementBlock("div", {
181
- id: calendarId,
182
- class: normalizeClass(["astryx-calendar", { "is-disabled": props.disabled }]),
183
- role: "application",
184
- "aria-label": resolvedLabel.value
185
- }, [
186
- createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "header", {}, () => [
187
- createElementVNode("button", {
188
- type: "button",
189
- class: "astryx-calendar-nav-button",
190
- disabled: props.disabled,
191
- "aria-label": unref(messages).calendar.previousMonth,
192
- onClick: _cache[0] || (_cache[0] = (...args) => unref(calendar).previousMonth && unref(calendar).previousMonth(...args))
193
- }, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
194
- width: "16",
195
- height: "16",
196
- viewBox: "0 0 16 16",
197
- fill: "none"
198
- }, [createElementVNode("path", {
199
- d: "M10 12L6 8L10 4",
200
- stroke: "currentColor",
201
- "stroke-width": "1.5",
202
- "stroke-linecap": "round",
203
- "stroke-linejoin": "round"
204
- })], -1)])], 8, _hoisted_3),
205
- createElementVNode("span", _hoisted_4, toDisplayString(monthYear.value), 1),
206
- createElementVNode("button", {
207
- type: "button",
208
- class: "astryx-calendar-nav-button",
209
- disabled: props.disabled,
210
- "aria-label": unref(messages).calendar.nextMonth,
211
- onClick: _cache[1] || (_cache[1] = (...args) => unref(calendar).nextMonth && unref(calendar).nextMonth(...args))
212
- }, [..._cache[3] || (_cache[3] = [createElementVNode("svg", {
213
- width: "16",
214
- height: "16",
215
- viewBox: "0 0 16 16",
216
- fill: "none"
217
- }, [createElementVNode("path", {
218
- d: "M6 4L10 8L6 12",
219
- stroke: "currentColor",
220
- "stroke-width": "1.5",
221
- "stroke-linecap": "round",
222
- "stroke-linejoin": "round"
223
- })], -1)])], 8, _hoisted_5)
224
- ])]),
225
- createElementVNode("div", _hoisted_6, [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDays.value, (day, index) => {
226
- return openBlock(), createElementBlock("div", {
227
- key: index,
228
- class: "astryx-calendar-weekday",
229
- role: "columnheader",
230
- "aria-label": weekDayLabels.value[index]
231
- }, toDisplayString(day), 9, _hoisted_7);
232
- }), 128))]),
233
- createElementVNode("div", {
234
- class: "astryx-calendar-grid",
235
- role: "grid",
236
- "aria-labelledby": calendarId,
237
- "aria-activedescendant": getCellId(unref(grid).row.value, unref(grid).column.value),
238
- tabindex: "0",
239
- onKeydown: onKeyDown
240
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(calendar).dates.value, (week, rowIndex) => {
241
- return openBlock(), createElementBlock("div", {
242
- key: rowIndex,
243
- class: "astryx-calendar-row",
244
- role: "row"
245
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(week, (date, colIndex) => {
246
- return openBlock(), createElementBlock("div", {
247
- id: getCellId(rowIndex, colIndex),
248
- key: colIndex,
249
- class: normalizeClass(["astryx-calendar-cell", {
250
- "is-selected": unref(calendar).isSelected(date),
251
- "is-disabled": unref(calendar).isDisabled(date),
252
- "is-today": isToday(date),
253
- "is-other-month": !unref(calendar).isInMonth(date),
254
- "is-active": activeIndex.value === rowIndex * 7 + colIndex
255
- }]),
256
- role: "gridcell",
257
- "aria-selected": unref(calendar).isSelected(date),
258
- "aria-disabled": unref(calendar).isDisabled(date),
259
- "aria-current": isToday(date) ? "date" : void 0,
260
- tabindex: "-1",
261
- onClick: ($event) => onDateClick(date, rowIndex, colIndex),
262
- onKeydown: withKeys(($event) => onDateClick(date, rowIndex, colIndex), ["enter"])
263
- }, [renderSlot(_ctx.$slots, "day", {
264
- date,
265
- isSelected: unref(calendar).isSelected(date),
266
- isDisabled: unref(calendar).isDisabled(date),
267
- isToday: isToday(date),
268
- isInMonth: unref(calendar).isInMonth(date)
269
- }, () => [createElementVNode("span", _hoisted_10, toDisplayString(date.day), 1)])], 42, _hoisted_9);
270
- }), 128))]);
271
- }), 128))], 40, _hoisted_8)
272
- ], 10, _hoisted_1);
273
- };
274
- }
275
- });
276
- //#endregion
277
- export { _sfc_main as t };
@@ -1,250 +0,0 @@
1
- import { a as useAstryxMessages } from "./context-Dbo22sck.js";
2
- import { t as _sfc_main$1 } from "./Calendar-BG7wEsro.js";
3
- import { t as _sfc_main$2 } from "./Popover-Crhk9PNP.js";
4
- import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderSlot, useId, useTemplateRef, watch, withCtx } from "vue";
5
- import "../styles/date-input.css";
6
- //#region src/DateInput/DateInput.vue
7
- const _hoisted_1 = ["data-disabled", "data-size"];
8
- const _hoisted_2 = {
9
- key: 0,
10
- class: "astryx-date-input-prefix"
11
- };
12
- const _hoisted_3 = ["disabled", "aria-label"];
13
- const _hoisted_4 = [
14
- "id",
15
- "value",
16
- "placeholder",
17
- "disabled",
18
- "aria-label",
19
- "aria-describedby",
20
- "aria-controls",
21
- "aria-expanded",
22
- "title"
23
- ];
24
- const _hoisted_5 = ["aria-label"];
25
- const _hoisted_6 = {
26
- key: 2,
27
- class: "astryx-date-input-suffix"
28
- };
29
- const _hoisted_7 = ["id"];
30
- const _hoisted_8 = ["name", "value"];
31
- const _sfc_main = /*@__PURE__*/ defineComponent({
32
- name: "AstryxDateInput",
33
- __name: "DateInput",
34
- props: {
35
- id: {},
36
- describedBy: {},
37
- modelValue: { default: null },
38
- placeholder: {},
39
- min: {},
40
- max: {},
41
- isDateDisabled: {},
42
- name: {},
43
- label: {},
44
- disabled: {
45
- type: Boolean,
46
- default: false
47
- },
48
- disabledReason: {},
49
- clearable: {
50
- type: Boolean,
51
- default: false
52
- },
53
- clearLabel: {},
54
- size: { default: "md" },
55
- status: { default: "default" }
56
- },
57
- emits: ["update:modelValue", "change"],
58
- setup(__props, { emit: __emit }) {
59
- const props = __props;
60
- const emit = __emit;
61
- const generatedId = `astryx-date-input-${useId()}`;
62
- const inputId = computed(() => props.id ?? generatedId);
63
- const popupId = computed(() => `${inputId.value}-popup`);
64
- const messages = useAstryxMessages();
65
- const resolvedPlaceholder = computed(() => props.placeholder ?? messages.value.dateInput.placeholder);
66
- const resolvedClearLabel = computed(() => props.clearLabel ?? messages.value.dateInput.clear(props.label));
67
- const dialogLabel = computed(() => props.label || messages.value.dateInput.dialogLabel);
68
- const inputRef = useTemplateRef("inputRef");
69
- const isOpen = ref(false);
70
- const toggleLabel = computed(() => isOpen.value ? messages.value.dateInput.closeCalendar : messages.value.dateInput.openCalendar);
71
- const inputValue = ref("");
72
- const modelValueRef = computed({
73
- get: () => props.modelValue,
74
- set: (value) => {
75
- emit("update:modelValue", value);
76
- emit("change", value);
77
- }
78
- });
79
- function formatDate(date) {
80
- if (!date) return "";
81
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
82
- }
83
- function parseDate(str) {
84
- if (!str.trim()) return null;
85
- const match = str.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
86
- if (match) {
87
- const [, year, month, day] = match;
88
- const date = new Date(Number(year), Number(month) - 1, Number(day));
89
- if (!Number.isNaN(date.getTime())) return date;
90
- }
91
- return null;
92
- }
93
- function syncDisplayValue() {
94
- inputValue.value = formatDate(props.modelValue);
95
- }
96
- watch(() => props.modelValue, syncDisplayValue, { immediate: true });
97
- function onInput(event) {
98
- const value = event.target.value.trim();
99
- inputValue.value = value;
100
- const parsed = parseDate(value);
101
- if (parsed) modelValueRef.value = parsed;
102
- }
103
- function onOpenChange(open) {
104
- isOpen.value = open;
105
- }
106
- function openCalendar() {
107
- if (!props.disabled) isOpen.value = true;
108
- }
109
- function onInputKeyDown(event) {
110
- if (props.disabled || isOpen.value) return;
111
- if (event.key === "ArrowDown" || event.altKey && event.key === "ArrowDown") {
112
- event.preventDefault();
113
- openCalendar();
114
- }
115
- }
116
- function onCalendarChange(date) {
117
- modelValueRef.value = date;
118
- isOpen.value = false;
119
- inputRef.value?.blur();
120
- }
121
- function onClear(event) {
122
- event.stopPropagation();
123
- modelValueRef.value = null;
124
- inputValue.value = "";
125
- isOpen.value = false;
126
- }
127
- syncDisplayValue();
128
- return (_ctx, _cache) => {
129
- return openBlock(), createElementBlock("div", { class: normalizeClass(["astryx-date-input", [`size-${props.size}`, `status-${props.status}`]]) }, [createVNode(_sfc_main$2, {
130
- "is-open": isOpen.value,
131
- "is-enabled": !props.disabled,
132
- placement: "below",
133
- alignment: "start",
134
- padding: 0,
135
- width: 248,
136
- "has-close-button": false,
137
- "is-modal": false,
138
- "has-auto-focus": true,
139
- role: "dialog",
140
- label: dialogLabel.value,
141
- onOpenChange
142
- }, {
143
- content: withCtx(() => [createElementVNode("div", { id: popupId.value }, [createVNode(_sfc_main$1, {
144
- "model-value": props.modelValue,
145
- min: props.min,
146
- max: props.max,
147
- "is-date-disabled": props.isDateDisabled,
148
- "onUpdate:modelValue": onCalendarChange
149
- }, null, 8, [
150
- "model-value",
151
- "min",
152
- "max",
153
- "is-date-disabled"
154
- ])], 8, _hoisted_7)]),
155
- default: withCtx(() => [createElementVNode("div", {
156
- class: "astryx-date-input-wrapper",
157
- "data-disabled": props.disabled ? "true" : void 0,
158
- "data-size": props.size
159
- }, [
160
- _ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_2, [renderSlot(_ctx.$slots, "prefix")])) : createCommentVNode("v-if", true),
161
- createElementVNode("button", {
162
- type: "button",
163
- class: "astryx-date-input-toggle",
164
- disabled: props.disabled,
165
- "aria-label": toggleLabel.value
166
- }, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
167
- width: "16",
168
- height: "16",
169
- viewBox: "0 0 16 16",
170
- fill: "none",
171
- "aria-hidden": "true"
172
- }, [
173
- createElementVNode("rect", {
174
- x: "3",
175
- y: "4",
176
- width: "10",
177
- height: "9",
178
- rx: "1",
179
- stroke: "currentColor",
180
- "stroke-width": "1.5"
181
- }),
182
- createElementVNode("path", {
183
- d: "M3 6H13",
184
- stroke: "currentColor",
185
- "stroke-width": "1.5"
186
- }),
187
- createElementVNode("path", {
188
- d: "M5 3V5M11 3V5",
189
- stroke: "currentColor",
190
- "stroke-width": "1.5",
191
- "stroke-linecap": "round"
192
- })
193
- ], -1)])], 8, _hoisted_3),
194
- createElementVNode("input", {
195
- id: inputId.value,
196
- ref_key: "inputRef",
197
- ref: inputRef,
198
- type: "text",
199
- class: "astryx-date-input-field",
200
- role: "combobox",
201
- value: inputValue.value,
202
- placeholder: resolvedPlaceholder.value,
203
- disabled: props.disabled,
204
- "aria-label": props.label,
205
- "aria-describedby": props.describedBy,
206
- "aria-controls": popupId.value,
207
- "aria-expanded": isOpen.value,
208
- "aria-haspopup": "dialog",
209
- title: props.disabledReason,
210
- autocomplete: "off",
211
- onInput,
212
- onClick: openCalendar,
213
- onKeydown: onInputKeyDown
214
- }, null, 40, _hoisted_4),
215
- props.clearable && props.modelValue ? (openBlock(), createElementBlock("button", {
216
- key: 1,
217
- type: "button",
218
- class: "astryx-date-input-clear",
219
- "aria-label": resolvedClearLabel.value,
220
- tabindex: "-1",
221
- onClick: onClear
222
- }, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
223
- width: "16",
224
- height: "16",
225
- viewBox: "0 0 16 16",
226
- fill: "none",
227
- "aria-hidden": "true"
228
- }, [createElementVNode("path", {
229
- d: "M12 4L4 12M4 4L12 12",
230
- stroke: "currentColor",
231
- "stroke-width": "1.5",
232
- "stroke-linecap": "round"
233
- })], -1)])], 8, _hoisted_5)) : _ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_6, [renderSlot(_ctx.$slots, "suffix")])) : createCommentVNode("v-if", true)
234
- ], 8, _hoisted_1)]),
235
- _: 3
236
- }, 8, [
237
- "is-open",
238
- "is-enabled",
239
- "label"
240
- ]), props.name ? (openBlock(), createElementBlock("input", {
241
- key: 0,
242
- type: "hidden",
243
- name: props.name,
244
- value: formatDate(props.modelValue)
245
- }, null, 8, _hoisted_8)) : createCommentVNode("v-if", true)], 2);
246
- };
247
- }
248
- });
249
- //#endregion
250
- export { _sfc_main as t };