@drawbridge/components 0.0.75 → 0.0.77

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.
@@ -113,7 +113,10 @@ var InputGroupError = ({
113
113
  warning_default,
114
114
  {
115
115
  ...{
116
- className: "w-4 h-4",
116
+ // shrink-0: a long error ("Expected your CNAME record to be …
117
+ // but found …") wraps, and a flex item with no floor gets
118
+ // squeezed to a sliver beside it.
119
+ className: "w-4 h-4 shrink-0",
117
120
  "aria-hidden": true
118
121
  }
119
122
  }
@@ -151,15 +154,70 @@ var InputGroupError = ({
151
154
  };
152
155
  var input_group_error_default = InputGroupError;
153
156
 
157
+ // components/styles.js
158
+ var WHITE = "rgb( 255, 255, 255 )";
159
+ var BLACK = "rgb( 0, 0, 0 )";
160
+ var bgColor = (style) => {
161
+ var _a, _b;
162
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
163
+ };
164
+ var textColor = (style) => {
165
+ var _a, _b;
166
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
167
+ };
168
+ var DEFAULT_FAMILY = "Roboto Flex";
169
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
170
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
171
+ var toFontWeight = (variant) => {
172
+ var _a;
173
+ if (!variant) return void 0;
174
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
175
+ if (variant.includes("regular")) return "normal";
176
+ return variant;
177
+ };
178
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
179
+ var buttonStyle = (style) => {
180
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
181
+ return {
182
+ backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || textColor(style),
183
+ borderColor: ((_f = (_e = (_d = style == null ? void 0 : style.button) == null ? void 0 : _d.background) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb) || textColor(style),
184
+ borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
185
+ color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
186
+ };
187
+ };
188
+ var headerStyle = (style) => {
189
+ var _a, _b, _c, _d;
190
+ return {
191
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
192
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
193
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
194
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
195
+ };
196
+ };
197
+ var inputStyle = (style) => {
198
+ var _a;
199
+ return {
200
+ backgroundColor: bgColor(style),
201
+ borderColor: textColor(style),
202
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
203
+ color: textColor(style)
204
+ };
205
+ };
206
+
154
207
  // components/input-group.js
155
- var import_jsx_runtime3 = (
156
- // A real <label> (not a bare <span>) so the field name is announced by
157
- // screen readers, clicking the text focuses the control, and
158
- // getByLabel()/role queries can find it. The association comes from
159
- // `htmlFor`, never from the wrapping — see the note above the id.
160
- require("react/jsx-runtime")
208
+ var import_jsx_runtime3 = require("react/jsx-runtime");
209
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
210
+ "span",
211
+ {
212
+ ...{
213
+ className: typeof children === "string" ? "flex items-center shrink-0 px-3 font-mono text-sm opacity-60 whitespace-nowrap select-none" : "flex items-center shrink-0 px-2"
214
+ },
215
+ children
216
+ }
161
217
  );
162
218
  var InputGroup = ({
219
+ after,
220
+ before,
163
221
  className,
164
222
  error,
165
223
  input,
@@ -170,7 +228,29 @@ var InputGroup = ({
170
228
  }) => {
171
229
  const generated = (0, import_react2.useId)();
172
230
  const id = (0, import_react2.isValidElement)(input) ? input.props.id || generated : generated;
173
- const control = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
231
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
232
+ const addons = after != null || before != null;
233
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
234
+ "div",
235
+ {
236
+ ...{
237
+ className: "input flex items-center overflow-hidden",
238
+ style: {
239
+ ...inputStyle(style),
240
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
241
+ // padding beats a layered utility, an inline style beats both.
242
+ padding: 0
243
+ }
244
+ },
245
+ children: [
246
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
247
+ (0, import_react2.cloneElement)(named, {
248
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
249
+ }),
250
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
251
+ ]
252
+ }
253
+ ) : named;
174
254
  const classes = [
175
255
  "input-group"
176
256
  ];
@@ -191,26 +271,32 @@ var InputGroup = ({
191
271
  }
192
272
  },
193
273
  children: [
194
- label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
195
- "label",
196
- {
197
- ...{
198
- className: "space-y-2 block",
199
- htmlFor: id
200
- },
201
- children: [
202
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
203
- "span",
204
- {
205
- ...{
206
- className: "block"
207
- },
208
- children: label
209
- }
210
- ),
211
- control
212
- ]
213
- }
274
+ label ? (
275
+ // A real <label> (not a bare <span>) so the field name is announced by
276
+ // screen readers, clicking the text focuses the control, and
277
+ // getByLabel()/role queries can find it. The association comes from
278
+ // `htmlFor`, never from the wrapping — see the note above the id.
279
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
280
+ "label",
281
+ {
282
+ ...{
283
+ className: "space-y-2 block",
284
+ htmlFor: id
285
+ },
286
+ children: [
287
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
288
+ "span",
289
+ {
290
+ ...{
291
+ className: "block"
292
+ },
293
+ children: label
294
+ }
295
+ ),
296
+ control
297
+ ]
298
+ }
299
+ )
214
300
  ) : control,
215
301
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
216
302
  input_group_error_default,
@@ -258,56 +344,6 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
258
344
  );
259
345
  var chevron_down_default = ChevronDown;
260
346
 
261
- // components/styles.js
262
- var WHITE = "rgb( 255, 255, 255 )";
263
- var BLACK = "rgb( 0, 0, 0 )";
264
- var bgColor = (style) => {
265
- var _a, _b;
266
- return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
267
- };
268
- var textColor = (style) => {
269
- var _a, _b;
270
- return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
271
- };
272
- var DEFAULT_FAMILY = "Roboto Flex";
273
- var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
274
- var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
275
- var toFontWeight = (variant) => {
276
- var _a;
277
- if (!variant) return void 0;
278
- if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
279
- if (variant.includes("regular")) return "normal";
280
- return variant;
281
- };
282
- var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
283
- var buttonStyle = (style) => {
284
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
285
- return {
286
- backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || textColor(style),
287
- borderColor: ((_f = (_e = (_d = style == null ? void 0 : style.button) == null ? void 0 : _d.background) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb) || textColor(style),
288
- borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
289
- color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
290
- };
291
- };
292
- var headerStyle = (style) => {
293
- var _a, _b, _c, _d;
294
- return {
295
- fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
296
- fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
297
- fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
298
- textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
299
- };
300
- };
301
- var inputStyle = (style) => {
302
- var _a;
303
- return {
304
- backgroundColor: bgColor(style),
305
- borderColor: textColor(style),
306
- borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
307
- color: textColor(style)
308
- };
309
- };
310
-
311
347
  // components/input-select.js
312
348
  var import_jsx_runtime5 = require("react/jsx-runtime");
313
349
  var InputSelect = ({
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-PURM4QR2.mjs";
4
+ } from "./chunk-PNM4PZ4L.mjs";
5
5
  import "./chunk-PT7UR6AO.mjs";
6
6
  import "./chunk-7GRIGQDC.mjs";
7
7
  import "./chunk-FYA7EAMR.mjs";
8
8
  import "./chunk-2ZYGRSSA.mjs";
9
- import "./chunk-MKBY26H7.mjs";
10
- import "./chunk-OHJMWJAQ.mjs";
9
+ import "./chunk-WUZE3BIA.mjs";
10
+ import "./chunk-KSCQQUFC.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
12
  import {
13
13
  buttonStyle
@@ -43,7 +43,10 @@ var InputGroupError = ({
43
43
  warning_default,
44
44
  {
45
45
  ...{
46
- className: "w-4 h-4",
46
+ // shrink-0: a long error ("Expected your CNAME record to be …
47
+ // but found …") wraps, and a flex item with no floor gets
48
+ // squeezed to a sliver beside it.
49
+ className: "w-4 h-4 shrink-0",
47
50
  "aria-hidden": true
48
51
  }
49
52
  }
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-2ZYGRSSA.mjs";
10
10
  import {
11
11
  input_group_default
12
- } from "./chunk-MKBY26H7.mjs";
12
+ } from "./chunk-WUZE3BIA.mjs";
13
13
  import {
14
14
  buttonStyle,
15
15
  headerStyle,
@@ -1,11 +1,25 @@
1
1
  import {
2
2
  input_group_error_default
3
- } from "./chunk-OHJMWJAQ.mjs";
3
+ } from "./chunk-KSCQQUFC.mjs";
4
+ import {
5
+ inputStyle
6
+ } from "./chunk-6F23WKP2.mjs";
4
7
 
5
8
  // components/input-group.js
6
9
  import { cloneElement, isValidElement, useId } from "react";
7
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
+ var Addon = ({ children }) => /* @__PURE__ */ jsx(
12
+ "span",
13
+ {
14
+ ...{
15
+ className: typeof children === "string" ? "flex items-center shrink-0 px-3 font-mono text-sm opacity-60 whitespace-nowrap select-none" : "flex items-center shrink-0 px-2"
16
+ },
17
+ children
18
+ }
19
+ );
8
20
  var InputGroup = ({
21
+ after,
22
+ before,
9
23
  className,
10
24
  error,
11
25
  input,
@@ -16,7 +30,29 @@ var InputGroup = ({
16
30
  }) => {
17
31
  const generated = useId();
18
32
  const id = isValidElement(input) ? input.props.id || generated : generated;
19
- const control = isValidElement(input) && !input.props.id ? cloneElement(input, { id }) : input;
33
+ const named = isValidElement(input) && !input.props.id ? cloneElement(input, { id }) : input;
34
+ const addons = after != null || before != null;
35
+ const control = addons && isValidElement(named) ? /* @__PURE__ */ jsxs(
36
+ "div",
37
+ {
38
+ ...{
39
+ className: "input flex items-center overflow-hidden",
40
+ style: {
41
+ ...inputStyle(style),
42
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
43
+ // padding beats a layered utility, an inline style beats both.
44
+ padding: 0
45
+ }
46
+ },
47
+ children: [
48
+ before != null && /* @__PURE__ */ jsx(Addon, { children: before }),
49
+ cloneElement(named, {
50
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
51
+ }),
52
+ after != null && /* @__PURE__ */ jsx(Addon, { children: after })
53
+ ]
54
+ }
55
+ ) : named;
20
56
  const classes = [
21
57
  "input-group"
22
58
  ];
@@ -90,7 +90,10 @@ var InputGroupError = ({
90
90
  warning_default,
91
91
  {
92
92
  ...{
93
- className: "w-4 h-4",
93
+ // shrink-0: a long error ("Expected your CNAME record to be …
94
+ // but found …") wraps, and a flex item with no floor gets
95
+ // squeezed to a sliver beside it.
96
+ className: "w-4 h-4 shrink-0",
94
97
  "aria-hidden": true
95
98
  }
96
99
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  input_group_error_default
3
- } from "./chunk-OHJMWJAQ.mjs";
3
+ } from "./chunk-KSCQQUFC.mjs";
4
4
  import "./chunk-Q3UIVGPQ.mjs";
5
5
  export {
6
6
  input_group_error_default as default
@@ -94,7 +94,10 @@ var InputGroupError = ({
94
94
  warning_default,
95
95
  {
96
96
  ...{
97
- className: "w-4 h-4",
97
+ // shrink-0: a long error ("Expected your CNAME record to be …
98
+ // but found …") wraps, and a flex item with no floor gets
99
+ // squeezed to a sliver beside it.
100
+ className: "w-4 h-4 shrink-0",
98
101
  "aria-hidden": true
99
102
  }
100
103
  }
@@ -132,15 +135,41 @@ var InputGroupError = ({
132
135
  };
133
136
  var input_group_error_default = InputGroupError;
134
137
 
138
+ // components/styles.js
139
+ var WHITE = "rgb( 255, 255, 255 )";
140
+ var BLACK = "rgb( 0, 0, 0 )";
141
+ var bgColor = (style) => {
142
+ var _a, _b;
143
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
144
+ };
145
+ var textColor = (style) => {
146
+ var _a, _b;
147
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
148
+ };
149
+ var inputStyle = (style) => {
150
+ var _a;
151
+ return {
152
+ backgroundColor: bgColor(style),
153
+ borderColor: textColor(style),
154
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
155
+ color: textColor(style)
156
+ };
157
+ };
158
+
135
159
  // components/input-group.js
136
- var import_jsx_runtime3 = (
137
- // A real <label> (not a bare <span>) so the field name is announced by
138
- // screen readers, clicking the text focuses the control, and
139
- // getByLabel()/role queries can find it. The association comes from
140
- // `htmlFor`, never from the wrapping — see the note above the id.
141
- require("react/jsx-runtime")
160
+ var import_jsx_runtime3 = require("react/jsx-runtime");
161
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
162
+ "span",
163
+ {
164
+ ...{
165
+ className: typeof children === "string" ? "flex items-center shrink-0 px-3 font-mono text-sm opacity-60 whitespace-nowrap select-none" : "flex items-center shrink-0 px-2"
166
+ },
167
+ children
168
+ }
142
169
  );
143
170
  var InputGroup = ({
171
+ after,
172
+ before,
144
173
  className,
145
174
  error,
146
175
  input,
@@ -151,7 +180,29 @@ var InputGroup = ({
151
180
  }) => {
152
181
  const generated = (0, import_react2.useId)();
153
182
  const id = (0, import_react2.isValidElement)(input) ? input.props.id || generated : generated;
154
- const control = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
183
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
184
+ const addons = after != null || before != null;
185
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
186
+ "div",
187
+ {
188
+ ...{
189
+ className: "input flex items-center overflow-hidden",
190
+ style: {
191
+ ...inputStyle(style),
192
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
193
+ // padding beats a layered utility, an inline style beats both.
194
+ padding: 0
195
+ }
196
+ },
197
+ children: [
198
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
199
+ (0, import_react2.cloneElement)(named, {
200
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
201
+ }),
202
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
203
+ ]
204
+ }
205
+ ) : named;
155
206
  const classes = [
156
207
  "input-group"
157
208
  ];
@@ -172,26 +223,32 @@ var InputGroup = ({
172
223
  }
173
224
  },
174
225
  children: [
175
- label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
176
- "label",
177
- {
178
- ...{
179
- className: "space-y-2 block",
180
- htmlFor: id
181
- },
182
- children: [
183
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
184
- "span",
185
- {
186
- ...{
187
- className: "block"
188
- },
189
- children: label
190
- }
191
- ),
192
- control
193
- ]
194
- }
226
+ label ? (
227
+ // A real <label> (not a bare <span>) so the field name is announced by
228
+ // screen readers, clicking the text focuses the control, and
229
+ // getByLabel()/role queries can find it. The association comes from
230
+ // `htmlFor`, never from the wrapping — see the note above the id.
231
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
232
+ "label",
233
+ {
234
+ ...{
235
+ className: "space-y-2 block",
236
+ htmlFor: id
237
+ },
238
+ children: [
239
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
240
+ "span",
241
+ {
242
+ ...{
243
+ className: "block"
244
+ },
245
+ children: label
246
+ }
247
+ ),
248
+ control
249
+ ]
250
+ }
251
+ )
195
252
  ) : control,
196
253
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
197
254
  input_group_error_default,
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  input_group_default
4
- } from "./chunk-MKBY26H7.mjs";
5
- import "./chunk-OHJMWJAQ.mjs";
4
+ } from "./chunk-WUZE3BIA.mjs";
5
+ import "./chunk-KSCQQUFC.mjs";
6
6
  import "./chunk-Q3UIVGPQ.mjs";
7
+ import "./chunk-6F23WKP2.mjs";
7
8
  export {
8
9
  input_group_default as default
9
10
  };
@@ -95,7 +95,10 @@ var InputGroupError = ({
95
95
  warning_default,
96
96
  {
97
97
  ...{
98
- className: "w-4 h-4",
98
+ // shrink-0: a long error ("Expected your CNAME record to be …
99
+ // but found …") wraps, and a flex item with no floor gets
100
+ // squeezed to a sliver beside it.
101
+ className: "w-4 h-4 shrink-0",
99
102
  "aria-hidden": true
100
103
  }
101
104
  }
@@ -133,15 +136,41 @@ var InputGroupError = ({
133
136
  };
134
137
  var input_group_error_default = InputGroupError;
135
138
 
139
+ // components/styles.js
140
+ var WHITE = "rgb( 255, 255, 255 )";
141
+ var BLACK = "rgb( 0, 0, 0 )";
142
+ var bgColor = (style) => {
143
+ var _a, _b;
144
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
145
+ };
146
+ var textColor = (style) => {
147
+ var _a, _b;
148
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
149
+ };
150
+ var inputStyle = (style) => {
151
+ var _a;
152
+ return {
153
+ backgroundColor: bgColor(style),
154
+ borderColor: textColor(style),
155
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
156
+ color: textColor(style)
157
+ };
158
+ };
159
+
136
160
  // components/input-group.js
137
- var import_jsx_runtime3 = (
138
- // A real <label> (not a bare <span>) so the field name is announced by
139
- // screen readers, clicking the text focuses the control, and
140
- // getByLabel()/role queries can find it. The association comes from
141
- // `htmlFor`, never from the wrapping — see the note above the id.
142
- require("react/jsx-runtime")
161
+ var import_jsx_runtime3 = require("react/jsx-runtime");
162
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
163
+ "span",
164
+ {
165
+ ...{
166
+ className: typeof children === "string" ? "flex items-center shrink-0 px-3 font-mono text-sm opacity-60 whitespace-nowrap select-none" : "flex items-center shrink-0 px-2"
167
+ },
168
+ children
169
+ }
143
170
  );
144
171
  var InputGroup = ({
172
+ after,
173
+ before,
145
174
  className,
146
175
  error,
147
176
  input,
@@ -152,7 +181,29 @@ var InputGroup = ({
152
181
  }) => {
153
182
  const generated = (0, import_react2.useId)();
154
183
  const id = (0, import_react2.isValidElement)(input) ? input.props.id || generated : generated;
155
- const control = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
184
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
185
+ const addons = after != null || before != null;
186
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
187
+ "div",
188
+ {
189
+ ...{
190
+ className: "input flex items-center overflow-hidden",
191
+ style: {
192
+ ...inputStyle(style),
193
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
194
+ // padding beats a layered utility, an inline style beats both.
195
+ padding: 0
196
+ }
197
+ },
198
+ children: [
199
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
200
+ (0, import_react2.cloneElement)(named, {
201
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
202
+ }),
203
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
204
+ ]
205
+ }
206
+ ) : named;
156
207
  const classes = [
157
208
  "input-group"
158
209
  ];
@@ -173,26 +224,32 @@ var InputGroup = ({
173
224
  }
174
225
  },
175
226
  children: [
176
- label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
177
- "label",
178
- {
179
- ...{
180
- className: "space-y-2 block",
181
- htmlFor: id
182
- },
183
- children: [
184
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
185
- "span",
186
- {
187
- ...{
188
- className: "block"
189
- },
190
- children: label
191
- }
192
- ),
193
- control
194
- ]
195
- }
227
+ label ? (
228
+ // A real <label> (not a bare <span>) so the field name is announced by
229
+ // screen readers, clicking the text focuses the control, and
230
+ // getByLabel()/role queries can find it. The association comes from
231
+ // `htmlFor`, never from the wrapping — see the note above the id.
232
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
233
+ "label",
234
+ {
235
+ ...{
236
+ className: "space-y-2 block",
237
+ htmlFor: id
238
+ },
239
+ children: [
240
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
241
+ "span",
242
+ {
243
+ ...{
244
+ className: "block"
245
+ },
246
+ children: label
247
+ }
248
+ ),
249
+ control
250
+ ]
251
+ }
252
+ )
196
253
  ) : control,
197
254
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
198
255
  input_group_error_default,
@@ -211,27 +268,6 @@ var InputGroup = ({
211
268
  };
212
269
  var input_group_default = InputGroup;
213
270
 
214
- // components/styles.js
215
- var WHITE = "rgb( 255, 255, 255 )";
216
- var BLACK = "rgb( 0, 0, 0 )";
217
- var bgColor = (style) => {
218
- var _a, _b;
219
- return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
220
- };
221
- var textColor = (style) => {
222
- var _a, _b;
223
- return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
224
- };
225
- var inputStyle = (style) => {
226
- var _a;
227
- return {
228
- backgroundColor: bgColor(style),
229
- borderColor: textColor(style),
230
- borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
231
- color: textColor(style)
232
- };
233
- };
234
-
235
271
  // components/input-text.js
236
272
  var import_jsx_runtime4 = require("react/jsx-runtime");
237
273
  var InputText = ({
@@ -3,8 +3,8 @@ import {
3
3
  } from "./chunk-Y466XTIK.mjs";
4
4
  import {
5
5
  input_group_default
6
- } from "./chunk-MKBY26H7.mjs";
7
- import "./chunk-OHJMWJAQ.mjs";
6
+ } from "./chunk-WUZE3BIA.mjs";
7
+ import "./chunk-KSCQQUFC.mjs";
8
8
  import "./chunk-Q3UIVGPQ.mjs";
9
9
  import "./chunk-6F23WKP2.mjs";
10
10
 
package/dist/product.js CHANGED
@@ -110,7 +110,10 @@ var InputGroupError = ({
110
110
  warning_default,
111
111
  {
112
112
  ...{
113
- className: "w-4 h-4",
113
+ // shrink-0: a long error ("Expected your CNAME record to be …
114
+ // but found …") wraps, and a flex item with no floor gets
115
+ // squeezed to a sliver beside it.
116
+ className: "w-4 h-4 shrink-0",
114
117
  "aria-hidden": true
115
118
  }
116
119
  }
@@ -148,15 +151,70 @@ var InputGroupError = ({
148
151
  };
149
152
  var input_group_error_default = InputGroupError;
150
153
 
154
+ // components/styles.js
155
+ var WHITE = "rgb( 255, 255, 255 )";
156
+ var BLACK = "rgb( 0, 0, 0 )";
157
+ var bgColor = (style) => {
158
+ var _a, _b;
159
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
160
+ };
161
+ var textColor = (style) => {
162
+ var _a, _b;
163
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
164
+ };
165
+ var DEFAULT_FAMILY = "Roboto Flex";
166
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
167
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
168
+ var toFontWeight = (variant) => {
169
+ var _a;
170
+ if (!variant) return void 0;
171
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
172
+ if (variant.includes("regular")) return "normal";
173
+ return variant;
174
+ };
175
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
176
+ var buttonStyle = (style) => {
177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
178
+ return {
179
+ backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || textColor(style),
180
+ borderColor: ((_f = (_e = (_d = style == null ? void 0 : style.button) == null ? void 0 : _d.background) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb) || textColor(style),
181
+ borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
182
+ color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
183
+ };
184
+ };
185
+ var headerStyle = (style) => {
186
+ var _a, _b, _c, _d;
187
+ return {
188
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
189
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
190
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
191
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
192
+ };
193
+ };
194
+ var inputStyle = (style) => {
195
+ var _a;
196
+ return {
197
+ backgroundColor: bgColor(style),
198
+ borderColor: textColor(style),
199
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
200
+ color: textColor(style)
201
+ };
202
+ };
203
+
151
204
  // components/input-group.js
152
- var import_jsx_runtime3 = (
153
- // A real <label> (not a bare <span>) so the field name is announced by
154
- // screen readers, clicking the text focuses the control, and
155
- // getByLabel()/role queries can find it. The association comes from
156
- // `htmlFor`, never from the wrapping — see the note above the id.
157
- require("react/jsx-runtime")
205
+ var import_jsx_runtime3 = require("react/jsx-runtime");
206
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
207
+ "span",
208
+ {
209
+ ...{
210
+ className: typeof children === "string" ? "flex items-center shrink-0 px-3 font-mono text-sm opacity-60 whitespace-nowrap select-none" : "flex items-center shrink-0 px-2"
211
+ },
212
+ children
213
+ }
158
214
  );
159
215
  var InputGroup = ({
216
+ after,
217
+ before,
160
218
  className,
161
219
  error,
162
220
  input,
@@ -167,7 +225,29 @@ var InputGroup = ({
167
225
  }) => {
168
226
  const generated = (0, import_react2.useId)();
169
227
  const id = (0, import_react2.isValidElement)(input) ? input.props.id || generated : generated;
170
- const control = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
228
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
229
+ const addons = after != null || before != null;
230
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
231
+ "div",
232
+ {
233
+ ...{
234
+ className: "input flex items-center overflow-hidden",
235
+ style: {
236
+ ...inputStyle(style),
237
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
238
+ // padding beats a layered utility, an inline style beats both.
239
+ padding: 0
240
+ }
241
+ },
242
+ children: [
243
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
244
+ (0, import_react2.cloneElement)(named, {
245
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
246
+ }),
247
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
248
+ ]
249
+ }
250
+ ) : named;
171
251
  const classes = [
172
252
  "input-group"
173
253
  ];
@@ -188,26 +268,32 @@ var InputGroup = ({
188
268
  }
189
269
  },
190
270
  children: [
191
- label ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
192
- "label",
193
- {
194
- ...{
195
- className: "space-y-2 block",
196
- htmlFor: id
197
- },
198
- children: [
199
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
200
- "span",
201
- {
202
- ...{
203
- className: "block"
204
- },
205
- children: label
206
- }
207
- ),
208
- control
209
- ]
210
- }
271
+ label ? (
272
+ // A real <label> (not a bare <span>) so the field name is announced by
273
+ // screen readers, clicking the text focuses the control, and
274
+ // getByLabel()/role queries can find it. The association comes from
275
+ // `htmlFor`, never from the wrapping — see the note above the id.
276
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
277
+ "label",
278
+ {
279
+ ...{
280
+ className: "space-y-2 block",
281
+ htmlFor: id
282
+ },
283
+ children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
285
+ "span",
286
+ {
287
+ ...{
288
+ className: "block"
289
+ },
290
+ children: label
291
+ }
292
+ ),
293
+ control
294
+ ]
295
+ }
296
+ )
211
297
  ) : control,
212
298
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
213
299
  input_group_error_default,
@@ -255,56 +341,6 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
255
341
  );
256
342
  var chevron_down_default = ChevronDown;
257
343
 
258
- // components/styles.js
259
- var WHITE = "rgb( 255, 255, 255 )";
260
- var BLACK = "rgb( 0, 0, 0 )";
261
- var bgColor = (style) => {
262
- var _a, _b;
263
- return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
264
- };
265
- var textColor = (style) => {
266
- var _a, _b;
267
- return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
268
- };
269
- var DEFAULT_FAMILY = "Roboto Flex";
270
- var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
271
- var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
272
- var toFontWeight = (variant) => {
273
- var _a;
274
- if (!variant) return void 0;
275
- if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
276
- if (variant.includes("regular")) return "normal";
277
- return variant;
278
- };
279
- var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
280
- var buttonStyle = (style) => {
281
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
282
- return {
283
- backgroundColor: ((_c = (_b = (_a = style == null ? void 0 : style.button) == null ? void 0 : _a.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || textColor(style),
284
- borderColor: ((_f = (_e = (_d = style == null ? void 0 : style.button) == null ? void 0 : _d.background) == null ? void 0 : _e.color) == null ? void 0 : _f.rgb) || textColor(style),
285
- borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
286
- color: ((_j = (_i = (_h = style == null ? void 0 : style.button) == null ? void 0 : _h.text) == null ? void 0 : _i.color) == null ? void 0 : _j.rgb) || bgColor(style)
287
- };
288
- };
289
- var headerStyle = (style) => {
290
- var _a, _b, _c, _d;
291
- return {
292
- fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
293
- fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
294
- fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
295
- textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
296
- };
297
- };
298
- var inputStyle = (style) => {
299
- var _a;
300
- return {
301
- backgroundColor: bgColor(style),
302
- borderColor: textColor(style),
303
- borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
304
- color: textColor(style)
305
- };
306
- };
307
-
308
344
  // components/input-select.js
309
345
  var import_jsx_runtime5 = require("react/jsx-runtime");
310
346
  var InputSelect = ({
package/dist/product.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-PURM4QR2.mjs";
4
+ } from "./chunk-PNM4PZ4L.mjs";
5
5
  import "./chunk-PT7UR6AO.mjs";
6
6
  import "./chunk-7GRIGQDC.mjs";
7
7
  import "./chunk-FYA7EAMR.mjs";
8
8
  import "./chunk-2ZYGRSSA.mjs";
9
- import "./chunk-MKBY26H7.mjs";
10
- import "./chunk-OHJMWJAQ.mjs";
9
+ import "./chunk-WUZE3BIA.mjs";
10
+ import "./chunk-KSCQQUFC.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
12
  import "./chunk-6F23WKP2.mjs";
13
13
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",
@@ -2,6 +2,10 @@ import { ComponentType, ReactNode } from 'react';
2
2
  import { BrandStyle } from './styles';
3
3
 
4
4
  export interface InputGroupProps {
5
+ /** Rendered inside the field's border after the control: a string reads as a fixed half of the value, a node renders as given. */
6
+ after?: ReactNode;
7
+ /** Rendered inside the field's border before the control. */
8
+ before?: ReactNode;
5
9
  className?: string;
6
10
  error?: ReactNode;
7
11
  input?: ReactNode;