@sunggang/ui-lib 0.4.30 → 0.4.31

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 (45) hide show
  1. package/Accordion.cjs.d.ts +1 -0
  2. package/Accordion.cjs.default.js +1 -0
  3. package/Accordion.cjs.js +223 -0
  4. package/Accordion.cjs.mjs +2 -0
  5. package/Accordion.esm.d.ts +1 -0
  6. package/Accordion.esm.js +216 -0
  7. package/Carousel.cjs.d.ts +1 -0
  8. package/Carousel.cjs.default.js +1 -0
  9. package/Carousel.cjs.js +177 -0
  10. package/Carousel.cjs.mjs +2 -0
  11. package/Carousel.esm.d.ts +1 -0
  12. package/Carousel.esm.js +153 -0
  13. package/DataTable.cjs.js +4 -3
  14. package/DataTable.esm.js +2 -1
  15. package/Skeleton.cjs.d.ts +1 -0
  16. package/Skeleton.cjs.default.js +1 -0
  17. package/Skeleton.cjs.js +169 -0
  18. package/Skeleton.cjs.mjs +2 -0
  19. package/Skeleton.esm.d.ts +1 -0
  20. package/Skeleton.esm.js +162 -0
  21. package/accordion.cjs2.js +161 -0
  22. package/accordion.esm2.js +135 -0
  23. package/button.cjs.js +175 -0
  24. package/button.esm.js +152 -0
  25. package/carousel.cjs2.js +342 -0
  26. package/carousel.esm2.js +313 -0
  27. package/index.cjs.css +311 -0
  28. package/index.cjs.js +23 -7
  29. package/index.esm.css +311 -0
  30. package/index.esm.js +8 -2
  31. package/input.cjs.js +0 -149
  32. package/input.esm.js +2 -149
  33. package/package.json +18 -1
  34. package/skeleton.cjs2.js +70 -0
  35. package/skeleton.esm2.js +68 -0
  36. package/src/Accordion.d.ts +1 -0
  37. package/src/Carousel.d.ts +1 -0
  38. package/src/Skeleton.d.ts +1 -0
  39. package/src/components/ui/accordion.d.ts +7 -0
  40. package/src/components/ui/carousel.d.ts +18 -0
  41. package/src/components/ui/skeleton.d.ts +2 -0
  42. package/src/index.d.ts +3 -0
  43. package/src/lib/Accordion/index.d.ts +79 -0
  44. package/src/lib/Carousel/index.d.ts +35 -0
  45. package/src/lib/Skeleton/index.d.ts +55 -0
@@ -0,0 +1 @@
1
+ export * from "./src/Accordion";
@@ -0,0 +1 @@
1
+ exports._default = require('./Accordion.cjs.js').default;
@@ -0,0 +1,223 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ require('react');
7
+ var accordion = require('./accordion.cjs2.js');
8
+ var utils = require('./utils.cjs.js');
9
+ require('@radix-ui/react-accordion');
10
+ require('lucide-react');
11
+ require('clsx');
12
+ require('tailwind-merge');
13
+
14
+ function _define_property(obj, key, value) {
15
+ if (key in obj) {
16
+ Object.defineProperty(obj, key, {
17
+ value: value,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ });
22
+ } else {
23
+ obj[key] = value;
24
+ }
25
+ return obj;
26
+ }
27
+ function _object_spread(target) {
28
+ for(var i = 1; i < arguments.length; i++){
29
+ var source = arguments[i] != null ? arguments[i] : {};
30
+ var ownKeys = Object.keys(source);
31
+ if (typeof Object.getOwnPropertySymbols === "function") {
32
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
33
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
34
+ }));
35
+ }
36
+ ownKeys.forEach(function(key) {
37
+ _define_property(target, key, source[key]);
38
+ });
39
+ }
40
+ return target;
41
+ }
42
+ function ownKeys(object, enumerableOnly) {
43
+ var keys = Object.keys(object);
44
+ if (Object.getOwnPropertySymbols) {
45
+ var symbols = Object.getOwnPropertySymbols(object);
46
+ if (enumerableOnly) {
47
+ symbols = symbols.filter(function(sym) {
48
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
49
+ });
50
+ }
51
+ keys.push.apply(keys, symbols);
52
+ }
53
+ return keys;
54
+ }
55
+ function _object_spread_props(target, source) {
56
+ source = source != null ? source : {};
57
+ if (Object.getOwnPropertyDescriptors) {
58
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
59
+ } else {
60
+ ownKeys(Object(source)).forEach(function(key) {
61
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
62
+ });
63
+ }
64
+ return target;
65
+ }
66
+ var BaseAccordion = function(param) {
67
+ var items = param.items, _param_type = param.type, type = _param_type === void 0 ? "single" : _param_type, _param_collapsible = param.collapsible, collapsible = _param_collapsible === void 0 ? true : _param_collapsible, defaultValue = param.defaultValue, value = param.value, onValueChange = param.onValueChange, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? "vertical" : _param_orientation, className = param.className, itemClassName = param.itemClassName, triggerClassName = param.triggerClassName, contentClassName = param.contentClassName, _param_showBorder = param.showBorder, showBorder = _param_showBorder === void 0 ? true : _param_showBorder, _param_size = param.size, size = _param_size === void 0 ? "md" : _param_size;
68
+ var sizeClasses = {
69
+ sm: {
70
+ trigger: "py-2 text-sm",
71
+ content: "text-sm"
72
+ },
73
+ md: {
74
+ trigger: "py-4 text-base",
75
+ content: "text-base"
76
+ },
77
+ lg: {
78
+ trigger: "py-6 text-lg",
79
+ content: "text-lg"
80
+ }
81
+ };
82
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
83
+ className: utils.cn("w-full", !showBorder && "[&>*]:border-none", className),
84
+ children: type === "single" ? /*#__PURE__*/ jsxRuntime.jsx(accordion.Accordion, {
85
+ type: "single",
86
+ collapsible: collapsible,
87
+ defaultValue: defaultValue,
88
+ value: value,
89
+ onValueChange: onValueChange,
90
+ orientation: orientation,
91
+ children: items.map(function(item) {
92
+ return /*#__PURE__*/ jsxRuntime.jsxs(accordion.AccordionItem, {
93
+ value: item.id,
94
+ disabled: item.disabled,
95
+ className: utils.cn(itemClassName),
96
+ children: [
97
+ /*#__PURE__*/ jsxRuntime.jsx(accordion.AccordionTrigger, {
98
+ className: utils.cn(sizeClasses[size].trigger, item.disabled && "opacity-50 cursor-not-allowed", triggerClassName, item.titleClassName),
99
+ children: item.title
100
+ }),
101
+ /*#__PURE__*/ jsxRuntime.jsx(accordion.AccordionContent, {
102
+ className: utils.cn(sizeClasses[size].content, contentClassName, item.contentClassName),
103
+ children: item.content
104
+ })
105
+ ]
106
+ }, item.id);
107
+ })
108
+ }) : /*#__PURE__*/ jsxRuntime.jsx(accordion.Accordion, {
109
+ type: "multiple",
110
+ defaultValue: defaultValue,
111
+ value: value,
112
+ onValueChange: onValueChange,
113
+ orientation: orientation,
114
+ children: items.map(function(item) {
115
+ return /*#__PURE__*/ jsxRuntime.jsxs(accordion.AccordionItem, {
116
+ value: item.id,
117
+ disabled: item.disabled,
118
+ className: utils.cn(itemClassName),
119
+ children: [
120
+ /*#__PURE__*/ jsxRuntime.jsx(accordion.AccordionTrigger, {
121
+ className: utils.cn(sizeClasses[size].trigger, item.disabled && "opacity-50 cursor-not-allowed", triggerClassName, item.titleClassName),
122
+ children: item.title
123
+ }),
124
+ /*#__PURE__*/ jsxRuntime.jsx(accordion.AccordionContent, {
125
+ className: utils.cn(sizeClasses[size].content, contentClassName, item.contentClassName),
126
+ children: item.content
127
+ })
128
+ ]
129
+ }, item.id);
130
+ })
131
+ })
132
+ });
133
+ };
134
+ var FAQAccordion = function(param) {
135
+ var faqs = param.faqs, className = param.className;
136
+ var items = faqs.map(function(faq) {
137
+ return {
138
+ id: faq.id,
139
+ title: faq.question,
140
+ content: /*#__PURE__*/ jsxRuntime.jsx("div", {
141
+ className: "text-gray-600 leading-relaxed",
142
+ children: faq.answer
143
+ })
144
+ };
145
+ });
146
+ return /*#__PURE__*/ jsxRuntime.jsx(BaseAccordion, {
147
+ items: items,
148
+ type: "single",
149
+ collapsible: true,
150
+ className: utils.cn("space-y-2", className),
151
+ itemClassName: "border rounded-lg px-4",
152
+ triggerClassName: "hover:no-underline hover:bg-gray-50 rounded-lg px-2"
153
+ });
154
+ };
155
+ var FeatureAccordion = function(param) {
156
+ var features = param.features, className = param.className;
157
+ var items = features.map(function(feature) {
158
+ return {
159
+ id: feature.id,
160
+ title: feature.title,
161
+ content: /*#__PURE__*/ jsxRuntime.jsxs("div", {
162
+ className: "space-y-3",
163
+ children: [
164
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
165
+ className: "text-gray-600",
166
+ children: feature.description
167
+ }),
168
+ feature.details
169
+ ]
170
+ }),
171
+ titleClassName: "flex items-center space-x-3"
172
+ };
173
+ });
174
+ return /*#__PURE__*/ jsxRuntime.jsx(BaseAccordion, {
175
+ items: items.map(function(item, index) {
176
+ return _object_spread_props(_object_spread({}, item), {
177
+ title: /*#__PURE__*/ jsxRuntime.jsxs("div", {
178
+ className: "flex items-center space-x-3",
179
+ children: [
180
+ features[index].icon && /*#__PURE__*/ jsxRuntime.jsx("div", {
181
+ className: "text-blue-500",
182
+ children: features[index].icon
183
+ }),
184
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
185
+ children: features[index].title
186
+ })
187
+ ]
188
+ })
189
+ });
190
+ }),
191
+ type: "single",
192
+ collapsible: true,
193
+ size: "lg",
194
+ className: className,
195
+ itemClassName: "border-l-4 border-l-blue-500 pl-4"
196
+ });
197
+ };
198
+ var SettingsAccordion = function(param) {
199
+ var categories = param.categories, className = param.className;
200
+ var items = categories.map(function(category) {
201
+ return {
202
+ id: category.id,
203
+ title: category.title,
204
+ content: /*#__PURE__*/ jsxRuntime.jsx("div", {
205
+ className: "bg-gray-50 rounded-lg p-4",
206
+ children: category.settings
207
+ })
208
+ };
209
+ });
210
+ return /*#__PURE__*/ jsxRuntime.jsx(BaseAccordion, {
211
+ items: items,
212
+ type: "multiple",
213
+ className: className,
214
+ itemClassName: "bg-white rounded-lg shadow-sm border",
215
+ triggerClassName: "px-6 py-4 font-semibold text-gray-800",
216
+ contentClassName: "px-6 pb-4"
217
+ });
218
+ };
219
+
220
+ exports.BaseAccordion = BaseAccordion;
221
+ exports.FAQAccordion = FAQAccordion;
222
+ exports.FeatureAccordion = FeatureAccordion;
223
+ exports.SettingsAccordion = SettingsAccordion;
@@ -0,0 +1,2 @@
1
+ export * from './Accordion.cjs.js';
2
+ export { _default as default } from './Accordion.cjs.default.js';
@@ -0,0 +1 @@
1
+ export * from "./src/Accordion";
@@ -0,0 +1,216 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import 'react';
3
+ import { A as Accordion, a as AccordionItem, b as AccordionTrigger, c as AccordionContent } from './accordion.esm2.js';
4
+ import { c as cn } from './utils.esm.js';
5
+ import '@radix-ui/react-accordion';
6
+ import 'lucide-react';
7
+ import 'clsx';
8
+ import 'tailwind-merge';
9
+
10
+ function _define_property(obj, key, value) {
11
+ if (key in obj) {
12
+ Object.defineProperty(obj, key, {
13
+ value: value,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
+ });
18
+ } else {
19
+ obj[key] = value;
20
+ }
21
+ return obj;
22
+ }
23
+ function _object_spread(target) {
24
+ for(var i = 1; i < arguments.length; i++){
25
+ var source = arguments[i] != null ? arguments[i] : {};
26
+ var ownKeys = Object.keys(source);
27
+ if (typeof Object.getOwnPropertySymbols === "function") {
28
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
29
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
30
+ }));
31
+ }
32
+ ownKeys.forEach(function(key) {
33
+ _define_property(target, key, source[key]);
34
+ });
35
+ }
36
+ return target;
37
+ }
38
+ function ownKeys(object, enumerableOnly) {
39
+ var keys = Object.keys(object);
40
+ if (Object.getOwnPropertySymbols) {
41
+ var symbols = Object.getOwnPropertySymbols(object);
42
+ if (enumerableOnly) {
43
+ symbols = symbols.filter(function(sym) {
44
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
45
+ });
46
+ }
47
+ keys.push.apply(keys, symbols);
48
+ }
49
+ return keys;
50
+ }
51
+ function _object_spread_props(target, source) {
52
+ source = source != null ? source : {};
53
+ if (Object.getOwnPropertyDescriptors) {
54
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
55
+ } else {
56
+ ownKeys(Object(source)).forEach(function(key) {
57
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
+ });
59
+ }
60
+ return target;
61
+ }
62
+ var BaseAccordion = function(param) {
63
+ var items = param.items, _param_type = param.type, type = _param_type === void 0 ? "single" : _param_type, _param_collapsible = param.collapsible, collapsible = _param_collapsible === void 0 ? true : _param_collapsible, defaultValue = param.defaultValue, value = param.value, onValueChange = param.onValueChange, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? "vertical" : _param_orientation, className = param.className, itemClassName = param.itemClassName, triggerClassName = param.triggerClassName, contentClassName = param.contentClassName, _param_showBorder = param.showBorder, showBorder = _param_showBorder === void 0 ? true : _param_showBorder, _param_size = param.size, size = _param_size === void 0 ? "md" : _param_size;
64
+ var sizeClasses = {
65
+ sm: {
66
+ trigger: "py-2 text-sm",
67
+ content: "text-sm"
68
+ },
69
+ md: {
70
+ trigger: "py-4 text-base",
71
+ content: "text-base"
72
+ },
73
+ lg: {
74
+ trigger: "py-6 text-lg",
75
+ content: "text-lg"
76
+ }
77
+ };
78
+ return /*#__PURE__*/ jsx("div", {
79
+ className: cn("w-full", !showBorder && "[&>*]:border-none", className),
80
+ children: type === "single" ? /*#__PURE__*/ jsx(Accordion, {
81
+ type: "single",
82
+ collapsible: collapsible,
83
+ defaultValue: defaultValue,
84
+ value: value,
85
+ onValueChange: onValueChange,
86
+ orientation: orientation,
87
+ children: items.map(function(item) {
88
+ return /*#__PURE__*/ jsxs(AccordionItem, {
89
+ value: item.id,
90
+ disabled: item.disabled,
91
+ className: cn(itemClassName),
92
+ children: [
93
+ /*#__PURE__*/ jsx(AccordionTrigger, {
94
+ className: cn(sizeClasses[size].trigger, item.disabled && "opacity-50 cursor-not-allowed", triggerClassName, item.titleClassName),
95
+ children: item.title
96
+ }),
97
+ /*#__PURE__*/ jsx(AccordionContent, {
98
+ className: cn(sizeClasses[size].content, contentClassName, item.contentClassName),
99
+ children: item.content
100
+ })
101
+ ]
102
+ }, item.id);
103
+ })
104
+ }) : /*#__PURE__*/ jsx(Accordion, {
105
+ type: "multiple",
106
+ defaultValue: defaultValue,
107
+ value: value,
108
+ onValueChange: onValueChange,
109
+ orientation: orientation,
110
+ children: items.map(function(item) {
111
+ return /*#__PURE__*/ jsxs(AccordionItem, {
112
+ value: item.id,
113
+ disabled: item.disabled,
114
+ className: cn(itemClassName),
115
+ children: [
116
+ /*#__PURE__*/ jsx(AccordionTrigger, {
117
+ className: cn(sizeClasses[size].trigger, item.disabled && "opacity-50 cursor-not-allowed", triggerClassName, item.titleClassName),
118
+ children: item.title
119
+ }),
120
+ /*#__PURE__*/ jsx(AccordionContent, {
121
+ className: cn(sizeClasses[size].content, contentClassName, item.contentClassName),
122
+ children: item.content
123
+ })
124
+ ]
125
+ }, item.id);
126
+ })
127
+ })
128
+ });
129
+ };
130
+ var FAQAccordion = function(param) {
131
+ var faqs = param.faqs, className = param.className;
132
+ var items = faqs.map(function(faq) {
133
+ return {
134
+ id: faq.id,
135
+ title: faq.question,
136
+ content: /*#__PURE__*/ jsx("div", {
137
+ className: "text-gray-600 leading-relaxed",
138
+ children: faq.answer
139
+ })
140
+ };
141
+ });
142
+ return /*#__PURE__*/ jsx(BaseAccordion, {
143
+ items: items,
144
+ type: "single",
145
+ collapsible: true,
146
+ className: cn("space-y-2", className),
147
+ itemClassName: "border rounded-lg px-4",
148
+ triggerClassName: "hover:no-underline hover:bg-gray-50 rounded-lg px-2"
149
+ });
150
+ };
151
+ var FeatureAccordion = function(param) {
152
+ var features = param.features, className = param.className;
153
+ var items = features.map(function(feature) {
154
+ return {
155
+ id: feature.id,
156
+ title: feature.title,
157
+ content: /*#__PURE__*/ jsxs("div", {
158
+ className: "space-y-3",
159
+ children: [
160
+ /*#__PURE__*/ jsx("p", {
161
+ className: "text-gray-600",
162
+ children: feature.description
163
+ }),
164
+ feature.details
165
+ ]
166
+ }),
167
+ titleClassName: "flex items-center space-x-3"
168
+ };
169
+ });
170
+ return /*#__PURE__*/ jsx(BaseAccordion, {
171
+ items: items.map(function(item, index) {
172
+ return _object_spread_props(_object_spread({}, item), {
173
+ title: /*#__PURE__*/ jsxs("div", {
174
+ className: "flex items-center space-x-3",
175
+ children: [
176
+ features[index].icon && /*#__PURE__*/ jsx("div", {
177
+ className: "text-blue-500",
178
+ children: features[index].icon
179
+ }),
180
+ /*#__PURE__*/ jsx("span", {
181
+ children: features[index].title
182
+ })
183
+ ]
184
+ })
185
+ });
186
+ }),
187
+ type: "single",
188
+ collapsible: true,
189
+ size: "lg",
190
+ className: className,
191
+ itemClassName: "border-l-4 border-l-blue-500 pl-4"
192
+ });
193
+ };
194
+ var SettingsAccordion = function(param) {
195
+ var categories = param.categories, className = param.className;
196
+ var items = categories.map(function(category) {
197
+ return {
198
+ id: category.id,
199
+ title: category.title,
200
+ content: /*#__PURE__*/ jsx("div", {
201
+ className: "bg-gray-50 rounded-lg p-4",
202
+ children: category.settings
203
+ })
204
+ };
205
+ });
206
+ return /*#__PURE__*/ jsx(BaseAccordion, {
207
+ items: items,
208
+ type: "multiple",
209
+ className: className,
210
+ itemClassName: "bg-white rounded-lg shadow-sm border",
211
+ triggerClassName: "px-6 py-4 font-semibold text-gray-800",
212
+ contentClassName: "px-6 pb-4"
213
+ });
214
+ };
215
+
216
+ export { BaseAccordion, FAQAccordion, FeatureAccordion, SettingsAccordion };
@@ -0,0 +1 @@
1
+ export * from "./src/Carousel";
@@ -0,0 +1 @@
1
+ exports._default = require('./Carousel.cjs.js').default;
@@ -0,0 +1,177 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var carousel = require('./carousel.cjs2.js');
8
+ var utils = require('./utils.cjs.js');
9
+ require('embla-carousel-react');
10
+ require('lucide-react');
11
+ require('./button.cjs.js');
12
+ require('@radix-ui/react-slot');
13
+ require('class-variance-authority');
14
+ require('clsx');
15
+ require('tailwind-merge');
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
+
37
+ function _array_like_to_array(arr, len) {
38
+ if (len == null || len > arr.length) len = arr.length;
39
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
40
+ return arr2;
41
+ }
42
+ function _array_with_holes(arr) {
43
+ if (Array.isArray(arr)) return arr;
44
+ }
45
+ function _iterable_to_array_limit(arr, i) {
46
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
47
+ if (_i == null) return;
48
+ var _arr = [];
49
+ var _n = true;
50
+ var _d = false;
51
+ var _s, _e;
52
+ try {
53
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
54
+ _arr.push(_s.value);
55
+ if (i && _arr.length === i) break;
56
+ }
57
+ } catch (err) {
58
+ _d = true;
59
+ _e = err;
60
+ } finally{
61
+ try {
62
+ if (!_n && _i["return"] != null) _i["return"]();
63
+ } finally{
64
+ if (_d) throw _e;
65
+ }
66
+ }
67
+ return _arr;
68
+ }
69
+ function _non_iterable_rest() {
70
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
71
+ }
72
+ function _sliced_to_array(arr, i) {
73
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
74
+ }
75
+ function _unsupported_iterable_to_array(o, minLen) {
76
+ if (!o) return;
77
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
78
+ var n = Object.prototype.toString.call(o).slice(8, -1);
79
+ if (n === "Object" && o.constructor) n = o.constructor.name;
80
+ if (n === "Map" || n === "Set") return Array.from(n);
81
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
82
+ }
83
+ var BaseCarousel = function(param) {
84
+ var items = param.items, _param_showNavigation = param.showNavigation, showNavigation = _param_showNavigation === void 0 ? true : _param_showNavigation, _param_showIndicators = param.showIndicators, showIndicators = _param_showIndicators === void 0 ? true : _param_showIndicators, autoPlay = param.autoPlay, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? "horizontal" : _param_orientation, _param_itemsPerView = param.itemsPerView, itemsPerView = _param_itemsPerView === void 0 ? 1 : _param_itemsPerView, _param_gap = param.gap, gap = _param_gap === void 0 ? "1rem" : _param_gap, className = param.className, itemClassName = param.itemClassName, navigationClassName = param.navigationClassName, indicatorClassName = param.indicatorClassName, onSlideChange = param.onSlideChange, onReady = param.onReady;
85
+ var _React_useState = _sliced_to_array(React__namespace.useState(), 2), api = _React_useState[0], setApi = _React_useState[1];
86
+ var _React_useState1 = _sliced_to_array(React__namespace.useState(0), 2), current = _React_useState1[0], setCurrent = _React_useState1[1];
87
+ var _React_useState2 = _sliced_to_array(React__namespace.useState(0), 2), count = _React_useState2[0], setCount = _React_useState2[1];
88
+ React__namespace.useEffect(function() {
89
+ if (!api) return;
90
+ setCount(api.scrollSnapList().length);
91
+ setCurrent(api.selectedScrollSnap() + 1);
92
+ api.on("select", function() {
93
+ var selectedIndex = api.selectedScrollSnap();
94
+ setCurrent(selectedIndex + 1);
95
+ onSlideChange === null || onSlideChange === void 0 ? void 0 : onSlideChange(selectedIndex);
96
+ });
97
+ onReady === null || onReady === void 0 ? void 0 : onReady(api);
98
+ }, [
99
+ api,
100
+ onSlideChange,
101
+ onReady
102
+ ]);
103
+ React__namespace.useEffect(function() {
104
+ if (!api || !autoPlay) return;
105
+ var interval = setInterval(function() {
106
+ if (api.canScrollNext()) {
107
+ api.scrollNext();
108
+ } else {
109
+ api.scrollTo(0);
110
+ }
111
+ }, autoPlay);
112
+ return function() {
113
+ return clearInterval(interval);
114
+ };
115
+ }, [
116
+ api,
117
+ autoPlay
118
+ ]);
119
+ var basisClass = itemsPerView === 1 ? "basis-full" : itemsPerView === 2 ? "basis-1/2" : itemsPerView === 3 ? "basis-1/3" : itemsPerView === 4 ? "basis-1/4" : "basis-1/".concat(itemsPerView);
120
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
121
+ className: utils.cn("relative w-full", className),
122
+ children: [
123
+ /*#__PURE__*/ jsxRuntime.jsxs(carousel.Carousel, {
124
+ setApi: setApi,
125
+ orientation: orientation,
126
+ opts: {
127
+ align: "start",
128
+ loop: true
129
+ },
130
+ className: "w-full",
131
+ children: [
132
+ /*#__PURE__*/ jsxRuntime.jsx(carousel.CarouselContent, {
133
+ className: utils.cn("-ml-1", orientation === "vertical" && "-mt-1 flex-col"),
134
+ style: {
135
+ gap: gap
136
+ },
137
+ children: items.map(function(item, index) {
138
+ return /*#__PURE__*/ jsxRuntime.jsx(carousel.CarouselItem, {
139
+ className: utils.cn("pl-1", basisClass, orientation === "vertical" && "pt-1", itemClassName),
140
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
141
+ className: "p-1",
142
+ children: item.content
143
+ })
144
+ }, item.id);
145
+ })
146
+ }),
147
+ showNavigation && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
148
+ children: [
149
+ /*#__PURE__*/ jsxRuntime.jsx(carousel.CarouselPrevious, {
150
+ className: utils.cn(navigationClassName)
151
+ }),
152
+ /*#__PURE__*/ jsxRuntime.jsx(carousel.CarouselNext, {
153
+ className: utils.cn(navigationClassName)
154
+ })
155
+ ]
156
+ })
157
+ ]
158
+ }),
159
+ showIndicators && /*#__PURE__*/ jsxRuntime.jsx("div", {
160
+ className: "flex justify-center mt-4 space-x-2",
161
+ children: Array.from({
162
+ length: count
163
+ }, function(_, index) {
164
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
165
+ className: utils.cn("h-2 w-2 rounded-full transition-all", current === index + 1 ? "bg-primary scale-125" : "bg-primary/30 hover:bg-primary/60", indicatorClassName),
166
+ onClick: function() {
167
+ return api === null || api === void 0 ? void 0 : api.scrollTo(index);
168
+ },
169
+ "aria-label": "前往第 ".concat(index + 1, " 張投影片")
170
+ }, index);
171
+ })
172
+ })
173
+ ]
174
+ });
175
+ };
176
+
177
+ exports.BaseCarousel = BaseCarousel;
@@ -0,0 +1,2 @@
1
+ export * from './Carousel.cjs.js';
2
+ export { _default as default } from './Carousel.cjs.default.js';
@@ -0,0 +1 @@
1
+ export * from "./src/Carousel";