@base-framework/ui 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -0
  3. package/dist/aside-template-D0KANPjh.js +35 -0
  4. package/dist/atoms.es.js +39 -0
  5. package/dist/bside-template-CDbINL4X.js +15 -0
  6. package/dist/calendar-DR_svCOR.js +424 -0
  7. package/dist/confirmation-D1Y_SgzE.js +1526 -0
  8. package/dist/icon-B9QUT2NY.js +47 -0
  9. package/dist/icons.es.js +658 -0
  10. package/dist/index.es.js +154 -0
  11. package/dist/inputs-BF3C3KfF.js +204 -0
  12. package/dist/mobile-nav-wrapper-7Qul1-mt.js +578 -0
  13. package/dist/molecules.es.js +45 -0
  14. package/dist/organisms.es.js +55 -0
  15. package/dist/pages.es.js +12 -0
  16. package/dist/sidebar-menu-page-M8hr9onX.js +224 -0
  17. package/dist/style.css +1 -0
  18. package/dist/tab-C_dZb2qH.js +1425 -0
  19. package/dist/templates.es.js +10 -0
  20. package/dist/tooltip-DCszmsxe.js +324 -0
  21. package/dist/types/components/atoms/atoms.d.ts +15 -0
  22. package/dist/types/components/atoms/badges/badge.d.ts +8 -0
  23. package/dist/types/components/atoms/buttons/buttons.d.ts +17 -0
  24. package/dist/types/components/atoms/cards/card.d.ts +8 -0
  25. package/dist/types/components/atoms/form/fieldset.d.ts +9 -0
  26. package/dist/types/components/atoms/form/inputs/checkbox.d.ts +10 -0
  27. package/dist/types/components/atoms/form/inputs/input-classes.d.ts +30 -0
  28. package/dist/types/components/atoms/form/inputs/inputs.d.ts +113 -0
  29. package/dist/types/components/atoms/form/inputs/range-slider.d.ts +10 -0
  30. package/dist/types/components/atoms/form/legend.d.ts +9 -0
  31. package/dist/types/components/atoms/form/select.d.ts +8 -0
  32. package/dist/types/components/atoms/icon.d.ts +8 -0
  33. package/dist/types/components/atoms/progress/circle-graph.d.ts +7 -0
  34. package/dist/types/components/atoms/progress/progress-bar.d.ts +9 -0
  35. package/dist/types/components/atoms/progress/semi-circle-graph.d.ts +7 -0
  36. package/dist/types/components/atoms/skeleton.d.ts +2 -0
  37. package/dist/types/components/atoms/tooltip.d.ts +12 -0
  38. package/dist/types/components/atoms/veil.d.ts +26 -0
  39. package/dist/types/components/icons/icons.d.ts +10 -0
  40. package/dist/types/components/molecules/alert.d.ts +7 -0
  41. package/dist/types/components/molecules/avatars/avatar.d.ts +15 -0
  42. package/dist/types/components/molecules/avatars/static-status-indicator.d.ts +2 -0
  43. package/dist/types/components/molecules/avatars/status-indicator.d.ts +2 -0
  44. package/dist/types/components/molecules/avatars/statuses.d.ts +13 -0
  45. package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +11 -0
  46. package/dist/types/components/molecules/breadcrumb/dots-indicator.d.ts +12 -0
  47. package/dist/types/components/molecules/combobox/combobox.d.ts +10 -0
  48. package/dist/types/components/molecules/counters/atoms.d.ts +3 -0
  49. package/dist/types/components/molecules/counters/counter.d.ts +11 -0
  50. package/dist/types/components/molecules/date-time/date-picker.d.ts +11 -0
  51. package/dist/types/components/molecules/date-time/time-frame.d.ts +1 -0
  52. package/dist/types/components/molecules/date-time/time-picker.d.ts +10 -0
  53. package/dist/types/components/molecules/delay-component.d.ts +18 -0
  54. package/dist/types/components/molecules/dialogs/confirmation.d.ts +27 -0
  55. package/dist/types/components/molecules/dialogs/dialog-container.d.ts +8 -0
  56. package/dist/types/components/molecules/dialogs/dialog.d.ts +78 -0
  57. package/dist/types/components/molecules/dropdowns/dropdown-item.d.ts +1 -0
  58. package/dist/types/components/molecules/dropdowns/dropdown-menu.d.ts +61 -0
  59. package/dist/types/components/molecules/dropdowns/dropdown.d.ts +1 -0
  60. package/dist/types/components/molecules/form/form-atoms.d.ts +40 -0
  61. package/dist/types/components/molecules/form/form-control.d.ts +10 -0
  62. package/dist/types/components/molecules/form/form-field.d.ts +10 -0
  63. package/dist/types/components/molecules/form/form.d.ts +14 -0
  64. package/dist/types/components/molecules/modals/atoms.d.ts +17 -0
  65. package/dist/types/components/molecules/modals/modal-container.d.ts +8 -0
  66. package/dist/types/components/molecules/modals/modal.d.ts +124 -0
  67. package/dist/types/components/molecules/molecules.d.ts +31 -0
  68. package/dist/types/components/molecules/notifications/notification-container.d.ts +31 -0
  69. package/dist/types/components/molecules/notifications/notification.d.ts +79 -0
  70. package/dist/types/components/molecules/popover.d.ts +57 -0
  71. package/dist/types/components/molecules/theme-toggle.d.ts +8 -0
  72. package/dist/types/components/molecules/toggle/toggle.d.ts +11 -0
  73. package/dist/types/components/organisms/button-group.d.ts +23 -0
  74. package/dist/types/components/organisms/calendar/calendar.d.ts +77 -0
  75. package/dist/types/components/organisms/calendar/month/calendar-cells.d.ts +1 -0
  76. package/dist/types/components/organisms/calendar/month/day-cell.d.ts +1 -0
  77. package/dist/types/components/organisms/calendar/month/day-header.d.ts +1 -0
  78. package/dist/types/components/organisms/calendar/month/month-calendar.d.ts +1 -0
  79. package/dist/types/components/organisms/calendar/month/navigation-button.d.ts +1 -0
  80. package/dist/types/components/organisms/calendar/utils.d.ts +3 -0
  81. package/dist/types/components/organisms/calendar/week/utils.d.ts +6 -0
  82. package/dist/types/components/organisms/calendar/week/week-calendar.d.ts +90 -0
  83. package/dist/types/components/organisms/calendar/week/week-cell.d.ts +1 -0
  84. package/dist/types/components/organisms/calendar/week/week-cells.d.ts +1 -0
  85. package/dist/types/components/organisms/calendar/week/week-header.d.ts +1 -0
  86. package/dist/types/components/organisms/lists/checkbox-col.d.ts +1 -0
  87. package/dist/types/components/organisms/lists/data-table-body.d.ts +5 -0
  88. package/dist/types/components/organisms/lists/data-table.d.ts +13 -0
  89. package/dist/types/components/organisms/lists/header-col.d.ts +2 -0
  90. package/dist/types/components/organisms/lists/table-header.d.ts +5 -0
  91. package/dist/types/components/organisms/lists/user-list.d.ts +15 -0
  92. package/dist/types/components/organisms/navigation/inline-navigation.d.ts +75 -0
  93. package/dist/types/components/organisms/navigation/main-link.d.ts +81 -0
  94. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/mobile-nav-wrapper.d.ts +14 -0
  95. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/navigation-popover.d.ts +36 -0
  96. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/popup-header.d.ts +1 -0
  97. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/title-header.d.ts +2 -0
  98. package/dist/types/components/organisms/navigation/nav-button-link.d.ts +44 -0
  99. package/dist/types/components/organisms/navigation/navigation-atoms.d.ts +8 -0
  100. package/dist/types/components/organisms/navigation/navigation-menu/navigation-menu.d.ts +58 -0
  101. package/dist/types/components/organisms/navigation/navigation.d.ts +58 -0
  102. package/dist/types/components/organisms/navigation/sidebar-menu/sidebar-menu.d.ts +2 -0
  103. package/dist/types/components/organisms/organisms.d.ts +38 -0
  104. package/dist/types/components/organisms/overlays/dockable-overlay.d.ts +38 -0
  105. package/dist/types/components/organisms/overlays/inline-overlay.d.ts +18 -0
  106. package/dist/types/components/organisms/overlays/overlay.d.ts +73 -0
  107. package/dist/types/components/organisms/panel.d.ts +22 -0
  108. package/dist/types/components/organisms/search/dropdown.d.ts +8 -0
  109. package/dist/types/components/organisms/search/search-dropdown.d.ts +10 -0
  110. package/dist/types/components/organisms/search/search-input.d.ts +7 -0
  111. package/dist/types/components/organisms/tabs/button-tab.d.ts +65 -0
  112. package/dist/types/components/organisms/tabs/tab-group.d.ts +48 -0
  113. package/dist/types/components/organisms/tabs/tab-navigation.d.ts +62 -0
  114. package/dist/types/components/organisms/tabs/tab.d.ts +35 -0
  115. package/dist/types/components/pages/basic-page.d.ts +19 -0
  116. package/dist/types/components/pages/blank-page.d.ts +17 -0
  117. package/dist/types/components/pages/center-page.d.ts +17 -0
  118. package/dist/types/components/pages/full-contain-page.d.ts +17 -0
  119. package/dist/types/components/pages/full-page.d.ts +25 -0
  120. package/dist/types/components/pages/fullscreen-page.d.ts +17 -0
  121. package/dist/types/components/pages/main-section.d.ts +8 -0
  122. package/dist/types/components/pages/page.d.ts +16 -0
  123. package/dist/types/components/pages/pages.d.ts +10 -0
  124. package/dist/types/components/pages/sidebar-menu-page.d.ts +70 -0
  125. package/dist/types/components/pages/templates/aside-template.d.ts +8 -0
  126. package/dist/types/components/pages/templates/bside-template.d.ts +8 -0
  127. package/dist/types/components/pages/templates/full-template.d.ts +8 -0
  128. package/dist/types/components/pages/templates/row.d.ts +8 -0
  129. package/dist/types/components/pages/templates/template-atoms.d.ts +16 -0
  130. package/dist/types/components/pages/templates/template.d.ts +8 -0
  131. package/dist/types/components/pages/templates/templates.d.ts +5 -0
  132. package/dist/types/ui.d.ts +6 -0
  133. package/dist/veil-B9GQfH0d.js +29 -0
  134. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 chris
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # Base UI
2
+
3
+ **Version**: 1.0.0
4
+
5
+ ## Overview
6
+ This documentation aims to guide the enhancement of component scalability and reusability within your projects through the use of organisms. Organisms are designed to function as the medium building blocks in a component-based architecture.
7
+
8
+ This module will add default organisms to your project.
9
+
10
+ ## Atomic Design
11
+ If you need to learn about atomic design, please refer to the [Atomic Design](https://bradfrost.com/blog/post/atomic-web-design/) documentation.
12
+
13
+ To learn more about Base framework or how to build atoms, refer to the [Base](https://github.com/chrisdurfee/base/wiki) documentation.
14
+
15
+ ### Oragnism Structure
16
+ Organisms can be created using atoms, other organisms, and components. Atoms are the smallest building blocks of a component, while components are composed of atoms and other components. Organisms are a collection of atoms and components that form a larger structure.
17
+
18
+ ```typescript
19
+ // Atom
20
+ const Link = Atom((props, children) => ({
21
+ ...props,
22
+ children,
23
+ tag: 'a',
24
+ }));
25
+
26
+ // Organism Atom
27
+ const Link = Atom((props, children) => (
28
+ Link({...props }, [
29
+ Icon({ class: 'icon' }),
30
+ children
31
+ ])
32
+ ));
33
+
34
+ // Organism Atom with Component
35
+ const Link = Atom((props, children) => (
36
+ Nav([
37
+ Ul([
38
+ Li([
39
+ Link([
40
+ Icon({ class: 'icon' }),
41
+ Span('Text')
42
+ ])
43
+ ])
44
+ ])
45
+ ]),
46
+ new List({...props }, [
47
+ children
48
+ ])
49
+ ));
50
+
51
+ // Organism Function with Component
52
+ const List = (props, children) => Div([
53
+ Header([
54
+ H1('Title')
55
+ ]),
56
+ new List({...props }, [
57
+ children
58
+ ])
59
+ ]);
60
+ ```
61
+
62
+ #### Organisms Nesting
63
+ Organisms should use composition to nest other atoms, organisms, or components.
64
+
65
+ ```typescript
66
+ const SecondaryButton = Atom((props, children) => (Button({
67
+ ...props,
68
+ class: 'secondary-btn',
69
+ children
70
+ }));
71
+ ```
72
+
73
+ ## Utilization of Organisms
74
+ To leverage an organism, invoke its function and pass the requisite values via a props and children. The organisms created with the Atom callback functions support passing optional props or children to the atom. The props object should always be first but if the atom does not require props, the children array or string can be passed as the first argument.
75
+
76
+ ```javascript
77
+ // props only
78
+ Div({class: 'text'});
79
+
80
+ // text child only
81
+ Div('test');
82
+
83
+ // array child only
84
+ Div([
85
+ Div('test')
86
+ ]);
87
+
88
+ // props and text child
89
+ Div({class: 'text'}, 'test');
90
+
91
+ // props and array children
92
+ Div({class: 'text'}, [
93
+ Div('test'),
94
+ Div('test')
95
+ ]);
96
+ ```
97
+
98
+ ### Example of Atom Utilization
99
+ ```typescript
100
+ SecondaryButton({
101
+ click(e) =>
102
+ {
103
+ // Handle the click event
104
+ }
105
+ })
106
+ ```
@@ -0,0 +1,35 @@
1
+ import { Atom as a } from "@base-framework/base";
2
+ import { Header as c, H1 as f } from "@base-framework/atoms";
3
+ const o = a((l, e) => ({
4
+ tag: "section",
5
+ ...l,
6
+ children: e
7
+ })), n = a((l, e) => o({
8
+ class: "body full-container flex flex-auto flex-col " + l.class,
9
+ ...l
10
+ }, e)), s = a((l, e) => (l.class = "row flex flex-auto flex-col lg:flex-row " + (l.class || ""), {
11
+ ...l,
12
+ children: e
13
+ })), u = a((l, e) => c([
14
+ f({ watch: l.watch }, l.text)
15
+ ], e)), t = a((l, e) => (l.class = "col flex flex-auto flex-col " + (l.class || ""), {
16
+ ...l,
17
+ children: e
18
+ })), m = a((l, e) => o({ class: "body aside-container flex flex-auto flex-col max-w-[100vw] h-full" }, [
19
+ s({ class: "flex flex-auto flex-col lg:flex-row" }, [
20
+ t({ class: "drawer control flex flex-auto w-full md:max-w-[320px]" }, [
21
+ l.left
22
+ ]),
23
+ t({ class: "flex flex-grow flex-col" }, [
24
+ l.right
25
+ ])
26
+ ])
27
+ ]));
28
+ export {
29
+ m as A,
30
+ n as F,
31
+ t as M,
32
+ s as R,
33
+ u as T,
34
+ o as a
35
+ };
@@ -0,0 +1,39 @@
1
+ import { B as e, C as t, a as n, F as o, L as p, P as r, R as u, S as I, b as i, T as l } from "./tooltip-DCszmsxe.js";
2
+ import { B as m, I as T, L as c } from "./icon-B9QUT2NY.js";
3
+ import { C as B, d as C, D as S, c as g, E as b, F as f, H as h, I as F, M as L, N as P, P as R, R as k, S as D, T as V, a as E, b as H, U as M, W as N } from "./inputs-BF3C3KfF.js";
4
+ import { V as W, a as w } from "./veil-B9GQfH0d.js";
5
+ export {
6
+ e as Badge,
7
+ m as Button,
8
+ t as Card,
9
+ B as Checkbox,
10
+ n as CircleGraph,
11
+ C as ColorInput,
12
+ S as DateInput,
13
+ g as DateTimeInput,
14
+ b as EmailInput,
15
+ o as Fieldset,
16
+ f as FileInput,
17
+ h as HiddenInput,
18
+ T as Icon,
19
+ F as Input,
20
+ p as Legend,
21
+ c as LoadingButton,
22
+ L as MonthInput,
23
+ P as NumberInput,
24
+ R as PasswordInput,
25
+ r as ProgressBar,
26
+ k as Radio,
27
+ u as RangeSlider,
28
+ D as SearchInput,
29
+ I as Select,
30
+ i as Skeleton,
31
+ V as TelInput,
32
+ E as Textarea,
33
+ H as TimeInput,
34
+ l as Tooltip,
35
+ M as UrlInput,
36
+ W as Veil,
37
+ w as VeilJot,
38
+ N as WeekInput
39
+ };
@@ -0,0 +1,15 @@
1
+ import { Atom as t } from "@base-framework/base";
2
+ import { a, R as l, M as o } from "./aside-template-D0KANPjh.js";
3
+ const s = t((e, r) => a({ class: "body bside-container flex flex-auto flex-col" }, [
4
+ l([
5
+ o([
6
+ e.left
7
+ ]),
8
+ o([
9
+ e.right
10
+ ])
11
+ ])
12
+ ]));
13
+ export {
14
+ s as B
15
+ };
@@ -0,0 +1,424 @@
1
+ var F = Object.defineProperty;
2
+ var O = (t, s, n) => s in t ? F(t, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[s] = n;
3
+ var p = (t, s, n) => O(t, typeof s != "symbol" ? s + "" : s, n);
4
+ import { Div as l, Img as B, Span as w, Button as I } from "@base-framework/atoms";
5
+ import { Component as P, Data as z, Atom as N, DateTime as Y } from "@base-framework/base";
6
+ import { B as j } from "./icon-B9QUT2NY.js";
7
+ import { Icons as M } from "./icons.es.js";
8
+ const A = (t, s) => {
9
+ const n = t ? t.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, e = s.getBoundingClientRect(), o = 10, r = window.scrollX, c = window.scrollY;
10
+ let d = n.left + r, u = n.bottom + c;
11
+ const i = window.innerHeight - n.bottom, f = n.top;
12
+ return d + e.width > window.innerWidth && (d = window.innerWidth - e.width - o), i < e.height && f > i ? u = n.top + c - e.height - o : i < e.height && (u = n.bottom + c - (e.height - i) - o), { x: d, y: u };
13
+ };
14
+ class lt extends P {
15
+ /**
16
+ * This will set up the data.
17
+ *
18
+ * @returns {object}
19
+ */
20
+ setData() {
21
+ const s = this.parent.data || new z();
22
+ return s.set({
23
+ position: { x: 0, y: 0 }
24
+ }), s;
25
+ }
26
+ /**
27
+ * This will get the class size.
28
+ *
29
+ * @returns {string}
30
+ */
31
+ getSize() {
32
+ switch (this.size || "lg") {
33
+ case "sm":
34
+ return "w-48";
35
+ case "md":
36
+ return "w-64";
37
+ case "lg":
38
+ return "w-[250px]";
39
+ case "xl":
40
+ return "w-96";
41
+ case "2xl":
42
+ return "w-[400px]";
43
+ case "fit":
44
+ return "w-fit";
45
+ case "full":
46
+ return "w-full";
47
+ }
48
+ }
49
+ /**
50
+ * This will render the modal component.
51
+ *
52
+ * @returns {object}
53
+ */
54
+ render() {
55
+ const s = this.getSize();
56
+ return l({
57
+ class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${s}`,
58
+ popover: "auto",
59
+ toggle: (n, { state: e }) => n.newState === "closed" ? e.open = !1 : null,
60
+ style: "top: [[position.y]]px; left: [[position.x]]px"
61
+ }, this.children);
62
+ }
63
+ /**
64
+ * This will setup the states.
65
+ *
66
+ * @returns {object}
67
+ */
68
+ setupStates() {
69
+ return {
70
+ open: {
71
+ id: this.parent.getId(),
72
+ callBack: (e) => {
73
+ this.state.open === !1 && this.destroy();
74
+ }
75
+ }
76
+ };
77
+ }
78
+ /**
79
+ * Updates the dropdown position.
80
+ *
81
+ * @returns {void}
82
+ */
83
+ updatePosition() {
84
+ const s = this.button ?? null, n = this.panel, e = A(s, n);
85
+ this.data.position = e;
86
+ }
87
+ /**
88
+ * This will run after the setup.
89
+ *
90
+ * @returns {void}
91
+ */
92
+ afterSetup() {
93
+ this.panel.showPopover(), this.updatePosition();
94
+ }
95
+ /**
96
+ * This will check if the element clicked was in the
97
+ * component of the button.
98
+ *
99
+ * @param {object} element
100
+ * @returns {boolean}
101
+ */
102
+ isOutsideClick(s) {
103
+ return !this.panel.contains(s) && this.button && !this.button.contains(s);
104
+ }
105
+ /**
106
+ * This will set up the events.
107
+ *
108
+ * @returns {array}
109
+ */
110
+ setupEvents() {
111
+ return [
112
+ ["click", document, (s) => {
113
+ this.isOutsideClick(s.target) && (this.state.open = !1);
114
+ }],
115
+ ["resize", window, (s) => this.updatePosition()],
116
+ ["scroll", document, (s) => this.updatePosition()]
117
+ ];
118
+ }
119
+ /**
120
+ * This will override the set up to use the app shell.
121
+ *
122
+ * @param {object} container
123
+ */
124
+ setContainer(s) {
125
+ this.container = app.root;
126
+ }
127
+ /**
128
+ * This will hide the popover before destroying.
129
+ *
130
+ * @returns {void}
131
+ */
132
+ beforeDestroy() {
133
+ this.panel.hidePopover();
134
+ }
135
+ }
136
+ const W = N(({ src: t, alt: s }) => t ? B({
137
+ class: "absolute w-full h-full rounded-full object-cover fadeIn",
138
+ src: t,
139
+ alt: s,
140
+ /**
141
+ * If there's an error loading the image, hide it.
142
+ */
143
+ error: (n) => n.target.style.display = "none"
144
+ }) : null), H = (t) => t.split(" ").map((s) => s.charAt(0)).join(""), T = (t) => !t || t.length < 2 ? t : H(t), R = (t) => w([t, (s, n) => {
145
+ n.textContent = T(s);
146
+ }]), b = {
147
+ xs: "h-6 w-6",
148
+ sm: "h-8 w-8",
149
+ md: "h-12 w-12",
150
+ lg: "h-16 w-16",
151
+ xl: "h-24 w-24",
152
+ "2xl": "h-32 w-32",
153
+ "3xl": "h-48 w-48",
154
+ default: "h-12 w-12"
155
+ }, S = {
156
+ xs: "text-[7px]",
157
+ sm: "text-xs",
158
+ md: "text-base",
159
+ lg: "text-xl",
160
+ xl: "text-2xl",
161
+ "2xl": "text-3xl",
162
+ "3xl": "text-4xl",
163
+ default: "text-base"
164
+ }, X = (t) => b[t] || b.default, E = (t) => S[t] || S.default, G = (t, s = null, n = "md") => {
165
+ const e = T(t), o = E(n);
166
+ return l(
167
+ {
168
+ class: `
169
+ flex items-center justify-center w-full h-full rounded-full
170
+ bg-muted text-muted-foreground font-medium
171
+ ${o}
172
+ `
173
+ },
174
+ [
175
+ s ? R(s) : w(e)
176
+ ]
177
+ );
178
+ }, ct = N(({ src: t, alt: s, fallbackText: n, watcherFallback: e, size: o }) => {
179
+ const r = X(o);
180
+ return l(
181
+ {
182
+ class: `relative flex items-center justify-center ${r}`
183
+ },
184
+ [
185
+ W({ src: t, alt: s }),
186
+ G(n, e, o)
187
+ ]
188
+ );
189
+ }), m = (t) => (t *= 1, t < 10 ? `0${t}` : String(t)), L = (t) => (t.indexOf("T") === -1 && t.indexOf(" ") === -1 && (t += "T00:00:01"), t.replace(" ", "T"), t), g = (t, s, n) => `${t}-${m(s + 1)}-${m(n)}`, q = (t) => t ? "bg-accent text-primary" : "", J = (t) => t ? "text-muted-foreground opacity-50" : "", K = (t, s) => t === s, Q = (t, s) => K(t, s) ? "bg-primary text-primary-foreground" : "", U = (t, s, n, e) => {
190
+ const o = Q(s, e);
191
+ if (o)
192
+ return o;
193
+ const r = q(t);
194
+ if (t)
195
+ return r;
196
+ const c = J(n);
197
+ return n ? c : "text-foreground";
198
+ }, x = ({ day: t, currentDate: s, date: n, isToday: e, isOutsideMonth: o, select: r }) => I(
199
+ {
200
+ class: `
201
+ flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md
202
+ ${U(e, s, o, n)}
203
+ hover:bg-muted/50 focus:z-10
204
+ `,
205
+ disabled: t === null,
206
+ "aria-label": t ? `Day ${t}` : null,
207
+ click: () => r(n)
208
+ },
209
+ t.toString()
210
+ ), D = (t, s, n, e) => t === e.date && s === e.month && n === e.year, V = (t, s, n) => {
211
+ const { year: e, month: o } = t, r = g(e, o, t.date), c = new Date(e, o, 1).getDay(), d = new Date(e, o + 1, 0).getDate(), u = new Date(e, o, 0).getDate(), i = [], f = o === 0 ? 11 : o - 1, y = o === 0 ? e - 1 : e;
212
+ for (let a = c - 1; a >= 0; a--) {
213
+ const h = D(u - a, f, y, s);
214
+ i.push(
215
+ x({
216
+ day: u - a,
217
+ currentDate: r,
218
+ date: g(y, f, u - a),
219
+ isToday: h,
220
+ isOutsideMonth: !0,
221
+ select: n
222
+ })
223
+ );
224
+ }
225
+ for (let a = 1; a <= d; a++) {
226
+ const h = D(a, o, e, s);
227
+ i.push(
228
+ x({
229
+ day: a,
230
+ currentDate: r,
231
+ date: g(e, o, a),
232
+ isToday: h,
233
+ isOutsideMonth: !1,
234
+ select: n
235
+ })
236
+ );
237
+ }
238
+ const C = o === 11 ? 0 : o + 1, v = o === 11 ? e + 1 : e, k = (7 - i.length % 7) % 7;
239
+ for (let a = 1; a <= k; a++) {
240
+ const h = D(a, C, v, s);
241
+ i.push(
242
+ x({
243
+ day: a,
244
+ currentDate: r,
245
+ date: g(v, C, a),
246
+ isToday: h,
247
+ isOutsideMonth: !0,
248
+ select: n
249
+ })
250
+ );
251
+ }
252
+ return i;
253
+ }, Z = (t) => l(
254
+ { class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
255
+ t
256
+ ), $ = ({ label: t, click: s }) => j(
257
+ {
258
+ class: `
259
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
260
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
261
+ ${t === "Previous" ? "left-1" : "right-1"}
262
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
263
+ `,
264
+ click: s,
265
+ "aria-label": `${t} month`,
266
+ variant: "icon",
267
+ icon: t === "Previous" ? M.chevron.single.left : M.chevron.single.right
268
+ }
269
+ ), _ = ({ next: t, previous: s }) => l({ class: "flex flex-auto min-h-12 text-sm font-medium relative justify-center items-center" }, [
270
+ w("[[monthName]] [[current.year]]"),
271
+ $({
272
+ label: "Previous",
273
+ click: s
274
+ }),
275
+ $({
276
+ label: "Next",
277
+ click: t
278
+ })
279
+ ]), tt = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Z), et = (t) => l({ class: "rdp w-full space-y-1" }, [
280
+ _({
281
+ next: t.next,
282
+ previous: t.previous
283
+ }),
284
+ l({
285
+ class: "flex flex-auto flex-col w-full",
286
+ onSet: ["currentDate", () => [
287
+ l({ class: "grid grid-cols-7" }, tt()),
288
+ l({ class: "grid grid-cols-7" }, V(
289
+ t.current,
290
+ t.today,
291
+ t.select
292
+ ))
293
+ ]]
294
+ })
295
+ ]);
296
+ class ut extends P {
297
+ constructor() {
298
+ super(...arguments);
299
+ /**
300
+ * This will set the selected date.
301
+ * @member {string} selectedDate
302
+ * @default null
303
+ */
304
+ p(this, "selectedDate", null);
305
+ /**
306
+ * This will set the selected call back.
307
+ * @member {function} selectedCallBack
308
+ * @default null
309
+ */
310
+ p(this, "selectedCallBack", null);
311
+ }
312
+ /**
313
+ * This will get the selected data.
314
+ *
315
+ * @param {object} today
316
+ * @returns {Date}
317
+ */
318
+ getSelectedDate(n) {
319
+ const e = this.selectedDate ? new Date(L(this.selectedDate)) : n;
320
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate());
321
+ }
322
+ /**
323
+ * This will set up the data for the calendar.
324
+ *
325
+ * @returns {Data}
326
+ */
327
+ setData() {
328
+ const n = /* @__PURE__ */ new Date(), e = this.getSelectedDate(n), o = e.getMonth();
329
+ return new z({
330
+ monthName: this.getMonthName(o),
331
+ currentDate: `${e.getFullYear()}-${o + 1}-${e.getDate()}`,
332
+ current: {
333
+ date: e.getDate(),
334
+ year: e.getFullYear(),
335
+ month: o
336
+ },
337
+ today: {
338
+ date: n.getDate(),
339
+ month: n.getMonth(),
340
+ year: n.getFullYear()
341
+ }
342
+ });
343
+ }
344
+ /**
345
+ * This will get the name of the month.
346
+ *
347
+ * @param {number} month
348
+ * @returns {string}
349
+ */
350
+ getMonthName(n) {
351
+ return Y.monthNames[n];
352
+ }
353
+ /**
354
+ * This will go to the previous month.
355
+ *
356
+ * @returns {void}
357
+ */
358
+ goToPreviousMonth() {
359
+ const n = this.data;
360
+ let e = n.current.month, o = n.current.year;
361
+ e === 0 ? (e = 11, o--) : e--, this.setCurrentDate(e, o);
362
+ }
363
+ /**
364
+ * This will go to the next month.
365
+ *
366
+ * @returns {void}
367
+ */
368
+ goToNextMonth() {
369
+ const n = this.data;
370
+ let e = n.current.month, o = n.current.year;
371
+ e === 11 ? (e = 0, o++) : e++, this.setCurrentDate(e, o);
372
+ }
373
+ /**
374
+ * This will set the current month and year.
375
+ *
376
+ * @param {number} month
377
+ * @param {number} year
378
+ * @param {number} [date=null]
379
+ * @returns {void}
380
+ */
381
+ setCurrentDate(n, e, o = null) {
382
+ const r = this.data;
383
+ r.current.month = n, r.current.year = e, typeof o == "number" && (r.current.date = m(o)), r.currentDate = `${e}-${m(n + 1)}-${r.current.date}`, r.monthName = this.getMonthName(n);
384
+ }
385
+ /**
386
+ * This will select a date.
387
+ *
388
+ * @param {string} date
389
+ * @returns {void}
390
+ */
391
+ selectDate(n) {
392
+ const e = /* @__PURE__ */ new Date(n + "T00:00:00");
393
+ this.setCurrentDate(e.getMonth(), e.getFullYear(), e.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
394
+ }
395
+ /**
396
+ * This will render the calendar.
397
+ *
398
+ * @returns {object}
399
+ */
400
+ render() {
401
+ return l({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
402
+ et({
403
+ current: this.data.current,
404
+ today: this.data.today,
405
+ select: (n) => this.selectDate(n),
406
+ next: () => this.goToNextMonth(),
407
+ previous: () => this.goToPreviousMonth()
408
+ })
409
+ ]);
410
+ }
411
+ }
412
+ export {
413
+ ct as A,
414
+ V as C,
415
+ x as D,
416
+ g as F,
417
+ et as M,
418
+ lt as P,
419
+ Z as a,
420
+ ut as b,
421
+ L as c,
422
+ A as g,
423
+ m as p
424
+ };