asta-ui 0.4.0 → 0.5.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/dist/base/checkbox-aui-052.d.ts +2 -0
- package/dist/base/checkbox-aui-052.js +9 -0
- package/dist/base/checkbox-aui-053.d.ts +2 -0
- package/dist/base/checkbox-aui-053.js +9 -0
- package/dist/base/checkbox-aui-054.d.ts +2 -0
- package/dist/base/checkbox-aui-054.js +9 -0
- package/dist/base/combobox-aui-046.d.ts +2 -0
- package/dist/base/combobox-aui-046.js +9 -0
- package/dist/base/combobox-aui-047.d.ts +2 -0
- package/dist/base/combobox-aui-047.js +9 -0
- package/dist/base/date-picker-aui-050.d.ts +2 -0
- package/dist/base/date-picker-aui-050.js +9 -0
- package/dist/base/date-picker-aui-051.d.ts +2 -0
- package/dist/base/date-picker-aui-051.js +9 -0
- package/dist/base/input-aui-029.d.ts +2 -0
- package/dist/base/input-aui-029.js +9 -0
- package/dist/base/input-aui-030.d.ts +2 -0
- package/dist/base/input-aui-030.js +9 -0
- package/dist/base/input-aui-031.d.ts +2 -0
- package/dist/base/input-aui-031.js +9 -0
- package/dist/base/input-aui-032.d.ts +2 -0
- package/dist/base/input-aui-032.js +11 -0
- package/dist/base/input-aui-033.d.ts +2 -0
- package/dist/base/input-aui-033.js +11 -0
- package/dist/base/input-aui-034.d.ts +2 -0
- package/dist/base/input-aui-034.js +9 -0
- package/dist/base/otp-input-aui-041.d.ts +2 -0
- package/dist/base/otp-input-aui-041.js +9 -0
- package/dist/base/otp-input-aui-042.d.ts +2 -0
- package/dist/base/otp-input-aui-042.js +9 -0
- package/dist/base/password-input-aui-039.d.ts +2 -0
- package/dist/base/password-input-aui-039.js +9 -0
- package/dist/base/password-input-aui-040.d.ts +2 -0
- package/dist/base/password-input-aui-040.js +11 -0
- package/dist/base/radio-group-aui-055.d.ts +2 -0
- package/dist/base/radio-group-aui-055.js +9 -0
- package/dist/base/radio-group-aui-056.d.ts +2 -0
- package/dist/base/radio-group-aui-056.js +9 -0
- package/dist/base/radio-group-aui-057.d.ts +2 -0
- package/dist/base/radio-group-aui-057.js +9 -0
- package/dist/base/select-aui-043.d.ts +2 -0
- package/dist/base/select-aui-043.js +9 -0
- package/dist/base/select-aui-044.d.ts +2 -0
- package/dist/base/select-aui-044.js +9 -0
- package/dist/base/select-aui-045.d.ts +2 -0
- package/dist/base/select-aui-045.js +9 -0
- package/dist/base/slider-aui-061.d.ts +2 -0
- package/dist/base/slider-aui-061.js +9 -0
- package/dist/base/slider-aui-062.d.ts +2 -0
- package/dist/base/slider-aui-062.js +9 -0
- package/dist/base/slider-aui-063.d.ts +2 -0
- package/dist/base/slider-aui-063.js +9 -0
- package/dist/base/switch-aui-058.d.ts +2 -0
- package/dist/base/switch-aui-058.js +9 -0
- package/dist/base/switch-aui-059.d.ts +2 -0
- package/dist/base/switch-aui-059.js +9 -0
- package/dist/base/switch-aui-060.d.ts +2 -0
- package/dist/base/switch-aui-060.js +9 -0
- package/dist/base/tag-input-aui-048.d.ts +2 -0
- package/dist/base/tag-input-aui-048.js +9 -0
- package/dist/base/tag-input-aui-049.d.ts +2 -0
- package/dist/base/tag-input-aui-049.js +9 -0
- package/dist/base/textarea-aui-035.d.ts +2 -0
- package/dist/base/textarea-aui-035.js +9 -0
- package/dist/base/textarea-aui-036.d.ts +2 -0
- package/dist/base/textarea-aui-036.js +9 -0
- package/dist/base/textarea-aui-037.d.ts +2 -0
- package/dist/base/textarea-aui-037.js +9 -0
- package/dist/base/textarea-aui-038.d.ts +2 -0
- package/dist/base/textarea-aui-038.js +11 -0
- package/dist/base.js +239 -21
- package/dist/checkbox-aui-052.d.ts +2 -0
- package/dist/checkbox-aui-052.js +9 -0
- package/dist/checkbox-aui-053.d.ts +2 -0
- package/dist/checkbox-aui-053.js +9 -0
- package/dist/checkbox-aui-054.d.ts +2 -0
- package/dist/checkbox-aui-054.js +9 -0
- package/dist/chunk-2LSUWI2Z.js +180 -0
- package/dist/chunk-3XMVXIOF.js +267 -0
- package/dist/chunk-4YNUJFTL.js +165 -0
- package/dist/chunk-5OHHGQV6.js +175 -0
- package/dist/chunk-5TMFFW3Y.js +149 -0
- package/dist/chunk-ANZANDQM.js +107 -0
- package/dist/chunk-BIYNJDPD.js +158 -0
- package/dist/chunk-BV5HEXB5.js +339 -0
- package/dist/chunk-CDQNLDO6.js +156 -0
- package/dist/chunk-CZCZB5YP.js +142 -0
- package/dist/chunk-D6LGKFZH.js +140 -0
- package/dist/chunk-EKPTPTKK.js +93 -0
- package/dist/chunk-EVCUN45S.js +167 -0
- package/dist/chunk-FGQPCDXI.js +136 -0
- package/dist/chunk-GERWW3CA.js +311 -0
- package/dist/chunk-GJ3R6IZL.js +232 -0
- package/dist/chunk-HVFB44HO.js +219 -0
- package/dist/chunk-I2WXKWTQ.js +151 -0
- package/dist/chunk-J6GK2V2C.js +252 -0
- package/dist/chunk-JVTDNOHQ.js +173 -0
- package/dist/chunk-K5PWBSVO.js +200 -0
- package/dist/chunk-KQCXQY5K.js +155 -0
- package/dist/chunk-KXWC2UHE.js +308 -0
- package/dist/chunk-NICNFGHT.js +138 -0
- package/dist/chunk-P3USWDWR.js +331 -0
- package/dist/chunk-QYI7LQBQ.js +208 -0
- package/dist/chunk-U6N7CZYN.js +305 -0
- package/dist/chunk-UMDVPRJW.js +117 -0
- package/dist/chunk-VPZP6TCT.js +155 -0
- package/dist/chunk-VVAL2JZJ.js +332 -0
- package/dist/chunk-VWYHP4SB.js +154 -0
- package/dist/chunk-W7RITVDV.js +182 -0
- package/dist/chunk-WSTQ6WZO.js +193 -0
- package/dist/chunk-Z5GNX2S3.js +171 -0
- package/dist/chunk-ZBF2UYXP.js +225 -0
- package/dist/combobox-aui-046.d.ts +2 -0
- package/dist/combobox-aui-046.js +9 -0
- package/dist/combobox-aui-047.d.ts +2 -0
- package/dist/combobox-aui-047.js +9 -0
- package/dist/date-picker-aui-050.d.ts +2 -0
- package/dist/date-picker-aui-050.js +9 -0
- package/dist/date-picker-aui-051.d.ts +2 -0
- package/dist/date-picker-aui-051.js +9 -0
- package/dist/index.js +239 -21
- package/dist/input-aui-029.d.ts +2 -0
- package/dist/input-aui-029.js +9 -0
- package/dist/input-aui-030.d.ts +2 -0
- package/dist/input-aui-030.js +9 -0
- package/dist/input-aui-031.d.ts +2 -0
- package/dist/input-aui-031.js +9 -0
- package/dist/input-aui-032.d.ts +2 -0
- package/dist/input-aui-032.js +11 -0
- package/dist/input-aui-033.d.ts +2 -0
- package/dist/input-aui-033.js +11 -0
- package/dist/input-aui-034.d.ts +2 -0
- package/dist/input-aui-034.js +9 -0
- package/dist/otp-input-aui-041.d.ts +2 -0
- package/dist/otp-input-aui-041.js +9 -0
- package/dist/otp-input-aui-042.d.ts +2 -0
- package/dist/otp-input-aui-042.js +9 -0
- package/dist/password-input-aui-039.d.ts +2 -0
- package/dist/password-input-aui-039.js +9 -0
- package/dist/password-input-aui-040.d.ts +2 -0
- package/dist/password-input-aui-040.js +11 -0
- package/dist/radio-group-aui-055.d.ts +2 -0
- package/dist/radio-group-aui-055.js +9 -0
- package/dist/radio-group-aui-056.d.ts +2 -0
- package/dist/radio-group-aui-056.js +9 -0
- package/dist/radio-group-aui-057.d.ts +2 -0
- package/dist/radio-group-aui-057.js +9 -0
- package/dist/select-aui-043.d.ts +2 -0
- package/dist/select-aui-043.js +9 -0
- package/dist/select-aui-044.d.ts +2 -0
- package/dist/select-aui-044.js +9 -0
- package/dist/select-aui-045.d.ts +2 -0
- package/dist/select-aui-045.js +9 -0
- package/dist/slider-aui-061.d.ts +2 -0
- package/dist/slider-aui-061.js +9 -0
- package/dist/slider-aui-062.d.ts +2 -0
- package/dist/slider-aui-062.js +9 -0
- package/dist/slider-aui-063.d.ts +2 -0
- package/dist/slider-aui-063.js +9 -0
- package/dist/switch-aui-058.d.ts +2 -0
- package/dist/switch-aui-058.js +9 -0
- package/dist/switch-aui-059.d.ts +2 -0
- package/dist/switch-aui-059.js +9 -0
- package/dist/switch-aui-060.d.ts +2 -0
- package/dist/switch-aui-060.js +9 -0
- package/dist/tag-input-aui-048.d.ts +2 -0
- package/dist/tag-input-aui-048.js +9 -0
- package/dist/tag-input-aui-049.d.ts +2 -0
- package/dist/tag-input-aui-049.js +9 -0
- package/dist/textarea-aui-035.d.ts +2 -0
- package/dist/textarea-aui-035.js +9 -0
- package/dist/textarea-aui-036.d.ts +2 -0
- package/dist/textarea-aui-036.js +9 -0
- package/dist/textarea-aui-037.d.ts +2 -0
- package/dist/textarea-aui-037.js +9 -0
- package/dist/textarea-aui-038.d.ts +2 -0
- package/dist/textarea-aui-038.js +11 -0
- package/dist/types/components/kit/variants/checkbox-aui-052.d.ts +29 -0
- package/dist/types/components/kit/variants/checkbox-aui-053.d.ts +24 -0
- package/dist/types/components/kit/variants/checkbox-aui-054.d.ts +33 -0
- package/dist/types/components/kit/variants/combobox-aui-046.d.ts +23 -0
- package/dist/types/components/kit/variants/combobox-aui-047.d.ts +24 -0
- package/dist/types/components/kit/variants/date-picker-aui-050.d.ts +26 -0
- package/dist/types/components/kit/variants/date-picker-aui-051.d.ts +23 -0
- package/dist/types/components/kit/variants/input-aui-029.d.ts +21 -0
- package/dist/types/components/kit/variants/input-aui-030.d.ts +29 -0
- package/dist/types/components/kit/variants/input-aui-031.d.ts +24 -0
- package/dist/types/components/kit/variants/input-aui-032.d.ts +36 -0
- package/dist/types/components/kit/variants/input-aui-033.d.ts +23 -0
- package/dist/types/components/kit/variants/input-aui-034.d.ts +29 -0
- package/dist/types/components/kit/variants/otp-input-aui-041.d.ts +20 -0
- package/dist/types/components/kit/variants/otp-input-aui-042.d.ts +23 -0
- package/dist/types/components/kit/variants/password-input-aui-039.d.ts +16 -0
- package/dist/types/components/kit/variants/password-input-aui-040.d.ts +24 -0
- package/dist/types/components/kit/variants/radio-group-aui-055.d.ts +27 -0
- package/dist/types/components/kit/variants/radio-group-aui-056.d.ts +28 -0
- package/dist/types/components/kit/variants/radio-group-aui-057.d.ts +26 -0
- package/dist/types/components/kit/variants/select-aui-043.d.ts +29 -0
- package/dist/types/components/kit/variants/select-aui-044.d.ts +24 -0
- package/dist/types/components/kit/variants/select-aui-045.d.ts +29 -0
- package/dist/types/components/kit/variants/slider-aui-061.d.ts +20 -0
- package/dist/types/components/kit/variants/slider-aui-062.d.ts +24 -0
- package/dist/types/components/kit/variants/slider-aui-063.d.ts +17 -0
- package/dist/types/components/kit/variants/switch-aui-058.d.ts +24 -0
- package/dist/types/components/kit/variants/switch-aui-059.d.ts +20 -0
- package/dist/types/components/kit/variants/switch-aui-060.d.ts +15 -0
- package/dist/types/components/kit/variants/tag-input-aui-048.d.ts +16 -0
- package/dist/types/components/kit/variants/tag-input-aui-049.d.ts +15 -0
- package/dist/types/components/kit/variants/textarea-aui-035.d.ts +19 -0
- package/dist/types/components/kit/variants/textarea-aui-036.d.ts +23 -0
- package/dist/types/components/kit/variants/textarea-aui-037.d.ts +30 -0
- package/dist/types/components/kit/variants/textarea-aui-038.d.ts +28 -0
- package/dist/types/packages/asta-ui/src/base/checkbox-aui-052.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/checkbox-aui-053.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/checkbox-aui-054.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/combobox-aui-046.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/combobox-aui-047.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/date-picker-aui-050.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/date-picker-aui-051.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-029.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-030.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-031.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-032.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-033.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/input-aui-034.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/otp-input-aui-041.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/otp-input-aui-042.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/password-input-aui-039.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/password-input-aui-040.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/radio-group-aui-055.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/radio-group-aui-056.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/radio-group-aui-057.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/select-aui-043.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/select-aui-044.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/select-aui-045.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/slider-aui-061.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/slider-aui-062.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/slider-aui-063.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/switch-aui-058.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/switch-aui-059.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/switch-aui-060.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tag-input-aui-048.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tag-input-aui-049.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-035.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-036.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-037.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/textarea-aui-038.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +70 -0
- package/dist/types/packages/asta-ui/src/checkbox-aui-052.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/checkbox-aui-053.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/checkbox-aui-054.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/combobox-aui-046.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/combobox-aui-047.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/date-picker-aui-050.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/date-picker-aui-051.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +70 -0
- package/dist/types/packages/asta-ui/src/input-aui-029.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input-aui-030.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input-aui-031.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input-aui-032.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input-aui-033.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/input-aui-034.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/otp-input-aui-041.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/otp-input-aui-042.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/password-input-aui-039.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/password-input-aui-040.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/radio-group-aui-055.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/radio-group-aui-056.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/radio-group-aui-057.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/select-aui-043.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/select-aui-044.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/select-aui-045.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/slider-aui-061.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/slider-aui-062.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/slider-aui-063.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/switch-aui-058.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/switch-aui-059.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/switch-aui-060.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tag-input-aui-048.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tag-input-aui-049.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-035.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-036.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-037.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/textarea-aui-038.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/checkbox-aui-052.tsx
|
|
4
|
+
import { useId, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
8
|
+
var SPRING = "cubic-bezier(.34,1.56,.64,1)";
|
|
9
|
+
var CSS = `
|
|
10
|
+
@keyframes aui052-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
|
|
11
|
+
@media (prefers-reduced-motion: reduce) { .aui052 * { animation: none !important; transition: none !important } }
|
|
12
|
+
`;
|
|
13
|
+
var rise = (i) => ({ animation: `aui052-rise .6s ${EASE} ${80 + i * 50}ms both` });
|
|
14
|
+
var Icon = ({ d }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-4 w-4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
|
|
15
|
+
var ITEMS = [
|
|
16
|
+
{ value: "notes", title: "AI notes", description: "Summaries after every call", price: 8, icon: /* @__PURE__ */ jsx(Icon, { d: "M8 2.5l1.4 3.1 3.1 1.4-3.1 1.4L8 11.5 6.6 8.4 3.5 7l3.1-1.4L8 2.5zM12.5 11l.6 1.4 1.4.6-1.4.6-.6 1.4-.6-1.4-1.4-.6 1.4-.6.6-1.4z" }) },
|
|
17
|
+
{ value: "guests", title: "Guest seats", description: "Invite clients for free", price: 5, icon: /* @__PURE__ */ jsx(Icon, { d: "M6 7.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zM1.5 13.5c.6-2.3 2.3-3.5 4.5-3.5s3.9 1.2 4.5 3.5M11 4h3.5M12.75 2.25v3.5" }) },
|
|
18
|
+
{ value: "audit", title: "Audit log", description: "Every change, kept a year", price: 12, icon: /* @__PURE__ */ jsx(Icon, { d: "M4 2.5h6l2.5 2.5v8.5H4zM6.5 7.5h4M6.5 10h4M10 2.5V5h2.5" }) },
|
|
19
|
+
{ value: "support", title: "Priority support", description: "Answers within the hour", price: 9, icon: /* @__PURE__ */ jsx(Icon, { d: "M2.5 9V8a5.5 5.5 0 0111 0v1M2.5 9h2v3.5h-2zM11.5 9h2v3.5h-2zM13.5 12.5c0 1-1 1.5-2.5 1.5H9" }) }
|
|
20
|
+
];
|
|
21
|
+
function Roll({ text }) {
|
|
22
|
+
const chars = text.split("");
|
|
23
|
+
return /* @__PURE__ */ jsxs("span", { className: "relative inline-flex tabular-nums", children: [
|
|
24
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: text }),
|
|
25
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "inline-flex", children: chars.map(
|
|
26
|
+
(ch, i) => /\d/.test(ch) ? /* @__PURE__ */ jsx("span", { className: "relative inline-block h-[1em] w-[0.6em] overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: "absolute inset-x-0 top-0 flex flex-col transition-transform duration-700",
|
|
30
|
+
style: { transform: `translateY(${-Number(ch) * 10}%)`, transitionTimingFunction: EASE, transitionDelay: `${(chars.length - 1 - i) * 50}ms` },
|
|
31
|
+
children: Array.from({ length: 10 }, (_, n) => /* @__PURE__ */ jsx("span", { className: "block h-[1em] text-center leading-[1em]", children: n }, n))
|
|
32
|
+
}
|
|
33
|
+
) }, chars.length - i) : /* @__PURE__ */ jsx("span", { className: "leading-[1em]", children: ch }, `c${chars.length - i}`)
|
|
34
|
+
) })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
function CheckboxCard({
|
|
38
|
+
items = ITEMS,
|
|
39
|
+
value,
|
|
40
|
+
defaultValue = ["notes", "audit"],
|
|
41
|
+
onChange,
|
|
42
|
+
eyebrow = "Astabyte \xB7 Add-ons",
|
|
43
|
+
title = "Shape your workspace",
|
|
44
|
+
base = 12,
|
|
45
|
+
currency = "$",
|
|
46
|
+
name,
|
|
47
|
+
className
|
|
48
|
+
}) {
|
|
49
|
+
const uid = useId();
|
|
50
|
+
const [inner, setInner] = useState(defaultValue);
|
|
51
|
+
const picked = value ?? inner;
|
|
52
|
+
const total = base + items.filter((it) => picked.includes(it.value)).reduce((s, it) => s + it.price, 0);
|
|
53
|
+
const toggle = (v) => {
|
|
54
|
+
const next = picked.includes(v) ? picked.filter((x) => x !== v) : [...picked, v];
|
|
55
|
+
if (value === void 0) setInner(next);
|
|
56
|
+
onChange?.(next);
|
|
57
|
+
};
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
"fieldset",
|
|
60
|
+
{
|
|
61
|
+
className: cx(
|
|
62
|
+
"aui052 w-full max-w-[460px] rounded-[14px] bg-paper p-5 sm:p-6",
|
|
63
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_1px_2px_rgb(0_0_0/0.04),0_18px_40px_-20px_rgb(0_0_0/0.25)]",
|
|
64
|
+
className
|
|
65
|
+
),
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx("style", { href: "asta-aui052", precedence: "asta", children: CSS }),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-end justify-between gap-4", style: rise(0), children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
70
|
+
/* @__PURE__ */ jsx("p", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-mute", children: eyebrow }),
|
|
71
|
+
/* @__PURE__ */ jsx("legend", { className: "mt-1.5 block text-[20px] font-medium leading-tight tracking-[-0.02em] text-ink", children: title })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs("p", { className: "shrink-0 text-right", children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-start justify-end text-[30px] font-medium leading-none tracking-[-0.04em] text-ink", children: [
|
|
75
|
+
/* @__PURE__ */ jsx("span", { className: "mr-0.5 mt-[3px] text-[14px] tracking-normal text-mute", children: currency }),
|
|
76
|
+
/* @__PURE__ */ jsx(Roll, { text: String(total) })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1.5 block text-[11.5px] text-mute", children: "per seat / month" })
|
|
79
|
+
] })
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsx("div", { className: "mt-5 grid grid-cols-2 gap-2 sm:gap-2.5", children: items.map((it, i) => {
|
|
82
|
+
const on = picked.includes(it.value);
|
|
83
|
+
const id = `${uid}-${it.value}`;
|
|
84
|
+
return /* @__PURE__ */ jsxs(
|
|
85
|
+
"label",
|
|
86
|
+
{
|
|
87
|
+
htmlFor: id,
|
|
88
|
+
style: rise(i + 1),
|
|
89
|
+
className: cx(
|
|
90
|
+
"group/cc relative flex select-none flex-col rounded-[11px] bg-paper p-3 sm:p-3.5 transition-transform duration-300 active:scale-[0.98]",
|
|
91
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)]",
|
|
92
|
+
"has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-brand",
|
|
93
|
+
it.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
|
|
94
|
+
),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
id,
|
|
100
|
+
type: "checkbox",
|
|
101
|
+
name,
|
|
102
|
+
value: it.value,
|
|
103
|
+
checked: on,
|
|
104
|
+
disabled: it.disabled,
|
|
105
|
+
onChange: () => toggle(it.value),
|
|
106
|
+
"aria-describedby": it.description ? `${id}-d` : void 0,
|
|
107
|
+
className: "sr-only"
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 rounded-[11px] bg-paper-2 opacity-0 transition-opacity duration-300 group-hover/cc:opacity-60" }),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
"span",
|
|
113
|
+
{
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
className: "pointer-events-none absolute inset-0 rounded-[11px] bg-[color-mix(in_srgb,var(--brand)_5%,transparent)] shadow-[inset_0_0_0_1.5px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_12%,transparent),0_10px_22px_-16px_color-mix(in_srgb,var(--brand)_55%,transparent)] transition-opacity duration-300",
|
|
116
|
+
style: { opacity: on ? 1 : 0 }
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsxs("span", { className: "relative flex items-start justify-between", children: [
|
|
120
|
+
/* @__PURE__ */ jsxs("span", { className: "relative grid h-8 w-8 place-items-center overflow-hidden rounded-[8px] bg-paper-2 text-ink", children: [
|
|
121
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-0 bg-brand transition-opacity duration-300", style: { opacity: on ? 1 : 0 } }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { className: cx("relative transition-colors duration-300", on && "text-white"), children: it.icon })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ jsx(Check, { on })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ jsxs("span", { className: "relative mt-5", children: [
|
|
127
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-baseline justify-between gap-2", children: [
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "text-[14px] font-medium tracking-[-0.01em] text-ink", children: it.title }),
|
|
129
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-[11.5px] tabular-nums text-mute", children: [
|
|
130
|
+
"+",
|
|
131
|
+
currency,
|
|
132
|
+
it.price
|
|
133
|
+
] })
|
|
134
|
+
] }),
|
|
135
|
+
it.description && /* @__PURE__ */ jsx("span", { id: `${id}-d`, className: "mt-0.5 block text-[12.5px] leading-snug text-mute", children: it.description })
|
|
136
|
+
] })
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
it.value
|
|
140
|
+
);
|
|
141
|
+
}) })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
function Check({ on }) {
|
|
147
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative grid h-5 w-5 place-items-center", children: [
|
|
148
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 rounded-full shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_22%,transparent)] transition-opacity duration-200", style: { opacity: on ? 0 : 1 } }),
|
|
149
|
+
/* @__PURE__ */ jsx(
|
|
150
|
+
"span",
|
|
151
|
+
{
|
|
152
|
+
className: "absolute inset-0 rounded-full bg-brand shadow-[inset_0_1px_0_rgb(255_255_255/0.25),0_2px_6px_-1px_color-mix(in_srgb,var(--brand)_60%,transparent)] transition-[transform,opacity] duration-500",
|
|
153
|
+
style: { transform: on ? "scale(1)" : "scale(0.4)", opacity: on ? 1 : 0, transitionTimingFunction: SPRING }
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "relative h-3 w-3 text-white", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx(
|
|
157
|
+
"path",
|
|
158
|
+
{
|
|
159
|
+
d: "M3.5 8.5l3 3 6-7",
|
|
160
|
+
pathLength: 1,
|
|
161
|
+
strokeDasharray: "1",
|
|
162
|
+
className: "transition-[stroke-dashoffset]",
|
|
163
|
+
style: { strokeDashoffset: on ? 0 : 1, transitionDuration: on ? "420ms" : "120ms", transitionDelay: on ? "120ms" : "0ms", transitionTimingFunction: EASE }
|
|
164
|
+
}
|
|
165
|
+
) })
|
|
166
|
+
] });
|
|
167
|
+
}
|
|
168
|
+
var checkbox_aui_052_default = CheckboxCard;
|
|
169
|
+
|
|
170
|
+
export {
|
|
171
|
+
CheckboxCard,
|
|
172
|
+
checkbox_aui_052_default
|
|
173
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/tag-input-aui-049.tsx
|
|
4
|
+
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
8
|
+
var KEYFRAMES = `
|
|
9
|
+
@keyframes aui049-in { 0% { opacity: 0; transform: scale(.7) } 60% { opacity: 1; transform: scale(1.04) } 100% { transform: none } }
|
|
10
|
+
@keyframes aui049-sug { from { opacity: 0; transform: translateY(6px) } }
|
|
11
|
+
@keyframes aui049-shake { 0%,100% { transform: none } 25% { transform: translateX(-4px) } 50% { transform: translateX(4px) } 75% { transform: translateX(-2px) } }
|
|
12
|
+
@media (prefers-reduced-motion: reduce) { .aui049 *, .aui049 { animation: none !important; transition: none !important } }
|
|
13
|
+
`;
|
|
14
|
+
var SUGGEST = ["design-systems", "motion", "typography", "frontend", "accessibility", "case-study", "process"];
|
|
15
|
+
var norm = (t) => t.trim().toLowerCase().replace(/^#/, "").replace(/\s+/g, "-");
|
|
16
|
+
function SuggestTagInput({
|
|
17
|
+
value,
|
|
18
|
+
defaultValue = ["motion"],
|
|
19
|
+
onChange,
|
|
20
|
+
suggestions = SUGGEST,
|
|
21
|
+
max = 6,
|
|
22
|
+
label = "Tags",
|
|
23
|
+
placeholder = "Add a tag",
|
|
24
|
+
name,
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const [inner, setInner] = useState(defaultValue);
|
|
28
|
+
const tags = value ?? inner;
|
|
29
|
+
const [text, setText] = useState("");
|
|
30
|
+
const [shake, setShake] = useState(null);
|
|
31
|
+
const input = useRef(null);
|
|
32
|
+
const field = useRef(null);
|
|
33
|
+
const fly = useRef(null);
|
|
34
|
+
const id = useId();
|
|
35
|
+
const full = tags.length >= max;
|
|
36
|
+
const t = norm(text);
|
|
37
|
+
const open = suggestions.filter((s) => !tags.includes(s));
|
|
38
|
+
const ghost = t ? open.find((s) => s.startsWith(t) && s !== t) : void 0;
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
const f = fly.current;
|
|
41
|
+
fly.current = null;
|
|
42
|
+
if (!f || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
43
|
+
const el = field.current?.querySelector(`[data-tag="${CSS.escape(f.tag)}"]`);
|
|
44
|
+
if (!el) return;
|
|
45
|
+
const r = el.getBoundingClientRect();
|
|
46
|
+
el.animate(
|
|
47
|
+
[
|
|
48
|
+
{ transform: `translate(${f.x - r.left}px, ${f.y - r.top}px) scale(.94)`, opacity: 0.4 },
|
|
49
|
+
{ transform: "translate(0,0) scale(1.04)", opacity: 1, offset: 0.75 },
|
|
50
|
+
{ transform: "none", opacity: 1 }
|
|
51
|
+
],
|
|
52
|
+
{ duration: 560, easing: EASE }
|
|
53
|
+
);
|
|
54
|
+
}, [tags]);
|
|
55
|
+
const set = (next) => {
|
|
56
|
+
if (value === void 0) setInner(next);
|
|
57
|
+
onChange?.(next);
|
|
58
|
+
};
|
|
59
|
+
const add = (raw, from) => {
|
|
60
|
+
const tag = norm(raw);
|
|
61
|
+
setText("");
|
|
62
|
+
if (!tag) return;
|
|
63
|
+
if (tags.includes(tag)) return setShake((s) => ({ tag, n: (s?.n ?? 0) + 1 }));
|
|
64
|
+
if (full) return;
|
|
65
|
+
if (from) {
|
|
66
|
+
const r = from.getBoundingClientRect();
|
|
67
|
+
fly.current = { tag, x: r.left, y: r.top };
|
|
68
|
+
}
|
|
69
|
+
set([...tags, tag]);
|
|
70
|
+
};
|
|
71
|
+
const remove = (tag) => {
|
|
72
|
+
set(tags.filter((x) => x !== tag));
|
|
73
|
+
input.current?.focus();
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("aui049 w-full", className), children: [
|
|
76
|
+
/* @__PURE__ */ jsx("style", { href: "asta-aui049", precedence: "asta", children: KEYFRAMES }),
|
|
77
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-baseline justify-between", children: [
|
|
78
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "text-[12.5px] font-medium text-ink", children: label }),
|
|
79
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-[11px] tabular-nums text-mute", "aria-live": "polite", children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", { className: cx("transition-colors", full && "text-ink"), children: tags.length }),
|
|
81
|
+
"/",
|
|
82
|
+
max
|
|
83
|
+
] })
|
|
84
|
+
] }),
|
|
85
|
+
/* @__PURE__ */ jsxs(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
ref: field,
|
|
89
|
+
onClick: () => input.current?.focus(),
|
|
90
|
+
className: cx(
|
|
91
|
+
"flex min-h-11 w-full cursor-text flex-wrap items-center gap-1.5 rounded-[10px] bg-paper p-1.5 transition-shadow duration-300",
|
|
92
|
+
"shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_22%,transparent)]",
|
|
93
|
+
"focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]"
|
|
94
|
+
),
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("ul", { className: "contents", "aria-label": label, children: tags.map((tag) => {
|
|
97
|
+
const shaking = shake?.tag === tag;
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"li",
|
|
100
|
+
{
|
|
101
|
+
"data-tag": tag,
|
|
102
|
+
className: "relative flex h-7 items-center gap-0.5 rounded-[7px] bg-ink pl-2.5 pr-0.5 text-[12.5px] font-medium text-paper",
|
|
103
|
+
style: { animation: shaking ? `aui049-shake .4s ${EASE}` : `aui049-in .45s ${EASE} both` },
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", { className: "mr-0.5 opacity-50", "aria-hidden": true, children: "#" }),
|
|
106
|
+
tag,
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: (e) => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
remove(tag);
|
|
114
|
+
},
|
|
115
|
+
"aria-label": `Remove ${tag}`,
|
|
116
|
+
className: "ml-0.5 flex h-6 w-6 items-center justify-center rounded-[5px] opacity-60 outline-none transition-[opacity,background-color] hover:bg-[color-mix(in_srgb,var(--paper)_14%,transparent)] hover:opacity-100 focus-visible:ring-2 focus-visible:ring-brand/60",
|
|
117
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m4.5 4.5 7 7M11.5 4.5l-7 7" }) })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
shaking ? `${tag}-${shake.n}` : tag
|
|
123
|
+
);
|
|
124
|
+
}) }),
|
|
125
|
+
/* @__PURE__ */ jsxs("span", { className: "relative flex h-7 min-w-[7rem] flex-1 items-center", children: [
|
|
126
|
+
ghost && /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-y-0 left-0 flex items-center whitespace-pre px-1.5 text-[13.5px]", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("span", { className: "invisible", children: text }),
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "text-mute", children: ghost.slice(t.length) }),
|
|
129
|
+
/* @__PURE__ */ jsx("kbd", { className: "ml-2 rounded-[4px] bg-paper-2 px-1 font-mono text-[10px] text-mute", children: "tab" })
|
|
130
|
+
] }),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
"input",
|
|
133
|
+
{
|
|
134
|
+
ref: input,
|
|
135
|
+
id,
|
|
136
|
+
value: text,
|
|
137
|
+
disabled: full && !text,
|
|
138
|
+
placeholder: full ? "That's the limit" : tags.length ? "" : placeholder,
|
|
139
|
+
autoComplete: "off",
|
|
140
|
+
spellCheck: false,
|
|
141
|
+
"aria-describedby": `${id}-sug`,
|
|
142
|
+
onChange: (e) => {
|
|
143
|
+
const v = e.target.value;
|
|
144
|
+
if (v.includes(",")) v.split(",").forEach((p) => add(p));
|
|
145
|
+
else setText(v);
|
|
146
|
+
},
|
|
147
|
+
onKeyDown: (e) => {
|
|
148
|
+
if (e.key === "Enter") {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
add(text);
|
|
151
|
+
} else if ((e.key === "Tab" || e.key === "ArrowRight") && ghost && e.currentTarget.selectionStart === text.length) {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
add(ghost);
|
|
154
|
+
} else if (e.key === "Backspace" && !text && tags.length) {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
remove(tags[tags.length - 1]);
|
|
157
|
+
} else if (e.key === "Escape") setText("");
|
|
158
|
+
},
|
|
159
|
+
onBlur: () => text.trim() && add(text),
|
|
160
|
+
className: "relative h-7 w-full bg-transparent px-1.5 text-[13.5px] text-ink outline-none placeholder:text-mute disabled:cursor-not-allowed"
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] })
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: tags.join(",") }),
|
|
168
|
+
/* @__PURE__ */ jsxs("div", { id: `${id}-sug`, className: "mt-3 flex flex-wrap items-center gap-1.5", children: [
|
|
169
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 font-mono text-[10.5px] uppercase tracking-[0.08em] text-mute", children: "Suggested" }),
|
|
170
|
+
open.length === 0 && /* @__PURE__ */ jsx("span", { className: "text-[12px] text-mute", children: "All added" }),
|
|
171
|
+
open.map((s, i) => {
|
|
172
|
+
const hit = !!t && s.startsWith(t);
|
|
173
|
+
return /* @__PURE__ */ jsxs(
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
type: "button",
|
|
177
|
+
disabled: full,
|
|
178
|
+
onClick: (e) => add(s, e.currentTarget),
|
|
179
|
+
className: cx(
|
|
180
|
+
"group flex h-7 items-center gap-1 rounded-[7px] px-2 text-[12.5px] outline-none transition-[background-color,box-shadow,transform,color] duration-200 hover:-translate-y-px active:scale-[.96] focus-visible:ring-2 focus-visible:ring-brand/50 disabled:pointer-events-none disabled:opacity-40",
|
|
181
|
+
hit ? "bg-[color-mix(in_srgb,var(--brand)_10%,transparent)] text-brand shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--brand)_35%,transparent)]" : "text-ink-2 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent)] hover:bg-paper-2 hover:text-ink"
|
|
182
|
+
),
|
|
183
|
+
style: { animation: `aui049-sug .45s ${EASE} ${Math.min(i, 6) * 40}ms both` },
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3 w-3 transition-transform duration-300 group-hover:rotate-90", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M8 3.5v9M3.5 8h9" }) }),
|
|
186
|
+
s
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
s
|
|
190
|
+
);
|
|
191
|
+
})
|
|
192
|
+
] })
|
|
193
|
+
] });
|
|
194
|
+
}
|
|
195
|
+
var tag_input_aui_049_default = SuggestTagInput;
|
|
196
|
+
|
|
197
|
+
export {
|
|
198
|
+
SuggestTagInput,
|
|
199
|
+
tag_input_aui_049_default
|
|
200
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/otp-input-aui-041.tsx
|
|
4
|
+
import { useId, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
8
|
+
var W = 42;
|
|
9
|
+
var H = 50;
|
|
10
|
+
var GAP = 7;
|
|
11
|
+
var MID = 18;
|
|
12
|
+
var CSS = `
|
|
13
|
+
@keyframes aui041-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
|
|
14
|
+
@keyframes aui041-drop { from { opacity: 0; transform: translateY(-8px) scale(.85) } to { opacity: 1; transform: none } }
|
|
15
|
+
@keyframes aui041-caret { 0%, 100% { opacity: 1 } 50% { opacity: 0 } }
|
|
16
|
+
@keyframes aui041-shake { 0%, 100% { transform: none } 20% { transform: translateX(-7px) } 40% { transform: translateX(6px) } 60% { transform: translateX(-4px) } 80% { transform: translateX(2px) } }
|
|
17
|
+
@media (prefers-reduced-motion: reduce) { .aui041 * { animation: none !important; transition: none !important } }
|
|
18
|
+
`;
|
|
19
|
+
var rise = (i) => ({ animation: `aui041-rise .6s ${EASE} ${i * 55}ms both` });
|
|
20
|
+
var x = (i) => i * (W + GAP) + (i >= 3 ? MID : 0);
|
|
21
|
+
function SplitOtp({ value, defaultValue = "", onChange, onComplete, error, pasteButton = true, label = "Verification code", autoFocus, className }) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
const input = useRef(null);
|
|
24
|
+
const [inner, setInner] = useState(defaultValue);
|
|
25
|
+
const code = (value ?? inner).replace(/\D/g, "").slice(0, 6);
|
|
26
|
+
const [focused, setFocused] = useState(false);
|
|
27
|
+
const [shake, setShake] = useState(0);
|
|
28
|
+
const [prevError, setPrevError] = useState(Boolean(error));
|
|
29
|
+
if (Boolean(error) !== prevError) {
|
|
30
|
+
setPrevError(Boolean(error));
|
|
31
|
+
if (error) setShake((s) => s + 1);
|
|
32
|
+
}
|
|
33
|
+
const full = code.length === 6;
|
|
34
|
+
const active = Math.min(code.length, 5);
|
|
35
|
+
const total = x(5) + W;
|
|
36
|
+
const update = (raw) => {
|
|
37
|
+
const next = raw.replace(/\D/g, "").slice(0, 6);
|
|
38
|
+
if (next === code) return;
|
|
39
|
+
if (value === void 0) setInner(next);
|
|
40
|
+
onChange?.(next);
|
|
41
|
+
if (next.length === 6 && code.length < 6) onComplete?.(next);
|
|
42
|
+
};
|
|
43
|
+
const onPaste = (e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
update(e.clipboardData.getData("text"));
|
|
46
|
+
};
|
|
47
|
+
const toEnd = (e) => {
|
|
48
|
+
const el = e.currentTarget;
|
|
49
|
+
const n = el.value.length;
|
|
50
|
+
if (el.selectionStart !== n || el.selectionEnd !== n) el.setSelectionRange(n, n);
|
|
51
|
+
};
|
|
52
|
+
const paste = async () => {
|
|
53
|
+
try {
|
|
54
|
+
update(await navigator.clipboard.readText());
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
input.current?.focus();
|
|
58
|
+
};
|
|
59
|
+
const shift = (i) => full ? i < 3 ? MID / 2 - 1 : -(MID / 2 - 1) : 0;
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: cx("aui041 inline-flex flex-col items-center", className), children: [
|
|
61
|
+
/* @__PURE__ */ jsx("style", { href: "asta-otp-input-aui-041", precedence: "asta", children: CSS }),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", style: { width: total, height: H, ...rise(0) }, children: [
|
|
63
|
+
/* @__PURE__ */ jsxs(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
"aria-hidden": true,
|
|
67
|
+
className: "absolute inset-0",
|
|
68
|
+
style: shake ? { animation: `aui041-shake .42s ${EASE} both` } : void 0,
|
|
69
|
+
children: [
|
|
70
|
+
Array.from({ length: 6 }, (_, i) => {
|
|
71
|
+
const d = code[i];
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: cx(
|
|
76
|
+
"absolute top-0 grid place-items-center rounded-[10px] transition-[transform,background-color,box-shadow] duration-500",
|
|
77
|
+
full ? "bg-[color-mix(in_srgb,var(--brand)_7%,var(--paper))] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--brand)_35%,transparent)]" : d ? "bg-paper shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_22%,transparent)]" : "bg-paper-2",
|
|
78
|
+
error && !focused && "shadow-[inset_0_0_0_1.5px_var(--ink)]"
|
|
79
|
+
),
|
|
80
|
+
style: { width: W, height: H, transform: `translateX(${x(i) + shift(i)}px)`, transitionTimingFunction: EASE, transitionDelay: full ? `${Math.abs(i - 2.5) * 20}ms` : "0ms" },
|
|
81
|
+
children: d && /* @__PURE__ */ jsx("span", { className: cx("text-[22px] font-medium tabular-nums tracking-[-0.02em] transition-colors duration-300", full ? "text-brand" : "text-ink"), style: { animation: `aui041-drop .32s ${EASE} both` }, children: d }, `${i}-${d}`)
|
|
82
|
+
},
|
|
83
|
+
i
|
|
84
|
+
);
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
className: "pointer-events-none absolute top-[24px] h-[2px] w-2 rounded-full bg-mute transition-opacity duration-300",
|
|
90
|
+
style: { left: x(3) - MID / 2 - GAP / 2 - 4, opacity: full ? 0 : 0.6 }
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: "pointer-events-none absolute left-0 top-0 rounded-[10px] shadow-[inset_0_0_0_1.5px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)] transition-[transform,opacity] duration-300",
|
|
97
|
+
style: { width: W, height: H, transform: `translateX(${x(active)}px)`, opacity: full ? 0 : focused ? 1 : code.length ? 0.55 : 0, transitionTimingFunction: EASE },
|
|
98
|
+
children: focused && !code[active] && /* @__PURE__ */ jsx("span", { className: "absolute left-1/2 top-1/2 h-5 w-[1.5px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-brand", style: { animation: "aui041-caret 1.05s steps(1) infinite" } })
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
shake
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
"input",
|
|
107
|
+
{
|
|
108
|
+
ref: input,
|
|
109
|
+
id,
|
|
110
|
+
"aria-label": label,
|
|
111
|
+
value: code,
|
|
112
|
+
inputMode: "numeric",
|
|
113
|
+
autoComplete: "one-time-code",
|
|
114
|
+
pattern: "\\d{6}",
|
|
115
|
+
maxLength: 6,
|
|
116
|
+
autoFocus,
|
|
117
|
+
"aria-invalid": error || void 0,
|
|
118
|
+
onChange: (e) => update(e.target.value),
|
|
119
|
+
onPaste,
|
|
120
|
+
onFocus: (e) => {
|
|
121
|
+
setFocused(true);
|
|
122
|
+
toEnd(e);
|
|
123
|
+
},
|
|
124
|
+
onBlur: () => setFocused(false),
|
|
125
|
+
onSelect: toEnd,
|
|
126
|
+
className: "absolute inset-0 h-full w-full cursor-text bg-transparent text-transparent caret-transparent outline-none selection:bg-transparent"
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex h-7 items-center gap-3 text-[12.5px]", style: rise(1), children: [
|
|
131
|
+
/* @__PURE__ */ jsx("span", { className: "text-mute", "aria-live": "polite", children: full ? "Code complete" : `${6 - code.length} digit${6 - code.length === 1 ? "" : "s"} to go` }),
|
|
132
|
+
pasteButton && /* @__PURE__ */ jsxs(
|
|
133
|
+
"button",
|
|
134
|
+
{
|
|
135
|
+
type: "button",
|
|
136
|
+
onClick: paste,
|
|
137
|
+
className: "flex h-7 items-center gap-1.5 rounded-[7px] px-2 font-medium text-ink outline-none transition-[background-color,transform] duration-200 hover:bg-paper-2 active:scale-95 focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 text-mute", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
140
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "2.5", width: "10", height: "11.5", rx: "2" }),
|
|
141
|
+
/* @__PURE__ */ jsx("path", { d: "M6 2.5V2a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 .5.5v.5", strokeLinecap: "round" })
|
|
142
|
+
] }),
|
|
143
|
+
"Paste code"
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] })
|
|
148
|
+
] });
|
|
149
|
+
}
|
|
150
|
+
var otp_input_aui_041_default = SplitOtp;
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
SplitOtp,
|
|
154
|
+
otp_input_aui_041_default
|
|
155
|
+
};
|