@rojaostudio/ds 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -0
- package/brand/rojao-black-on-white.png +0 -0
- package/brand/rojao-black.png +0 -0
- package/brand/rojao-white-on-black.png +0 -0
- package/brand/rojao-white.png +0 -0
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/compat/generate.d.ts +6 -0
- package/dist/compat/generate.js +1 -0
- package/dist/compat/recipes.d.ts +1 -0
- package/dist/compat/recipes.js +1 -0
- package/dist/compat/themes.d.ts +1 -0
- package/dist/compat/themes.js +1 -0
- package/dist/compat/tokens.d.ts +1 -0
- package/dist/compat/tokens.js +1 -0
- package/dist/components/accordion.d.ts +35 -0
- package/dist/components/accordion.js +95 -0
- package/dist/components/alert.d.ts +24 -0
- package/dist/components/alert.js +72 -0
- package/dist/components/avatar.d.ts +45 -0
- package/dist/components/avatar.js +97 -0
- package/dist/components/badge.d.ts +45 -0
- package/dist/components/badge.js +114 -0
- package/dist/components/blocker-card.d.ts +42 -0
- package/dist/components/blocker-card.js +45 -0
- package/dist/components/bottom-sheet.d.ts +31 -0
- package/dist/components/bottom-sheet.js +120 -0
- package/dist/components/breadcrumb.d.ts +28 -0
- package/dist/components/breadcrumb.js +52 -0
- package/dist/components/button.d.ts +27 -0
- package/dist/components/button.js +124 -0
- package/dist/components/card.d.ts +27 -0
- package/dist/components/card.js +52 -0
- package/dist/components/chat-bubble.d.ts +16 -0
- package/dist/components/chat-bubble.js +55 -0
- package/dist/components/checkbox.d.ts +14 -0
- package/dist/components/checkbox.js +78 -0
- package/dist/components/chip-input.d.ts +26 -0
- package/dist/components/chip-input.js +182 -0
- package/dist/components/chips.d.ts +22 -0
- package/dist/components/chips.js +94 -0
- package/dist/components/choice-card.d.ts +16 -0
- package/dist/components/choice-card.js +60 -0
- package/dist/components/choice-carousel.d.ts +16 -0
- package/dist/components/choice-carousel.js +154 -0
- package/dist/components/choice-preview-card.d.ts +37 -0
- package/dist/components/choice-preview-card.js +39 -0
- package/dist/components/color-input.d.ts +20 -0
- package/dist/components/color-input.js +79 -0
- package/dist/components/combobox.d.ts +70 -0
- package/dist/components/combobox.js +213 -0
- package/dist/components/context-menu.d.ts +33 -0
- package/dist/components/context-menu.js +70 -0
- package/dist/components/copilot-hint.d.ts +18 -0
- package/dist/components/copilot-hint.js +63 -0
- package/dist/components/copy-field.d.ts +16 -0
- package/dist/components/copy-field.js +41 -0
- package/dist/components/currency-input.d.ts +32 -0
- package/dist/components/currency-input.js +138 -0
- package/dist/components/danger-zone.d.ts +20 -0
- package/dist/components/danger-zone.js +21 -0
- package/dist/components/data-table-header.d.ts +43 -0
- package/dist/components/data-table-header.js +205 -0
- package/dist/components/date-picker.d.ts +40 -0
- package/dist/components/date-picker.js +252 -0
- package/dist/components/divider.d.ts +20 -0
- package/dist/components/divider.js +47 -0
- package/dist/components/drawer.d.ts +26 -0
- package/dist/components/drawer.js +82 -0
- package/dist/components/dropzone.d.ts +19 -0
- package/dist/components/dropzone.js +65 -0
- package/dist/components/empty-state.d.ts +48 -0
- package/dist/components/empty-state.js +91 -0
- package/dist/components/fab.d.ts +38 -0
- package/dist/components/fab.js +100 -0
- package/dist/components/filter-chip.d.ts +54 -0
- package/dist/components/filter-chip.js +66 -0
- package/dist/components/floating-stepper.d.ts +44 -0
- package/dist/components/floating-stepper.js +53 -0
- package/dist/components/form-card-header.d.ts +13 -0
- package/dist/components/form-card-header.js +8 -0
- package/dist/components/icon-button.d.ts +17 -0
- package/dist/components/icon-button.js +80 -0
- package/dist/components/image-crop-modal.d.ts +59 -0
- package/dist/components/image-crop-modal.js +240 -0
- package/dist/components/image-upload.d.ts +72 -0
- package/dist/components/image-upload.js +271 -0
- package/dist/components/index.d.ts +85 -0
- package/dist/components/index.js +200 -0
- package/dist/components/input.d.ts +25 -0
- package/dist/components/input.js +136 -0
- package/dist/components/insight-card.d.ts +19 -0
- package/dist/components/insight-card.js +27 -0
- package/dist/components/label.d.ts +16 -0
- package/dist/components/label.js +43 -0
- package/dist/components/media-tile.d.ts +24 -0
- package/dist/components/media-tile.js +28 -0
- package/dist/components/menu.d.ts +50 -0
- package/dist/components/menu.js +80 -0
- package/dist/components/modal.d.ts +25 -0
- package/dist/components/modal.js +71 -0
- package/dist/components/notice.d.ts +50 -0
- package/dist/components/notice.js +103 -0
- package/dist/components/option-tile.d.ts +60 -0
- package/dist/components/option-tile.js +144 -0
- package/dist/components/page-shell.d.ts +29 -0
- package/dist/components/page-shell.js +36 -0
- package/dist/components/page-skeleton.d.ts +35 -0
- package/dist/components/page-skeleton.js +12 -0
- package/dist/components/page-tabs.d.ts +35 -0
- package/dist/components/page-tabs.js +55 -0
- package/dist/components/pagination.d.ts +31 -0
- package/dist/components/pagination.js +80 -0
- package/dist/components/paywall-banner.d.ts +37 -0
- package/dist/components/paywall-banner.js +42 -0
- package/dist/components/paywall.d.ts +44 -0
- package/dist/components/paywall.js +55 -0
- package/dist/components/phone-frame.d.ts +9 -0
- package/dist/components/phone-frame.js +18 -0
- package/dist/components/phone-input.d.ts +24 -0
- package/dist/components/phone-input.js +92 -0
- package/dist/components/pix-icon.d.ts +8 -0
- package/dist/components/pix-icon.js +24 -0
- package/dist/components/popover.d.ts +44 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/pricing-card.d.ts +42 -0
- package/dist/components/pricing-card.js +29 -0
- package/dist/components/qr-display.d.ts +19 -0
- package/dist/components/qr-display.js +24 -0
- package/dist/components/radio.d.ts +33 -0
- package/dist/components/radio.js +97 -0
- package/dist/components/row-actions.d.ts +24 -0
- package/dist/components/row-actions.js +76 -0
- package/dist/components/saving-bar-context.d.ts +40 -0
- package/dist/components/saving-bar-context.js +125 -0
- package/dist/components/saving-bar.d.ts +18 -0
- package/dist/components/saving-bar.js +72 -0
- package/dist/components/search.d.ts +30 -0
- package/dist/components/search.js +81 -0
- package/dist/components/section-card.d.ts +14 -0
- package/dist/components/section-card.js +49 -0
- package/dist/components/section-header.d.ts +29 -0
- package/dist/components/section-header.js +7 -0
- package/dist/components/select.d.ts +21 -0
- package/dist/components/select.js +140 -0
- package/dist/components/selectable-card.d.ts +35 -0
- package/dist/components/selectable-card.js +27 -0
- package/dist/components/setting-row.d.ts +33 -0
- package/dist/components/setting-row.js +19 -0
- package/dist/components/settings-list.d.ts +25 -0
- package/dist/components/settings-list.js +22 -0
- package/dist/components/skeleton.d.ts +24 -0
- package/dist/components/skeleton.js +49 -0
- package/dist/components/slider.d.ts +32 -0
- package/dist/components/slider.js +79 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +36 -0
- package/dist/components/step-progress.d.ts +12 -0
- package/dist/components/step-progress.js +24 -0
- package/dist/components/summary-bar.d.ts +31 -0
- package/dist/components/summary-bar.js +54 -0
- package/dist/components/table.d.ts +23 -0
- package/dist/components/table.js +80 -0
- package/dist/components/textarea.d.ts +21 -0
- package/dist/components/textarea.js +95 -0
- package/dist/components/themed.d.ts +36 -0
- package/dist/components/themed.js +22 -0
- package/dist/components/time-picker.d.ts +34 -0
- package/dist/components/time-picker.js +213 -0
- package/dist/components/toaster.d.ts +84 -0
- package/dist/components/toaster.js +284 -0
- package/dist/components/toggle-card-compact.d.ts +21 -0
- package/dist/components/toggle-card-compact.js +99 -0
- package/dist/components/toggle-card.d.ts +15 -0
- package/dist/components/toggle-card.js +76 -0
- package/dist/components/toggle-group.d.ts +67 -0
- package/dist/components/toggle-group.js +80 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +64 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +89 -0
- package/dist/components/typing-indicator.d.ts +8 -0
- package/dist/components/typing-indicator.js +27 -0
- package/dist/components/use-dismiss.d.ts +9 -0
- package/dist/components/use-dismiss.js +28 -0
- package/dist/components/use-focus-trap.d.ts +5 -0
- package/dist/components/use-focus-trap.js +54 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +89 -0
- package/dist/targets/native/components/accordion.d.ts +18 -0
- package/dist/targets/native/components/accordion.js +122 -0
- package/dist/targets/native/components/alert.d.ts +16 -0
- package/dist/targets/native/components/alert.js +58 -0
- package/dist/targets/native/components/avatar.d.ts +25 -0
- package/dist/targets/native/components/avatar.js +88 -0
- package/dist/targets/native/components/badge.d.ts +27 -0
- package/dist/targets/native/components/badge.js +59 -0
- package/dist/targets/native/components/button.d.ts +18 -0
- package/dist/targets/native/components/button.js +84 -0
- package/dist/targets/native/components/card.d.ts +6 -0
- package/dist/targets/native/components/card.js +36 -0
- package/dist/targets/native/components/checkbox.d.ts +12 -0
- package/dist/targets/native/components/checkbox.js +59 -0
- package/dist/targets/native/components/chips.d.ts +17 -0
- package/dist/targets/native/components/chips.js +77 -0
- package/dist/targets/native/components/choice-card.d.ts +11 -0
- package/dist/targets/native/components/choice-card.js +52 -0
- package/dist/targets/native/components/context-menu.d.ts +11 -0
- package/dist/targets/native/components/context-menu.js +19 -0
- package/dist/targets/native/components/currency-input.d.ts +22 -0
- package/dist/targets/native/components/currency-input.js +105 -0
- package/dist/targets/native/components/danger-zone.d.ts +13 -0
- package/dist/targets/native/components/danger-zone.js +27 -0
- package/dist/targets/native/components/date-picker.d.ts +13 -0
- package/dist/targets/native/components/date-picker.js +185 -0
- package/dist/targets/native/components/divider.d.ts +9 -0
- package/dist/targets/native/components/divider.js +36 -0
- package/dist/targets/native/components/empty-state.d.ts +13 -0
- package/dist/targets/native/components/empty-state.js +10 -0
- package/dist/targets/native/components/fab.d.ts +25 -0
- package/dist/targets/native/components/fab.js +112 -0
- package/dist/targets/native/components/filter-chip.d.ts +22 -0
- package/dist/targets/native/components/filter-chip.js +70 -0
- package/dist/targets/native/components/form-field.d.ts +13 -0
- package/dist/targets/native/components/form-field.js +29 -0
- package/dist/targets/native/components/form-screen.d.ts +19 -0
- package/dist/targets/native/components/form-screen.js +88 -0
- package/dist/targets/native/components/google-icon.d.ts +8 -0
- package/dist/targets/native/components/google-icon.js +32 -0
- package/dist/targets/native/components/icon-button.d.ts +18 -0
- package/dist/targets/native/components/icon-button.js +80 -0
- package/dist/targets/native/components/icon.d.ts +11 -0
- package/dist/targets/native/components/icon.js +9 -0
- package/dist/targets/native/components/image-upload.d.ts +12 -0
- package/dist/targets/native/components/image-upload.js +95 -0
- package/dist/targets/native/components/index.d.ts +45 -0
- package/dist/targets/native/components/index.js +100 -0
- package/dist/targets/native/components/input.d.ts +17 -0
- package/dist/targets/native/components/input.js +103 -0
- package/dist/targets/native/components/list-item.d.ts +20 -0
- package/dist/targets/native/components/list-item.js +71 -0
- package/dist/targets/native/components/menu.d.ts +24 -0
- package/dist/targets/native/components/menu.js +71 -0
- package/dist/targets/native/components/modal.d.ts +15 -0
- package/dist/targets/native/components/modal.js +110 -0
- package/dist/targets/native/components/paywall-banner.d.ts +11 -0
- package/dist/targets/native/components/paywall-banner.js +46 -0
- package/dist/targets/native/components/paywall.d.ts +18 -0
- package/dist/targets/native/components/paywall.js +61 -0
- package/dist/targets/native/components/radio.d.ts +20 -0
- package/dist/targets/native/components/radio.js +71 -0
- package/dist/targets/native/components/search.d.ts +22 -0
- package/dist/targets/native/components/search.js +92 -0
- package/dist/targets/native/components/select.d.ts +17 -0
- package/dist/targets/native/components/select.js +86 -0
- package/dist/targets/native/components/sheet.d.ts +11 -0
- package/dist/targets/native/components/sheet.js +51 -0
- package/dist/targets/native/components/skeleton.d.ts +18 -0
- package/dist/targets/native/components/skeleton.js +52 -0
- package/dist/targets/native/components/slider.d.ts +18 -0
- package/dist/targets/native/components/slider.js +153 -0
- package/dist/targets/native/components/spinner.d.ts +7 -0
- package/dist/targets/native/components/spinner.js +10 -0
- package/dist/targets/native/components/stepper.d.ts +10 -0
- package/dist/targets/native/components/stepper.js +33 -0
- package/dist/targets/native/components/switch.d.ts +20 -0
- package/dist/targets/native/components/switch.js +68 -0
- package/dist/targets/native/components/text.d.ts +12 -0
- package/dist/targets/native/components/text.js +31 -0
- package/dist/targets/native/components/textarea.d.ts +13 -0
- package/dist/targets/native/components/textarea.js +92 -0
- package/dist/targets/native/components/theme.d.ts +18 -0
- package/dist/targets/native/components/theme.js +20 -0
- package/dist/targets/native/components/toaster.d.ts +35 -0
- package/dist/targets/native/components/toaster.js +159 -0
- package/dist/targets/native/fonts.d.ts +9 -0
- package/dist/targets/native/fonts.js +10 -0
- package/dist/targets/native/icons.d.ts +1 -0
- package/dist/targets/native/icons.js +1 -0
- package/dist/targets/native/index.d.ts +3 -0
- package/dist/targets/native/index.js +11 -0
- package/dist/targets/native/preset.cjs +69 -0
- package/dist/targets/native/resolve.d.ts +22 -0
- package/dist/targets/native/resolve.js +85 -0
- package/dist/targets/native/theme.css +118 -0
- package/dist/targets/native/theme.d.ts +117 -0
- package/dist/targets/native/theme.js +118 -0
- package/package.json +194 -0
- package/styles/_primitives.generated.css +284 -0
- package/styles/base.css +950 -0
- package/styles/themes/rojao.css +107 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { forwardRef, useState, useEffect, useRef, useImperativeHandle } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
const ContextMenu = forwardRef(function ContextMenu2({
|
|
6
|
+
children,
|
|
7
|
+
menu,
|
|
8
|
+
minWidth = 180,
|
|
9
|
+
disabled = false,
|
|
10
|
+
className = ""
|
|
11
|
+
}, ref) {
|
|
12
|
+
const [pos, setPos] = useState(null);
|
|
13
|
+
const [mounted, setMounted] = useState(false);
|
|
14
|
+
const containerRef = useRef(null);
|
|
15
|
+
const menuRef = useRef(null);
|
|
16
|
+
useImperativeHandle(ref, () => containerRef.current);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setMounted(true);
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!pos) return;
|
|
22
|
+
const close = () => setPos(null);
|
|
23
|
+
const handleClick = (e) => {
|
|
24
|
+
var _a;
|
|
25
|
+
if ((_a = menuRef.current) == null ? void 0 : _a.contains(e.target)) return;
|
|
26
|
+
close();
|
|
27
|
+
};
|
|
28
|
+
const handleKey = (e) => {
|
|
29
|
+
if (e.key === "Escape") close();
|
|
30
|
+
};
|
|
31
|
+
document.addEventListener("mousedown", handleClick);
|
|
32
|
+
document.addEventListener("keydown", handleKey);
|
|
33
|
+
document.addEventListener("scroll", close, true);
|
|
34
|
+
return () => {
|
|
35
|
+
document.removeEventListener("mousedown", handleClick);
|
|
36
|
+
document.removeEventListener("keydown", handleKey);
|
|
37
|
+
document.removeEventListener("scroll", close, true);
|
|
38
|
+
};
|
|
39
|
+
}, [pos]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!pos || !menuRef.current) return;
|
|
42
|
+
const rect = menuRef.current.getBoundingClientRect();
|
|
43
|
+
const { innerWidth: vw, innerHeight: vh } = window;
|
|
44
|
+
let { x, y } = pos;
|
|
45
|
+
if (x + rect.width > vw - 8) x = vw - rect.width - 8;
|
|
46
|
+
if (y + rect.height > vh - 8) y = vh - rect.height - 8;
|
|
47
|
+
if (x !== pos.x || y !== pos.y) setPos({ x, y });
|
|
48
|
+
}, [pos]);
|
|
49
|
+
function handleContext(e) {
|
|
50
|
+
if (disabled) return;
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
setPos({ x: e.clientX, y: e.clientY });
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { ref: containerRef, onContextMenu: handleContext, className }, children), mounted && pos && createPortal(
|
|
55
|
+
/* @__PURE__ */ React.createElement(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
ref: menuRef,
|
|
59
|
+
role: "menu",
|
|
60
|
+
className: "fixed z-[1000] rounded-(--radius-card) border border-stroke-default bg-surface-default shadow-lg py-1",
|
|
61
|
+
style: { top: pos.y, left: pos.x, minWidth }
|
|
62
|
+
},
|
|
63
|
+
typeof menu === "function" ? menu({ close: () => setPos(null) }) : menu
|
|
64
|
+
),
|
|
65
|
+
document.body
|
|
66
|
+
));
|
|
67
|
+
});
|
|
68
|
+
export {
|
|
69
|
+
ContextMenu
|
|
70
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
type CopilotHintPriority = 'high' | 'medium' | 'low';
|
|
4
|
+
interface CopilotHintProps {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
cta?: {
|
|
9
|
+
label: string;
|
|
10
|
+
href: string;
|
|
11
|
+
};
|
|
12
|
+
dismissible?: boolean;
|
|
13
|
+
priority?: CopilotHintPriority;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function CopilotHint({ id, title, description, cta, dismissible, priority, className, }: CopilotHintProps): react.JSX.Element | null;
|
|
17
|
+
|
|
18
|
+
export { CopilotHint, type CopilotHintPriority, type CopilotHintProps };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
function CopilotHint({
|
|
5
|
+
id,
|
|
6
|
+
title,
|
|
7
|
+
description,
|
|
8
|
+
cta,
|
|
9
|
+
dismissible = true,
|
|
10
|
+
priority = "medium",
|
|
11
|
+
className = ""
|
|
12
|
+
}) {
|
|
13
|
+
const [dismissed, setDismissed] = useState(true);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setDismissed(localStorage.getItem(`copilot-dismissed:${id}`) === "1");
|
|
16
|
+
}, [id]);
|
|
17
|
+
if (dismissed) return null;
|
|
18
|
+
function dismiss() {
|
|
19
|
+
localStorage.setItem(`copilot-dismissed:${id}`, "1");
|
|
20
|
+
setDismissed(true);
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ React.createElement(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: [
|
|
26
|
+
"rounded-(--radius-card) border bg-(--surface-raised) p-4 flex gap-3",
|
|
27
|
+
priority === "high" ? "border-brand-primary" : "border-stroke-default",
|
|
28
|
+
className
|
|
29
|
+
].filter(Boolean).join(" ")
|
|
30
|
+
},
|
|
31
|
+
priority === "high" && /* @__PURE__ */ React.createElement("div", { className: "w-1 self-stretch rounded-full bg-(--brand-primary) shrink-0" }),
|
|
32
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("p", { className: "text-label font-medium text-(--text-primary)" }, title), description && /* @__PURE__ */ React.createElement("p", { className: "text-caption text-(--text-muted) mt-0.5 leading-relaxed" }, description), cta && /* @__PURE__ */ React.createElement(
|
|
33
|
+
"a",
|
|
34
|
+
{
|
|
35
|
+
href: cta.href,
|
|
36
|
+
className: "mt-2 inline-flex text-caption font-medium text-(--brand-primary) hover:underline"
|
|
37
|
+
},
|
|
38
|
+
cta.label,
|
|
39
|
+
" \u2192"
|
|
40
|
+
)),
|
|
41
|
+
dismissible && /* @__PURE__ */ React.createElement(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: dismiss,
|
|
46
|
+
"aria-label": "Dispensar",
|
|
47
|
+
className: "text-(--text-disabled) hover:text-(--text-secondary) transition-colors shrink-0 self-start"
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ React.createElement("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none" }, /* @__PURE__ */ React.createElement(
|
|
50
|
+
"path",
|
|
51
|
+
{
|
|
52
|
+
d: "M1 1l12 12M13 1L1 13",
|
|
53
|
+
stroke: "currentColor",
|
|
54
|
+
strokeWidth: "1.5",
|
|
55
|
+
strokeLinecap: "round"
|
|
56
|
+
}
|
|
57
|
+
))
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
CopilotHint
|
|
63
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
interface CopyFieldProps {
|
|
4
|
+
/** Texto copiado pro clipboard. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Rótulo do botão em repouso. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Rótulo após copiar (feedback). */
|
|
9
|
+
copiedLabel?: string;
|
|
10
|
+
/** Largura total do container. */
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function CopyField({ value, label, copiedLabel, fullWidth, className, }: CopyFieldProps): react.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { CopyField, type CopyFieldProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Copy, Check } from "lucide-react";
|
|
5
|
+
function CopyField({
|
|
6
|
+
value,
|
|
7
|
+
label = "Copiar",
|
|
8
|
+
copiedLabel = "Copiado!",
|
|
9
|
+
fullWidth = false,
|
|
10
|
+
className = ""
|
|
11
|
+
}) {
|
|
12
|
+
const [copied, setCopied] = useState(false);
|
|
13
|
+
async function handleCopy() {
|
|
14
|
+
try {
|
|
15
|
+
await navigator.clipboard.writeText(value);
|
|
16
|
+
setCopied(true);
|
|
17
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick: handleCopy,
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
className: [
|
|
28
|
+
"inline-flex items-center justify-center gap-2 h-control-md px-4 rounded-(--radius-card)",
|
|
29
|
+
"border border-stroke-default text-fg-secondary text-sm font-semibold",
|
|
30
|
+
"hover:bg-surface-hover transition-colors focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
31
|
+
fullWidth ? "w-full" : "",
|
|
32
|
+
className
|
|
33
|
+
].join(" ")
|
|
34
|
+
},
|
|
35
|
+
copied ? /* @__PURE__ */ React.createElement(Check, { className: "size-4 shrink-0 text-success-text" }) : /* @__PURE__ */ React.createElement(Copy, { className: "size-4 shrink-0" }),
|
|
36
|
+
copied ? copiedLabel : label
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
CopyField
|
|
41
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface CurrencyInputProps {
|
|
5
|
+
/** Label renderada acima do controle (mesmo padrão do Input do DS). */
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/** Nome do hidden input pra submission (server actions, forms). */
|
|
8
|
+
name: string;
|
|
9
|
+
/** ISO 4217 — 'BRL', 'USD', 'JPY', etc. Quando passada, resolve symbol/decimals/locale automaticamente. */
|
|
10
|
+
currency?: string;
|
|
11
|
+
/** Símbolo da moeda exibido à esquerda (R$, $, €, ₿). Obrigatório se `currency` não for passada. */
|
|
12
|
+
symbol?: string;
|
|
13
|
+
/** Casas decimais. BRL/USD = 2, JPY = 0, BTC = 8. Obrigatório se `currency` não for passada. */
|
|
14
|
+
decimals?: number;
|
|
15
|
+
/** Locale pra formatação. Default depende de `currency` (BRL→pt-BR etc) ou 'en'. */
|
|
16
|
+
locale?: string;
|
|
17
|
+
/** Valor inicial em SUBUNITS (integer). Ex: 9900 = R$99,00. */
|
|
18
|
+
defaultValueSubunits?: number | null;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Callback com valor atual em subunits a cada mudança. */
|
|
22
|
+
onChange?: (subunits: number) => void;
|
|
23
|
+
/** Máximo de dígitos. default = 10 → R$ 99.999.999,99. */
|
|
24
|
+
maxDigits?: number;
|
|
25
|
+
/** Mostrar "0,00" em vez do placeholder quando valor é zero. default = false. */
|
|
26
|
+
showZero?: boolean;
|
|
27
|
+
size?: 'sm' | 'md' | 'lg';
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
declare function CurrencyInput({ label, name, currency, symbol: symbolProp, decimals: decimalsProp, locale: localeProp, defaultValueSubunits, placeholder, disabled, onChange, maxDigits, showZero, size, className, }: CurrencyInputProps): react.JSX.Element;
|
|
31
|
+
|
|
32
|
+
export { CurrencyInput, type CurrencyInputProps };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { useState, useRef, useId, useMemo } from "react";
|
|
4
|
+
const CURRENCY_LOCALE = {
|
|
5
|
+
BRL: "pt-BR",
|
|
6
|
+
USD: "en-US",
|
|
7
|
+
EUR: "de-DE",
|
|
8
|
+
GBP: "en-GB",
|
|
9
|
+
JPY: "ja-JP",
|
|
10
|
+
CNY: "zh-CN",
|
|
11
|
+
KRW: "ko-KR",
|
|
12
|
+
INR: "en-IN",
|
|
13
|
+
MXN: "es-MX",
|
|
14
|
+
COP: "es-CO",
|
|
15
|
+
ARS: "es-AR",
|
|
16
|
+
CLP: "es-CL",
|
|
17
|
+
PEN: "es-PE",
|
|
18
|
+
UYU: "es-UY",
|
|
19
|
+
CAD: "en-CA",
|
|
20
|
+
AUD: "en-AU",
|
|
21
|
+
CHF: "de-CH",
|
|
22
|
+
SGD: "en-SG",
|
|
23
|
+
HKD: "zh-HK",
|
|
24
|
+
TWD: "zh-TW"
|
|
25
|
+
};
|
|
26
|
+
function resolveCurrency(currency, explicitLocale) {
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
const locale = (_a = explicitLocale != null ? explicitLocale : CURRENCY_LOCALE[currency]) != null ? _a : "en";
|
|
29
|
+
try {
|
|
30
|
+
const fmt = new Intl.NumberFormat(locale, { style: "currency", currency, currencyDisplay: "narrowSymbol" });
|
|
31
|
+
const decimals = (_b = fmt.resolvedOptions().maximumFractionDigits) != null ? _b : 2;
|
|
32
|
+
const symbol = (_d = (_c = fmt.formatToParts(0).find((p) => p.type === "currency")) == null ? void 0 : _c.value) != null ? _d : currency;
|
|
33
|
+
return { symbol, decimals, locale };
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return { symbol: currency, decimals: 2, locale };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const SIZE_INPUT = {
|
|
39
|
+
sm: "h-control-sm text-caption pl-7 pr-3",
|
|
40
|
+
md: "h-control-md text-label pl-9 pr-3",
|
|
41
|
+
lg: "h-control-lg text-body pl-10 pr-3"
|
|
42
|
+
};
|
|
43
|
+
const SIZE_SYMBOL = {
|
|
44
|
+
sm: "left-2.5 text-caption",
|
|
45
|
+
md: "left-3 text-label",
|
|
46
|
+
lg: "left-3.5 text-body"
|
|
47
|
+
};
|
|
48
|
+
function formatSubunits(subunits, decimals, locale) {
|
|
49
|
+
const divisor = Math.pow(10, decimals);
|
|
50
|
+
const decimal = subunits / divisor;
|
|
51
|
+
return new Intl.NumberFormat(locale, {
|
|
52
|
+
minimumFractionDigits: decimals,
|
|
53
|
+
maximumFractionDigits: decimals
|
|
54
|
+
}).format(decimal);
|
|
55
|
+
}
|
|
56
|
+
function CurrencyInput({
|
|
57
|
+
label,
|
|
58
|
+
name,
|
|
59
|
+
currency,
|
|
60
|
+
symbol: symbolProp,
|
|
61
|
+
decimals: decimalsProp,
|
|
62
|
+
locale: localeProp,
|
|
63
|
+
defaultValueSubunits,
|
|
64
|
+
placeholder,
|
|
65
|
+
disabled,
|
|
66
|
+
onChange,
|
|
67
|
+
maxDigits = 10,
|
|
68
|
+
showZero = false,
|
|
69
|
+
size = "md",
|
|
70
|
+
className = ""
|
|
71
|
+
}) {
|
|
72
|
+
const id = useId();
|
|
73
|
+
const inputRef = useRef(null);
|
|
74
|
+
const [subunits, setSubunits] = useState(defaultValueSubunits != null ? defaultValueSubunits : 0);
|
|
75
|
+
const { symbol, decimals, locale } = useMemo(() => {
|
|
76
|
+
if (currency) {
|
|
77
|
+
const resolved = resolveCurrency(currency, localeProp);
|
|
78
|
+
return {
|
|
79
|
+
symbol: symbolProp != null ? symbolProp : resolved.symbol,
|
|
80
|
+
decimals: decimalsProp != null ? decimalsProp : resolved.decimals,
|
|
81
|
+
locale: resolved.locale
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
symbol: symbolProp != null ? symbolProp : "$",
|
|
86
|
+
decimals: decimalsProp != null ? decimalsProp : 2,
|
|
87
|
+
locale: localeProp != null ? localeProp : "en-US"
|
|
88
|
+
};
|
|
89
|
+
}, [currency, symbolProp, decimalsProp, localeProp]);
|
|
90
|
+
function update(next) {
|
|
91
|
+
setSubunits(next);
|
|
92
|
+
onChange == null ? void 0 : onChange(next);
|
|
93
|
+
}
|
|
94
|
+
function handleChange(e) {
|
|
95
|
+
if (disabled) return;
|
|
96
|
+
const digits = e.target.value.replace(/\D/g, "").slice(0, maxDigits);
|
|
97
|
+
update(digits === "" ? 0 : parseInt(digits, 10));
|
|
98
|
+
}
|
|
99
|
+
const isEmpty = subunits === 0 && !showZero;
|
|
100
|
+
const displayValue = isEmpty ? "" : formatSubunits(subunits, decimals, locale);
|
|
101
|
+
const placeholderText = placeholder != null ? placeholder : formatSubunits(0, decimals, locale);
|
|
102
|
+
const control = /* @__PURE__ */ React.createElement("div", { className: ["relative flex items-center", label ? "" : className].join(" ") }, /* @__PURE__ */ React.createElement(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
className: [
|
|
106
|
+
"absolute select-none pointer-events-none",
|
|
107
|
+
SIZE_SYMBOL[size],
|
|
108
|
+
disabled ? "text-fg-disabled" : "text-fg-muted"
|
|
109
|
+
].join(" ")
|
|
110
|
+
},
|
|
111
|
+
symbol
|
|
112
|
+
), /* @__PURE__ */ React.createElement(
|
|
113
|
+
"input",
|
|
114
|
+
{
|
|
115
|
+
ref: inputRef,
|
|
116
|
+
id,
|
|
117
|
+
type: "text",
|
|
118
|
+
inputMode: "numeric",
|
|
119
|
+
value: displayValue,
|
|
120
|
+
placeholder: placeholderText,
|
|
121
|
+
onChange: handleChange,
|
|
122
|
+
disabled,
|
|
123
|
+
className: [
|
|
124
|
+
"w-full rounded-(--radius-control) border border-stroke-control bg-surface-default",
|
|
125
|
+
"placeholder:text-fg-placeholder",
|
|
126
|
+
"focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
127
|
+
"transition-colors",
|
|
128
|
+
SIZE_INPUT[size],
|
|
129
|
+
disabled ? "bg-surface-raised text-fg-disabled cursor-not-allowed" : "text-fg-primary cursor-text"
|
|
130
|
+
].join(" ")
|
|
131
|
+
}
|
|
132
|
+
), /* @__PURE__ */ React.createElement("input", { type: "hidden", name, value: subunits }));
|
|
133
|
+
if (!label) return control;
|
|
134
|
+
return /* @__PURE__ */ React.createElement("div", { className: ["flex flex-col gap-1.5", className].join(" ") }, /* @__PURE__ */ React.createElement("label", { htmlFor: id, className: "text-label font-medium text-fg-primary" }, label), control);
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
CurrencyInput
|
|
138
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface DangerZoneProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function DangerZone({ title, description, children, className }: DangerZoneProps): react.JSX.Element;
|
|
11
|
+
interface DangerZoneItemProps {
|
|
12
|
+
title: ReactNode;
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
/** Ação à direita — normalmente um Button variant="outline" color="danger" size="sm". */
|
|
15
|
+
action?: ReactNode;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function DangerZoneItem({ title, description, action, className }: DangerZoneItemProps): react.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { DangerZone, DangerZoneItem, type DangerZoneItemProps, type DangerZoneProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { AlertTriangle } from "lucide-react";
|
|
4
|
+
import { FormCardHeader } from "./form-card-header.js";
|
|
5
|
+
function DangerZone({ title, description, children, className = "" }) {
|
|
6
|
+
return /* @__PURE__ */ React.createElement("section", { className: ["space-y-4", className].filter(Boolean).join(" ") }, (title || description) && /* @__PURE__ */ React.createElement(
|
|
7
|
+
FormCardHeader,
|
|
8
|
+
{
|
|
9
|
+
icon: /* @__PURE__ */ React.createElement(AlertTriangle, { size: 18, strokeWidth: 1.5 }),
|
|
10
|
+
title,
|
|
11
|
+
subtitle: description
|
|
12
|
+
}
|
|
13
|
+
), /* @__PURE__ */ React.createElement("div", { className: "rounded-(--radius-card) border p-5 bg-danger-soft border-danger-border" }, children));
|
|
14
|
+
}
|
|
15
|
+
function DangerZoneItem({ title, description, action, className = "" }) {
|
|
16
|
+
return /* @__PURE__ */ React.createElement("div", { className: ["flex items-start justify-between gap-4 py-4 first:pt-0 last:pb-0", className].filter(Boolean).join(" ") }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("p", { className: "text-sm font-medium text-(--text-primary)" }, title), description && /* @__PURE__ */ React.createElement("p", { className: "text-xs text-(--text-muted) mt-0.5 leading-relaxed" }, description)), action && /* @__PURE__ */ React.createElement("div", { className: "shrink-0" }, action));
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
DangerZone,
|
|
20
|
+
DangerZoneItem
|
|
21
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
type DataTableHeaderSearch = {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (v: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
};
|
|
8
|
+
type DataTableFilterOption = {
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
count?: number;
|
|
12
|
+
};
|
|
13
|
+
type DataTableFilterDef = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
options: DataTableFilterOption[];
|
|
18
|
+
onChange: (v: string) => void;
|
|
19
|
+
};
|
|
20
|
+
type DataTablePillDef = {
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
active: boolean;
|
|
24
|
+
count?: number;
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
};
|
|
27
|
+
type DataTableHeaderProps = {
|
|
28
|
+
search?: DataTableHeaderSearch;
|
|
29
|
+
filters?: DataTableFilterDef[];
|
|
30
|
+
pillFilters?: DataTablePillDef[];
|
|
31
|
+
onClear?: () => void;
|
|
32
|
+
actions?: React.ReactNode;
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Em mobile, move filters + actions para um BottomSheet. pillFilters sempre visíveis. */
|
|
35
|
+
mobileCollapse?: boolean;
|
|
36
|
+
};
|
|
37
|
+
declare function FilterDropdown({ f, placement }: {
|
|
38
|
+
f: DataTableFilterDef;
|
|
39
|
+
placement?: 'bottom-start' | 'bottom-end';
|
|
40
|
+
}): react.JSX.Element;
|
|
41
|
+
declare function DataTableHeader({ search, filters, pillFilters, onClear, actions, className, mobileCollapse, }: DataTableHeaderProps): react.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { type DataTableFilterDef, type DataTableFilterOption, DataTableHeader, type DataTableHeaderProps, type DataTableHeaderSearch, type DataTablePillDef, FilterDropdown };
|