@snacky/ui 0.1.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.
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/index.cjs +1082 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1625 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +541 -0
- package/dist/index.d.ts +541 -0
- package/dist/index.js +1024 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1082 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key2 of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
14
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Accordion: () => Accordion,
|
|
24
|
+
AddressResult: () => AddressResult,
|
|
25
|
+
AlertBanner: () => AlertBanner,
|
|
26
|
+
Avatar: () => Avatar,
|
|
27
|
+
BottomSheet: () => BottomSheet,
|
|
28
|
+
Button: () => Button,
|
|
29
|
+
Callout: () => Callout,
|
|
30
|
+
ChatInput: () => ChatInput,
|
|
31
|
+
Checkbox: () => Checkbox,
|
|
32
|
+
CopyField: () => CopyField,
|
|
33
|
+
DiscountTag: () => DiscountTag,
|
|
34
|
+
FilterChip: () => FilterChip,
|
|
35
|
+
FullWidthBanner: () => FullWidthBanner,
|
|
36
|
+
Header: () => Header,
|
|
37
|
+
HeroBanner: () => HeroBanner,
|
|
38
|
+
IconButton: () => IconButton,
|
|
39
|
+
Illustration: () => Illustration,
|
|
40
|
+
NavBar: () => NavBar,
|
|
41
|
+
NotificationBadge: () => NotificationBadge,
|
|
42
|
+
NotificationListItem: () => NotificationListItem,
|
|
43
|
+
OrderListItem: () => OrderListItem,
|
|
44
|
+
OtpField: () => OtpField,
|
|
45
|
+
PointBalanceBanner: () => PointBalanceBanner,
|
|
46
|
+
ProductCard: () => ProductCard,
|
|
47
|
+
ProductChip: () => ProductChip,
|
|
48
|
+
ProductImage: () => ProductImage,
|
|
49
|
+
RadioOption: () => RadioOption,
|
|
50
|
+
SearchField: () => SearchField,
|
|
51
|
+
Section: () => Section,
|
|
52
|
+
SnackyIcons: () => SnackyIcons,
|
|
53
|
+
SoldOutBadge: () => SoldOutBadge,
|
|
54
|
+
SquareBanner: () => SquareBanner,
|
|
55
|
+
TabRow: () => TabRow,
|
|
56
|
+
TextField: () => TextField,
|
|
57
|
+
Toggle: () => Toggle,
|
|
58
|
+
UploadButton: () => UploadButton,
|
|
59
|
+
VariantBadge: () => VariantBadge,
|
|
60
|
+
typography: () => typography
|
|
61
|
+
});
|
|
62
|
+
module.exports = __toCommonJS(index_exports);
|
|
63
|
+
|
|
64
|
+
// src/theme/tokens.ts
|
|
65
|
+
var typography = {
|
|
66
|
+
h1: {
|
|
67
|
+
bold: { fontFamily: "Poppins, sans-serif", fontSize: "32px", fontWeight: 700, lineHeight: "36px", letterSpacing: "0.01em" }
|
|
68
|
+
},
|
|
69
|
+
h2: {
|
|
70
|
+
bold: { fontFamily: "Poppins, sans-serif", fontSize: "20px", fontWeight: 700, lineHeight: "36px", letterSpacing: "0.01em" }
|
|
71
|
+
},
|
|
72
|
+
h3: {
|
|
73
|
+
bold: { fontFamily: "Poppins, sans-serif", fontSize: "16px", fontWeight: 700, lineHeight: "36px", letterSpacing: "0.01em" },
|
|
74
|
+
regular: { fontFamily: "Poppins, sans-serif", fontSize: "16px", fontWeight: 400, lineHeight: "36px", letterSpacing: "normal" }
|
|
75
|
+
},
|
|
76
|
+
body: {
|
|
77
|
+
semibold: { fontFamily: "Poppins, sans-serif", fontSize: "14px", fontWeight: 600, lineHeight: "24px", letterSpacing: "normal" },
|
|
78
|
+
regular: { fontFamily: "Poppins, sans-serif", fontSize: "14px", fontWeight: 400, lineHeight: "24px", letterSpacing: "normal" }
|
|
79
|
+
},
|
|
80
|
+
small: {
|
|
81
|
+
semibold: { fontFamily: "Poppins, sans-serif", fontSize: "12px", fontWeight: 600, lineHeight: "24px", letterSpacing: "normal" },
|
|
82
|
+
bold: { fontFamily: "Poppins, sans-serif", fontSize: "12px", fontWeight: 700, lineHeight: "24px", letterSpacing: "0.01em" },
|
|
83
|
+
regular: { fontFamily: "Poppins, sans-serif", fontSize: "12px", fontWeight: 400, lineHeight: "24px", letterSpacing: "normal" }
|
|
84
|
+
},
|
|
85
|
+
caption: {
|
|
86
|
+
semibold: { fontFamily: "Poppins, sans-serif", fontSize: "10px", fontWeight: 600, lineHeight: "23px", letterSpacing: "0.01em" },
|
|
87
|
+
regular: { fontFamily: "Poppins, sans-serif", fontSize: "10px", fontWeight: 400, lineHeight: "16px", letterSpacing: "0.01em" }
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/components/Button/Button.tsx
|
|
92
|
+
var import_react = require("react");
|
|
93
|
+
|
|
94
|
+
// src/utils/cx.ts
|
|
95
|
+
function cx(...parts) {
|
|
96
|
+
return parts.filter(Boolean).join(" ");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/components/Button/Button.tsx
|
|
100
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
101
|
+
var Button = (0, import_react.forwardRef)(function Button2({ variant = "primary", danger = false, size = "default", icon, children, className, disabled, ...rest }, ref) {
|
|
102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
ref,
|
|
106
|
+
type: "button",
|
|
107
|
+
disabled,
|
|
108
|
+
className: cx(
|
|
109
|
+
"snacky-btn",
|
|
110
|
+
`snacky-btn--${variant}`,
|
|
111
|
+
size === "small" && "snacky-btn--small",
|
|
112
|
+
danger && "snacky-btn--danger",
|
|
113
|
+
className
|
|
114
|
+
),
|
|
115
|
+
...rest,
|
|
116
|
+
children: [
|
|
117
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "snacky-btn__icon", children: icon }),
|
|
118
|
+
children
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// src/components/IconButton/IconButton.tsx
|
|
125
|
+
var import_react2 = require("react");
|
|
126
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
127
|
+
var IconButton = (0, import_react2.forwardRef)(function IconButton2({ variant = "primary", size = "default", icon, selected = false, ariaLabel, className, disabled, ...rest }, ref) {
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
ref,
|
|
132
|
+
type: "button",
|
|
133
|
+
disabled,
|
|
134
|
+
"aria-label": ariaLabel,
|
|
135
|
+
"aria-pressed": selected,
|
|
136
|
+
className: cx(
|
|
137
|
+
"snacky-iconbtn",
|
|
138
|
+
`snacky-iconbtn--${variant}`,
|
|
139
|
+
size === "small" && "snacky-iconbtn--small",
|
|
140
|
+
selected && "snacky-iconbtn--selected",
|
|
141
|
+
className
|
|
142
|
+
),
|
|
143
|
+
...rest,
|
|
144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "snacky-iconbtn__icon", children: icon })
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// src/components/IconButton/UploadButton.tsx
|
|
150
|
+
var import_react3 = require("react");
|
|
151
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
152
|
+
var UploadButton = (0, import_react3.forwardRef)(function UploadButton2({ icon, ariaLabel = "Upload image", className, ...rest }, ref) {
|
|
153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { ref, type: "button", "aria-label": ariaLabel, className: cx("snacky-upload", className), ...rest, children: icon });
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// src/components/Input/TextField.tsx
|
|
157
|
+
var import_react4 = require("react");
|
|
158
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
159
|
+
var TextField = (0, import_react4.forwardRef)(function TextField2({
|
|
160
|
+
value,
|
|
161
|
+
onChange,
|
|
162
|
+
label,
|
|
163
|
+
leadingIcon,
|
|
164
|
+
trailingIcon,
|
|
165
|
+
trailingIconRotated = false,
|
|
166
|
+
error,
|
|
167
|
+
disabled,
|
|
168
|
+
className,
|
|
169
|
+
id,
|
|
170
|
+
...rest
|
|
171
|
+
}, ref) {
|
|
172
|
+
const autoId = (0, import_react4.useId)();
|
|
173
|
+
const fieldId = id ?? autoId;
|
|
174
|
+
const errorMessage = typeof error === "string" ? error : void 0;
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className, children: [
|
|
176
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "snacky-field-label", htmlFor: fieldId, children: label }),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
className: cx("snacky-field", !!error && "snacky-field--error", disabled && "snacky-field--disabled"),
|
|
181
|
+
children: [
|
|
182
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "snacky-field__icon", children: leadingIcon }),
|
|
183
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
184
|
+
"input",
|
|
185
|
+
{
|
|
186
|
+
ref,
|
|
187
|
+
id: fieldId,
|
|
188
|
+
className: "snacky-field__input",
|
|
189
|
+
value,
|
|
190
|
+
onChange: (e) => onChange(e.target.value),
|
|
191
|
+
disabled,
|
|
192
|
+
...rest
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
className: "snacky-field__icon",
|
|
199
|
+
style: trailingIconRotated ? { transform: "rotate(180deg)" } : void 0,
|
|
200
|
+
children: trailingIcon
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "snacky-field-error", children: errorMessage })
|
|
207
|
+
] });
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// src/components/Input/SearchField.tsx
|
|
211
|
+
var import_react5 = require("react");
|
|
212
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
213
|
+
var SearchField = (0, import_react5.forwardRef)(function SearchField2({ value, onChange, searchIcon, onClear, className, placeholder = "Search products...", ...rest }, ref) {
|
|
214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cx("snacky-search", className), children: [
|
|
215
|
+
searchIcon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "snacky-search__icon", children: searchIcon }),
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
217
|
+
"input",
|
|
218
|
+
{
|
|
219
|
+
ref,
|
|
220
|
+
className: "snacky-search__input",
|
|
221
|
+
value,
|
|
222
|
+
placeholder,
|
|
223
|
+
onChange: (e) => onChange(e.target.value),
|
|
224
|
+
...rest
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
value && onClear && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "snacky-search__clear", onClick: onClear, "aria-label": "Clear search", children: "\u2715" })
|
|
228
|
+
] });
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// src/components/Input/OtpField.tsx
|
|
232
|
+
var import_react6 = require("react");
|
|
233
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
234
|
+
function OtpField({ value, onChange, length = 6, disabled }) {
|
|
235
|
+
const cellRefs = (0, import_react6.useRef)([]);
|
|
236
|
+
const digits = Array.from({ length }, (_, i) => value[i] ?? "");
|
|
237
|
+
function setDigit(index, digit) {
|
|
238
|
+
const next = digits.slice();
|
|
239
|
+
next[index] = digit;
|
|
240
|
+
onChange(next.join(""));
|
|
241
|
+
if (digit && index < length - 1) cellRefs.current[index + 1]?.focus();
|
|
242
|
+
}
|
|
243
|
+
function handleKeyDown(index, e) {
|
|
244
|
+
if (e.key === "Backspace" && !digits[index] && index > 0) {
|
|
245
|
+
cellRefs.current[index - 1]?.focus();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "snacky-otp", children: digits.map((digit, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
249
|
+
"input",
|
|
250
|
+
{
|
|
251
|
+
ref: (el) => {
|
|
252
|
+
cellRefs.current[i] = el;
|
|
253
|
+
},
|
|
254
|
+
className: "snacky-otp__cell",
|
|
255
|
+
inputMode: "numeric",
|
|
256
|
+
maxLength: 1,
|
|
257
|
+
value: digit,
|
|
258
|
+
disabled,
|
|
259
|
+
onChange: (e) => setDigit(i, e.target.value.replace(/\D/g, "").slice(-1)),
|
|
260
|
+
onKeyDown: (e) => handleKeyDown(i, e),
|
|
261
|
+
"aria-label": `Digit ${i + 1}`
|
|
262
|
+
},
|
|
263
|
+
i
|
|
264
|
+
)) });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// src/components/Input/CopyField.tsx
|
|
268
|
+
var import_react7 = require("react");
|
|
269
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
270
|
+
function CopyField({ value, onCopy, className }) {
|
|
271
|
+
const [copied, setCopied] = (0, import_react7.useState)(false);
|
|
272
|
+
async function handleCopy() {
|
|
273
|
+
try {
|
|
274
|
+
await navigator.clipboard.writeText(value);
|
|
275
|
+
} catch {
|
|
276
|
+
}
|
|
277
|
+
onCopy?.(value);
|
|
278
|
+
setCopied(true);
|
|
279
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
280
|
+
}
|
|
281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cx("snacky-copy", className), children: [
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "snacky-copy__value", children: value }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: cx("snacky-copy__action", copied && "snacky-copy__action--copied"), onClick: handleCopy, children: copied ? "Copied" : "Copy" })
|
|
284
|
+
] });
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/components/Input/ChatInput.tsx
|
|
288
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
289
|
+
function ChatInput({ value, onChange, onSend, sendIcon, className, placeholder = "Write your message here", ...rest }) {
|
|
290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: cx("snacky-chatfield", className), children: [
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
292
|
+
"input",
|
|
293
|
+
{
|
|
294
|
+
className: "snacky-chatfield__input",
|
|
295
|
+
value,
|
|
296
|
+
placeholder,
|
|
297
|
+
onChange: (e) => onChange(e.target.value),
|
|
298
|
+
onKeyDown: (e) => e.key === "Enter" && value && onSend(),
|
|
299
|
+
...rest
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
303
|
+
"button",
|
|
304
|
+
{
|
|
305
|
+
type: "button",
|
|
306
|
+
className: cx("snacky-chatfield__send", value && "snacky-chatfield__send--active"),
|
|
307
|
+
onClick: onSend,
|
|
308
|
+
disabled: !value,
|
|
309
|
+
"aria-label": "Send",
|
|
310
|
+
children: sendIcon ?? "\u27A4"
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] });
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/components/Input/AddressResult.tsx
|
|
317
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
318
|
+
function AddressResult({ icon, title, subtitle, onClick, className }) {
|
|
319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: cx("snacky-address-result", className), onClick, children: [
|
|
320
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "snacky-address-result__icon", children: icon }),
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "snacky-address-result__title", children: title }),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "snacky-address-result__subtitle", children: subtitle })
|
|
324
|
+
] })
|
|
325
|
+
] });
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// src/components/Chips/ProductChip.tsx
|
|
329
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
330
|
+
function ProductChip({ label, selected, thumbnail, onClick, className, ...rest }) {
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
332
|
+
"button",
|
|
333
|
+
{
|
|
334
|
+
type: "button",
|
|
335
|
+
className: cx("snacky-chip", selected && "snacky-chip--selected", className),
|
|
336
|
+
"aria-pressed": selected,
|
|
337
|
+
onClick,
|
|
338
|
+
...rest,
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "snacky-chip__thumb", children: thumbnail }),
|
|
341
|
+
label
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/components/Chips/FilterChip.tsx
|
|
348
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
349
|
+
function FilterChip({ label, selected, onClick, className, ...rest }) {
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
351
|
+
"button",
|
|
352
|
+
{
|
|
353
|
+
type: "button",
|
|
354
|
+
className: cx("snacky-chip", selected && "snacky-chip--selected", className),
|
|
355
|
+
"aria-pressed": selected,
|
|
356
|
+
onClick,
|
|
357
|
+
...rest,
|
|
358
|
+
children: label
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/components/RadioButton/RadioButton.tsx
|
|
364
|
+
var import_react8 = require("react");
|
|
365
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
366
|
+
function RadioOption({ label, selected, onClick, disabled, name, className }) {
|
|
367
|
+
const id = (0, import_react8.useId)();
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
369
|
+
"label",
|
|
370
|
+
{
|
|
371
|
+
htmlFor: id,
|
|
372
|
+
className: cx("snacky-radio-option", disabled && "snacky-radio-option--disabled", className),
|
|
373
|
+
children: [
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
375
|
+
"input",
|
|
376
|
+
{
|
|
377
|
+
id,
|
|
378
|
+
type: "radio",
|
|
379
|
+
className: "snacky-radio",
|
|
380
|
+
name,
|
|
381
|
+
checked: selected,
|
|
382
|
+
disabled,
|
|
383
|
+
onChange: onClick
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
label
|
|
387
|
+
]
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
393
|
+
var import_react9 = require("react");
|
|
394
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
395
|
+
function Checkbox({ label, checked, onChange, disabled, className }) {
|
|
396
|
+
const id = (0, import_react9.useId)();
|
|
397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { htmlFor: id, className: cx("snacky-checkbox-option", className), children: [
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
399
|
+
"input",
|
|
400
|
+
{
|
|
401
|
+
id,
|
|
402
|
+
type: "checkbox",
|
|
403
|
+
className: "snacky-checkbox",
|
|
404
|
+
checked,
|
|
405
|
+
disabled,
|
|
406
|
+
onChange: (e) => onChange(e.target.checked)
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
label
|
|
410
|
+
] });
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/components/Toggle/Toggle.tsx
|
|
414
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
415
|
+
function Toggle({ checked, onChange, disabled, ariaLabel = "Toggle", className }) {
|
|
416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
type: "button",
|
|
420
|
+
role: "switch",
|
|
421
|
+
"aria-checked": checked,
|
|
422
|
+
"aria-label": ariaLabel,
|
|
423
|
+
disabled,
|
|
424
|
+
className: cx("snacky-toggle", checked && "snacky-toggle--on", className),
|
|
425
|
+
onClick: () => onChange(!checked),
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "snacky-toggle__track" }),
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "snacky-toggle__thumb" })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// src/components/Navbar/Navbar.tsx
|
|
435
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
436
|
+
function NavBar({ items, selected, onSelect, className }) {
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: cx("snacky-navbar", className), children: items.map((item, i) => {
|
|
438
|
+
const active = i === selected;
|
|
439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
type: "button",
|
|
443
|
+
className: cx("snacky-navbar__item", active && "snacky-navbar__item--active"),
|
|
444
|
+
"aria-current": active ? "page" : void 0,
|
|
445
|
+
onClick: () => onSelect(i),
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "snacky-navbar__icon", children: active && item.activeIcon ? item.activeIcon : item.icon }),
|
|
448
|
+
item.label
|
|
449
|
+
]
|
|
450
|
+
},
|
|
451
|
+
item.label
|
|
452
|
+
);
|
|
453
|
+
}) });
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// src/components/Tab/Tab.tsx
|
|
457
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
458
|
+
function TabRow({ tabs, selected, onSelect, className }) {
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cx("snacky-tabrow", className), role: "tablist", children: tabs.map((tab, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
460
|
+
"button",
|
|
461
|
+
{
|
|
462
|
+
type: "button",
|
|
463
|
+
role: "tab",
|
|
464
|
+
"aria-selected": i === selected,
|
|
465
|
+
className: cx("snacky-tab", i === selected && "snacky-tab--active"),
|
|
466
|
+
onClick: () => onSelect(i),
|
|
467
|
+
children: tab
|
|
468
|
+
},
|
|
469
|
+
tab
|
|
470
|
+
)) });
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/icons/outline.tsx
|
|
474
|
+
var outline_exports = {};
|
|
475
|
+
__export(outline_exports, {
|
|
476
|
+
account: () => account,
|
|
477
|
+
back: () => back,
|
|
478
|
+
bell: () => bell,
|
|
479
|
+
calendar: () => calendar,
|
|
480
|
+
camera: () => camera,
|
|
481
|
+
cart: () => cart,
|
|
482
|
+
cartAdd: () => cartAdd,
|
|
483
|
+
cash: () => cash,
|
|
484
|
+
category: () => category,
|
|
485
|
+
chat: () => chat,
|
|
486
|
+
check: () => check,
|
|
487
|
+
chevronDown: () => chevronDown,
|
|
488
|
+
chevronRight: () => chevronRight,
|
|
489
|
+
chevronUp: () => chevronUp,
|
|
490
|
+
clock: () => clock,
|
|
491
|
+
close: () => close,
|
|
492
|
+
closeCircle: () => closeCircle,
|
|
493
|
+
creditCard: () => creditCard,
|
|
494
|
+
document: () => document,
|
|
495
|
+
edit: () => edit,
|
|
496
|
+
eye: () => eye,
|
|
497
|
+
eyeOff: () => eyeOff,
|
|
498
|
+
heart: () => heart,
|
|
499
|
+
help: () => help,
|
|
500
|
+
history: () => history,
|
|
501
|
+
home: () => home,
|
|
502
|
+
key: () => key,
|
|
503
|
+
location: () => location,
|
|
504
|
+
lock: () => lock,
|
|
505
|
+
logout: () => logout,
|
|
506
|
+
messageSquare: () => messageSquare,
|
|
507
|
+
minus: () => minus,
|
|
508
|
+
phone: () => phone,
|
|
509
|
+
pin: () => pin,
|
|
510
|
+
plus: () => plus,
|
|
511
|
+
receipt: () => receipt,
|
|
512
|
+
search: () => search,
|
|
513
|
+
send: () => send,
|
|
514
|
+
share: () => share,
|
|
515
|
+
smartphone: () => smartphone,
|
|
516
|
+
trash: () => trash,
|
|
517
|
+
truck: () => truck
|
|
518
|
+
});
|
|
519
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
520
|
+
function base(path) {
|
|
521
|
+
return function OutlineIcon({ width = 24, height = 24, color = "currentColor", ...rest }) {
|
|
522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", ...rest, children: path });
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
var home = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1h-4v-6H9v6H5a1 1 0 0 1-1-1v-8.5Z" }));
|
|
526
|
+
var category = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "4", y: "4", width: "7", height: "7", rx: "1" }),
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "13", y: "4", width: "7", height: "7", rx: "1" }),
|
|
529
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "4", y: "13", width: "7", height: "7", rx: "1" }),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "13", y: "13", width: "7", height: "7", rx: "1" })
|
|
531
|
+
] }));
|
|
532
|
+
var cart = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "9", cy: "20", r: "1" }),
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "17", cy: "20", r: "1" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 4h2l2.4 11.6a1.5 1.5 0 0 0 1.47 1.2h8.06a1.5 1.5 0 0 0 1.47-1.2L20 7H6" })
|
|
536
|
+
] }));
|
|
537
|
+
var cartAdd = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "9", cy: "20", r: "1" }),
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "17", cy: "20", r: "1" }),
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 4h2l2.4 11.6a1.5 1.5 0 0 0 1.47 1.2h8.06a1.5 1.5 0 0 0 1.47-1.2L20 7H6" }),
|
|
541
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M18 2v5M15.5 4.5h5" })
|
|
542
|
+
] }));
|
|
543
|
+
var history = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 12a9 9 0 1 0 3-6.7" }),
|
|
545
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 4v4h4" }),
|
|
546
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 8v4l3 2" })
|
|
547
|
+
] }));
|
|
548
|
+
var account = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "8", r: "3.5" }),
|
|
550
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M5 20c0-3.3 3.1-6 7-6s7 2.7 7 6" })
|
|
551
|
+
] }));
|
|
552
|
+
var eye = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M2 12s3.5-6.5 10-6.5S22 12 22 12s-3.5 6.5-10 6.5S2 12 2 12Z" }),
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "2.5" })
|
|
555
|
+
] }));
|
|
556
|
+
var eyeOff = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
557
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 3l18 18" }),
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M10.6 5.6A9.9 9.9 0 0 1 12 5.5c6.5 0 10 6.5 10 6.5a15.9 15.9 0 0 1-3.4 4.2M6.5 6.8A16.4 16.4 0 0 0 2 12s3.5 6.5 10 6.5a10 10 0 0 0 4-.8" }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9.9 9.9a2.5 2.5 0 0 0 3.5 3.5" })
|
|
560
|
+
] }));
|
|
561
|
+
var chevronDown = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 9l6 6 6-6" }));
|
|
562
|
+
var chevronUp = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 15l6-6 6 6" }));
|
|
563
|
+
var chevronRight = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 6l6 6-6 6" }));
|
|
564
|
+
var back = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M15 6l-6 6 6 6" }));
|
|
565
|
+
var close = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 6l12 12M18 6L6 18" }));
|
|
566
|
+
var closeCircle = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
568
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 9l6 6M15 9l-6 6" })
|
|
569
|
+
] }));
|
|
570
|
+
var calendar = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "3", y: "5", width: "18", height: "16", rx: "2" }),
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 9h18M8 3v4M16 3v4" })
|
|
573
|
+
] }));
|
|
574
|
+
var search = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "11", cy: "11", r: "7" }),
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M21 21l-4.3-4.3" })
|
|
577
|
+
] }));
|
|
578
|
+
var location = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 21s7-7.2 7-12a7 7 0 0 0-14 0c0 4.8 7 12 7 12Z" }),
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "9", r: "2.5" })
|
|
581
|
+
] }));
|
|
582
|
+
var pin = location;
|
|
583
|
+
var send = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M22 2 11 13M22 2l-7 20-4-9-9-4 20-7Z" }));
|
|
584
|
+
var chat = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M21 12a8 8 0 1 1-3.3-6.5L21 4l-1 4.7A7.9 7.9 0 0 1 21 12Z" }));
|
|
585
|
+
var messageSquare = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 4h16v12H8l-4 4V4Z" }));
|
|
586
|
+
var heart = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 20s-7-4.4-9.3-9A5 5 0 0 1 12 6a5 5 0 0 1 9.3 5c-2.3 4.6-9.3 9-9.3 9Z" }));
|
|
587
|
+
var bell = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 9a6 6 0 0 1 12 0c0 5 2 6 2 6H4s2-1 2-6Z" }),
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M10 19a2 2 0 0 0 4 0" })
|
|
590
|
+
] }));
|
|
591
|
+
var check = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M5 13l4 4 10-10" }));
|
|
592
|
+
var plus = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 5v14M5 12h14" }));
|
|
593
|
+
var minus = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M5 12h14" }));
|
|
594
|
+
var trash = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13" }) }));
|
|
595
|
+
var edit = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3Z" }) }));
|
|
596
|
+
var share = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "6", cy: "12", r: "2.5" }),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "18", cy: "6", r: "2.5" }),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "18", cy: "18", r: "2.5" }),
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M8.3 10.7l7.4-4.4M8.3 13.3l7.4 4.4" })
|
|
601
|
+
] }));
|
|
602
|
+
var camera = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
603
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 8h3l2-2h6l2 2h3v11H4V8Z" }),
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "13.5", r: "3.5" })
|
|
605
|
+
] }));
|
|
606
|
+
var phone = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 3h3l2 5-2.5 1.5a12 12 0 0 0 6 6L16 13l5 2v3a2 2 0 0 1-2 2A16 16 0 0 1 4 5a2 2 0 0 1 2-2Z" }));
|
|
607
|
+
var lock = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "5", y: "11", width: "14", height: "9", rx: "1.5" }),
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M8 11V8a4 4 0 0 1 8 0v3" })
|
|
610
|
+
] }));
|
|
611
|
+
var document = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M7 3h7l4 4v14H7V3Z" }),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M14 3v4h4" })
|
|
614
|
+
] }));
|
|
615
|
+
var creditCard = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "3", y: "6", width: "18", height: "12", rx: "2" }),
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M3 10h18" })
|
|
618
|
+
] }));
|
|
619
|
+
var receipt = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
620
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M6 3h12v18l-2-1.5-2 1.5-2-1.5-2 1.5-2-1.5-2 1.5V3Z" }),
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 8h6M9 12h6" })
|
|
622
|
+
] }));
|
|
623
|
+
var smartphone = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
624
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "7", y: "2", width: "10", height: "20", rx: "2" }),
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M11 19h2" })
|
|
626
|
+
] }));
|
|
627
|
+
var key = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "8", cy: "15", r: "4" }),
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M11 12l9-9M17 6l3 3M14 9l2 2" })
|
|
630
|
+
] }));
|
|
631
|
+
var help = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
633
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.9.4-1 1-1 1.7" }),
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 17h.01" })
|
|
635
|
+
] }));
|
|
636
|
+
var logout = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M16 17l5-5-5-5M21 12H9" })
|
|
639
|
+
] }));
|
|
640
|
+
var truck = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
641
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M2 7h11v10H2V7Z" }),
|
|
642
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M13 10h4l4 3v4h-8v-7Z" }),
|
|
643
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "7", cy: "19", r: "1.5" }),
|
|
644
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "17", cy: "19", r: "1.5" })
|
|
645
|
+
] }));
|
|
646
|
+
var cash = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "3" })
|
|
649
|
+
] }));
|
|
650
|
+
var clock = base(/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M12 7v5l3.5 2" })
|
|
653
|
+
] }));
|
|
654
|
+
|
|
655
|
+
// src/icons/solid.tsx
|
|
656
|
+
var solid_exports = {};
|
|
657
|
+
__export(solid_exports, {
|
|
658
|
+
cart: () => cart2,
|
|
659
|
+
category: () => category2,
|
|
660
|
+
heart: () => heart2,
|
|
661
|
+
home: () => home2
|
|
662
|
+
});
|
|
663
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
664
|
+
function base2(path) {
|
|
665
|
+
return function SolidIcon({ width = 24, height = 24, color = "currentColor", ...rest }) {
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { width, height, viewBox: "0 0 24 24", fill: color, ...rest, children: path });
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
var home2 = base2(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M4 10.5 12 4l8 6.5V19a1 1 0 0 1-1 1h-4v-6H9v6H5a1 1 0 0 1-1-1v-8.5Z" }));
|
|
670
|
+
var category2 = base2(/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "4", y: "4", width: "7", height: "7", rx: "1" }),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "13", y: "4", width: "7", height: "7", rx: "1" }),
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "4", y: "13", width: "7", height: "7", rx: "1" }),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("rect", { x: "13", y: "13", width: "7", height: "7", rx: "1" })
|
|
675
|
+
] }));
|
|
676
|
+
var cart2 = base2(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M3 4h2l2.4 11.6a1.5 1.5 0 0 0 1.47 1.2h8.06a1.5 1.5 0 0 0 1.47-1.2L20 7H6l-.4-2H3v-1Zm6 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm8 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" }));
|
|
677
|
+
var heart2 = base2(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12 20s-7-4.4-9.3-9A5 5 0 0 1 12 6a5 5 0 0 1 9.3 5c-2.3 4.6-9.3 9-9.3 9Z" }));
|
|
678
|
+
|
|
679
|
+
// src/icons/index.ts
|
|
680
|
+
var SnackyIcons = { outline: outline_exports, solid: solid_exports };
|
|
681
|
+
|
|
682
|
+
// src/components/Header/Header.tsx
|
|
683
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
684
|
+
function Header({ title, leadingIcon, onLeadingClick, trailingIcon, onTrailingClick, className }) {
|
|
685
|
+
const LeadingIconEl = leadingIcon === "back" ? SnackyIcons.outline.back : SnackyIcons.outline.close;
|
|
686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: cx("snacky-header", className), children: [
|
|
687
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
type: "button",
|
|
691
|
+
className: "snacky-header__icon-btn",
|
|
692
|
+
onClick: onLeadingClick,
|
|
693
|
+
"aria-label": leadingIcon === "back" ? "Back" : "Close",
|
|
694
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LeadingIconEl, { width: 24, height: 24 })
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cx("snacky-header__title-row", leadingIcon && !trailingIcon && "snacky-header__title-row--balance"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "snacky-header__title", children: title }) }),
|
|
698
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "snacky-header__icon-btn", onClick: onTrailingClick, "aria-label": "Action", children: trailingIcon })
|
|
699
|
+
] });
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// src/components/Banner/Banner.tsx
|
|
703
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
704
|
+
function HeroBanner({ imageUrl, alt, onClick, className }) {
|
|
705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: imageUrl, alt, onClick, className: cx("snacky-banner-hero", className) });
|
|
706
|
+
}
|
|
707
|
+
function SquareBanner({ imageUrl, alt, onClick, className }) {
|
|
708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: imageUrl, alt, onClick, className: cx("snacky-banner-square", className) });
|
|
709
|
+
}
|
|
710
|
+
function FullWidthBanner({ imageUrl, alt, onClick, className }) {
|
|
711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: imageUrl, alt, onClick, className: cx("snacky-banner-full", className) });
|
|
712
|
+
}
|
|
713
|
+
function PointBalanceBanner({ pointsIcon, points, balanceIcon, balance, className }) {
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("snacky-banner-point-balance", className), children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "snacky-banner-point-balance__item", children: [
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "snacky-banner-point-balance__icon", children: pointsIcon }),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-point-balance__label", children: "Points" }),
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-point-balance__value", children: points })
|
|
720
|
+
] })
|
|
721
|
+
] }),
|
|
722
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "snacky-banner-point-balance__divider" }),
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "snacky-banner-point-balance__item", children: [
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "snacky-banner-point-balance__icon", children: balanceIcon }),
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-point-balance__label", children: "Balance" }),
|
|
727
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-point-balance__value", children: balance })
|
|
728
|
+
] })
|
|
729
|
+
] })
|
|
730
|
+
] });
|
|
731
|
+
}
|
|
732
|
+
function AlertBanner({ message, countdown, className }) {
|
|
733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("snacky-banner-alert", className), children: [
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-alert__message", children: message }),
|
|
735
|
+
countdown && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "snacky-banner-alert__countdown", children: countdown })
|
|
736
|
+
] });
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// src/components/Badge/Badge.tsx
|
|
740
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
741
|
+
function NotificationBadge({ count, max = 99, children, className }) {
|
|
742
|
+
if (count <= 0) return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_jsx_runtime21.Fragment, { children });
|
|
743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: cx("snacky-badge-wrap", className), children: [
|
|
744
|
+
children,
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "snacky-badge-notification", children: count > max ? `${max}+` : count })
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
function DiscountTag({ label, className }) {
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx("snacky-discount-tag", className), children: label });
|
|
750
|
+
}
|
|
751
|
+
function SoldOutBadge({ className }) {
|
|
752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx("snacky-soldout-badge", className), children: "Sold Out" });
|
|
753
|
+
}
|
|
754
|
+
function VariantBadge({ label, className }) {
|
|
755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: cx("snacky-variant-badge", className), children: label });
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/components/Callout/Callout.tsx
|
|
759
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
760
|
+
function Callout({ message, timestamp, variant, statusIcon, className }) {
|
|
761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cx("snacky-callout", `snacky-callout--${variant}`, className), children: [
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "snacky-callout__message", children: message }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "snacky-callout__meta", children: [
|
|
764
|
+
timestamp,
|
|
765
|
+
statusIcon && variant !== "received" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "snacky-callout__meta-icon", children: statusIcon })
|
|
766
|
+
] })
|
|
767
|
+
] });
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/components/List/List.tsx
|
|
771
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
772
|
+
var STATUS_LABEL = {
|
|
773
|
+
waiting: "Waiting for Payment",
|
|
774
|
+
process: "Order Processing",
|
|
775
|
+
processCod: "Order Processing",
|
|
776
|
+
shipped: "Order Shipped",
|
|
777
|
+
received: "Order Received",
|
|
778
|
+
cancelled: "Order Cancelled"
|
|
779
|
+
};
|
|
780
|
+
var STATUS_ACTION = {
|
|
781
|
+
shipped: "Track Shipment",
|
|
782
|
+
received: "Buy Again",
|
|
783
|
+
cancelled: "Buy Again"
|
|
784
|
+
};
|
|
785
|
+
function OrderListItem({
|
|
786
|
+
productImage,
|
|
787
|
+
productName,
|
|
788
|
+
status,
|
|
789
|
+
itemsSummary,
|
|
790
|
+
total,
|
|
791
|
+
paymentDeadline,
|
|
792
|
+
actionLabel,
|
|
793
|
+
onAction,
|
|
794
|
+
onClick,
|
|
795
|
+
className
|
|
796
|
+
}) {
|
|
797
|
+
const action = actionLabel ?? STATUS_ACTION[status];
|
|
798
|
+
const isCod = status === "processCod";
|
|
799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
className: cx("snacky-order-item", className),
|
|
803
|
+
role: onClick ? "button" : void 0,
|
|
804
|
+
tabIndex: onClick ? 0 : void 0,
|
|
805
|
+
onClick,
|
|
806
|
+
onKeyDown: onClick ? (e) => (e.key === "Enter" || e.key === " ") && onClick() : void 0,
|
|
807
|
+
children: [
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "snacky-order-item__top", children: [
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "snacky-order-item__thumb-box", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { className: "snacky-order-item__thumb", src: productImage, alt: "" }) }),
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "snacky-order-item__info", children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
812
|
+
"span",
|
|
813
|
+
{
|
|
814
|
+
className: cx("snacky-order-item__status", status === "cancelled" && "snacky-order-item__status--cancelled"),
|
|
815
|
+
children: STATUS_LABEL[status]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "snacky-order-item__name", children: productName })
|
|
819
|
+
] })
|
|
820
|
+
] }),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "snacky-order-item__details", children: [
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "snacky-order-item__count", children: itemsSummary }),
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: cx("snacky-order-item__total", isCod && "snacky-order-item__total--cod"), children: [
|
|
824
|
+
"Order Total: ",
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("b", { children: total })
|
|
826
|
+
] }),
|
|
827
|
+
isCod && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "snacky-order-item__cod", children: "COD" })
|
|
828
|
+
] }),
|
|
829
|
+
status === "waiting" && paymentDeadline && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "snacky-order-item__deadline", children: [
|
|
830
|
+
"Pay before ",
|
|
831
|
+
paymentDeadline
|
|
832
|
+
] }),
|
|
833
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "snacky-order-item__action-row", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
834
|
+
Button,
|
|
835
|
+
{
|
|
836
|
+
variant: "primary",
|
|
837
|
+
onClick: (e) => {
|
|
838
|
+
e.stopPropagation();
|
|
839
|
+
onAction?.();
|
|
840
|
+
},
|
|
841
|
+
children: action
|
|
842
|
+
}
|
|
843
|
+
) })
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
function NotificationListItem({ title, message, unread = false, onClick, className }) {
|
|
849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
850
|
+
"div",
|
|
851
|
+
{
|
|
852
|
+
className: cx("snacky-notif-item", unread && "snacky-notif-item--unread", className),
|
|
853
|
+
role: onClick ? "button" : void 0,
|
|
854
|
+
tabIndex: onClick ? 0 : void 0,
|
|
855
|
+
onClick,
|
|
856
|
+
onKeyDown: onClick ? (e) => (e.key === "Enter" || e.key === " ") && onClick() : void 0,
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "snacky-notif-item__title", children: title }),
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "snacky-notif-item__message", children: message })
|
|
860
|
+
]
|
|
861
|
+
}
|
|
862
|
+
);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// src/components/Accordion/Accordion.tsx
|
|
866
|
+
var import_react10 = require("react");
|
|
867
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
868
|
+
function Accordion({ title, leadingIcon, children, defaultOpen = false, className }) {
|
|
869
|
+
const [open, setOpen] = (0, import_react10.useState)(defaultOpen);
|
|
870
|
+
const panelId = (0, import_react10.useId)();
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cx("snacky-accordion", !leadingIcon && "snacky-accordion--bordered", !!leadingIcon && "snacky-accordion--icon", className), children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
873
|
+
"button",
|
|
874
|
+
{
|
|
875
|
+
type: "button",
|
|
876
|
+
className: "snacky-accordion__header",
|
|
877
|
+
"aria-expanded": open,
|
|
878
|
+
"aria-controls": panelId,
|
|
879
|
+
onClick: () => setOpen((v) => !v),
|
|
880
|
+
children: [
|
|
881
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "snacky-accordion__icon", children: leadingIcon }),
|
|
882
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "snacky-accordion__title", children: title }),
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
884
|
+
"svg",
|
|
885
|
+
{
|
|
886
|
+
className: cx("snacky-accordion__chevron", open && "snacky-accordion__chevron--open"),
|
|
887
|
+
viewBox: "0 0 20 20",
|
|
888
|
+
fill: "none",
|
|
889
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M5 7.5L10 12.5L15 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
]
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { id: panelId, className: "snacky-accordion__panel", children })
|
|
896
|
+
] });
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// src/components/Modal/BottomSheet.tsx
|
|
900
|
+
var import_react11 = require("react");
|
|
901
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
902
|
+
function BottomSheet({ open, onDismiss, children, hideHandle = false, className }) {
|
|
903
|
+
(0, import_react11.useEffect)(() => {
|
|
904
|
+
if (!open) return;
|
|
905
|
+
function onKeyDown(e) {
|
|
906
|
+
if (e.key === "Escape") onDismiss();
|
|
907
|
+
}
|
|
908
|
+
window.addEventListener("keydown", onKeyDown);
|
|
909
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
910
|
+
}, [open, onDismiss]);
|
|
911
|
+
if (!open) return null;
|
|
912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "snacky-sheet-overlay", onClick: onDismiss, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
913
|
+
"div",
|
|
914
|
+
{
|
|
915
|
+
className: cx("snacky-sheet", className),
|
|
916
|
+
role: "dialog",
|
|
917
|
+
"aria-modal": "true",
|
|
918
|
+
onClick: (e) => e.stopPropagation(),
|
|
919
|
+
children: [
|
|
920
|
+
!hideHandle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "snacky-sheet__handle" }),
|
|
921
|
+
children
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
) });
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/components/Section/Section.tsx
|
|
928
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
929
|
+
function Section({ title, onAction, children, className }) {
|
|
930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("section", { className: cx("snacky-section", className), children: [
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "snacky-section__header", children: [
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "snacky-section__title", children: title }),
|
|
933
|
+
onAction && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: "snacky-section__action", onClick: onAction, "aria-label": `See more: ${title}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", width: "16", height: "16", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M6 3.5L10.5 8L6 12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
934
|
+
] }),
|
|
935
|
+
children
|
|
936
|
+
] });
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// src/components/Avatar/Avatar.tsx
|
|
940
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
941
|
+
function Avatar({ src, alt, size = "md", className }) {
|
|
942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src, alt, className: cx("snacky-avatar", `snacky-avatar--${size}`, className) });
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// src/components/Illustration/Illustration.tsx
|
|
946
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
947
|
+
var SIZE = {
|
|
948
|
+
empty: { width: 268, height: 200 },
|
|
949
|
+
createAccount: { width: 360, height: 240 },
|
|
950
|
+
welcome: { width: 200, height: 200 },
|
|
951
|
+
success: { width: 200, height: 200 },
|
|
952
|
+
discountReferral: { width: 268, height: 200 }
|
|
953
|
+
};
|
|
954
|
+
function Illustration({ variant, src, alt, className }) {
|
|
955
|
+
const { width, height } = SIZE[variant];
|
|
956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src, alt, width, height, className: cx("snacky-illustration", className) });
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// src/components/ProductImage/ProductImage.tsx
|
|
960
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
961
|
+
function ProductImage({ src, alt, usage, sold = false, className }) {
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: cx("snacky-product-image-wrap", `snacky-product-image-wrap--${usage}`, className), children: [
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { src, alt, className: cx("snacky-product-image", `snacky-product-image--${usage}`) }),
|
|
964
|
+
sold && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "snacky-product-image-sold-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "snacky-product-image-sold-label", children: "Sold Out" }) })
|
|
965
|
+
] });
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// src/components/ProductCard/ProductCard.tsx
|
|
969
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
970
|
+
function ProductCard(props) {
|
|
971
|
+
if (props.variant === "details") {
|
|
972
|
+
const { productName: productName2, imageUrl: imageUrl2, price: price2, rating: rating2, originalPrice: originalPrice2, discountLabel: discountLabel2, ratingCount, favorited, onFavoriteClick, onShareClick, onChatClick, sold, ratingIcon: ratingIcon2, favoriteIcon, shareIcon, chatIcon, onClick: onClick2, className: className2 } = props;
|
|
973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cx("snacky-product-card", "snacky-product-card--details", className2), children: [
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__image-wrap", onClick: onClick2, children: [
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { className: "snacky-product-card__image", src: imageUrl2, alt: productName2 }),
|
|
976
|
+
sold && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__discount", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SoldOutBadge, {}) })
|
|
977
|
+
] }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "snacky-product-card__name", children: productName2 }),
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__price-row", children: [
|
|
980
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__price", children: price2 }),
|
|
981
|
+
originalPrice2 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__original-price", children: originalPrice2 }),
|
|
982
|
+
discountLabel2 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DiscountTag, { label: discountLabel2 })
|
|
983
|
+
] }),
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__footer-row", children: [
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "snacky-product-card__rating", children: [
|
|
986
|
+
ratingIcon2 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__rating-icon", children: ratingIcon2 }),
|
|
987
|
+
rating2,
|
|
988
|
+
" (",
|
|
989
|
+
ratingCount,
|
|
990
|
+
")"
|
|
991
|
+
] }),
|
|
992
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__actions snacky-product-card__actions--details", children: [
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: favoriteIcon ?? "\u2665", selected: favorited, onClick: onFavoriteClick, ariaLabel: "Favorite" }),
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: shareIcon ?? "\u2934", onClick: onShareClick, ariaLabel: "Share" }),
|
|
995
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "secondary", icon: chatIcon ?? "\u{1F4AC}", onClick: onChatClick, ariaLabel: "Chat with seller" })
|
|
996
|
+
] })
|
|
997
|
+
] })
|
|
998
|
+
] });
|
|
999
|
+
}
|
|
1000
|
+
const { productName, imageUrl, price, rating, originalPrice, discountLabel, onAddToCart, cartIcon, ratingIcon, onClick, className } = props;
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1002
|
+
"div",
|
|
1003
|
+
{
|
|
1004
|
+
className: cx("snacky-product-card", "snacky-product-card--list", className),
|
|
1005
|
+
role: "button",
|
|
1006
|
+
tabIndex: 0,
|
|
1007
|
+
onClick,
|
|
1008
|
+
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onClick?.(),
|
|
1009
|
+
children: [
|
|
1010
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__image-wrap", children: [
|
|
1011
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { className: "snacky-product-card__image", src: imageUrl, alt: productName }),
|
|
1012
|
+
discountLabel && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__discount", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DiscountTag, { label: discountLabel }) })
|
|
1013
|
+
] }),
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "snacky-product-card__name", children: productName }),
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__price-row", children: [
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__price", children: price }),
|
|
1017
|
+
originalPrice && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__original-price", children: originalPrice })
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "snacky-product-card__footer-row", children: [
|
|
1020
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "snacky-product-card__rating", children: [
|
|
1021
|
+
ratingIcon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "snacky-product-card__rating-icon", children: ratingIcon }),
|
|
1022
|
+
rating
|
|
1023
|
+
] }),
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1025
|
+
IconButton,
|
|
1026
|
+
{
|
|
1027
|
+
variant: "primary",
|
|
1028
|
+
icon: cartIcon ?? "+",
|
|
1029
|
+
onClick: (e) => {
|
|
1030
|
+
e.stopPropagation();
|
|
1031
|
+
onAddToCart();
|
|
1032
|
+
},
|
|
1033
|
+
ariaLabel: "Add to cart"
|
|
1034
|
+
}
|
|
1035
|
+
)
|
|
1036
|
+
] })
|
|
1037
|
+
]
|
|
1038
|
+
}
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1042
|
+
0 && (module.exports = {
|
|
1043
|
+
Accordion,
|
|
1044
|
+
AddressResult,
|
|
1045
|
+
AlertBanner,
|
|
1046
|
+
Avatar,
|
|
1047
|
+
BottomSheet,
|
|
1048
|
+
Button,
|
|
1049
|
+
Callout,
|
|
1050
|
+
ChatInput,
|
|
1051
|
+
Checkbox,
|
|
1052
|
+
CopyField,
|
|
1053
|
+
DiscountTag,
|
|
1054
|
+
FilterChip,
|
|
1055
|
+
FullWidthBanner,
|
|
1056
|
+
Header,
|
|
1057
|
+
HeroBanner,
|
|
1058
|
+
IconButton,
|
|
1059
|
+
Illustration,
|
|
1060
|
+
NavBar,
|
|
1061
|
+
NotificationBadge,
|
|
1062
|
+
NotificationListItem,
|
|
1063
|
+
OrderListItem,
|
|
1064
|
+
OtpField,
|
|
1065
|
+
PointBalanceBanner,
|
|
1066
|
+
ProductCard,
|
|
1067
|
+
ProductChip,
|
|
1068
|
+
ProductImage,
|
|
1069
|
+
RadioOption,
|
|
1070
|
+
SearchField,
|
|
1071
|
+
Section,
|
|
1072
|
+
SnackyIcons,
|
|
1073
|
+
SoldOutBadge,
|
|
1074
|
+
SquareBanner,
|
|
1075
|
+
TabRow,
|
|
1076
|
+
TextField,
|
|
1077
|
+
Toggle,
|
|
1078
|
+
UploadButton,
|
|
1079
|
+
VariantBadge,
|
|
1080
|
+
typography
|
|
1081
|
+
});
|
|
1082
|
+
//# sourceMappingURL=index.cjs.map
|