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,311 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/combobox-aui-047.tsx
|
|
4
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { Fragment, 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 CSS = `
|
|
9
|
+
@keyframes aui047-pop { from { opacity: 0; transform: translateY(var(--aui047-y, -6px)) scale(.97) } }
|
|
10
|
+
@keyframes aui047-row { from { opacity: 0; transform: translateY(5px) } }
|
|
11
|
+
@keyframes aui047-chip { 0% { opacity: 0; transform: scale(.6) } 60% { opacity: 1; transform: scale(1.06) } 100% { transform: none } }
|
|
12
|
+
@keyframes aui047-drop { 0% { transform: scale(0) } 60% { transform: scale(1.5) } 100% { transform: none } }
|
|
13
|
+
@keyframes aui047-ripple { from { opacity: .5; transform: scale(1) } to { opacity: 0; transform: scale(3.2) } }
|
|
14
|
+
@media (prefers-reduced-motion: reduce) { .aui047 *, .aui047 { animation: none !important; transition: none !important } }
|
|
15
|
+
`;
|
|
16
|
+
var TINTS = [
|
|
17
|
+
"bg-brand",
|
|
18
|
+
"bg-[color-mix(in_srgb,var(--brand)_58%,var(--paper))]",
|
|
19
|
+
"bg-[color-mix(in_srgb,var(--brand)_30%,var(--paper))]",
|
|
20
|
+
"bg-ink",
|
|
21
|
+
"bg-[color-mix(in_srgb,var(--ink)_52%,var(--paper))]",
|
|
22
|
+
"bg-[color-mix(in_srgb,var(--ink)_24%,var(--paper))]"
|
|
23
|
+
];
|
|
24
|
+
var LABELS = [
|
|
25
|
+
{ id: "bug", name: "Bug", tint: 3, count: 14 },
|
|
26
|
+
{ id: "design", name: "Design", tint: 0, count: 9 },
|
|
27
|
+
{ id: "frontend", name: "Frontend", tint: 1, count: 22 },
|
|
28
|
+
{ id: "motion", name: "Motion", tint: 2, count: 4 },
|
|
29
|
+
{ id: "docs", name: "Docs", tint: 4, count: 7 },
|
|
30
|
+
{ id: "research", name: "Research", tint: 5, count: 3 }
|
|
31
|
+
];
|
|
32
|
+
function Dot({ tint = 0, size = 8, pop }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative inline-flex shrink-0", style: { width: size, height: size }, children: [
|
|
34
|
+
pop && /* @__PURE__ */ jsx("span", { className: cx("absolute inset-0 rounded-full", TINTS[tint % TINTS.length]), style: { animation: `aui047-ripple .7s ${EASE} both` } }),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
className: cx("relative h-full w-full rounded-full shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_12%,transparent)]", TINTS[tint % TINTS.length]),
|
|
39
|
+
style: pop ? { animation: `aui047-drop .5s ${EASE} both` } : void 0
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
function roomBelow(el, need) {
|
|
45
|
+
const r = el.getBoundingClientRect();
|
|
46
|
+
let top = 0;
|
|
47
|
+
let bottom = window.innerHeight;
|
|
48
|
+
for (let p = el.parentElement; p && p !== document.body; p = p.parentElement) {
|
|
49
|
+
if (/hidden|auto|scroll|clip/.test(getComputedStyle(p).overflowY)) {
|
|
50
|
+
const c = p.getBoundingClientRect();
|
|
51
|
+
top = c.top;
|
|
52
|
+
bottom = c.bottom;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const below = bottom - r.bottom;
|
|
57
|
+
return below >= need || below >= r.top - top;
|
|
58
|
+
}
|
|
59
|
+
function CreatableCombobox({ options = LABELS, value, defaultValue = ["bug", "frontend"], onChange, onCreate, label = "Labels", placeholder = "Add label\u2026", name, disabled, className }) {
|
|
60
|
+
const [made, setMade] = useState([]);
|
|
61
|
+
const known = useMemo(() => [...options, ...made], [options, made]);
|
|
62
|
+
const byId = useMemo(() => new Map(known.map((l) => [l.id, l])), [known]);
|
|
63
|
+
const [inner, setInner] = useState(defaultValue);
|
|
64
|
+
const ids = value ?? inner;
|
|
65
|
+
const [open, setOpen] = useState(false);
|
|
66
|
+
const [down, setDown] = useState(true);
|
|
67
|
+
const [q, setQ] = useState("");
|
|
68
|
+
const [active, setActive] = useState(0);
|
|
69
|
+
const [tint, setTint] = useState((options.length + 1) % TINTS.length);
|
|
70
|
+
const [fresh, setFresh] = useState(null);
|
|
71
|
+
const root = useRef(null);
|
|
72
|
+
const field = useRef(null);
|
|
73
|
+
const input = useRef(null);
|
|
74
|
+
const list = useRef(null);
|
|
75
|
+
const uid = useId();
|
|
76
|
+
const t = q.trim();
|
|
77
|
+
const tl = t.toLowerCase();
|
|
78
|
+
const matches = useMemo(() => tl ? known.filter((l) => l.name.toLowerCase().includes(tl)) : known, [known, tl]);
|
|
79
|
+
const exact = known.some((l) => l.name.toLowerCase() === tl);
|
|
80
|
+
const canCreate = !!t && !exact;
|
|
81
|
+
const rows = canCreate ? matches.length + 1 : matches.length;
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (open) list.current?.querySelector(`[data-i="${active}"]`)?.scrollIntoView({ block: "nearest" });
|
|
84
|
+
}, [active, open]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!open) return;
|
|
87
|
+
const onDown = (e) => {
|
|
88
|
+
if (!root.current?.contains(e.target)) setOpen(false);
|
|
89
|
+
};
|
|
90
|
+
document.addEventListener("pointerdown", onDown);
|
|
91
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
92
|
+
}, [open]);
|
|
93
|
+
const set = (next) => {
|
|
94
|
+
if (value === void 0) setInner(next);
|
|
95
|
+
onChange?.(next);
|
|
96
|
+
};
|
|
97
|
+
const show = () => {
|
|
98
|
+
if (disabled || open || !field.current) return;
|
|
99
|
+
setDown(roomBelow(field.current, 250));
|
|
100
|
+
setActive(0);
|
|
101
|
+
setOpen(true);
|
|
102
|
+
};
|
|
103
|
+
const toggle = (l) => {
|
|
104
|
+
if (!l) return;
|
|
105
|
+
set(ids.includes(l.id) ? ids.filter((x) => x !== l.id) : [...ids, l.id]);
|
|
106
|
+
setFresh(null);
|
|
107
|
+
setQ("");
|
|
108
|
+
};
|
|
109
|
+
const create = () => {
|
|
110
|
+
if (!canCreate) return;
|
|
111
|
+
const base = tl.replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "label";
|
|
112
|
+
let id = base;
|
|
113
|
+
for (let n = 2; byId.has(id); n++) id = `${base}-${n}`;
|
|
114
|
+
const l = { id, name: t, tint, count: 0 };
|
|
115
|
+
setMade((m) => [...m, l]);
|
|
116
|
+
set([...ids, id]);
|
|
117
|
+
setFresh(id);
|
|
118
|
+
setTint((x) => (x + 1) % TINTS.length);
|
|
119
|
+
setQ("");
|
|
120
|
+
setActive(0);
|
|
121
|
+
onCreate?.(l);
|
|
122
|
+
};
|
|
123
|
+
const choose = (i) => canCreate && i === 0 ? create() : toggle(matches[canCreate ? i - 1 : i]);
|
|
124
|
+
const onKey = (e) => {
|
|
125
|
+
if (e.key === "ArrowDown") {
|
|
126
|
+
if (!open) show();
|
|
127
|
+
else setActive((a) => rows ? (a + 1) % rows : 0);
|
|
128
|
+
} else if (e.key === "ArrowUp") {
|
|
129
|
+
if (!open) show();
|
|
130
|
+
else setActive((a) => rows ? (a - 1 + rows) % rows : 0);
|
|
131
|
+
} else if (e.key === "Enter") {
|
|
132
|
+
if (open && rows) choose(active);
|
|
133
|
+
else if (canCreate) create();
|
|
134
|
+
} else if (e.key === "Escape") {
|
|
135
|
+
if (!open && !q) return;
|
|
136
|
+
setOpen(false);
|
|
137
|
+
setQ("");
|
|
138
|
+
} else if (e.key === "Backspace" && !q && ids.length) set(ids.slice(0, -1));
|
|
139
|
+
else return;
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ jsxs("div", { ref: root, className: cx("aui047 relative w-full", open && "z-40", className), children: [
|
|
143
|
+
/* @__PURE__ */ jsx("style", { href: "asta-aui047", precedence: "asta", children: CSS }),
|
|
144
|
+
/* @__PURE__ */ jsxs(
|
|
145
|
+
"div",
|
|
146
|
+
{
|
|
147
|
+
ref: field,
|
|
148
|
+
onPointerDown: (e) => {
|
|
149
|
+
if (e.target === e.currentTarget) {
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
input.current?.focus();
|
|
152
|
+
show();
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
className: cx(
|
|
156
|
+
"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",
|
|
157
|
+
"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)]",
|
|
158
|
+
"focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)]",
|
|
159
|
+
disabled && "cursor-not-allowed opacity-45"
|
|
160
|
+
),
|
|
161
|
+
children: [
|
|
162
|
+
ids.map((id) => {
|
|
163
|
+
const l = byId.get(id);
|
|
164
|
+
if (!l) return null;
|
|
165
|
+
return /* @__PURE__ */ jsxs("span", { className: "inline-flex h-7 items-center gap-1.5 rounded-[7px] bg-paper-2 pl-2.5 pr-0.5 text-[12.5px] font-medium text-ink", style: { animation: `aui047-chip .45s ${EASE} both` }, children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Dot, { tint: l.tint, pop: fresh === id }),
|
|
167
|
+
l.name,
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
type: "button",
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
disabled,
|
|
174
|
+
"aria-label": `Remove ${l.name}`,
|
|
175
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
176
|
+
onClick: () => set(ids.filter((x) => x !== id)),
|
|
177
|
+
className: "flex h-6 w-6 items-center justify-center rounded-[5px] text-mute outline-none transition-colors hover:bg-[color-mix(in_srgb,var(--ink)_8%,transparent)] hover:text-ink",
|
|
178
|
+
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" }) })
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }, id);
|
|
182
|
+
}),
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
"input",
|
|
185
|
+
{
|
|
186
|
+
ref: input,
|
|
187
|
+
value: q,
|
|
188
|
+
disabled,
|
|
189
|
+
placeholder: ids.length ? placeholder : `${label}\u2026`,
|
|
190
|
+
role: "combobox",
|
|
191
|
+
"aria-label": label,
|
|
192
|
+
"aria-expanded": open,
|
|
193
|
+
"aria-controls": `${uid}-list`,
|
|
194
|
+
"aria-autocomplete": "list",
|
|
195
|
+
"aria-activedescendant": open && rows ? `${uid}-o-${active}` : void 0,
|
|
196
|
+
autoComplete: "off",
|
|
197
|
+
spellCheck: false,
|
|
198
|
+
onFocus: show,
|
|
199
|
+
onClick: show,
|
|
200
|
+
onChange: (e) => {
|
|
201
|
+
setQ(e.target.value);
|
|
202
|
+
setActive(0);
|
|
203
|
+
if (!open) show();
|
|
204
|
+
},
|
|
205
|
+
onKeyDown: onKey,
|
|
206
|
+
onBlur: (e) => {
|
|
207
|
+
if (root.current?.contains(e.relatedTarget)) return;
|
|
208
|
+
setOpen(false);
|
|
209
|
+
setQ("");
|
|
210
|
+
},
|
|
211
|
+
className: "h-7 min-w-[7rem] flex-1 bg-transparent px-1.5 text-[13.5px] text-ink outline-none placeholder:text-mute disabled:cursor-not-allowed"
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
name && ids.map((id) => /* @__PURE__ */ jsx("input", { type: "hidden", name, value: byId.get(id)?.name ?? id }, id)),
|
|
218
|
+
open && /* @__PURE__ */ jsxs(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
222
|
+
className: cx(
|
|
223
|
+
"absolute inset-x-0 z-50 overflow-hidden rounded-[13px] bg-paper",
|
|
224
|
+
"shadow-[0_0_0_1px_color-mix(in_srgb,var(--ink)_9%,transparent),0_22px_48px_-16px_rgb(0_0_0/0.3),0_4px_10px_-4px_rgb(0_0_0/0.08)]",
|
|
225
|
+
down ? "top-full mt-2 origin-top" : "bottom-full mb-2 origin-bottom [--aui047-y:6px]"
|
|
226
|
+
),
|
|
227
|
+
style: { animation: `aui047-pop .3s ${EASE} both` },
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsxs("ul", { ref: list, id: `${uid}-list`, role: "listbox", "aria-multiselectable": true, "aria-label": label, className: "max-h-[208px] overflow-y-auto overscroll-contain p-1 [scrollbar-width:thin]", children: [
|
|
230
|
+
canCreate && /* @__PURE__ */ jsxs(
|
|
231
|
+
"li",
|
|
232
|
+
{
|
|
233
|
+
id: `${uid}-o-0`,
|
|
234
|
+
"data-i": 0,
|
|
235
|
+
role: "option",
|
|
236
|
+
"aria-selected": false,
|
|
237
|
+
onPointerMove: () => active !== 0 && setActive(0),
|
|
238
|
+
onClick: create,
|
|
239
|
+
className: cx("mb-1 flex h-11 cursor-pointer select-none items-center gap-2.5 rounded-[8px] px-2.5 transition-colors duration-150", active === 0 ? "bg-[color-mix(in_srgb,var(--brand)_8%,transparent)]" : ""),
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-6 w-6 items-center justify-center rounded-[6px] bg-brand text-white", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "M8 3.5v9M3.5 8h9" }) }) }),
|
|
242
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 truncate text-[13.5px] text-ink-2", children: [
|
|
243
|
+
"Create",
|
|
244
|
+
" ",
|
|
245
|
+
/* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-[6px] bg-paper-2 px-1.5 py-0.5 align-middle font-medium text-ink", children: [
|
|
246
|
+
/* @__PURE__ */ jsx(Dot, { tint, pop: true }, tint),
|
|
247
|
+
t
|
|
248
|
+
] })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": "Label colour", children: TINTS.map((_, n) => /* @__PURE__ */ jsx(
|
|
251
|
+
"button",
|
|
252
|
+
{
|
|
253
|
+
type: "button",
|
|
254
|
+
tabIndex: -1,
|
|
255
|
+
role: "radio",
|
|
256
|
+
"aria-checked": n === tint,
|
|
257
|
+
"aria-label": `Colour ${n + 1}`,
|
|
258
|
+
onClick: (e) => {
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
setTint(n);
|
|
261
|
+
},
|
|
262
|
+
className: cx("flex h-4 w-4 items-center justify-center rounded-full outline-none transition-transform duration-200 hover:scale-110", n === tint && "shadow-[0_0_0_1.5px_var(--paper),0_0_0_3px_var(--brand)]"),
|
|
263
|
+
children: /* @__PURE__ */ jsx(Dot, { tint: n, size: 10 })
|
|
264
|
+
},
|
|
265
|
+
n
|
|
266
|
+
)) })
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
matches.map((l, k) => {
|
|
271
|
+
const i = canCreate ? k + 1 : k;
|
|
272
|
+
const on = ids.includes(l.id);
|
|
273
|
+
return /* @__PURE__ */ jsxs(
|
|
274
|
+
"li",
|
|
275
|
+
{
|
|
276
|
+
id: `${uid}-o-${i}`,
|
|
277
|
+
"data-i": i,
|
|
278
|
+
role: "option",
|
|
279
|
+
"aria-selected": on,
|
|
280
|
+
onPointerMove: () => active !== i && setActive(i),
|
|
281
|
+
onClick: () => toggle(l),
|
|
282
|
+
className: cx("flex h-9 cursor-pointer select-none items-center gap-2.5 rounded-[8px] px-2.5 transition-colors duration-150", i === active && "bg-paper-2"),
|
|
283
|
+
style: { animation: `aui047-row .35s ${EASE} ${Math.min(k, 6) * 25}ms both` },
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsx(Dot, { tint: l.tint }),
|
|
286
|
+
/* @__PURE__ */ jsx("span", { className: cx("min-w-0 flex-1 truncate text-[13.5px] text-ink", on && "font-medium"), children: l.name }),
|
|
287
|
+
l.count !== void 0 && /* @__PURE__ */ jsx("span", { className: "font-mono text-[11px] tabular-nums text-mute", children: l.count }),
|
|
288
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cx("h-3.5 w-3.5 shrink-0 text-brand transition-[opacity,transform] duration-300", on ? "scale-100 opacity-100" : "scale-50 opacity-0"), fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3.5 8.5 3 3 6-7" }) })
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
l.id
|
|
292
|
+
);
|
|
293
|
+
})
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ jsx("p", { className: "px-3.5 py-2 text-[11.5px] text-mute shadow-[0_-1px_0_color-mix(in_srgb,var(--ink)_7%,transparent)]", children: canCreate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
296
|
+
/* @__PURE__ */ jsx("kbd", { className: "font-sans text-ink-2", children: "\u21B5" }),
|
|
297
|
+
" creates \u201C",
|
|
298
|
+
t,
|
|
299
|
+
"\u201D"
|
|
300
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: "Type a new name to create a label" }) })
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
var combobox_aui_047_default = CreatableCombobox;
|
|
307
|
+
|
|
308
|
+
export {
|
|
309
|
+
CreatableCombobox,
|
|
310
|
+
combobox_aui_047_default
|
|
311
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/variants/textarea-aui-037.tsx
|
|
4
|
+
import { useEffect, 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 CSS = `
|
|
9
|
+
@keyframes aui037-rise { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
|
|
10
|
+
@keyframes aui037-star { 0% { transform: scale(.6) rotate(-14deg) } 55% { transform: scale(1.22) rotate(4deg) } 100% { transform: none } }
|
|
11
|
+
@keyframes aui037-word { from { opacity: 0; transform: translateY(7px) } to { opacity: 1; transform: none } }
|
|
12
|
+
@keyframes aui037-chip { from { opacity: 0; transform: scale(.85) } to { opacity: 1; transform: none } }
|
|
13
|
+
@media (prefers-reduced-motion: reduce) { .aui037 * { animation: none !important; transition: none !important } }
|
|
14
|
+
`;
|
|
15
|
+
var rise = (i) => ({ animation: `aui037-rise .6s ${EASE} ${i * 55}ms both` });
|
|
16
|
+
var WORDS = ["Tap a star", "Not for me", "Could be better", "It's good", "Really good", "Loved it"];
|
|
17
|
+
var PROMPTS = ["How was it?", "What went wrong?", "What would make it better?", "What did you like?", "What stood out?", "What did you love about it?"];
|
|
18
|
+
function Star({ on, delay, pop }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"svg",
|
|
21
|
+
{
|
|
22
|
+
viewBox: "0 0 24 24",
|
|
23
|
+
className: cx("h-7 w-7 transition-colors duration-200", on ? "text-brand" : "text-[color-mix(in_srgb,var(--ink)_14%,transparent)]"),
|
|
24
|
+
style: pop && on ? { animation: `aui037-star .5s ${EASE} ${delay}ms both` } : void 0,
|
|
25
|
+
fill: "currentColor",
|
|
26
|
+
"aria-hidden": true,
|
|
27
|
+
children: /* @__PURE__ */ jsx("path", { d: "M12 2.8l2.7 5.6 6.1.8-4.5 4.2 1.1 6.1L12 16.6l-5.4 2.9 1.1-6.1-4.5-4.2 6.1-.8L12 2.8Z", strokeLinejoin: "round" })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
function ReviewTextarea({
|
|
32
|
+
product = "Studio headphones",
|
|
33
|
+
meta = "Delivered 12 Nov \xB7 Order A-2041",
|
|
34
|
+
image = "/lab/headphones.jpg",
|
|
35
|
+
rating,
|
|
36
|
+
defaultRating = 0,
|
|
37
|
+
onRatingChange,
|
|
38
|
+
defaultText = "",
|
|
39
|
+
photos: initial = [],
|
|
40
|
+
maxPhotos = 4,
|
|
41
|
+
onSubmit,
|
|
42
|
+
className
|
|
43
|
+
}) {
|
|
44
|
+
const id = useId();
|
|
45
|
+
const [innerRating, setInnerRating] = useState(defaultRating);
|
|
46
|
+
const score = rating ?? innerRating;
|
|
47
|
+
const [hover, setHover] = useState(0);
|
|
48
|
+
const [wave, setWave] = useState(0);
|
|
49
|
+
const [text, setText] = useState(defaultText);
|
|
50
|
+
const [photos, setPhotos] = useState(initial);
|
|
51
|
+
const [sent, setSent] = useState(false);
|
|
52
|
+
const picker = useRef(null);
|
|
53
|
+
const urls = useRef([]);
|
|
54
|
+
const stars = useRef([]);
|
|
55
|
+
useEffect(() => () => urls.current.forEach((u) => URL.revokeObjectURL(u)), []);
|
|
56
|
+
const pick = (n) => {
|
|
57
|
+
if (rating === void 0) setInnerRating(n);
|
|
58
|
+
onRatingChange?.(n);
|
|
59
|
+
setWave((w) => w + 1);
|
|
60
|
+
};
|
|
61
|
+
const shown = hover || score;
|
|
62
|
+
const onKey = (e) => {
|
|
63
|
+
const d = e.key === "ArrowRight" || e.key === "ArrowUp" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowDown" ? -1 : 0;
|
|
64
|
+
if (!d) return;
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const n = Math.min(5, Math.max(1, (score || 0) + d));
|
|
67
|
+
pick(n);
|
|
68
|
+
stars.current[n - 1]?.focus();
|
|
69
|
+
};
|
|
70
|
+
const remove = (i) => {
|
|
71
|
+
const p = photos[i];
|
|
72
|
+
if (p.file) {
|
|
73
|
+
URL.revokeObjectURL(p.src);
|
|
74
|
+
urls.current = urls.current.filter((u) => u !== p.src);
|
|
75
|
+
}
|
|
76
|
+
setPhotos((all) => all.filter((_, j) => j !== i));
|
|
77
|
+
};
|
|
78
|
+
const ready = score > 0 && !sent;
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: cx(
|
|
83
|
+
"aui037 w-full max-w-[440px] rounded-[14px] bg-paper p-5 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)]",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsx("style", { href: "asta-textarea-aui-037", precedence: "asta", children: CSS }),
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", style: rise(0), children: [
|
|
89
|
+
/* @__PURE__ */ jsx("img", { src: image, alt: "", width: 44, height: 44, loading: "lazy", decoding: "async", className: "h-11 w-11 rounded-[9px] bg-paper-2 object-cover" }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
91
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-[14px] font-medium text-ink", children: product }),
|
|
92
|
+
/* @__PURE__ */ jsx("p", { className: "mt-0.5 truncate text-[12px] text-mute", children: meta })
|
|
93
|
+
] })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-5 flex items-center justify-between gap-3", style: rise(1), children: [
|
|
96
|
+
/* @__PURE__ */ jsx("div", { role: "radiogroup", "aria-label": `Rate ${product}`, className: "-ml-1 flex", onKeyDown: onKey, onPointerLeave: () => setHover(0), children: [1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx(
|
|
97
|
+
"button",
|
|
98
|
+
{
|
|
99
|
+
ref: (el) => {
|
|
100
|
+
stars.current[n - 1] = el;
|
|
101
|
+
},
|
|
102
|
+
type: "button",
|
|
103
|
+
role: "radio",
|
|
104
|
+
"aria-checked": score === n,
|
|
105
|
+
"aria-label": `${n} star${n > 1 ? "s" : ""}`,
|
|
106
|
+
tabIndex: score ? score === n ? 0 : -1 : n === 1 ? 0 : -1,
|
|
107
|
+
onPointerEnter: () => setHover(n),
|
|
108
|
+
onClick: () => pick(n),
|
|
109
|
+
className: "rounded-[7px] p-1 outline-none transition-transform duration-200 hover:scale-110 active:scale-95 focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
110
|
+
style: { transitionTimingFunction: EASE },
|
|
111
|
+
children: /* @__PURE__ */ jsx("span", { className: "block", children: /* @__PURE__ */ jsx(Star, { on: n <= shown, pop: wave > 0 && !hover, delay: (n - 1) * 45 }) }, wave)
|
|
112
|
+
},
|
|
113
|
+
n
|
|
114
|
+
)) }),
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "relative h-5 overflow-hidden text-right text-[13.5px] font-medium text-ink", children: /* @__PURE__ */ jsx("span", { className: "block", style: { animation: `aui037-word .3s ${EASE} both` }, children: WORDS[shown] }, shown) })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "sr-only", children: "Your review" }),
|
|
118
|
+
/* @__PURE__ */ jsxs(
|
|
119
|
+
"div",
|
|
120
|
+
{
|
|
121
|
+
className: "mt-4 rounded-[11px] bg-paper-2 transition-shadow duration-300 focus-within:bg-paper focus-within:shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_12%,transparent)]",
|
|
122
|
+
style: rise(2),
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
"textarea",
|
|
126
|
+
{
|
|
127
|
+
id,
|
|
128
|
+
rows: 3,
|
|
129
|
+
value: text,
|
|
130
|
+
onChange: (e) => setText(e.target.value),
|
|
131
|
+
placeholder: PROMPTS[shown],
|
|
132
|
+
className: "block w-full resize-none bg-transparent px-3.5 pt-3 text-[14px] leading-[1.55] text-ink outline-none placeholder:text-mute"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsxs("ul", { className: "flex flex-wrap items-center gap-2 px-3 pb-3 pt-2", "aria-label": "Photos", children: [
|
|
136
|
+
photos.map((p, i) => /* @__PURE__ */ jsxs("li", { className: "group relative", style: { animation: `aui037-chip .35s ${EASE} both` }, children: [
|
|
137
|
+
/* @__PURE__ */ jsx("img", { src: p.src, alt: p.alt, width: 44, height: 44, loading: "lazy", decoding: "async", className: "h-11 w-11 rounded-[8px] object-cover shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)]" }),
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
onClick: () => remove(i),
|
|
143
|
+
"aria-label": `Remove ${p.alt}`,
|
|
144
|
+
className: "absolute -right-1.5 -top-1.5 grid h-5 w-5 place-items-center rounded-full bg-ink text-paper opacity-0 outline-none transition-[opacity,transform] duration-200 group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-brand/50 active:scale-90 [@media(hover:none)]:opacity-100",
|
|
145
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-2.5 w-2.5", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" }) })
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] }, p.src)),
|
|
149
|
+
photos.length < maxPhotos && /* @__PURE__ */ jsxs("li", { children: [
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"input",
|
|
152
|
+
{
|
|
153
|
+
ref: picker,
|
|
154
|
+
type: "file",
|
|
155
|
+
accept: "image/*",
|
|
156
|
+
multiple: true,
|
|
157
|
+
hidden: true,
|
|
158
|
+
onChange: (e) => {
|
|
159
|
+
const list = Array.from(e.target.files ?? []).slice(0, maxPhotos - photos.length);
|
|
160
|
+
const added = list.map((f) => {
|
|
161
|
+
const url = URL.createObjectURL(f);
|
|
162
|
+
urls.current.push(url);
|
|
163
|
+
return { src: url, alt: f.name, file: f };
|
|
164
|
+
});
|
|
165
|
+
setPhotos((all) => [...all, ...added]);
|
|
166
|
+
e.target.value = "";
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ jsxs(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
onClick: () => picker.current?.click(),
|
|
175
|
+
className: "flex h-11 items-center gap-1.5 rounded-[8px] px-3 text-[12.5px] font-medium text-ink outline-none shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] transition-[transform,background-color] duration-200 hover:bg-paper active:scale-[.97] focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", className: "h-4 w-4 text-mute", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
178
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "3.5", width: "12", height: "9.5", rx: "2" }),
|
|
179
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8.2", r: "2.2" }),
|
|
180
|
+
/* @__PURE__ */ jsx("path", { d: "M5.5 3.5 6.4 2h3.2l.9 1.5" })
|
|
181
|
+
] }),
|
|
182
|
+
"Add photo",
|
|
183
|
+
/* @__PURE__ */ jsxs("span", { className: "font-normal text-mute", children: [
|
|
184
|
+
photos.length,
|
|
185
|
+
"/",
|
|
186
|
+
maxPhotos
|
|
187
|
+
] })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
] })
|
|
192
|
+
] })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between gap-3", style: rise(3), children: [
|
|
197
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12px] text-mute", "aria-live": "polite", children: sent ? "Thanks. Your review is live." : "Shown with your first name" }),
|
|
198
|
+
/* @__PURE__ */ jsxs(
|
|
199
|
+
"button",
|
|
200
|
+
{
|
|
201
|
+
type: "button",
|
|
202
|
+
disabled: !ready,
|
|
203
|
+
onClick: () => {
|
|
204
|
+
onSubmit?.({
|
|
205
|
+
rating: score,
|
|
206
|
+
text: text.trim(),
|
|
207
|
+
photos: photos.filter((p) => !p.file).map(({ src, alt }) => ({ src, alt })),
|
|
208
|
+
files: photos.flatMap((p) => p.file ? [p.file] : [])
|
|
209
|
+
});
|
|
210
|
+
setSent(true);
|
|
211
|
+
},
|
|
212
|
+
className: cx(
|
|
213
|
+
"group inline-flex h-9 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[8px] px-4 text-[13.5px] font-medium outline-none transition-[background-color,color,transform] duration-300 active:scale-[.97] focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2",
|
|
214
|
+
ready ? "bg-ink text-paper" : sent ? "bg-brand text-white" : "bg-paper-2 text-mute"
|
|
215
|
+
),
|
|
216
|
+
children: [
|
|
217
|
+
sent ? "Posted" : "Post review",
|
|
218
|
+
!sent && /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-3.5 w-3.5 transition-transform duration-300 group-enabled:group-hover:translate-x-0.5", style: { transitionTimingFunction: EASE }, fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3 8h10M9 4l4 4-4 4" }) })
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] })
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
var textarea_aui_037_default = ReviewTextarea;
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
ReviewTextarea,
|
|
231
|
+
textarea_aui_037_default
|
|
232
|
+
};
|