@rojaostudio/ds 1.0.0 → 1.0.2
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/components/accordion.js +43 -37
- package/dist/components/alert.js +35 -28
- package/dist/components/avatar.js +41 -34
- package/dist/components/badge.js +21 -14
- package/dist/components/blocker-card.js +11 -2
- package/dist/components/bottom-sheet.js +60 -53
- package/dist/components/breadcrumb.js +32 -22
- package/dist/components/button.js +18 -11
- package/dist/components/card.js +24 -9
- package/dist/components/chat-bubble.js +6 -5
- package/dist/components/checkbox.js +61 -48
- package/dist/components/chip-input.js +98 -81
- package/dist/components/chips.js +36 -29
- package/dist/components/choice-card.js +48 -42
- package/dist/components/choice-carousel.js +79 -74
- package/dist/components/choice-preview-card.js +17 -6
- package/dist/components/color-input.js +41 -35
- package/dist/components/combobox.js +97 -75
- package/dist/components/context-menu.js +17 -13
- package/dist/components/copilot-hint.js +40 -31
- package/dist/components/copy-field.js +8 -5
- package/dist/components/currency-input.js +40 -32
- package/dist/components/danger-zone.js +19 -9
- package/dist/components/data-table-header.js +185 -135
- package/dist/components/date-picker.js +114 -95
- package/dist/components/divider.js +11 -8
- package/dist/components/drawer.js +40 -28
- package/dist/components/dropzone.js +23 -20
- package/dist/components/empty-state.js +26 -23
- package/dist/components/fab.js +38 -26
- package/dist/components/filter-chip.js +20 -16
- package/dist/components/floating-stepper.js +42 -32
- package/dist/components/form-card-header.js +9 -1
- package/dist/components/icon-button.js +19 -13
- package/dist/components/image-crop-modal.js +69 -48
- package/dist/components/image-upload.js +172 -128
- package/dist/components/input.js +90 -62
- package/dist/components/insight-card.js +12 -1
- package/dist/components/label.js +12 -7
- package/dist/components/media-tile.js +11 -8
- package/dist/components/menu.js +28 -25
- package/dist/components/modal.js +43 -28
- package/dist/components/notice.js +34 -16
- package/dist/components/option-tile.js +55 -49
- package/dist/components/page-shell.js +13 -6
- package/dist/components/page-skeleton.js +32 -2
- package/dist/components/page-tabs.js +39 -26
- package/dist/components/pagination.js +38 -33
- package/dist/components/paywall-banner.js +19 -3
- package/dist/components/paywall.js +18 -8
- package/dist/components/phone-frame.js +5 -4
- package/dist/components/phone-input.js +50 -31
- package/dist/components/pix-icon.js +11 -6
- package/dist/components/popover.js +27 -23
- package/dist/components/pricing-card.js +16 -1
- package/dist/components/qr-display.js +16 -11
- package/dist/components/radio.js +73 -56
- package/dist/components/row-actions.js +61 -53
- package/dist/components/saving-bar-context.js +35 -29
- package/dist/components/saving-bar.js +36 -33
- package/dist/components/search.js +49 -44
- package/dist/components/section-card.js +43 -35
- package/dist/components/section-header.js +11 -1
- package/dist/components/select.js +83 -62
- package/dist/components/selectable-card.js +10 -3
- package/dist/components/setting-row.js +11 -1
- package/dist/components/settings-list.js +9 -5
- package/dist/components/skeleton.js +6 -5
- package/dist/components/slider.js +52 -38
- package/dist/components/spinner.js +18 -12
- package/dist/components/step-progress.js +11 -10
- package/dist/components/summary-bar.js +33 -28
- package/dist/components/table.js +20 -15
- package/dist/components/textarea.js +40 -24
- package/dist/components/themed.d.ts +1 -1
- package/dist/components/themed.js +2 -1
- package/dist/components/time-picker.js +117 -97
- package/dist/components/toaster.js +80 -74
- package/dist/components/toggle-card-compact.js +79 -71
- package/dist/components/toggle-card.js +61 -53
- package/dist/components/toggle-group.js +35 -29
- package/dist/components/toggle.js +46 -36
- package/dist/components/tooltip.js +30 -25
- package/dist/components/typing-indicator.js +10 -7
- package/dist/targets/native/components/accordion.js +31 -25
- package/dist/targets/native/components/alert.js +22 -16
- package/dist/targets/native/components/avatar.js +36 -29
- package/dist/targets/native/components/badge.js +4 -3
- package/dist/targets/native/components/button.js +11 -4
- package/dist/targets/native/components/card.js +2 -1
- package/dist/targets/native/components/checkbox.js +18 -15
- package/dist/targets/native/components/chips.js +19 -16
- package/dist/targets/native/components/choice-card.js +29 -23
- package/dist/targets/native/components/context-menu.js +13 -9
- package/dist/targets/native/components/currency-input.js +28 -25
- package/dist/targets/native/components/danger-zone.js +10 -4
- package/dist/targets/native/components/date-picker.js +86 -70
- package/dist/targets/native/components/divider.js +3 -2
- package/dist/targets/native/components/empty-state.js +6 -1
- package/dist/targets/native/components/fab.js +32 -26
- package/dist/targets/native/components/filter-chip.js +9 -8
- package/dist/targets/native/components/form-field.js +20 -10
- package/dist/targets/native/components/form-screen.js +50 -45
- package/dist/targets/native/components/google-icon.js +31 -25
- package/dist/targets/native/components/icon-button.js +6 -4
- package/dist/targets/native/components/icon.js +2 -1
- package/dist/targets/native/components/image-upload.js +59 -50
- package/dist/targets/native/components/input.js +41 -34
- package/dist/targets/native/components/list-item.js +29 -23
- package/dist/targets/native/components/menu.js +12 -10
- package/dist/targets/native/components/modal.js +41 -32
- package/dist/targets/native/components/paywall-banner.js +13 -4
- package/dist/targets/native/components/paywall.js +11 -1
- package/dist/targets/native/components/radio.js +19 -16
- package/dist/targets/native/components/search.js +41 -38
- package/dist/targets/native/components/select.js +71 -63
- package/dist/targets/native/components/sheet.js +36 -30
- package/dist/targets/native/components/skeleton.js +6 -5
- package/dist/targets/native/components/slider.js +51 -43
- package/dist/targets/native/components/spinner.js +2 -1
- package/dist/targets/native/components/stepper.js +14 -9
- package/dist/targets/native/components/switch.js +15 -14
- package/dist/targets/native/components/text.js +2 -1
- package/dist/targets/native/components/textarea.js +2 -1
- package/dist/targets/native/components/theme.js +2 -1
- package/dist/targets/native/components/toaster.js +24 -21
- package/dist/targets/native/index.d.ts +1 -1
- package/dist/targets/native/index.js +1 -3
- package/package.json +190 -194
- package/styles/base.css +3 -3
- 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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { ChevronDown, ListFilter, SlidersHorizontal, X } from "lucide-react";
|
|
5
6
|
import { FilterChip } from "./filter-chip.js";
|
|
@@ -21,57 +22,72 @@ function getOptionLabel(filter) {
|
|
|
21
22
|
return (_a = opt == null ? void 0 : opt.label) != null ? _a : filter.label;
|
|
22
23
|
}
|
|
23
24
|
function FilterDropdown({ f, placement = "bottom-start" }) {
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
25
26
|
Popover,
|
|
26
27
|
{
|
|
27
28
|
placement,
|
|
28
|
-
trigger: /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
trigger: /* @__PURE__ */ jsxs("button", { type: "button", className: triggerCls(f.value !== ""), children: [
|
|
30
|
+
getOptionLabel(f),
|
|
31
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 12 })
|
|
32
|
+
] }),
|
|
33
|
+
children: ({ close }) => /* @__PURE__ */ jsx("div", { className: "w-36 rounded-(--radius-card) border border-stroke-default bg-surface-default shadow-xl p-1 overflow-hidden", children: f.options.map((opt) => /* @__PURE__ */ jsxs(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
type: "button",
|
|
37
|
+
onClick: () => {
|
|
38
|
+
f.onChange(opt.value);
|
|
39
|
+
close();
|
|
40
|
+
},
|
|
41
|
+
className: optCls(f.value === opt.value),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { children: opt.label }),
|
|
44
|
+
opt.count != null && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold opacity-60 tabular-nums", children: opt.count })
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
opt.value
|
|
48
|
+
)) })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function MobileSingleFilter({ f }) {
|
|
53
|
+
const [open, setOpen] = useState(false);
|
|
54
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: triggerCls(f.value !== ""), onClick: () => setOpen(true), children: [
|
|
56
|
+
getOptionLabel(f),
|
|
57
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 12 })
|
|
58
|
+
] }),
|
|
59
|
+
/* @__PURE__ */ jsx(BottomSheet, { open, onClose: () => setOpen(false), title: f.label, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: f.options.map((opt) => /* @__PURE__ */ jsxs(
|
|
31
60
|
"button",
|
|
32
61
|
{
|
|
33
|
-
key: opt.value,
|
|
34
62
|
type: "button",
|
|
35
63
|
onClick: () => {
|
|
36
64
|
f.onChange(opt.value);
|
|
37
|
-
|
|
65
|
+
setOpen(false);
|
|
38
66
|
},
|
|
39
|
-
className: optCls(f.value === opt.value)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
function MobileSingleFilter({ f }) {
|
|
47
|
-
const [open, setOpen] = useState(false);
|
|
48
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", { type: "button", className: triggerCls(f.value !== ""), onClick: () => setOpen(true) }, getOptionLabel(f), /* @__PURE__ */ React.createElement(ChevronDown, { size: 12 })), /* @__PURE__ */ React.createElement(BottomSheet, { open, onClose: () => setOpen(false), title: f.label }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-0.5" }, f.options.map((opt) => /* @__PURE__ */ React.createElement(
|
|
49
|
-
"button",
|
|
50
|
-
{
|
|
51
|
-
key: opt.value,
|
|
52
|
-
type: "button",
|
|
53
|
-
onClick: () => {
|
|
54
|
-
f.onChange(opt.value);
|
|
55
|
-
setOpen(false);
|
|
67
|
+
className: optCls(f.value === opt.value),
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", { children: opt.label }),
|
|
70
|
+
opt.count != null && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold opacity-60 tabular-nums", children: opt.count })
|
|
71
|
+
]
|
|
56
72
|
},
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
opt.count != null && /* @__PURE__ */ React.createElement("span", { className: "text-[11px] font-semibold opacity-60 tabular-nums" }, opt.count)
|
|
61
|
-
)))));
|
|
73
|
+
opt.value
|
|
74
|
+
)) }) })
|
|
75
|
+
] });
|
|
62
76
|
}
|
|
63
77
|
function FiltersButton({ count, onClick }) {
|
|
64
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ jsxs(
|
|
65
79
|
"button",
|
|
66
80
|
{
|
|
67
81
|
type: "button",
|
|
68
82
|
"data-filter-toggle": true,
|
|
69
83
|
onClick,
|
|
70
|
-
className: `h-control-md flex items-center gap-1.5 px-3 text-label border rounded-(--radius-control) transition-colors ${count > 0 ? "bg-brand-primary text-brand-on-primary border-brand-primary" : "bg-surface-default text-fg-muted border-stroke-default hover:bg-surface-raised"}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
className: `h-control-md flex items-center gap-1.5 px-3 text-label border rounded-(--radius-control) transition-colors ${count > 0 ? "bg-brand-primary text-brand-on-primary border-brand-primary" : "bg-surface-default text-fg-muted border-stroke-default hover:bg-surface-raised"}`,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsx(SlidersHorizontal, { size: 14 }),
|
|
87
|
+
"Filtros",
|
|
88
|
+
count > 0 && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center w-4 h-4 rounded-full bg-surface-default text-fg-primary text-[10px] font-bold", children: count })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
75
91
|
);
|
|
76
92
|
}
|
|
77
93
|
function FilterGroups({
|
|
@@ -80,25 +96,33 @@ function FilterGroups({
|
|
|
80
96
|
onClear,
|
|
81
97
|
showClear
|
|
82
98
|
}) {
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
100
|
+
filters.map((f) => /* @__PURE__ */ jsxs("div", { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold text-fg-disabled uppercase tracking-wide mb-2", children: f.label }),
|
|
102
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: f.options.map((opt) => /* @__PURE__ */ jsxs(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
type: "button",
|
|
106
|
+
onClick: () => onPick(f, opt.value),
|
|
107
|
+
className: optCls(f.value === opt.value),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { children: opt.label }),
|
|
110
|
+
opt.count != null && /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold opacity-60 tabular-nums", children: opt.count })
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
opt.value
|
|
114
|
+
)) })
|
|
115
|
+
] }, f.key)),
|
|
116
|
+
onClear && showClear && /* @__PURE__ */ jsx(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
type: "button",
|
|
120
|
+
onClick: onClear,
|
|
121
|
+
className: "w-full text-center text-caption text-fg-disabled hover:text-fg-secondary underline underline-offset-2 pt-1",
|
|
122
|
+
children: "Limpar filtros"
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
102
126
|
}
|
|
103
127
|
function DataTableHeader({
|
|
104
128
|
search,
|
|
@@ -115,89 +139,115 @@ function DataTableHeader({
|
|
|
115
139
|
const collapseDesktop = filters.length >= 2;
|
|
116
140
|
const activeFilters = filters.filter((f) => f.value !== "");
|
|
117
141
|
const singleFilter = filters.length === 1 ? filters[0] : null;
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
))), filters.length > 0 && !collapseDesktop && /* @__PURE__ */ React.createElement("div", { className: "hidden md:flex items-center gap-1.5" }, (search || pillFilters.length > 0) && /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", className: "mx-0.5" }), /* @__PURE__ */ React.createElement(ListFilter, { size: 14, className: "text-fg-disabled shrink-0" }), filters.map((f) => /* @__PURE__ */ React.createElement(FilterDropdown, { key: f.key, f }))), collapseDesktop && /* @__PURE__ */ React.createElement("div", { className: "hidden md:flex items-center gap-1.5" }, (search || pillFilters.length > 0) && /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", className: "mx-0.5" }), activeFilters.map((f) => /* @__PURE__ */ React.createElement(
|
|
137
|
-
"button",
|
|
138
|
-
{
|
|
139
|
-
key: f.key,
|
|
140
|
-
type: "button",
|
|
141
|
-
onClick: () => f.onChange(""),
|
|
142
|
-
title: f.label,
|
|
143
|
-
className: triggerCls(true)
|
|
144
|
-
},
|
|
145
|
-
getOptionLabel(f),
|
|
146
|
-
/* @__PURE__ */ React.createElement(X, { size: 12 })
|
|
147
|
-
)), /* @__PURE__ */ React.createElement(Popover, { placement: "bottom-end", trigger: /* @__PURE__ */ React.createElement(FiltersButton, { count: activeFilterCount }) }, ({ close }) => /* @__PURE__ */ React.createElement("div", { className: "bg-surface-default border border-stroke-default rounded-(--radius-card) shadow-lg p-4 w-56 max-h-[70vh] overflow-y-auto" }, /* @__PURE__ */ React.createElement(
|
|
148
|
-
FilterGroups,
|
|
149
|
-
{
|
|
150
|
-
filters,
|
|
151
|
-
onPick: (f, v) => {
|
|
152
|
-
f.onChange(v);
|
|
153
|
-
close();
|
|
154
|
-
},
|
|
155
|
-
onClear: onClear ? () => {
|
|
156
|
-
onClear();
|
|
157
|
-
close();
|
|
158
|
-
} : void 0,
|
|
159
|
-
showClear: activeFilterCount > 0
|
|
160
|
-
}
|
|
161
|
-
)))), onClear && activeFilterCount > 0 && !collapseDesktop && /* @__PURE__ */ React.createElement(
|
|
162
|
-
IconButton,
|
|
163
|
-
{
|
|
164
|
-
icon: /* @__PURE__ */ React.createElement(X, { size: 13 }),
|
|
165
|
-
"aria-label": "Limpar filtros",
|
|
166
|
-
size: "sm",
|
|
167
|
-
variant: "ghost",
|
|
168
|
-
color: "neutral",
|
|
169
|
-
className: "hidden md:inline-flex",
|
|
170
|
-
onClick: onClear
|
|
171
|
-
}
|
|
172
|
-
), singleFilter && !(mobileCollapse && actions) && /* @__PURE__ */ React.createElement("div", { className: "md:hidden" }, /* @__PURE__ */ React.createElement(MobileSingleFilter, { f: singleFilter })), !mobileCollapse && filters.length >= 2 && /* @__PURE__ */ React.createElement("div", { className: "md:hidden" }, /* @__PURE__ */ React.createElement(Popover, { placement: "bottom-end", trigger: /* @__PURE__ */ React.createElement(FiltersButton, { count: activeFilterCount }) }, ({ close }) => /* @__PURE__ */ React.createElement("div", { className: "bg-surface-default border border-stroke-default rounded-(--radius-card) shadow-lg p-4 w-52" }, /* @__PURE__ */ React.createElement(
|
|
173
|
-
FilterGroups,
|
|
174
|
-
{
|
|
175
|
-
filters,
|
|
176
|
-
onPick: (f, v) => {
|
|
177
|
-
f.onChange(v);
|
|
178
|
-
close();
|
|
179
|
-
},
|
|
180
|
-
onClear: onClear ? () => {
|
|
181
|
-
onClear();
|
|
182
|
-
close();
|
|
183
|
-
} : void 0,
|
|
184
|
-
showClear: activeFilterCount > 0
|
|
185
|
-
}
|
|
186
|
-
)))), mobileCollapse && (filters.length >= 2 || actions) && /* @__PURE__ */ React.createElement("div", { className: "md:hidden" }, /* @__PURE__ */ React.createElement(FiltersButton, { count: activeFilterCount, onClick: () => setSheetOpen(true) }), /* @__PURE__ */ React.createElement(BottomSheet, { open: sheetOpen, onClose: () => setSheetOpen(false), title: "Filtros" }, /* @__PURE__ */ React.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ React.createElement(
|
|
187
|
-
FilterGroups,
|
|
188
|
-
{
|
|
189
|
-
filters,
|
|
190
|
-
onPick: (f, v) => {
|
|
191
|
-
f.onChange(v);
|
|
192
|
-
setSheetOpen(false);
|
|
142
|
+
return /* @__PURE__ */ jsxs("div", { className: ["flex items-center gap-2 mb-3", className].filter(Boolean).join(" "), children: [
|
|
143
|
+
search && /* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx(
|
|
144
|
+
Search,
|
|
145
|
+
{
|
|
146
|
+
size: "md",
|
|
147
|
+
value: search.value,
|
|
148
|
+
onChange: (e) => search.onChange(e.target.value),
|
|
149
|
+
onClear: () => search.onChange(""),
|
|
150
|
+
placeholder: (_a = search.placeholder) != null ? _a : "Buscar..."
|
|
151
|
+
}
|
|
152
|
+
) }),
|
|
153
|
+
pillFilters.length > 0 && /* @__PURE__ */ jsx("div", { "data-pill-filter": true, className: "flex items-center [gap:var(--filter-chip-group-gap)] flex-wrap", children: pillFilters.map((p) => /* @__PURE__ */ jsx(
|
|
154
|
+
FilterChip,
|
|
155
|
+
{
|
|
156
|
+
label: p.label,
|
|
157
|
+
active: p.active,
|
|
158
|
+
count: p.count,
|
|
159
|
+
onClick: p.onClick
|
|
193
160
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
161
|
+
p.key
|
|
162
|
+
)) }),
|
|
163
|
+
filters.length > 0 && !collapseDesktop && /* @__PURE__ */ jsxs("div", { className: "hidden md:flex items-center gap-1.5", children: [
|
|
164
|
+
(search || pillFilters.length > 0) && /* @__PURE__ */ jsx(Divider, { orientation: "vertical", className: "mx-0.5" }),
|
|
165
|
+
/* @__PURE__ */ jsx(ListFilter, { size: 14, className: "text-fg-disabled shrink-0" }),
|
|
166
|
+
filters.map((f) => /* @__PURE__ */ jsx(FilterDropdown, { f }, f.key))
|
|
167
|
+
] }),
|
|
168
|
+
collapseDesktop && /* @__PURE__ */ jsxs("div", { className: "hidden md:flex items-center gap-1.5", children: [
|
|
169
|
+
(search || pillFilters.length > 0) && /* @__PURE__ */ jsx(Divider, { orientation: "vertical", className: "mx-0.5" }),
|
|
170
|
+
activeFilters.map((f) => /* @__PURE__ */ jsxs(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
onClick: () => f.onChange(""),
|
|
175
|
+
title: f.label,
|
|
176
|
+
className: triggerCls(true),
|
|
177
|
+
children: [
|
|
178
|
+
getOptionLabel(f),
|
|
179
|
+
/* @__PURE__ */ jsx(X, { size: 12 })
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
f.key
|
|
183
|
+
)),
|
|
184
|
+
/* @__PURE__ */ jsx(Popover, { placement: "bottom-end", trigger: /* @__PURE__ */ jsx(FiltersButton, { count: activeFilterCount }), children: ({ close }) => /* @__PURE__ */ jsx("div", { className: "bg-surface-default border border-stroke-default rounded-(--radius-card) shadow-lg p-4 w-56 max-h-[70vh] overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
185
|
+
FilterGroups,
|
|
186
|
+
{
|
|
187
|
+
filters,
|
|
188
|
+
onPick: (f, v) => {
|
|
189
|
+
f.onChange(v);
|
|
190
|
+
close();
|
|
191
|
+
},
|
|
192
|
+
onClear: onClear ? () => {
|
|
193
|
+
onClear();
|
|
194
|
+
close();
|
|
195
|
+
} : void 0,
|
|
196
|
+
showClear: activeFilterCount > 0
|
|
197
|
+
}
|
|
198
|
+
) }) })
|
|
199
|
+
] }),
|
|
200
|
+
onClear && activeFilterCount > 0 && !collapseDesktop && /* @__PURE__ */ jsx(
|
|
201
|
+
IconButton,
|
|
202
|
+
{
|
|
203
|
+
icon: /* @__PURE__ */ jsx(X, { size: 13 }),
|
|
204
|
+
"aria-label": "Limpar filtros",
|
|
205
|
+
size: "sm",
|
|
206
|
+
variant: "ghost",
|
|
207
|
+
color: "neutral",
|
|
208
|
+
className: "hidden md:inline-flex",
|
|
209
|
+
onClick: onClear
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
singleFilter && !(mobileCollapse && actions) && /* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx(MobileSingleFilter, { f: singleFilter }) }),
|
|
213
|
+
!mobileCollapse && filters.length >= 2 && /* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx(Popover, { placement: "bottom-end", trigger: /* @__PURE__ */ jsx(FiltersButton, { count: activeFilterCount }), children: ({ close }) => /* @__PURE__ */ jsx("div", { className: "bg-surface-default border border-stroke-default rounded-(--radius-card) shadow-lg p-4 w-52", children: /* @__PURE__ */ jsx(
|
|
214
|
+
FilterGroups,
|
|
215
|
+
{
|
|
216
|
+
filters,
|
|
217
|
+
onPick: (f, v) => {
|
|
218
|
+
f.onChange(v);
|
|
219
|
+
close();
|
|
220
|
+
},
|
|
221
|
+
onClear: onClear ? () => {
|
|
222
|
+
onClear();
|
|
223
|
+
close();
|
|
224
|
+
} : void 0,
|
|
225
|
+
showClear: activeFilterCount > 0
|
|
226
|
+
}
|
|
227
|
+
) }) }) }),
|
|
228
|
+
mobileCollapse && (filters.length >= 2 || actions) && /* @__PURE__ */ jsxs("div", { className: "md:hidden", children: [
|
|
229
|
+
/* @__PURE__ */ jsx(FiltersButton, { count: activeFilterCount, onClick: () => setSheetOpen(true) }),
|
|
230
|
+
/* @__PURE__ */ jsx(BottomSheet, { open: sheetOpen, onClose: () => setSheetOpen(false), title: "Filtros", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
231
|
+
/* @__PURE__ */ jsx(
|
|
232
|
+
FilterGroups,
|
|
233
|
+
{
|
|
234
|
+
filters,
|
|
235
|
+
onPick: (f, v) => {
|
|
236
|
+
f.onChange(v);
|
|
237
|
+
setSheetOpen(false);
|
|
238
|
+
},
|
|
239
|
+
onClear: onClear ? () => {
|
|
240
|
+
onClear();
|
|
241
|
+
setSheetOpen(false);
|
|
242
|
+
} : void 0,
|
|
243
|
+
showClear: activeFilterCount > 0
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
actions && /* @__PURE__ */ jsx("div", { className: "pt-2 border-t border-stroke-default", children: actions })
|
|
247
|
+
] }) })
|
|
248
|
+
] }),
|
|
249
|
+
mobileCollapse ? /* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center", children: actions }) : actions
|
|
250
|
+
] });
|
|
201
251
|
}
|
|
202
252
|
export {
|
|
203
253
|
DataTableHeader,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-ORMEWXMH.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
import { forwardRef, useState, useRef, useEffect, useId, useImperativeHandle } from "react";
|
|
4
5
|
import { Calendar, ChevronLeft, ChevronRight, X } from "lucide-react";
|
|
5
6
|
import { Popover } from "./popover.js";
|
|
@@ -141,111 +142,129 @@ const DatePicker = forwardRef(function DatePicker2({
|
|
|
141
142
|
const weekdays = weekdayLabels != null ? weekdayLabels : weekStartsOn === 1 ? PT_WEEKDAYS_MON_FIRST : ["D", ...PT_WEEKDAYS_MON_FIRST.slice(0, 6)];
|
|
142
143
|
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
143
144
|
const formatted = value ? value.toLocaleDateString(locale, { day: "2-digit", month: "2-digit", year: "numeric" }) : "";
|
|
144
|
-
const calendar = /* @__PURE__ */
|
|
145
|
+
const calendar = /* @__PURE__ */ jsxs(
|
|
145
146
|
"div",
|
|
146
147
|
{
|
|
147
148
|
role: "dialog",
|
|
148
149
|
"aria-label": "Calend\xE1rio",
|
|
149
|
-
className: "rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg p-3 w-[280px]"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
className: "rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg p-3 w-[280px]",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
onClick: () => nav(-1),
|
|
158
|
+
"aria-label": "M\xEAs anterior",
|
|
159
|
+
className: "p-1 rounded hover:bg-surface-raised text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
160
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 16 })
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ jsxs("span", { className: "text-label font-semibold text-fg-primary", children: [
|
|
164
|
+
PT_MONTHS[view.month],
|
|
165
|
+
" ",
|
|
166
|
+
view.year
|
|
167
|
+
] }),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
type: "button",
|
|
172
|
+
onClick: () => nav(1),
|
|
173
|
+
"aria-label": "Pr\xF3ximo m\xEAs",
|
|
174
|
+
className: "p-1 rounded hover:bg-surface-raised text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
175
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-1", children: weekdays.map((w, i) => /* @__PURE__ */ jsx("div", { className: "text-center text-[10px] font-semibold text-fg-muted uppercase", children: w }, i)) }),
|
|
180
|
+
/* @__PURE__ */ jsx("div", { role: "grid", className: "grid grid-cols-7 gap-1", onKeyDown: handleGridKeyDown, children: days.map((d, i) => {
|
|
181
|
+
const inMonth = d.getMonth() === view.month;
|
|
182
|
+
const isToday = isSameDay(d, today);
|
|
183
|
+
const isSelected = !!value && isSameDay(d, value);
|
|
184
|
+
const isFocused = !!tabFocusDate && isSameDay(d, tabFocusDate);
|
|
185
|
+
const dis = isDisabled(d);
|
|
186
|
+
return /* @__PURE__ */ jsx(
|
|
187
|
+
"button",
|
|
188
|
+
{
|
|
189
|
+
ref: isFocused ? activeDayRef : void 0,
|
|
190
|
+
type: "button",
|
|
191
|
+
role: "gridcell",
|
|
192
|
+
onClick: () => handleSelect(d),
|
|
193
|
+
disabled: dis,
|
|
194
|
+
"aria-selected": isSelected,
|
|
195
|
+
"aria-label": d.toLocaleDateString(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
196
|
+
tabIndex: isFocused ? 0 : -1,
|
|
197
|
+
className: [
|
|
198
|
+
"h-8 rounded text-caption font-medium transition-colors",
|
|
199
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
200
|
+
"disabled:cursor-not-allowed disabled:opacity-30",
|
|
201
|
+
isSelected ? "bg-brand-primary text-brand-on-primary" : isToday ? "border border-stroke-focus text-fg-primary hover:bg-surface-raised" : inMonth ? "text-fg-primary hover:bg-surface-raised" : "text-fg-disabled hover:bg-surface-raised"
|
|
202
|
+
].join(" "),
|
|
203
|
+
children: d.getDate()
|
|
204
|
+
},
|
|
205
|
+
i
|
|
206
|
+
);
|
|
207
|
+
}) })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
const control = /* @__PURE__ */ jsxs("div", { className: ["relative", width === "full" ? "block w-full" : "inline-block", label ? "" : className].join(" "), children: [
|
|
212
|
+
/* @__PURE__ */ jsx(
|
|
213
|
+
Popover,
|
|
153
214
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
215
|
+
trigger: /* @__PURE__ */ jsxs(
|
|
216
|
+
"button",
|
|
217
|
+
{
|
|
218
|
+
ref: triggerRef,
|
|
219
|
+
id: triggerId,
|
|
220
|
+
type: "button",
|
|
221
|
+
onClick: (e) => {
|
|
222
|
+
e.stopPropagation();
|
|
223
|
+
if (!disabled) setOpen((o) => !o);
|
|
224
|
+
},
|
|
225
|
+
disabled,
|
|
226
|
+
"aria-label": ariaLabel != null ? ariaLabel : "Selecionar data",
|
|
227
|
+
"aria-haspopup": "dialog",
|
|
228
|
+
"aria-expanded": open,
|
|
229
|
+
className: [
|
|
230
|
+
"w-full flex items-center gap-2 rounded-(--radius-control) border border-stroke-control bg-surface-default",
|
|
231
|
+
"transition-colors focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
232
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
233
|
+
value ? "pr-7" : "",
|
|
234
|
+
SIZE_CLASS[size]
|
|
235
|
+
].join(" "),
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ jsx(Calendar, { size: 16, className: "text-fg-muted shrink-0" }),
|
|
238
|
+
/* @__PURE__ */ jsx("span", { className: ["flex-1 text-left truncate", value ? "text-fg-primary" : "text-fg-placeholder"].join(" "), children: formatted || placeholder })
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
),
|
|
242
|
+
triggerClassName: width === "full" ? "block w-full" : "inline-block",
|
|
243
|
+
placement: "bottom-start",
|
|
244
|
+
offset: 4,
|
|
245
|
+
open,
|
|
246
|
+
onOpenChange: (v) => {
|
|
247
|
+
if (!disabled) setOpen(v);
|
|
248
|
+
},
|
|
249
|
+
children: () => calendar
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
value && !disabled && /* @__PURE__ */ jsx(
|
|
161
253
|
"button",
|
|
162
254
|
{
|
|
163
255
|
type: "button",
|
|
164
|
-
onClick:
|
|
165
|
-
"aria-label": "
|
|
166
|
-
className: "
|
|
167
|
-
|
|
168
|
-
/* @__PURE__ */ React.createElement(ChevronRight, { size: 16 })
|
|
169
|
-
)),
|
|
170
|
-
/* @__PURE__ */ React.createElement("div", { className: "grid grid-cols-7 gap-1 mb-1" }, weekdays.map((w, i) => /* @__PURE__ */ React.createElement("div", { key: i, className: "text-center text-[10px] font-semibold text-fg-muted uppercase" }, w))),
|
|
171
|
-
/* @__PURE__ */ React.createElement("div", { role: "grid", className: "grid grid-cols-7 gap-1", onKeyDown: handleGridKeyDown }, days.map((d, i) => {
|
|
172
|
-
const inMonth = d.getMonth() === view.month;
|
|
173
|
-
const isToday = isSameDay(d, today);
|
|
174
|
-
const isSelected = !!value && isSameDay(d, value);
|
|
175
|
-
const isFocused = !!tabFocusDate && isSameDay(d, tabFocusDate);
|
|
176
|
-
const dis = isDisabled(d);
|
|
177
|
-
return /* @__PURE__ */ React.createElement(
|
|
178
|
-
"button",
|
|
179
|
-
{
|
|
180
|
-
key: i,
|
|
181
|
-
ref: isFocused ? activeDayRef : void 0,
|
|
182
|
-
type: "button",
|
|
183
|
-
role: "gridcell",
|
|
184
|
-
onClick: () => handleSelect(d),
|
|
185
|
-
disabled: dis,
|
|
186
|
-
"aria-selected": isSelected,
|
|
187
|
-
"aria-label": d.toLocaleDateString(locale, { weekday: "long", day: "numeric", month: "long", year: "numeric" }),
|
|
188
|
-
tabIndex: isFocused ? 0 : -1,
|
|
189
|
-
className: [
|
|
190
|
-
"h-8 rounded text-caption font-medium transition-colors",
|
|
191
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
192
|
-
"disabled:cursor-not-allowed disabled:opacity-30",
|
|
193
|
-
isSelected ? "bg-brand-primary text-brand-on-primary" : isToday ? "border border-stroke-focus text-fg-primary hover:bg-surface-raised" : inMonth ? "text-fg-primary hover:bg-surface-raised" : "text-fg-disabled hover:bg-surface-raised"
|
|
194
|
-
].join(" ")
|
|
195
|
-
},
|
|
196
|
-
d.getDate()
|
|
197
|
-
);
|
|
198
|
-
}))
|
|
199
|
-
);
|
|
200
|
-
const control = /* @__PURE__ */ React.createElement("div", { className: ["relative", width === "full" ? "block w-full" : "inline-block", label ? "" : className].join(" ") }, /* @__PURE__ */ React.createElement(
|
|
201
|
-
Popover,
|
|
202
|
-
{
|
|
203
|
-
trigger: /* @__PURE__ */ React.createElement(
|
|
204
|
-
"button",
|
|
205
|
-
{
|
|
206
|
-
ref: triggerRef,
|
|
207
|
-
id: triggerId,
|
|
208
|
-
type: "button",
|
|
209
|
-
onClick: (e) => {
|
|
210
|
-
e.stopPropagation();
|
|
211
|
-
if (!disabled) setOpen((o) => !o);
|
|
212
|
-
},
|
|
213
|
-
disabled,
|
|
214
|
-
"aria-label": ariaLabel != null ? ariaLabel : "Selecionar data",
|
|
215
|
-
"aria-haspopup": "dialog",
|
|
216
|
-
"aria-expanded": open,
|
|
217
|
-
className: [
|
|
218
|
-
"w-full flex items-center gap-2 rounded-(--radius-control) border border-stroke-control bg-surface-default",
|
|
219
|
-
"transition-colors focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
|
|
220
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
221
|
-
value ? "pr-7" : "",
|
|
222
|
-
SIZE_CLASS[size]
|
|
223
|
-
].join(" ")
|
|
224
|
-
},
|
|
225
|
-
/* @__PURE__ */ React.createElement(Calendar, { size: 16, className: "text-fg-muted shrink-0" }),
|
|
226
|
-
/* @__PURE__ */ React.createElement("span", { className: ["flex-1 text-left truncate", value ? "text-fg-primary" : "text-fg-placeholder"].join(" ") }, formatted || placeholder)
|
|
227
|
-
),
|
|
228
|
-
triggerClassName: width === "full" ? "block w-full" : "inline-block",
|
|
229
|
-
placement: "bottom-start",
|
|
230
|
-
offset: 4,
|
|
231
|
-
open,
|
|
232
|
-
onOpenChange: (v) => {
|
|
233
|
-
if (!disabled) setOpen(v);
|
|
256
|
+
onClick: handleClear,
|
|
257
|
+
"aria-label": "Limpar data",
|
|
258
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-0.5 rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus",
|
|
259
|
+
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
234
260
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
), value && !disabled && /* @__PURE__ */ React.createElement(
|
|
238
|
-
"button",
|
|
239
|
-
{
|
|
240
|
-
type: "button",
|
|
241
|
-
onClick: handleClear,
|
|
242
|
-
"aria-label": "Limpar data",
|
|
243
|
-
className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-0.5 rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-stroke-focus"
|
|
244
|
-
},
|
|
245
|
-
/* @__PURE__ */ React.createElement(X, { size: 14 })
|
|
246
|
-
));
|
|
261
|
+
)
|
|
262
|
+
] });
|
|
247
263
|
if (!label) return control;
|
|
248
|
-
return /* @__PURE__ */
|
|
264
|
+
return /* @__PURE__ */ jsxs("div", { className: ["flex flex-col gap-1.5", width === "full" ? "w-full" : "inline-flex", className].join(" "), children: [
|
|
265
|
+
/* @__PURE__ */ jsx("label", { htmlFor: triggerId, className: "text-label font-medium text-fg-primary", children: label }),
|
|
266
|
+
control
|
|
267
|
+
] });
|
|
249
268
|
});
|
|
250
269
|
export {
|
|
251
270
|
DatePicker
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-ORMEWXMH.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
const COLOR_BY_VARIANT = {
|
|
3
4
|
subtle: "bg-stroke-subtle",
|
|
4
5
|
default: "bg-stroke-default",
|
|
@@ -11,7 +12,7 @@ function Divider({
|
|
|
11
12
|
children
|
|
12
13
|
}) {
|
|
13
14
|
if (orientation === "vertical") {
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
15
16
|
"div",
|
|
16
17
|
{
|
|
17
18
|
role: "separator",
|
|
@@ -21,19 +22,21 @@ function Divider({
|
|
|
21
22
|
);
|
|
22
23
|
}
|
|
23
24
|
if (children) {
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
25
26
|
"div",
|
|
26
27
|
{
|
|
27
28
|
role: "separator",
|
|
28
29
|
"aria-orientation": "horizontal",
|
|
29
|
-
className: ["flex items-center gap-3 my-2", className].join(" ")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
className: ["flex items-center gap-3 my-2", className].join(" "),
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: ["flex-1 h-px", COLOR_BY_VARIANT[variant]].join(" ") }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "text-caption text-fg-muted shrink-0", children }),
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: ["flex-1 h-px", COLOR_BY_VARIANT[variant]].join(" ") })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
34
37
|
);
|
|
35
38
|
}
|
|
36
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
37
40
|
"hr",
|
|
38
41
|
{
|
|
39
42
|
role: "separator",
|