@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.
Files changed (134) hide show
  1. package/dist/components/accordion.js +43 -37
  2. package/dist/components/alert.js +35 -28
  3. package/dist/components/avatar.js +41 -34
  4. package/dist/components/badge.js +21 -14
  5. package/dist/components/blocker-card.js +11 -2
  6. package/dist/components/bottom-sheet.js +60 -53
  7. package/dist/components/breadcrumb.js +32 -22
  8. package/dist/components/button.js +18 -11
  9. package/dist/components/card.js +24 -9
  10. package/dist/components/chat-bubble.js +6 -5
  11. package/dist/components/checkbox.js +61 -48
  12. package/dist/components/chip-input.js +98 -81
  13. package/dist/components/chips.js +36 -29
  14. package/dist/components/choice-card.js +48 -42
  15. package/dist/components/choice-carousel.js +79 -74
  16. package/dist/components/choice-preview-card.js +17 -6
  17. package/dist/components/color-input.js +41 -35
  18. package/dist/components/combobox.js +97 -75
  19. package/dist/components/context-menu.js +17 -13
  20. package/dist/components/copilot-hint.js +40 -31
  21. package/dist/components/copy-field.js +8 -5
  22. package/dist/components/currency-input.js +40 -32
  23. package/dist/components/danger-zone.js +19 -9
  24. package/dist/components/data-table-header.js +185 -135
  25. package/dist/components/date-picker.js +114 -95
  26. package/dist/components/divider.js +11 -8
  27. package/dist/components/drawer.js +40 -28
  28. package/dist/components/dropzone.js +23 -20
  29. package/dist/components/empty-state.js +26 -23
  30. package/dist/components/fab.js +38 -26
  31. package/dist/components/filter-chip.js +20 -16
  32. package/dist/components/floating-stepper.js +42 -32
  33. package/dist/components/form-card-header.js +9 -1
  34. package/dist/components/icon-button.js +19 -13
  35. package/dist/components/image-crop-modal.js +69 -48
  36. package/dist/components/image-upload.js +172 -128
  37. package/dist/components/input.js +90 -62
  38. package/dist/components/insight-card.js +12 -1
  39. package/dist/components/label.js +12 -7
  40. package/dist/components/media-tile.js +11 -8
  41. package/dist/components/menu.js +28 -25
  42. package/dist/components/modal.js +43 -28
  43. package/dist/components/notice.js +34 -16
  44. package/dist/components/option-tile.js +55 -49
  45. package/dist/components/page-shell.js +13 -6
  46. package/dist/components/page-skeleton.js +32 -2
  47. package/dist/components/page-tabs.js +39 -26
  48. package/dist/components/pagination.js +38 -33
  49. package/dist/components/paywall-banner.js +19 -3
  50. package/dist/components/paywall.js +18 -8
  51. package/dist/components/phone-frame.js +5 -4
  52. package/dist/components/phone-input.js +50 -31
  53. package/dist/components/pix-icon.js +11 -6
  54. package/dist/components/popover.js +27 -23
  55. package/dist/components/pricing-card.js +16 -1
  56. package/dist/components/qr-display.js +16 -11
  57. package/dist/components/radio.js +73 -56
  58. package/dist/components/row-actions.js +61 -53
  59. package/dist/components/saving-bar-context.js +35 -29
  60. package/dist/components/saving-bar.js +36 -33
  61. package/dist/components/search.js +49 -44
  62. package/dist/components/section-card.js +43 -35
  63. package/dist/components/section-header.js +11 -1
  64. package/dist/components/select.js +83 -62
  65. package/dist/components/selectable-card.js +10 -3
  66. package/dist/components/setting-row.js +11 -1
  67. package/dist/components/settings-list.js +9 -5
  68. package/dist/components/skeleton.js +6 -5
  69. package/dist/components/slider.js +52 -38
  70. package/dist/components/spinner.js +18 -12
  71. package/dist/components/step-progress.js +11 -10
  72. package/dist/components/summary-bar.js +33 -28
  73. package/dist/components/table.js +20 -15
  74. package/dist/components/textarea.js +40 -24
  75. package/dist/components/themed.d.ts +1 -1
  76. package/dist/components/themed.js +2 -1
  77. package/dist/components/time-picker.js +117 -97
  78. package/dist/components/toaster.js +80 -74
  79. package/dist/components/toggle-card-compact.js +79 -71
  80. package/dist/components/toggle-card.js +61 -53
  81. package/dist/components/toggle-group.js +35 -29
  82. package/dist/components/toggle.js +46 -36
  83. package/dist/components/tooltip.js +30 -25
  84. package/dist/components/typing-indicator.js +10 -7
  85. package/dist/targets/native/components/accordion.js +31 -25
  86. package/dist/targets/native/components/alert.js +22 -16
  87. package/dist/targets/native/components/avatar.js +36 -29
  88. package/dist/targets/native/components/badge.js +4 -3
  89. package/dist/targets/native/components/button.js +11 -4
  90. package/dist/targets/native/components/card.js +2 -1
  91. package/dist/targets/native/components/checkbox.js +18 -15
  92. package/dist/targets/native/components/chips.js +19 -16
  93. package/dist/targets/native/components/choice-card.js +29 -23
  94. package/dist/targets/native/components/context-menu.js +13 -9
  95. package/dist/targets/native/components/currency-input.js +28 -25
  96. package/dist/targets/native/components/danger-zone.js +10 -4
  97. package/dist/targets/native/components/date-picker.js +86 -70
  98. package/dist/targets/native/components/divider.js +3 -2
  99. package/dist/targets/native/components/empty-state.js +6 -1
  100. package/dist/targets/native/components/fab.js +32 -26
  101. package/dist/targets/native/components/filter-chip.js +9 -8
  102. package/dist/targets/native/components/form-field.js +20 -10
  103. package/dist/targets/native/components/form-screen.js +50 -45
  104. package/dist/targets/native/components/google-icon.js +31 -25
  105. package/dist/targets/native/components/icon-button.js +6 -4
  106. package/dist/targets/native/components/icon.js +2 -1
  107. package/dist/targets/native/components/image-upload.js +59 -50
  108. package/dist/targets/native/components/input.js +41 -34
  109. package/dist/targets/native/components/list-item.js +29 -23
  110. package/dist/targets/native/components/menu.js +12 -10
  111. package/dist/targets/native/components/modal.js +41 -32
  112. package/dist/targets/native/components/paywall-banner.js +13 -4
  113. package/dist/targets/native/components/paywall.js +11 -1
  114. package/dist/targets/native/components/radio.js +19 -16
  115. package/dist/targets/native/components/search.js +41 -38
  116. package/dist/targets/native/components/select.js +71 -63
  117. package/dist/targets/native/components/sheet.js +36 -30
  118. package/dist/targets/native/components/skeleton.js +6 -5
  119. package/dist/targets/native/components/slider.js +51 -43
  120. package/dist/targets/native/components/spinner.js +2 -1
  121. package/dist/targets/native/components/stepper.js +14 -9
  122. package/dist/targets/native/components/switch.js +15 -14
  123. package/dist/targets/native/components/text.js +2 -1
  124. package/dist/targets/native/components/textarea.js +2 -1
  125. package/dist/targets/native/components/theme.js +2 -1
  126. package/dist/targets/native/components/toaster.js +24 -21
  127. package/dist/targets/native/index.d.ts +1 -1
  128. package/dist/targets/native/index.js +1 -3
  129. package/package.json +190 -194
  130. package/styles/base.css +3 -3
  131. package/brand/rojao-black-on-white.png +0 -0
  132. package/brand/rojao-black.png +0 -0
  133. package/brand/rojao-white-on-black.png +0 -0
  134. package/brand/rojao-white.png +0 -0
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import "../chunk-ORMEWXMH.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
3
4
  function ChoiceCard({ selected, onClick, label, description, icon, disabled = false, className = "" }) {
4
- return /* @__PURE__ */ React.createElement(
5
+ return /* @__PURE__ */ jsxs(
5
6
  "button",
6
7
  {
7
8
  type: "button",
@@ -12,47 +13,52 @@ function ChoiceCard({ selected, onClick, label, description, icon, disabled = fa
12
13
  selected ? "[border-color:var(--choice-card-border-active)] [background:var(--choice-card-bg-active)]" : "[border-color:var(--choice-card-border)] [background:var(--choice-card-bg)] hover:[border-color:var(--choice-card-border-hover)]",
13
14
  disabled ? "opacity-50 cursor-not-allowed" : "",
14
15
  className
15
- ].filter(Boolean).join(" ")
16
- },
17
- icon && /* @__PURE__ */ React.createElement(
18
- "div",
19
- {
20
- className: [
21
- "shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
22
- selected ? "[background:var(--choice-card-icon-bg-active)] [color:var(--choice-card-icon-active)]" : "[background:var(--choice-card-icon-bg)] [color:var(--choice-card-icon)]"
23
- ].join(" ")
24
- },
25
- icon
26
- ),
27
- /* @__PURE__ */ React.createElement("div", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement(
28
- "p",
29
- {
30
- className: [
31
- "text-label font-semibold",
32
- selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
33
- ].join(" ")
34
- },
35
- label
36
- ), description && /* @__PURE__ */ React.createElement(
37
- "p",
38
- {
39
- className: [
40
- "text-caption mt-0.5",
41
- selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
42
- ].join(" ")
43
- },
44
- description
45
- )),
46
- /* @__PURE__ */ React.createElement(
47
- "div",
48
- {
49
- className: [
50
- "shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
51
- selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
52
- ].join(" ")
53
- },
54
- selected && /* @__PURE__ */ React.createElement("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
55
- )
16
+ ].filter(Boolean).join(" "),
17
+ children: [
18
+ icon && /* @__PURE__ */ jsx(
19
+ "div",
20
+ {
21
+ className: [
22
+ "shrink-0 w-9 h-9 rounded-(--radius-card) flex items-center justify-center transition-colors",
23
+ selected ? "[background:var(--choice-card-icon-bg-active)] [color:var(--choice-card-icon-active)]" : "[background:var(--choice-card-icon-bg)] [color:var(--choice-card-icon)]"
24
+ ].join(" "),
25
+ children: icon
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
29
+ /* @__PURE__ */ jsx(
30
+ "p",
31
+ {
32
+ className: [
33
+ "text-label font-semibold",
34
+ selected ? "[color:var(--choice-card-label-active)]" : "[color:var(--choice-card-label)]"
35
+ ].join(" "),
36
+ children: label
37
+ }
38
+ ),
39
+ description && /* @__PURE__ */ jsx(
40
+ "p",
41
+ {
42
+ className: [
43
+ "text-caption mt-0.5",
44
+ selected ? "[color:var(--choice-card-description-active)]" : "[color:var(--choice-card-description)]"
45
+ ].join(" "),
46
+ children: description
47
+ }
48
+ )
49
+ ] }),
50
+ /* @__PURE__ */ jsx(
51
+ "div",
52
+ {
53
+ className: [
54
+ "shrink-0 w-4 h-4 rounded-full border-2 flex items-center justify-center transition-colors",
55
+ selected ? "[border-color:var(--choice-card-radio-border-active)]" : "[border-color:var(--choice-card-radio-border)]"
56
+ ].join(" "),
57
+ children: selected && /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full [background:var(--choice-card-radio-dot)]" })
58
+ }
59
+ )
60
+ ]
61
+ }
56
62
  );
57
63
  }
58
64
  export {
@@ -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 { useRef, useState, useEffect, useCallback } from "react";
4
5
  function ChoiceCarousel({
5
6
  options,
@@ -70,84 +71,88 @@ function ChoiceCarousel({
70
71
  scrollByAmount(-1);
71
72
  }
72
73
  };
73
- return /* @__PURE__ */ React.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React.createElement(
74
- "button",
75
- {
76
- type: "button",
77
- "aria-label": "Anterior",
78
- onClick: () => scrollByAmount(-1),
79
- disabled: !canScrollLeft,
80
- className: "hidden md:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
81
- style: {
82
- background: "var(--choice-carousel-chevron-bg)",
83
- border: `1px solid var(--choice-carousel-chevron-border)`,
84
- color: "var(--choice-carousel-chevron-text)",
85
- boxShadow: "var(--shadow-md)"
74
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
75
+ /* @__PURE__ */ jsx(
76
+ "button",
77
+ {
78
+ type: "button",
79
+ "aria-label": "Anterior",
80
+ onClick: () => scrollByAmount(-1),
81
+ disabled: !canScrollLeft,
82
+ className: "hidden md:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
83
+ style: {
84
+ background: "var(--choice-carousel-chevron-bg)",
85
+ border: `1px solid var(--choice-carousel-chevron-border)`,
86
+ color: "var(--choice-carousel-chevron-text)",
87
+ boxShadow: "var(--shadow-md)"
88
+ },
89
+ children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M10 4l-4 4 4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
86
90
  }
87
- },
88
- /* @__PURE__ */ React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8" }, /* @__PURE__ */ React.createElement("path", { d: "M10 4l-4 4 4 4", strokeLinecap: "round", strokeLinejoin: "round" }))
89
- ), /* @__PURE__ */ React.createElement(
90
- "div",
91
- {
92
- ref: trackRef,
93
- role: multiple ? "group" : "radiogroup",
94
- "aria-label": ariaLabel,
95
- tabIndex: 0,
96
- onKeyDown: handleKeyDown,
97
- className: "flex overflow-x-auto scroll-smooth focus:outline-none",
98
- style: {
99
- gap: "var(--choice-carousel-gap)",
100
- scrollSnapType: "x mandatory",
101
- scrollbarWidth: "none",
102
- paddingBlock: 4
91
+ ),
92
+ /* @__PURE__ */ jsx(
93
+ "div",
94
+ {
95
+ ref: trackRef,
96
+ role: multiple ? "group" : "radiogroup",
97
+ "aria-label": ariaLabel,
98
+ tabIndex: 0,
99
+ onKeyDown: handleKeyDown,
100
+ className: "flex overflow-x-auto scroll-smooth focus:outline-none",
101
+ style: {
102
+ gap: "var(--choice-carousel-gap)",
103
+ scrollSnapType: "x mandatory",
104
+ scrollbarWidth: "none",
105
+ paddingBlock: 4
106
+ },
107
+ children: options.map((option) => {
108
+ var _a;
109
+ const selected = isSelected(option);
110
+ const disabled = (_a = isDisabled == null ? void 0 : isDisabled(option)) != null ? _a : false;
111
+ return /* @__PURE__ */ jsx(
112
+ "div",
113
+ {
114
+ role: multiple ? "checkbox" : "radio",
115
+ "aria-checked": selected,
116
+ "aria-disabled": disabled,
117
+ tabIndex: disabled ? -1 : 0,
118
+ onClick: () => handleSelect(option),
119
+ onKeyDown: (e) => {
120
+ if (e.key === "Enter" || e.key === " ") {
121
+ e.preventDefault();
122
+ handleSelect(option);
123
+ }
124
+ },
125
+ className: "shrink-0",
126
+ style: {
127
+ width: "var(--choice-carousel-card-width-mobile)",
128
+ scrollSnapAlign: "start",
129
+ cursor: disabled ? "not-allowed" : "pointer"
130
+ },
131
+ children: renderCard(option, selected)
132
+ },
133
+ getKey(option)
134
+ );
135
+ })
103
136
  }
104
- },
105
- options.map((option) => {
106
- var _a;
107
- const selected = isSelected(option);
108
- const disabled = (_a = isDisabled == null ? void 0 : isDisabled(option)) != null ? _a : false;
109
- return /* @__PURE__ */ React.createElement(
110
- "div",
111
- {
112
- key: getKey(option),
113
- role: multiple ? "checkbox" : "radio",
114
- "aria-checked": selected,
115
- "aria-disabled": disabled,
116
- tabIndex: disabled ? -1 : 0,
117
- onClick: () => handleSelect(option),
118
- onKeyDown: (e) => {
119
- if (e.key === "Enter" || e.key === " ") {
120
- e.preventDefault();
121
- handleSelect(option);
122
- }
123
- },
124
- className: "shrink-0",
125
- style: {
126
- width: "var(--choice-carousel-card-width-mobile)",
127
- scrollSnapAlign: "start",
128
- cursor: disabled ? "not-allowed" : "pointer"
129
- }
137
+ ),
138
+ /* @__PURE__ */ jsx(
139
+ "button",
140
+ {
141
+ type: "button",
142
+ "aria-label": "Pr\xF3ximo",
143
+ onClick: () => scrollByAmount(1),
144
+ disabled: !canScrollRight,
145
+ className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
146
+ style: {
147
+ background: "var(--choice-carousel-chevron-bg)",
148
+ border: `1px solid var(--choice-carousel-chevron-border)`,
149
+ color: "var(--choice-carousel-chevron-text)",
150
+ boxShadow: "var(--shadow-md)"
130
151
  },
131
- renderCard(option, selected)
132
- );
133
- })
134
- ), /* @__PURE__ */ React.createElement(
135
- "button",
136
- {
137
- type: "button",
138
- "aria-label": "Pr\xF3ximo",
139
- onClick: () => scrollByAmount(1),
140
- disabled: !canScrollRight,
141
- className: "hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10 w-9 h-9 rounded-full items-center justify-center transition-opacity disabled:opacity-0 disabled:pointer-events-none",
142
- style: {
143
- background: "var(--choice-carousel-chevron-bg)",
144
- border: `1px solid var(--choice-carousel-chevron-border)`,
145
- color: "var(--choice-carousel-chevron-text)",
146
- boxShadow: "var(--shadow-md)"
152
+ children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }) })
147
153
  }
148
- },
149
- /* @__PURE__ */ React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.8" }, /* @__PURE__ */ React.createElement("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }))
150
- ));
154
+ )
155
+ ] });
151
156
  }
152
157
  export {
153
158
  ChoiceCarousel
@@ -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 { Check, Lock } from "lucide-react";
4
5
  function ChoicePreviewCard({
5
6
  selected,
@@ -14,7 +15,7 @@ function ChoicePreviewCard({
14
15
  className = ""
15
16
  }) {
16
17
  const aspect = previewAspect === "square" ? "aspect-square" : previewAspect === "wide" ? "aspect-[2/1]" : "aspect-video";
17
- return /* @__PURE__ */ React.createElement(
18
+ return /* @__PURE__ */ jsxs(
18
19
  "button",
19
20
  {
20
21
  type: "button",
@@ -27,11 +28,21 @@ function ChoicePreviewCard({
27
28
  selected ? "border-2 border-stroke-focus bg-surface-raised" : "border border-stroke-default bg-surface-default hover:border-stroke-strong",
28
29
  disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
29
30
  className
30
- ].filter(Boolean).join(" ")
31
- },
32
- /* @__PURE__ */ React.createElement("div", { className: ["relative w-full overflow-hidden rounded-(--radius-card) ring-1 ring-inset ring-stroke-subtle", aspect].join(" ") }, preview, badge && /* @__PURE__ */ React.createElement("span", { className: "absolute top-1.5 left-1.5" }, badge), selected && /* @__PURE__ */ React.createElement("span", { className: "absolute bottom-1.5 right-1.5 size-5 rounded-full bg-stroke-focus text-surface-default flex items-center justify-center" }, /* @__PURE__ */ React.createElement(Check, { size: 12, strokeWidth: 3 })), locked && // TODO(DS): trocar por token de overlay (--choice-preview-overlay) — Patrick.
33
- /* @__PURE__ */ React.createElement("span", { className: "absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.55)]" }, /* @__PURE__ */ React.createElement(Lock, { size: 18, className: "text-white" }))),
34
- /* @__PURE__ */ React.createElement("div", { className: "px-1 pt-2" }, /* @__PURE__ */ React.createElement("div", { className: "text-sm font-medium text-fg-primary" }, label), description && /* @__PURE__ */ React.createElement("div", { className: "text-xs text-fg-muted mt-0.5 leading-snug" }, description))
31
+ ].filter(Boolean).join(" "),
32
+ children: [
33
+ /* @__PURE__ */ jsxs("div", { className: ["relative w-full overflow-hidden rounded-(--radius-card) ring-1 ring-inset ring-stroke-subtle", aspect].join(" "), children: [
34
+ preview,
35
+ badge && /* @__PURE__ */ jsx("span", { className: "absolute top-1.5 left-1.5", children: badge }),
36
+ selected && /* @__PURE__ */ jsx("span", { className: "absolute bottom-1.5 right-1.5 size-5 rounded-full bg-stroke-focus text-surface-default flex items-center justify-center", children: /* @__PURE__ */ jsx(Check, { size: 12, strokeWidth: 3 }) }),
37
+ locked && // TODO(DS): trocar por token de overlay (--choice-preview-overlay) — Patrick.
38
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.55)]", children: /* @__PURE__ */ jsx(Lock, { size: 18, className: "text-white" }) })
39
+ ] }),
40
+ /* @__PURE__ */ jsxs("div", { className: "px-1 pt-2", children: [
41
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-fg-primary", children: label }),
42
+ description && /* @__PURE__ */ jsx("div", { className: "text-xs text-fg-muted mt-0.5 leading-snug", children: description })
43
+ ] })
44
+ ]
45
+ }
35
46
  );
36
47
  }
37
48
  export {
@@ -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 { useEffect, useRef, useState } from "react";
4
5
  const HEX_RE = /^#[0-9a-fA-F]{6}$/;
5
6
  function ColorInput({
@@ -27,7 +28,7 @@ function ColorInput({
27
28
  }
28
29
  const h = size === "sm" ? "h-control-sm" : "h-control-md";
29
30
  const swatch = size === "sm" ? "size-5" : "size-6";
30
- return /* @__PURE__ */ React.createElement(
31
+ return /* @__PURE__ */ jsxs(
31
32
  "div",
32
33
  {
33
34
  className: [
@@ -37,41 +38,46 @@ function ColorInput({
37
38
  "transition-colors focus-within:border-stroke-focus focus-within:ring-2 focus-within:ring-stroke-focus/20",
38
39
  disabled ? "opacity-50 cursor-not-allowed" : "",
39
40
  className
40
- ].filter(Boolean).join(" ")
41
- },
42
- /* @__PURE__ */ React.createElement("span", { className: `relative shrink-0 ${swatch} rounded-(--radius-control) border border-stroke-subtle overflow-hidden` }, /* @__PURE__ */ React.createElement("span", { className: "absolute inset-0", style: { backgroundColor: value } }), /* @__PURE__ */ React.createElement(
43
- "input",
44
- {
45
- type: "color",
46
- value: HEX_RE.test(value) ? value : "#000000",
47
- onChange: (e) => onChange(e.target.value.toUpperCase()),
48
- disabled,
49
- "aria-label": ariaLabel,
50
- className: "absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed"
51
- }
52
- )),
53
- /* @__PURE__ */ React.createElement(
54
- "input",
55
- {
56
- ref: inputRef,
57
- type: "text",
58
- value: draft,
59
- onChange: (e) => setDraft(e.target.value),
60
- onBlur: commit,
61
- onKeyDown: (e) => {
62
- var _a;
63
- if (e.key === "Enter") {
64
- e.preventDefault();
65
- commit();
66
- (_a = inputRef.current) == null ? void 0 : _a.blur();
41
+ ].filter(Boolean).join(" "),
42
+ children: [
43
+ /* @__PURE__ */ jsxs("span", { className: `relative shrink-0 ${swatch} rounded-(--radius-control) border border-stroke-subtle overflow-hidden`, children: [
44
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0", style: { backgroundColor: value } }),
45
+ /* @__PURE__ */ jsx(
46
+ "input",
47
+ {
48
+ type: "color",
49
+ value: HEX_RE.test(value) ? value : "#000000",
50
+ onChange: (e) => onChange(e.target.value.toUpperCase()),
51
+ disabled,
52
+ "aria-label": ariaLabel,
53
+ className: "absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed"
54
+ }
55
+ )
56
+ ] }),
57
+ /* @__PURE__ */ jsx(
58
+ "input",
59
+ {
60
+ ref: inputRef,
61
+ type: "text",
62
+ value: draft,
63
+ onChange: (e) => setDraft(e.target.value),
64
+ onBlur: commit,
65
+ onKeyDown: (e) => {
66
+ var _a;
67
+ if (e.key === "Enter") {
68
+ e.preventDefault();
69
+ commit();
70
+ (_a = inputRef.current) == null ? void 0 : _a.blur();
71
+ }
72
+ },
73
+ disabled,
74
+ maxLength: 7,
75
+ "aria-label": ariaLabel,
76
+ className: "min-w-0 flex-1 bg-transparent text-label font-mono text-fg-primary outline-none disabled:cursor-not-allowed"
67
77
  }
68
- },
69
- disabled,
70
- maxLength: 7,
71
- "aria-label": ariaLabel,
72
- className: "min-w-0 flex-1 bg-transparent text-label font-mono text-fg-primary outline-none disabled:cursor-not-allowed"
73
- }
74
- )
78
+ )
79
+ ]
80
+ }
75
81
  );
76
82
  }
77
83
  export {
@@ -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 { forwardRef, useState, useRef, useEffect, useId, useImperativeHandle } from "react";
4
5
  import { ChevronDown, Check, Search as SearchIcon, X, Plus } from "lucide-react";
5
6
  import { Popover } from "./popover.js";
@@ -100,81 +101,97 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
100
101
  const sel = selectedOption();
101
102
  const triggerLabel = isMulti ? props.value.length === 0 ? placeholder : `${props.value.length} selecionado(s)` : (_a = sel == null ? void 0 : sel.label) != null ? _a : placeholder;
102
103
  const isPlaceholder = isMulti ? props.value.length === 0 : !sel;
103
- const dropdown = /* @__PURE__ */ React.createElement(
104
+ const dropdown = /* @__PURE__ */ jsxs(
104
105
  "div",
105
106
  {
106
107
  id,
107
108
  role: "listbox",
108
109
  style: { width: Math.max(dropdownWidth, dropdownMinWidth != null ? dropdownMinWidth : 0) || void 0 },
109
- className: "max-h-72 overflow-hidden rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg flex flex-col"
110
- },
111
- /* @__PURE__ */ React.createElement("div", { className: "relative shrink-0 border-b border-stroke-subtle" }, /* @__PURE__ */ React.createElement(SearchIcon, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-fg-muted pointer-events-none" }), /* @__PURE__ */ React.createElement(
112
- "input",
113
- {
114
- ref: inputRef,
115
- type: "text",
116
- value: query,
117
- onChange: (e) => {
118
- setQuery(e.target.value);
119
- setActiveIdx(0);
120
- },
121
- onKeyDown: handleKey,
122
- placeholder: "Buscar\u2026",
123
- className: "w-full pl-9 pr-8 py-2 text-label bg-transparent outline-none text-fg-primary placeholder:text-fg-placeholder",
124
- "aria-label": "Buscar op\xE7\xF5es"
125
- }
126
- ), query && /* @__PURE__ */ React.createElement(
127
- "button",
128
- {
129
- type: "button",
130
- onClick: () => {
131
- var _a2;
132
- setQuery("");
133
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
134
- },
135
- "aria-label": "Limpar",
136
- className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-1"
137
- },
138
- /* @__PURE__ */ React.createElement(X, { size: 12 })
139
- )),
140
- /* @__PURE__ */ React.createElement("div", { className: "overflow-y-auto py-1 max-h-60" }, filtered.length === 0 && !showCreate ? /* @__PURE__ */ React.createElement("div", { className: "px-3 py-3 text-label text-fg-muted text-center" }, emptyMessage) : /* @__PURE__ */ React.createElement(React.Fragment, null, filtered.map((opt, idx) => {
141
- const selected = isSelected(opt);
142
- const active = idx === activeIdx;
143
- return /* @__PURE__ */ React.createElement(
144
- "button",
145
- {
146
- key: opt.value,
147
- type: "button",
148
- role: "option",
149
- "aria-selected": selected,
150
- disabled: opt.disabled,
151
- onClick: () => handleSelect(opt),
152
- onMouseEnter: () => setActiveIdx(idx),
153
- className: [
154
- "w-full flex items-start gap-2.5 px-3 py-2 text-label text-left transition-colors",
155
- "disabled:cursor-not-allowed disabled:opacity-50",
156
- active ? "bg-surface-raised" : "hover:bg-surface-raised"
157
- ].join(" ")
158
- },
159
- opt.icon && /* @__PURE__ */ React.createElement("span", { className: "shrink-0 text-fg-muted mt-0.5 [&_svg]:size-4" }, opt.icon),
160
- /* @__PURE__ */ React.createElement("span", { className: "flex-1 min-w-0" }, /* @__PURE__ */ React.createElement("span", { className: "block text-fg-primary truncate" }, opt.label), opt.description && /* @__PURE__ */ React.createElement("span", { className: "block text-caption text-fg-muted truncate" }, opt.description)),
161
- selected && /* @__PURE__ */ React.createElement(Check, { size: 14, className: "shrink-0 text-fg-muted mt-0.5" })
162
- );
163
- }), showCreate && /* @__PURE__ */ React.createElement(
164
- "button",
165
- {
166
- type: "button",
167
- onClick: doCreate,
168
- className: "w-full flex items-center gap-2.5 px-3 py-2 text-label text-left text-fg-primary transition-colors hover:bg-surface-raised border-t border-stroke-subtle"
169
- },
170
- /* @__PURE__ */ React.createElement(Plus, { size: 14, className: "shrink-0 text-fg-muted" }),
171
- /* @__PURE__ */ React.createElement("span", { className: "truncate" }, createLabel(trimmed))
172
- )))
110
+ className: "max-h-72 overflow-hidden rounded-(--radius-control) border border-stroke-control bg-surface-default shadow-lg flex flex-col",
111
+ children: [
112
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0 border-b border-stroke-subtle", children: [
113
+ /* @__PURE__ */ jsx(SearchIcon, { size: 14, className: "absolute left-3 top-1/2 -translate-y-1/2 text-fg-muted pointer-events-none" }),
114
+ /* @__PURE__ */ jsx(
115
+ "input",
116
+ {
117
+ ref: inputRef,
118
+ type: "text",
119
+ value: query,
120
+ onChange: (e) => {
121
+ setQuery(e.target.value);
122
+ setActiveIdx(0);
123
+ },
124
+ onKeyDown: handleKey,
125
+ placeholder: "Buscar\u2026",
126
+ className: "w-full pl-9 pr-8 py-2 text-label bg-transparent outline-none text-fg-primary placeholder:text-fg-placeholder",
127
+ "aria-label": "Buscar op\xE7\xF5es"
128
+ }
129
+ ),
130
+ query && /* @__PURE__ */ jsx(
131
+ "button",
132
+ {
133
+ type: "button",
134
+ onClick: () => {
135
+ var _a2;
136
+ setQuery("");
137
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
138
+ },
139
+ "aria-label": "Limpar",
140
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-fg-muted hover:text-fg-primary p-1",
141
+ children: /* @__PURE__ */ jsx(X, { size: 12 })
142
+ }
143
+ )
144
+ ] }),
145
+ /* @__PURE__ */ jsx("div", { className: "overflow-y-auto py-1 max-h-60", children: filtered.length === 0 && !showCreate ? /* @__PURE__ */ jsx("div", { className: "px-3 py-3 text-label text-fg-muted text-center", children: emptyMessage }) : /* @__PURE__ */ jsxs(Fragment, { children: [
146
+ filtered.map((opt, idx) => {
147
+ const selected = isSelected(opt);
148
+ const active = idx === activeIdx;
149
+ return /* @__PURE__ */ jsxs(
150
+ "button",
151
+ {
152
+ type: "button",
153
+ role: "option",
154
+ "aria-selected": selected,
155
+ disabled: opt.disabled,
156
+ onClick: () => handleSelect(opt),
157
+ onMouseEnter: () => setActiveIdx(idx),
158
+ className: [
159
+ "w-full flex items-start gap-2.5 px-3 py-2 text-label text-left transition-colors",
160
+ "disabled:cursor-not-allowed disabled:opacity-50",
161
+ active ? "bg-surface-raised" : "hover:bg-surface-raised"
162
+ ].join(" "),
163
+ children: [
164
+ opt.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-fg-muted mt-0.5 [&_svg]:size-4", children: opt.icon }),
165
+ /* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
166
+ /* @__PURE__ */ jsx("span", { className: "block text-fg-primary truncate", children: opt.label }),
167
+ opt.description && /* @__PURE__ */ jsx("span", { className: "block text-caption text-fg-muted truncate", children: opt.description })
168
+ ] }),
169
+ selected && /* @__PURE__ */ jsx(Check, { size: 14, className: "shrink-0 text-fg-muted mt-0.5" })
170
+ ]
171
+ },
172
+ opt.value
173
+ );
174
+ }),
175
+ showCreate && /* @__PURE__ */ jsxs(
176
+ "button",
177
+ {
178
+ type: "button",
179
+ onClick: doCreate,
180
+ className: "w-full flex items-center gap-2.5 px-3 py-2 text-label text-left text-fg-primary transition-colors hover:bg-surface-raised border-t border-stroke-subtle",
181
+ children: [
182
+ /* @__PURE__ */ jsx(Plus, { size: 14, className: "shrink-0 text-fg-muted" }),
183
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: createLabel(trimmed) })
184
+ ]
185
+ }
186
+ )
187
+ ] }) })
188
+ ]
189
+ }
173
190
  );
174
- return /* @__PURE__ */ React.createElement("div", { className: ["relative inline-block", width === "full" ? "w-full" : "w-auto", className].join(" ") }, /* @__PURE__ */ React.createElement(
191
+ return /* @__PURE__ */ jsx("div", { className: ["relative inline-block", width === "full" ? "w-full" : "w-auto", className].join(" "), children: /* @__PURE__ */ jsx(
175
192
  Popover,
176
193
  {
177
- trigger: /* @__PURE__ */ React.createElement(
194
+ trigger: /* @__PURE__ */ jsxs(
178
195
  "button",
179
196
  {
180
197
  ref: triggerRef,
@@ -192,10 +209,15 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
192
209
  "transition-colors focus:outline-none focus:border-stroke-focus focus:ring-2 focus:ring-stroke-focus/20",
193
210
  "disabled:opacity-50 disabled:cursor-not-allowed",
194
211
  SIZE_CLASS[size]
195
- ].join(" ")
196
- },
197
- /* @__PURE__ */ React.createElement("span", { className: ["truncate inline-flex items-center", isPlaceholder ? "text-fg-placeholder" : "text-fg-primary"].join(" ") }, triggerContent ? triggerContent(sel) : /* @__PURE__ */ React.createElement(React.Fragment, null, (sel == null ? void 0 : sel.icon) && /* @__PURE__ */ React.createElement("span", { className: "inline-flex mr-2 align-middle [&_svg]:size-4" }, sel.icon), triggerLabel)),
198
- /* @__PURE__ */ React.createElement(ChevronDown, { size: 16, className: "text-fg-muted shrink-0" })
212
+ ].join(" "),
213
+ children: [
214
+ /* @__PURE__ */ jsx("span", { className: ["truncate inline-flex items-center", isPlaceholder ? "text-fg-placeholder" : "text-fg-primary"].join(" "), children: triggerContent ? triggerContent(sel) : /* @__PURE__ */ jsxs(Fragment, { children: [
215
+ (sel == null ? void 0 : sel.icon) && /* @__PURE__ */ jsx("span", { className: "inline-flex mr-2 align-middle [&_svg]:size-4", children: sel.icon }),
216
+ triggerLabel
217
+ ] }) }),
218
+ /* @__PURE__ */ jsx(ChevronDown, { size: 16, className: "text-fg-muted shrink-0" })
219
+ ]
220
+ }
199
221
  ),
200
222
  triggerClassName: width === "full" ? "block w-full" : "inline-block",
201
223
  placement: "bottom-start",
@@ -203,10 +225,10 @@ const Combobox = forwardRef(function Combobox2(props, ref) {
203
225
  open,
204
226
  onOpenChange: (v) => {
205
227
  if (!disabled) setOpen(v);
206
- }
207
- },
208
- () => dropdown
209
- ));
228
+ },
229
+ children: () => dropdown
230
+ }
231
+ ) });
210
232
  });
211
233
  export {
212
234
  Combobox