@krizaka/ui 3.67.1 → 3.68.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/chunk-PZ4FJOD5.js +44 -0
- package/dist/chunk-PZ4FJOD5.js.map +1 -0
- package/dist/{chunk-6BMKLAZ7.js → chunk-Z47KIPCT.js} +7 -2
- package/dist/{chunk-6BMKLAZ7.js.map → chunk-Z47KIPCT.js.map} +1 -1
- package/dist/copy-button.d.ts +29 -0
- package/dist/copy-button.js +56 -0
- package/dist/copy-button.js.map +1 -0
- package/dist/date-picker.d.ts +15 -15
- package/dist/filter-bar.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/kind-config-editor.js +106 -129
- package/dist/kind-config-editor.js.map +1 -1
- package/dist/money-input.d.ts +29 -0
- package/dist/money-input.js +78 -0
- package/dist/money-input.js.map +1 -0
- package/dist/nav-bar.d.ts +28 -4
- package/dist/nav-bar.js +20 -10
- package/dist/nav-bar.js.map +1 -1
- package/dist/promo-code-field.d.ts +38 -0
- package/dist/promo-code-field.js +94 -0
- package/dist/promo-code-field.js.map +1 -0
- package/dist/radio-group.js +1 -1
- package/dist/retro-tv.d.ts +39 -4
- package/dist/retro-tv.js +217 -40
- package/dist/retro-tv.js.map +1 -1
- package/dist/status-chip.js +1 -1
- package/dist/terminal-replay.js +1 -1
- package/dist/virtual.d.ts +3 -3
- package/package.json +47 -4
- package/registry/account-menu.json +1 -1
- package/registry/account-settings.json +1 -1
- package/registry/achievement.json +1 -1
- package/registry/action-bar.json +1 -1
- package/registry/activity-feed.json +1 -1
- package/registry/agenda.json +1 -1
- package/registry/alert.json +1 -1
- package/registry/analysis-report.json +1 -1
- package/registry/anatomy-plate.json +1 -1
- package/registry/app-frame.json +2 -2
- package/registry/app-header.json +1 -1
- package/registry/app-shell.json +1 -1
- package/registry/argument-card.json +1 -1
- package/registry/audio-player.json +1 -1
- package/registry/auth-layout.json +1 -1
- package/registry/avatar.json +1 -1
- package/registry/badge.json +1 -1
- package/registry/bird-plate.json +1 -1
- package/registry/button.json +1 -1
- package/registry/captcha.json +1 -1
- package/registry/card-grid.json +1 -1
- package/registry/card.json +1 -1
- package/registry/catalogue-page.json +1 -1
- package/registry/changelog-page.json +1 -1
- package/registry/chapter.json +1 -1
- package/registry/chat.json +1 -1
- package/registry/checkbox.json +1 -1
- package/registry/chip-link.json +1 -1
- package/registry/chip-row.json +1 -1
- package/registry/chip.json +1 -1
- package/registry/choice-grid.json +1 -1
- package/registry/code-block.json +1 -1
- package/registry/collection-switcher.json +1 -1
- package/registry/combobox.json +1 -1
- package/registry/command.json +1 -1
- package/registry/comparison-table.json +1 -1
- package/registry/component-page.json +1 -1
- package/registry/confirm-button.json +1 -1
- package/registry/contact-page.json +1 -1
- package/registry/continue-prompt.json +1 -1
- package/registry/copy-button.json +382 -0
- package/registry/countdown.json +1 -1
- package/registry/cover-hero.json +1 -1
- package/registry/cta-panel.json +1 -1
- package/registry/dashboard-layout.json +1 -1
- package/registry/data-table.json +1 -1
- package/registry/date-picker.json +1 -1
- package/registry/decision-list.json +1 -1
- package/registry/description-list.json +1 -1
- package/registry/desktop-window.json +1 -1
- package/registry/detail-layout.json +1 -1
- package/registry/dialog.json +1 -1
- package/registry/docs-article-page.json +1 -1
- package/registry/docs-hub-page.json +1 -1
- package/registry/docs-layout.json +1 -1
- package/registry/docs-nav.json +1 -1
- package/registry/document-viewer.json +1 -1
- package/registry/doodle.json +1 -1
- package/registry/drop-overlay.json +1 -1
- package/registry/dropdown-menu.json +1 -1
- package/registry/elephant.json +2 -2
- package/registry/embed-facade.json +1 -1
- package/registry/empty-state.json +1 -1
- package/registry/engine-flow.json +1 -1
- package/registry/entity-header.json +1 -1
- package/registry/environment-notice.json +1 -1
- package/registry/error-page.json +1 -1
- package/registry/examples/copy-button/default.d.ts +4 -0
- package/registry/examples/copy-button/default.js +11 -0
- package/registry/examples/copy-button/default.tsx +7 -0
- package/registry/examples/copy-button/icon-only.d.ts +4 -0
- package/registry/examples/copy-button/icon-only.js +11 -0
- package/registry/examples/copy-button/icon-only.tsx +7 -0
- package/registry/examples/money-input/currencies.d.ts +4 -0
- package/registry/examples/money-input/currencies.js +18 -0
- package/registry/examples/money-input/currencies.tsx +16 -0
- package/registry/examples/money-input/default.d.ts +4 -0
- package/registry/examples/money-input/default.js +18 -0
- package/registry/examples/money-input/default.tsx +16 -0
- package/registry/examples/promo-code-field/applied.d.ts +4 -0
- package/registry/examples/promo-code-field/applied.js +11 -0
- package/registry/examples/promo-code-field/applied.tsx +7 -0
- package/registry/examples/promo-code-field/default.d.ts +4 -0
- package/registry/examples/promo-code-field/default.js +19 -0
- package/registry/examples/promo-code-field/default.tsx +14 -0
- package/registry/examples/promo-code-field/expired.d.ts +4 -0
- package/registry/examples/promo-code-field/expired.js +11 -0
- package/registry/examples/promo-code-field/expired.tsx +7 -0
- package/registry/examples/retro-tv/playlist-channel.d.ts +4 -0
- package/registry/examples/retro-tv/playlist-channel.js +15 -0
- package/registry/examples/retro-tv/playlist-channel.tsx +10 -0
- package/registry/examples/retro-tv/playlist-crossfade.d.ts +4 -0
- package/registry/examples/retro-tv/playlist-crossfade.js +15 -0
- package/registry/examples/retro-tv/playlist-crossfade.tsx +10 -0
- package/registry/examples/retro-tv/playlist-slide.d.ts +4 -0
- package/registry/examples/retro-tv/playlist-slide.js +15 -0
- package/registry/examples/retro-tv/playlist-slide.tsx +10 -0
- package/registry/field.json +1 -1
- package/registry/file-upload.json +1 -1
- package/registry/filter-bar.json +1 -1
- package/registry/flock.json +1 -1
- package/registry/footnote.json +1 -1
- package/registry/force-update-screen.json +1 -1
- package/registry/form.json +1 -1
- package/registry/gallery-page.json +1 -1
- package/registry/genui.json +1 -1
- package/registry/glossary-term.json +1 -1
- package/registry/glossary.json +1 -1
- package/registry/glow-card.json +1 -1
- package/registry/goal-gauge.json +1 -1
- package/registry/grade-stamp.json +1 -1
- package/registry/how-it-works-page.json +1 -1
- package/registry/image-cropper.json +1 -1
- package/registry/index.json +108 -9
- package/registry/iso.json +1 -1
- package/registry/kanban.json +1 -1
- package/registry/kbd.json +1 -1
- package/registry/kind-config-editor.json +1 -1
- package/registry/kpi-explained.json +1 -1
- package/registry/landing-page.json +1 -1
- package/registry/landscape.json +1 -1
- package/registry/language-switch.json +1 -1
- package/registry/legal-page.json +1 -1
- package/registry/link-card.json +1 -1
- package/registry/list.json +1 -1
- package/registry/loader.json +1 -1
- package/registry/longform-page.json +1 -1
- package/registry/maintenance-screen.json +1 -1
- package/registry/map.json +2 -2
- package/registry/margin-layout.json +1 -1
- package/registry/markdown.json +1 -1
- package/registry/marketing-layout.json +1 -1
- package/registry/marquee.json +1 -1
- package/registry/mascot-quote.json +1 -1
- package/registry/mascot-state.json +1 -1
- package/registry/mascots.json +1 -1
- package/registry/match-dialog.json +1 -1
- package/registry/media-capture.json +1 -1
- package/registry/media-gallery.json +1 -1
- package/registry/media-grid.json +1 -1
- package/registry/meta-row.json +1 -1
- package/registry/meter.json +1 -1
- package/registry/money-input.json +236 -0
- package/registry/nav-bar.json +22 -8
- package/registry/next-actions.json +1 -1
- package/registry/notification-preferences.json +1 -1
- package/registry/number-ticker.json +1 -1
- package/registry/opening-hours.json +1 -1
- package/registry/page-header.json +1 -1
- package/registry/page-hero.json +1 -1
- package/registry/page-index.json +1 -1
- package/registry/page.json +1 -1
- package/registry/pagination.json +1 -1
- package/registry/photo-grid.json +1 -1
- package/registry/pointer-light.json +1 -1
- package/registry/popover.json +1 -1
- package/registry/pricing-page.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/profile-card.json +1 -1
- package/registry/progress.json +1 -1
- package/registry/promise-card.json +1 -1
- package/registry/promo-code-field.json +258 -0
- package/registry/qr-code.json +1 -1
- package/registry/quota-meter.json +1 -1
- package/registry/radio-group.json +1 -1
- package/registry/rail-nav.json +2 -2
- package/registry/recipes.json +1 -1
- package/registry/retro-tv.json +120 -8
- package/registry/reviews.json +1 -1
- package/registry/router.json +1 -1
- package/registry/scroll-stage.json +1 -1
- package/registry/search-field.json +1 -1
- package/registry/section-backdrop.json +1 -1
- package/registry/separator.json +1 -1
- package/registry/service-card.json +1 -1
- package/registry/settings-layout.json +1 -1
- package/registry/shop-composer.json +1 -1
- package/registry/shop.json +2 -2
- package/registry/showcase.json +1 -1
- package/registry/signature.json +1 -1
- package/registry/site-cahier.json +1 -1
- package/registry/site-footer.json +2 -2
- package/registry/sites.json +1 -1
- package/registry/skeleton.json +1 -1
- package/registry/skip-link.json +1 -1
- package/registry/slider.json +1 -1
- package/registry/slot-picker.json +1 -1
- package/registry/slot.json +1 -1
- package/registry/specimen-tag.json +1 -1
- package/registry/speed-lines.json +1 -1
- package/registry/spinner.json +1 -1
- package/registry/split-view.json +1 -1
- package/registry/stage-banner.json +1 -1
- package/registry/stat.json +1 -1
- package/registry/status-chip.json +1 -1
- package/registry/status-page.json +1 -1
- package/registry/step-progress.json +1 -1
- package/registry/step-showcase.json +1 -1
- package/registry/stepper.json +1 -1
- package/registry/sticky-action.json +1 -1
- package/registry/stuck.json +1 -1
- package/registry/swipe-deck.json +1 -1
- package/registry/switch.json +1 -1
- package/registry/tabs.json +1 -1
- package/registry/tag-input.json +1 -1
- package/registry/tag-selector.json +1 -1
- package/registry/taped-photo.json +1 -1
- package/registry/terminal-replay.json +1 -1
- package/registry/text-style.json +1 -1
- package/registry/theme.json +1 -1
- package/registry/toast.json +1 -1
- package/registry/toc.json +1 -1
- package/registry/tooltip.json +1 -1
- package/registry/tree-view.json +1 -1
- package/registry/update-prompt.json +1 -1
- package/registry/upload-queue.json +1 -1
- package/registry/usage.json +1 -1
- package/registry/verified-badge.json +1 -1
- package/registry/versus-card.json +1 -1
- package/registry/vertical-video.json +1 -1
- package/registry/video-player.json +1 -1
- package/registry/video-trimmer.json +1 -1
- package/registry/virtual.json +1 -1
- package/registry/wall.json +1 -1
- package/registry/waveform.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-NSLXEDIS.js";
|
|
5
|
+
|
|
6
|
+
// src/field/field.tsx
|
|
7
|
+
import { tv } from "tailwind-variants";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
var field = tv({
|
|
10
|
+
slots: {
|
|
11
|
+
root: "flex flex-col gap-1.5",
|
|
12
|
+
label: "text-xs font-semibold text-fg-secondary",
|
|
13
|
+
control: "flex h-11 w-full rounded-lg border border-border-control bg-surface-2 px-3 text-sm text-fg placeholder:text-fg-muted transition-[border-color,box-shadow] focus-visible:border-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger aria-invalid:ring-danger/30",
|
|
14
|
+
hint: "text-xs text-fg-secondary",
|
|
15
|
+
// The message reads in the danger text role (≥ 4.5:1 on every surface, both themes); the dot is the danger fill.
|
|
16
|
+
error: "flex items-center gap-1.5 text-xs font-medium text-fg-danger before:h-1.5 before:w-1.5 before:shrink-0 before:rounded-full before:bg-danger",
|
|
17
|
+
selectWrap: "relative flex w-full",
|
|
18
|
+
chevron: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-secondary"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
var s = field();
|
|
22
|
+
var Field = {
|
|
23
|
+
Root: ({ className, ...props }) => /* @__PURE__ */ jsx("div", { className: s.root({ className }), ...props }),
|
|
24
|
+
Label: ({ className, ...props }) => /* @__PURE__ */ jsx("label", { className: s.label({ className }), ...props }),
|
|
25
|
+
Hint: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: s.hint({ className }), ...props }),
|
|
26
|
+
Error: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { role: "alert", className: s.error({ className }), ...props })
|
|
27
|
+
};
|
|
28
|
+
var invalidProps = (invalid) => invalid ? { "aria-invalid": true, "data-invalid": "" } : {};
|
|
29
|
+
function Input({ invalid, className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("input", { ...invalidProps(invalid), className: s.control({ className }), ...props });
|
|
31
|
+
}
|
|
32
|
+
function Select({ invalid, className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("span", { className: s.selectWrap(), children: [
|
|
34
|
+
/* @__PURE__ */ jsx("select", { ...invalidProps(invalid), className: s.control({ className: cn("appearance-none pr-9", className) }), ...props }),
|
|
35
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, className: s.chevron(), children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
Field,
|
|
41
|
+
Input,
|
|
42
|
+
Select
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=chunk-PZ4FJOD5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/field/field.tsx"],"sourcesContent":["// Server-safe. The label ↔ control wiring is HTML (htmlFor / id, aria-describedby): no context.\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\n\nexport const field = tv({\n slots: {\n root: \"flex flex-col gap-1.5\",\n label: \"text-xs font-semibold text-fg-secondary\",\n control:\n \"flex h-11 w-full rounded-lg border border-border-control bg-surface-2 px-3 text-sm text-fg placeholder:text-fg-muted \" +\n \"transition-[border-color,box-shadow] focus-visible:border-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring \" +\n \"disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-danger aria-invalid:ring-danger/30\",\n hint: \"text-xs text-fg-secondary\",\n // The message reads in the danger text role (≥ 4.5:1 on every surface, both themes); the dot is the danger fill.\n error: \"flex items-center gap-1.5 text-xs font-medium text-fg-danger before:h-1.5 before:w-1.5 before:shrink-0 before:rounded-full before:bg-danger\",\n selectWrap: \"relative flex w-full\",\n chevron: \"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-fg-secondary\",\n },\n});\nconst s = field();\n\nexport const Field = {\n Root: ({ className, ...props }: React.ComponentProps<\"div\">) => <div className={s.root({ className })} {...props} />,\n Label: ({ className, ...props }: React.ComponentProps<\"label\">) => <label className={s.label({ className })} {...props} />,\n Hint: ({ className, ...props }: React.ComponentProps<\"p\">) => <p className={s.hint({ className })} {...props} />,\n Error: ({ className, ...props }: React.ComponentProps<\"p\">) => <p role=\"alert\" className={s.error({ className })} {...props} />,\n};\n\ntype ControlProps = {\n /** Marks the control invalid: aria-invalid and data-invalid (pair it with a `Field.Error` in aria-describedby). */\n invalid?: boolean;\n};\n\nconst invalidProps = (invalid?: boolean) => (invalid ? { \"aria-invalid\": true as const, \"data-invalid\": \"\" } : {});\n\nexport function Input({ invalid, className, ...props }: React.ComponentProps<\"input\"> & ControlProps) {\n return <input {...invalidProps(invalid)} className={s.control({ className })} {...props} />;\n}\n\nexport function Textarea({ invalid, className, ...props }: React.ComponentProps<\"textarea\"> & ControlProps) {\n return <textarea {...invalidProps(invalid)} className={s.control({ className: cn(\"h-auto min-h-24 py-2\", className) })} {...props} />;\n}\n\n/** A native <select>, styled like the other controls (the platform's menu: accessible and right on phones). */\nexport function Select({ invalid, className, ...props }: React.ComponentProps<\"select\"> & ControlProps) {\n return (\n <span className={s.selectWrap()}>\n <select {...invalidProps(invalid)} className={s.control({ className: cn(\"appearance-none pr-9\", className) })} {...props} />\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden className={s.chevron()}>\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </span>\n );\n}\n"],"mappings":";;;;;;AAEA,SAAS,UAAU;AAsB+C,cAwB9D,YAxB8D;AAlB3D,IAAM,QAAQ,GAAG;AAAA,EACtB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SACE;AAAA,IAGF,MAAM;AAAA;AAAA,IAEN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,SAAS;AAAA,EACX;AACF,CAAC;AACD,IAAM,IAAI,MAAM;AAET,IAAM,QAAQ;AAAA,EACnB,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,MAAmC,oBAAC,SAAI,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAAA,EAClH,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,MAAqC,oBAAC,WAAM,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAAA,EACxH,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,MAAiC,oBAAC,OAAE,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAAA,EAC9G,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,MAAiC,oBAAC,OAAE,MAAK,SAAQ,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAC/H;AAOA,IAAM,eAAe,CAAC,YAAuB,UAAU,EAAE,gBAAgB,MAAe,gBAAgB,GAAG,IAAI,CAAC;AAEzG,SAAS,MAAM,EAAE,SAAS,WAAW,GAAG,MAAM,GAAiD;AACpG,SAAO,oBAAC,WAAO,GAAG,aAAa,OAAO,GAAG,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAC3F;AAOO,SAAS,OAAO,EAAE,SAAS,WAAW,GAAG,MAAM,GAAkD;AACtG,SACE,qBAAC,UAAK,WAAW,EAAE,WAAW,GAC5B;AAAA,wBAAC,YAAQ,GAAG,aAAa,OAAO,GAAG,WAAW,EAAE,QAAQ,EAAE,WAAW,GAAG,wBAAwB,SAAS,EAAE,CAAC,GAAI,GAAG,OAAO;AAAA,IAC1H,oBAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MAAC,WAAW,EAAE,QAAQ,GACvJ,8BAAC,UAAK,GAAE,gBAAe,GACzB;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -30,12 +30,17 @@ var RetryGlyph = (p) => /* @__PURE__ */ jsxs(Glyph, { ...p, children: [
|
|
|
30
30
|
/* @__PURE__ */ jsx("path", { d: "M4 12a8 8 0 1 0 2.3-5.7L4 8.5" }),
|
|
31
31
|
/* @__PURE__ */ jsx("path", { d: "M4 4v4.5h4.5" })
|
|
32
32
|
] });
|
|
33
|
+
var CopyGlyph = (p) => /* @__PURE__ */ jsxs(Glyph, { ...p, children: [
|
|
34
|
+
/* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
35
|
+
/* @__PURE__ */ jsx("path", { d: "M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3" })
|
|
36
|
+
] });
|
|
33
37
|
|
|
34
38
|
export {
|
|
35
39
|
PlayGlyph,
|
|
36
40
|
PauseGlyph,
|
|
37
41
|
ChevronGlyph,
|
|
38
42
|
CheckGlyph,
|
|
39
|
-
RetryGlyph
|
|
43
|
+
RetryGlyph,
|
|
44
|
+
CopyGlyph
|
|
40
45
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-Z47KIPCT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/glyphs.tsx"],"sourcesContent":["// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" }) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"],"mappings":";;;AASI,cAsBF,YAtBE;AAFJ,SAAS,MAAM,EAAE,YAAY,WAAW,MAAM,SAAS,GAA+D;AACpH,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR;AAAA,MACA,MAAM,OAAO,iBAAiB;AAAA,MAC9B,QAAQ,OAAO,SAAS;AAAA,MACxB,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAW;AAAA,MACX,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,YAAY,CAAC,MACxB,oBAAC,SAAO,GAAG,GAAG,MAAI,MAChB,8BAAC,UAAK,GAAE,kFAAiF,GAC3F;AAEK,IAAM,aAAa,CAAC,MACzB,qBAAC,SAAO,GAAG,GAAG,MAAI,MAChB;AAAA,sBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,KAAI,QAAO,MAAK,IAAG,KAAI;AAAA,EAC/C,oBAAC,UAAK,GAAE,MAAK,GAAE,KAAI,OAAM,KAAI,QAAO,MAAK,IAAG,KAAI;AAAA,GAClD;AAoCK,IAAM,eAAe,CAAC,EAAE,YAAY,QAAQ,GAAG,EAAE,MACtD,oBAAC,SAAO,GAAG,GACT,8BAAC,UAAK,GAAG,EAAE,MAAM,iBAAiB,OAAO,gBAAgB,IAAI,iBAAiB,MAAM,eAAe,EAAE,SAAS,GAAG,GACnH;AAEK,IAAM,aAAa,CAAC,MACzB,oBAAC,SAAO,GAAG,GACT,8BAAC,UAAK,GAAE,mBAAkB,GAC5B;AAqCK,IAAM,aAAa,CAAC,MACzB,qBAAC,SAAO,GAAG,GACT;AAAA,sBAAC,UAAK,GAAE,iCAAgC;AAAA,EACxC,oBAAC,UAAK,GAAE,gBAAe;AAAA,GACzB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/glyphs.tsx"],"sourcesContent":["// The small line glyphs the data and media primitives draw (play, volume, search, chevrons…): decorative, 24-unit\n// box, `currentColor`, sized by the caller's class. Shared by the entries that need them; never exported on its own —\n// a product draws its own icons with @krizaka/icons.\nimport type * as React from \"react\";\n\ntype GlyphProps = { className?: string };\n\nfunction Glyph({ className = \"h-4 w-4\", fill, children }: GlyphProps & { fill?: boolean; children: React.ReactNode }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={className}\n fill={fill ? \"currentColor\" : \"none\"}\n stroke={fill ? \"none\" : \"currentColor\"}\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n {children}\n </svg>\n );\n}\n\nexport const PlayGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <path d=\"M8 5.5v13a1 1 0 0 0 1.5.86l10.4-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5Z\" />\n </Glyph>\n);\nexport const PauseGlyph = (p: GlyphProps) => (\n <Glyph {...p} fill>\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" />\n </Glyph>\n);\nexport const VolumeGlyph = ({ muted, ...p }: GlyphProps & { muted?: boolean }) => (\n <Glyph {...p}>\n <path d=\"M11 5 6 9H3v6h3l5 4V5Z\" />\n {muted ? <path d=\"m22 9-6 6m0-6 6 6\" /> : <path d=\"M15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13\" />}\n </Glyph>\n);\nexport const FullscreenGlyph = ({ exit, ...p }: GlyphProps & { exit?: boolean }) => (\n <Glyph {...p}>\n {exit ? <path d=\"M9 4v5H4m11-5v5h5M9 20v-5H4m11 5v-5h5\" /> : <path d=\"M4 9V4h5m6 0h5v5M4 15v5h5m11-5v5h-5\" />}\n </Glyph>\n);\nexport const CaptionsGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <path d=\"M10 10.5a2 2 0 1 0 0 3M17 10.5a2 2 0 1 0 0 3\" />\n </Glyph>\n);\nexport const PipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" />\n <rect x=\"12\" y=\"12\" width=\"6\" height=\"4\" rx=\"1\" />\n </Glyph>\n);\nexport const SearchGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-3.5-3.5\" />\n </Glyph>\n);\nexport const CloseGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </Glyph>\n);\nexport const ChevronGlyph = ({ direction = \"down\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" | \"up\" | \"down\" }) => (\n <Glyph {...p}>\n <path d={{ left: \"m15 6-6 6 6 6\", right: \"m9 6 6 6-6 6\", up: \"m6 15 6-6 6 6\", down: \"m6 9 6 6 6-6\" }[direction]} />\n </Glyph>\n);\nexport const CheckGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M20 6 9 17l-5-5\" />\n </Glyph>\n);\nexport const PlusGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 5v14M5 12h14\" />\n </Glyph>\n);\nexport const CalendarGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\" />\n <path d=\"M3 10h18M8 3v4M16 3v4\" />\n </Glyph>\n);\nexport const UploadGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 16V4m0 0L7 9m5-5 5 5\" />\n <path d=\"M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />\n </Glyph>\n);\nexport const FileGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8l-5-5Z\" />\n <path d=\"M14 3v5h5\" />\n </Glyph>\n);\nexport const CameraGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 8h3l2-3h6l2 3h3a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z\" />\n <circle cx=\"12\" cy=\"13.5\" r=\"3.5\" />\n </Glyph>\n);\nexport const FlipGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 0 1 14-5.3M20 12a8 8 0 0 1-14 5.3\" />\n <path d=\"M18 3v4h-4M6 21v-4h4\" />\n </Glyph>\n);\nexport const RetryGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 12a8 8 0 1 0 2.3-5.7L4 8.5\" />\n <path d=\"M4 4v4.5h4.5\" />\n </Glyph>\n);\nexport const SortGlyph = ({ direction, ...p }: GlyphProps & { direction?: \"ascending\" | \"descending\" }) => (\n <Glyph {...p}>\n {direction === \"ascending\" ? <path d=\"m7 14 5-5 5 5\" /> : direction === \"descending\" ? <path d=\"m7 10 5 5 5-5\" /> : <path d=\"m8 9 4-4 4 4M8 15l4 4 4-4\" />}\n </Glyph>\n);\nexport const ArrowGlyph = ({ direction = \"right\", ...p }: GlyphProps & { direction?: \"left\" | \"right\" }) => (\n <Glyph {...p}>\n <path d={direction === \"left\" ? \"M19 12H5m0 0 6-6m-6 6 6 6\" : \"M5 12h14m0 0-6-6m6 6-6 6\"} />\n </Glyph>\n);\nexport const ExternalGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M14 4h6v6M20 4l-9 9\" />\n <path d=\"M18 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4\" />\n </Glyph>\n);\nexport const WarningGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M12 4 2.5 20h19L12 4Z\" />\n <path d=\"M12 10v4M12 17.2v.1\" />\n </Glyph>\n);\nexport const CopyGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" />\n <path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" />\n </Glyph>\n);\nexport const PencilGlyph = (p: GlyphProps) => (\n <Glyph {...p}>\n <path d=\"M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4zM13.5 6.5l4 4\" />\n </Glyph>\n);\n"],"mappings":";;;AASI,cAsBF,YAtBE;AAFJ,SAAS,MAAM,EAAE,YAAY,WAAW,MAAM,SAAS,GAA+D;AACpH,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR;AAAA,MACA,MAAM,OAAO,iBAAiB;AAAA,MAC9B,QAAQ,OAAO,SAAS;AAAA,MACxB,aAAY;AAAA,MACZ,eAAc;AAAA,MACd,gBAAe;AAAA,MACf,eAAW;AAAA,MACX,WAAU;AAAA,MAET;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,YAAY,CAAC,MACxB,oBAAC,SAAO,GAAG,GAAG,MAAI,MAChB,8BAAC,UAAK,GAAE,kFAAiF,GAC3F;AAEK,IAAM,aAAa,CAAC,MACzB,qBAAC,SAAO,GAAG,GAAG,MAAI,MAChB;AAAA,sBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,KAAI,QAAO,MAAK,IAAG,KAAI;AAAA,EAC/C,oBAAC,UAAK,GAAE,MAAK,GAAE,KAAI,OAAM,KAAI,QAAO,MAAK,IAAG,KAAI;AAAA,GAClD;AAoCK,IAAM,eAAe,CAAC,EAAE,YAAY,QAAQ,GAAG,EAAE,MACtD,oBAAC,SAAO,GAAG,GACT,8BAAC,UAAK,GAAG,EAAE,MAAM,iBAAiB,OAAO,gBAAgB,IAAI,iBAAiB,MAAM,eAAe,EAAE,SAAS,GAAG,GACnH;AAEK,IAAM,aAAa,CAAC,MACzB,oBAAC,SAAO,GAAG,GACT,8BAAC,UAAK,GAAE,mBAAkB,GAC5B;AAqCK,IAAM,aAAa,CAAC,MACzB,qBAAC,SAAO,GAAG,GACT;AAAA,sBAAC,UAAK,GAAE,iCAAgC;AAAA,EACxC,oBAAC,UAAK,GAAE,gBAAe;AAAA,GACzB;AAwBK,IAAM,YAAY,CAAC,MACxB,qBAAC,SAAO,GAAG,GACT;AAAA,sBAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI;AAAA,EAChD,oBAAC,UAAK,GAAE,2DAA0D;AAAA,GACpE;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { B as ButtonProps } from './button-Cm9pFH3P.js';
|
|
3
|
+
import 'tailwind-variants';
|
|
4
|
+
|
|
5
|
+
type CopyButtonProps = Omit<ButtonProps, "onClick" | "asChild" | "value" | "children"> & {
|
|
6
|
+
/** The text to copy. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** The words of the button (and its accessible name), passed translated: "Copy link". Icon only: set `iconOnly`. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** What it says once copied, announced politely: "Copied". */
|
|
11
|
+
copiedLabel: string;
|
|
12
|
+
/** Said when the clipboard is unavailable, above the selected value: "Press Ctrl+C to copy". */
|
|
13
|
+
fallbackLabel: string;
|
|
14
|
+
/** Shows only the icon (the label stays the accessible name). */
|
|
15
|
+
iconOnly?: boolean;
|
|
16
|
+
/** Replaces the copy icon (a `@krizaka/icons` one, say). */
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/** Replaces the check icon shown once copied. */
|
|
19
|
+
copiedIcon?: React.ReactNode;
|
|
20
|
+
/** How long "Copied" stays, in milliseconds (1800 by default). */
|
|
21
|
+
resetMs?: number;
|
|
22
|
+
/** Called after the value is copied. */
|
|
23
|
+
onCopy?: () => void;
|
|
24
|
+
};
|
|
25
|
+
/** A button that copies `value`. State: `data-copied`. */
|
|
26
|
+
declare function CopyButton({ value, label, copiedLabel, fallbackLabel, iconOnly, icon, copiedIcon, resetMs, onCopy, variant, className, ...props }: CopyButtonProps): React.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { CopyButton };
|
|
29
|
+
export type { CopyButtonProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CheckGlyph,
|
|
4
|
+
CopyGlyph
|
|
5
|
+
} from "./chunk-Z47KIPCT.js";
|
|
6
|
+
import {
|
|
7
|
+
Button
|
|
8
|
+
} from "./chunk-V7W4RLRW.js";
|
|
9
|
+
import "./chunk-D3T54RSL.js";
|
|
10
|
+
import "./chunk-WEVYKZIF.js";
|
|
11
|
+
import {
|
|
12
|
+
cn
|
|
13
|
+
} from "./chunk-NSLXEDIS.js";
|
|
14
|
+
|
|
15
|
+
// src/copy-button/copy-button.tsx
|
|
16
|
+
import * as React from "react";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
function CopyButton({ value, label, copiedLabel, fallbackLabel, iconOnly, icon, copiedIcon, resetMs = 1800, onCopy, variant = "secondary", className, ...props }) {
|
|
19
|
+
const [copied, setCopied] = React.useState(false);
|
|
20
|
+
const [manual, setManual] = React.useState(false);
|
|
21
|
+
const fieldRef = React.useRef(null);
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (!copied) return;
|
|
24
|
+
const timer = window.setTimeout(() => setCopied(false), resetMs);
|
|
25
|
+
return () => window.clearTimeout(timer);
|
|
26
|
+
}, [copied, resetMs]);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (manual) fieldRef.current?.select();
|
|
29
|
+
}, [manual]);
|
|
30
|
+
const copy = async () => {
|
|
31
|
+
try {
|
|
32
|
+
await navigator.clipboard.writeText(value);
|
|
33
|
+
setManual(false);
|
|
34
|
+
setCopied(true);
|
|
35
|
+
onCopy?.();
|
|
36
|
+
} catch {
|
|
37
|
+
setManual(true);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const name = copied ? copiedLabel : label;
|
|
41
|
+
return /* @__PURE__ */ jsxs("span", { className: "inline-flex flex-col gap-1.5", children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant, "aria-label": iconOnly ? name : void 0, title: iconOnly ? name : void 0, "data-copied": copied ? "" : void 0, className: cn(className), onClick: () => void copy(), ...props, children: [
|
|
43
|
+
copied ? copiedIcon ?? /* @__PURE__ */ jsx(CheckGlyph, {}) : icon ?? /* @__PURE__ */ jsx(CopyGlyph, {}),
|
|
44
|
+
!iconOnly && /* @__PURE__ */ jsx("span", { children: name })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", className: "sr-only", children: copied ? copiedLabel : "" }),
|
|
47
|
+
manual && /* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1 text-xs text-fg-secondary", children: [
|
|
48
|
+
fallbackLabel,
|
|
49
|
+
/* @__PURE__ */ jsx("input", { ref: fieldRef, readOnly: true, value, onFocus: (event) => event.currentTarget.select(), className: "h-9 rounded-lg border border-border-control bg-surface-2 px-2 text-sm text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" })
|
|
50
|
+
] })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
CopyButton
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=copy-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/copy-button/copy-button.tsx"],"sourcesContent":["// Client (a state, the clipboard). Copies a value and says so in a polite live region. Without the Clipboard API\n// (an insecure page, an old webview) it falls back to a selected, read-only field the person copies by hand: the\n// failure is never silent.\nimport * as React from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/button\";\nimport { cn } from \"../cn\";\nimport { CheckGlyph, CopyGlyph } from \"../glyphs\";\n\nexport type CopyButtonProps = Omit<ButtonProps, \"onClick\" | \"asChild\" | \"value\" | \"children\"> & {\n /** The text to copy. */\n value: string;\n /** The words of the button (and its accessible name), passed translated: \"Copy link\". Icon only: set `iconOnly`. */\n label: string;\n /** What it says once copied, announced politely: \"Copied\". */\n copiedLabel: string;\n /** Said when the clipboard is unavailable, above the selected value: \"Press Ctrl+C to copy\". */\n fallbackLabel: string;\n /** Shows only the icon (the label stays the accessible name). */\n iconOnly?: boolean;\n /** Replaces the copy icon (a `@krizaka/icons` one, say). */\n icon?: React.ReactNode;\n /** Replaces the check icon shown once copied. */\n copiedIcon?: React.ReactNode;\n /** How long \"Copied\" stays, in milliseconds (1800 by default). */\n resetMs?: number;\n /** Called after the value is copied. */\n onCopy?: () => void;\n};\n\n/** A button that copies `value`. State: `data-copied`. */\nexport function CopyButton({ value, label, copiedLabel, fallbackLabel, iconOnly, icon, copiedIcon, resetMs = 1800, onCopy, variant = \"secondary\", className, ...props }: CopyButtonProps) {\n const [copied, setCopied] = React.useState(false);\n const [manual, setManual] = React.useState(false);\n const fieldRef = React.useRef<HTMLInputElement>(null);\n React.useEffect(() => {\n if (!copied) return;\n const timer = window.setTimeout(() => setCopied(false), resetMs);\n return () => window.clearTimeout(timer);\n }, [copied, resetMs]);\n React.useEffect(() => {\n if (manual) fieldRef.current?.select();\n }, [manual]);\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(value);\n setManual(false);\n setCopied(true);\n onCopy?.();\n } catch {\n // No Clipboard API, or refused: show the value selected, to copy by hand.\n setManual(true);\n }\n };\n const name = copied ? copiedLabel : label;\n return (\n <span className=\"inline-flex flex-col gap-1.5\">\n <Button type=\"button\" variant={variant} aria-label={iconOnly ? name : undefined} title={iconOnly ? name : undefined} data-copied={copied ? \"\" : undefined} className={cn(className)} onClick={() => void copy()} {...props}>\n {copied ? (copiedIcon ?? <CheckGlyph />) : (icon ?? <CopyGlyph />)}\n {!iconOnly && <span>{name}</span>}\n </Button>\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {copied ? copiedLabel : \"\"}\n </span>\n {manual && (\n <label className=\"flex flex-col gap-1 text-xs text-fg-secondary\">\n {fallbackLabel}\n <input ref={fieldRef} readOnly value={value} onFocus={(event) => event.currentTarget.select()} className=\"h-9 rounded-lg border border-border-control bg-surface-2 px-2 text-sm text-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\" />\n </label>\n )}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,YAAY,WAAW;AAsDjB,SAC2B,KAD3B;AA1BC,SAAS,WAAW,EAAE,OAAO,OAAO,aAAa,eAAe,UAAU,MAAM,YAAY,UAAU,MAAM,QAAQ,UAAU,aAAa,WAAW,GAAG,MAAM,GAAoB;AACxL,QAAM,CAAC,QAAQ,SAAS,IAAU,eAAS,KAAK;AAChD,QAAM,CAAC,QAAQ,SAAS,IAAU,eAAS,KAAK;AAChD,QAAM,WAAiB,aAAyB,IAAI;AACpD,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,OAAQ;AACb,UAAM,QAAQ,OAAO,WAAW,MAAM,UAAU,KAAK,GAAG,OAAO;AAC/D,WAAO,MAAM,OAAO,aAAa,KAAK;AAAA,EACxC,GAAG,CAAC,QAAQ,OAAO,CAAC;AACpB,EAAM,gBAAU,MAAM;AACpB,QAAI,OAAQ,UAAS,SAAS,OAAO;AAAA,EACvC,GAAG,CAAC,MAAM,CAAC;AACX,QAAM,OAAO,YAAY;AACvB,QAAI;AACF,YAAM,UAAU,UAAU,UAAU,KAAK;AACzC,gBAAU,KAAK;AACf,gBAAU,IAAI;AACd,eAAS;AAAA,IACX,QAAQ;AAEN,gBAAU,IAAI;AAAA,IAChB;AAAA,EACF;AACA,QAAM,OAAO,SAAS,cAAc;AACpC,SACE,qBAAC,UAAK,WAAU,gCACd;AAAA,yBAAC,UAAO,MAAK,UAAS,SAAkB,cAAY,WAAW,OAAO,QAAW,OAAO,WAAW,OAAO,QAAW,eAAa,SAAS,KAAK,QAAW,WAAW,GAAG,SAAS,GAAG,SAAS,MAAM,KAAK,KAAK,GAAI,GAAG,OAClN;AAAA,eAAU,cAAc,oBAAC,cAAW,IAAO,QAAQ,oBAAC,aAAU;AAAA,MAC9D,CAAC,YAAY,oBAAC,UAAM,gBAAK;AAAA,OAC5B;AAAA,IACA,oBAAC,UAAK,MAAK,UAAS,aAAU,UAAS,WAAU,WAC9C,mBAAS,cAAc,IAC1B;AAAA,IACC,UACC,qBAAC,WAAM,WAAU,iDACd;AAAA;AAAA,MACD,oBAAC,WAAM,KAAK,UAAU,UAAQ,MAAC,OAAc,SAAS,CAAC,UAAU,MAAM,cAAc,OAAO,GAAG,WAAU,2JAA0J;AAAA,OACrQ;AAAA,KAEJ;AAEJ;","names":[]}
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -175,11 +175,11 @@ declare const dateField: tailwind_variants.TVReturnType<{
|
|
|
175
175
|
[key: string]: {
|
|
176
176
|
[key: string]: tailwind_variants.ClassValue | {
|
|
177
177
|
root?: tailwind_variants.ClassValue;
|
|
178
|
+
legend?: tailwind_variants.ClassValue;
|
|
178
179
|
row?: tailwind_variants.ClassValue;
|
|
180
|
+
part?: tailwind_variants.ClassValue;
|
|
179
181
|
hint?: tailwind_variants.ClassValue;
|
|
180
182
|
error?: tailwind_variants.ClassValue;
|
|
181
|
-
legend?: tailwind_variants.ClassValue;
|
|
182
|
-
part?: tailwind_variants.ClassValue;
|
|
183
183
|
input?: tailwind_variants.ClassValue;
|
|
184
184
|
};
|
|
185
185
|
};
|
|
@@ -187,11 +187,11 @@ declare const dateField: tailwind_variants.TVReturnType<{
|
|
|
187
187
|
[x: string]: {
|
|
188
188
|
[x: string]: tailwind_variants.ClassValue | {
|
|
189
189
|
root?: tailwind_variants.ClassValue;
|
|
190
|
+
legend?: tailwind_variants.ClassValue;
|
|
190
191
|
row?: tailwind_variants.ClassValue;
|
|
192
|
+
part?: tailwind_variants.ClassValue;
|
|
191
193
|
hint?: tailwind_variants.ClassValue;
|
|
192
194
|
error?: tailwind_variants.ClassValue;
|
|
193
|
-
legend?: tailwind_variants.ClassValue;
|
|
194
|
-
part?: tailwind_variants.ClassValue;
|
|
195
195
|
input?: tailwind_variants.ClassValue;
|
|
196
196
|
};
|
|
197
197
|
};
|
|
@@ -207,11 +207,11 @@ declare const dateField: tailwind_variants.TVReturnType<{
|
|
|
207
207
|
[key: string]: {
|
|
208
208
|
[key: string]: tailwind_variants.ClassValue | {
|
|
209
209
|
root?: tailwind_variants.ClassValue;
|
|
210
|
+
legend?: tailwind_variants.ClassValue;
|
|
210
211
|
row?: tailwind_variants.ClassValue;
|
|
212
|
+
part?: tailwind_variants.ClassValue;
|
|
211
213
|
hint?: tailwind_variants.ClassValue;
|
|
212
214
|
error?: tailwind_variants.ClassValue;
|
|
213
|
-
legend?: tailwind_variants.ClassValue;
|
|
214
|
-
part?: tailwind_variants.ClassValue;
|
|
215
215
|
input?: tailwind_variants.ClassValue;
|
|
216
216
|
};
|
|
217
217
|
};
|
|
@@ -294,15 +294,15 @@ declare const datePicker: tailwind_variants.TVReturnType<{
|
|
|
294
294
|
[key: string]: {
|
|
295
295
|
[key: string]: tailwind_variants.ClassValue | {
|
|
296
296
|
root?: tailwind_variants.ClassValue;
|
|
297
|
-
label?: tailwind_variants.ClassValue;
|
|
298
297
|
row?: tailwind_variants.ClassValue;
|
|
298
|
+
hint?: tailwind_variants.ClassValue;
|
|
299
|
+
error?: tailwind_variants.ClassValue;
|
|
300
|
+
label?: tailwind_variants.ClassValue;
|
|
299
301
|
icon?: tailwind_variants.ClassValue;
|
|
300
302
|
content?: tailwind_variants.ClassValue;
|
|
301
303
|
layout?: tailwind_variants.ClassValue;
|
|
302
304
|
presets?: tailwind_variants.ClassValue;
|
|
303
305
|
presetNode?: tailwind_variants.ClassValue;
|
|
304
|
-
hint?: tailwind_variants.ClassValue;
|
|
305
|
-
error?: tailwind_variants.ClassValue;
|
|
306
306
|
trigger?: tailwind_variants.ClassValue;
|
|
307
307
|
clear?: tailwind_variants.ClassValue;
|
|
308
308
|
preset?: tailwind_variants.ClassValue;
|
|
@@ -312,15 +312,15 @@ declare const datePicker: tailwind_variants.TVReturnType<{
|
|
|
312
312
|
[x: string]: {
|
|
313
313
|
[x: string]: tailwind_variants.ClassValue | {
|
|
314
314
|
root?: tailwind_variants.ClassValue;
|
|
315
|
-
label?: tailwind_variants.ClassValue;
|
|
316
315
|
row?: tailwind_variants.ClassValue;
|
|
316
|
+
hint?: tailwind_variants.ClassValue;
|
|
317
|
+
error?: tailwind_variants.ClassValue;
|
|
318
|
+
label?: tailwind_variants.ClassValue;
|
|
317
319
|
icon?: tailwind_variants.ClassValue;
|
|
318
320
|
content?: tailwind_variants.ClassValue;
|
|
319
321
|
layout?: tailwind_variants.ClassValue;
|
|
320
322
|
presets?: tailwind_variants.ClassValue;
|
|
321
323
|
presetNode?: tailwind_variants.ClassValue;
|
|
322
|
-
hint?: tailwind_variants.ClassValue;
|
|
323
|
-
error?: tailwind_variants.ClassValue;
|
|
324
324
|
trigger?: tailwind_variants.ClassValue;
|
|
325
325
|
clear?: tailwind_variants.ClassValue;
|
|
326
326
|
preset?: tailwind_variants.ClassValue;
|
|
@@ -344,15 +344,15 @@ declare const datePicker: tailwind_variants.TVReturnType<{
|
|
|
344
344
|
[key: string]: {
|
|
345
345
|
[key: string]: tailwind_variants.ClassValue | {
|
|
346
346
|
root?: tailwind_variants.ClassValue;
|
|
347
|
-
label?: tailwind_variants.ClassValue;
|
|
348
347
|
row?: tailwind_variants.ClassValue;
|
|
348
|
+
hint?: tailwind_variants.ClassValue;
|
|
349
|
+
error?: tailwind_variants.ClassValue;
|
|
350
|
+
label?: tailwind_variants.ClassValue;
|
|
349
351
|
icon?: tailwind_variants.ClassValue;
|
|
350
352
|
content?: tailwind_variants.ClassValue;
|
|
351
353
|
layout?: tailwind_variants.ClassValue;
|
|
352
354
|
presets?: tailwind_variants.ClassValue;
|
|
353
355
|
presetNode?: tailwind_variants.ClassValue;
|
|
354
|
-
hint?: tailwind_variants.ClassValue;
|
|
355
|
-
error?: tailwind_variants.ClassValue;
|
|
356
356
|
trigger?: tailwind_variants.ClassValue;
|
|
357
357
|
clear?: tailwind_variants.ClassValue;
|
|
358
358
|
preset?: tailwind_variants.ClassValue;
|
package/dist/filter-bar.d.ts
CHANGED
|
@@ -74,8 +74,8 @@ declare function SavedViews({ views, current, modified, onSelect, onSave, onRena
|
|
|
74
74
|
declare const filterBar: tailwind_variants.TVReturnType<{
|
|
75
75
|
[key: string]: {
|
|
76
76
|
[key: string]: tailwind_variants.ClassValue | {
|
|
77
|
-
count?: tailwind_variants.ClassValue;
|
|
78
77
|
root?: tailwind_variants.ClassValue;
|
|
78
|
+
count?: tailwind_variants.ClassValue;
|
|
79
79
|
controls?: tailwind_variants.ClassValue;
|
|
80
80
|
active?: tailwind_variants.ClassValue;
|
|
81
81
|
clear?: tailwind_variants.ClassValue;
|
|
@@ -87,8 +87,8 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
87
87
|
} | {
|
|
88
88
|
[x: string]: {
|
|
89
89
|
[x: string]: tailwind_variants.ClassValue | {
|
|
90
|
-
count?: tailwind_variants.ClassValue;
|
|
91
90
|
root?: tailwind_variants.ClassValue;
|
|
91
|
+
count?: tailwind_variants.ClassValue;
|
|
92
92
|
controls?: tailwind_variants.ClassValue;
|
|
93
93
|
active?: tailwind_variants.ClassValue;
|
|
94
94
|
clear?: tailwind_variants.ClassValue;
|
|
@@ -109,8 +109,8 @@ declare const filterBar: tailwind_variants.TVReturnType<{
|
|
|
109
109
|
}, undefined, {
|
|
110
110
|
[key: string]: {
|
|
111
111
|
[key: string]: tailwind_variants.ClassValue | {
|
|
112
|
-
count?: tailwind_variants.ClassValue;
|
|
113
112
|
root?: tailwind_variants.ClassValue;
|
|
113
|
+
count?: tailwind_variants.ClassValue;
|
|
114
114
|
controls?: tailwind_variants.ClassValue;
|
|
115
115
|
active?: tailwind_variants.ClassValue;
|
|
116
116
|
clear?: tailwind_variants.ClassValue;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cx
|
|
4
|
+
} from "./chunk-6ISW63JI.js";
|
|
2
5
|
import {
|
|
3
6
|
MotionObserver,
|
|
4
7
|
RotatingWord
|
|
@@ -18,9 +21,6 @@ import {
|
|
|
18
21
|
neutral,
|
|
19
22
|
useIds
|
|
20
23
|
} from "./chunk-B2HS5EAH.js";
|
|
21
|
-
import {
|
|
22
|
-
cx
|
|
23
|
-
} from "./chunk-6ISW63JI.js";
|
|
24
24
|
|
|
25
25
|
// src/marks/wu-sama-geometry.ts
|
|
26
26
|
import { marks } from "@krizaka/tokens/native";
|