@drawbridge/components 0.0.75 → 0.0.76

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.
@@ -151,15 +151,70 @@ var InputGroupError = ({
151
151
  };
152
152
  var input_group_error_default = InputGroupError;
153
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
+
154
204
  // 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")
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
+ }
161
214
  );
162
215
  var InputGroup = ({
216
+ after,
217
+ before,
163
218
  className,
164
219
  error,
165
220
  input,
@@ -170,7 +225,29 @@ var InputGroup = ({
170
225
  }) => {
171
226
  const generated = (0, import_react2.useId)();
172
227
  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;
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;
174
251
  const classes = [
175
252
  "input-group"
176
253
  ];
@@ -191,26 +268,32 @@ var InputGroup = ({
191
268
  }
192
269
  },
193
270
  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
- }
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
+ )
214
297
  ) : control,
215
298
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
216
299
  input_group_error_default,
@@ -258,56 +341,6 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
258
341
  );
259
342
  var chevron_down_default = ChevronDown;
260
343
 
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
344
  // components/input-select.js
312
345
  var import_jsx_runtime5 = require("react/jsx-runtime");
313
346
  var InputSelect = ({
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-PURM4QR2.mjs";
4
+ } from "./chunk-TFZRXJYH.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";
9
+ import "./chunk-TSVDDA5K.mjs";
10
10
  import "./chunk-OHJMWJAQ.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
12
  import {
@@ -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-TSVDDA5K.mjs";
13
13
  import {
14
14
  buttonStyle,
15
15
  headerStyle,
@@ -1,11 +1,25 @@
1
1
  import {
2
2
  input_group_error_default
3
3
  } from "./chunk-OHJMWJAQ.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
  ];
@@ -132,15 +132,41 @@ var InputGroupError = ({
132
132
  };
133
133
  var input_group_error_default = InputGroupError;
134
134
 
135
+ // components/styles.js
136
+ var WHITE = "rgb( 255, 255, 255 )";
137
+ var BLACK = "rgb( 0, 0, 0 )";
138
+ var bgColor = (style) => {
139
+ var _a, _b;
140
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
141
+ };
142
+ var textColor = (style) => {
143
+ var _a, _b;
144
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
145
+ };
146
+ var inputStyle = (style) => {
147
+ var _a;
148
+ return {
149
+ backgroundColor: bgColor(style),
150
+ borderColor: textColor(style),
151
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
152
+ color: textColor(style)
153
+ };
154
+ };
155
+
135
156
  // 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")
157
+ var import_jsx_runtime3 = require("react/jsx-runtime");
158
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
159
+ "span",
160
+ {
161
+ ...{
162
+ 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"
163
+ },
164
+ children
165
+ }
142
166
  );
143
167
  var InputGroup = ({
168
+ after,
169
+ before,
144
170
  className,
145
171
  error,
146
172
  input,
@@ -151,7 +177,29 @@ var InputGroup = ({
151
177
  }) => {
152
178
  const generated = (0, import_react2.useId)();
153
179
  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;
180
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
181
+ const addons = after != null || before != null;
182
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
183
+ "div",
184
+ {
185
+ ...{
186
+ className: "input flex items-center overflow-hidden",
187
+ style: {
188
+ ...inputStyle(style),
189
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
190
+ // padding beats a layered utility, an inline style beats both.
191
+ padding: 0
192
+ }
193
+ },
194
+ children: [
195
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
196
+ (0, import_react2.cloneElement)(named, {
197
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
198
+ }),
199
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
200
+ ]
201
+ }
202
+ ) : named;
155
203
  const classes = [
156
204
  "input-group"
157
205
  ];
@@ -172,26 +220,32 @@ var InputGroup = ({
172
220
  }
173
221
  },
174
222
  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
- }
223
+ label ? (
224
+ // A real <label> (not a bare <span>) so the field name is announced by
225
+ // screen readers, clicking the text focuses the control, and
226
+ // getByLabel()/role queries can find it. The association comes from
227
+ // `htmlFor`, never from the wrapping — see the note above the id.
228
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
229
+ "label",
230
+ {
231
+ ...{
232
+ className: "space-y-2 block",
233
+ htmlFor: id
234
+ },
235
+ children: [
236
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
237
+ "span",
238
+ {
239
+ ...{
240
+ className: "block"
241
+ },
242
+ children: label
243
+ }
244
+ ),
245
+ control
246
+ ]
247
+ }
248
+ )
195
249
  ) : control,
196
250
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
197
251
  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";
4
+ } from "./chunk-TSVDDA5K.mjs";
5
5
  import "./chunk-OHJMWJAQ.mjs";
6
6
  import "./chunk-Q3UIVGPQ.mjs";
7
+ import "./chunk-6F23WKP2.mjs";
7
8
  export {
8
9
  input_group_default as default
9
10
  };
@@ -133,15 +133,41 @@ var InputGroupError = ({
133
133
  };
134
134
  var input_group_error_default = InputGroupError;
135
135
 
136
+ // components/styles.js
137
+ var WHITE = "rgb( 255, 255, 255 )";
138
+ var BLACK = "rgb( 0, 0, 0 )";
139
+ var bgColor = (style) => {
140
+ var _a, _b;
141
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
142
+ };
143
+ var textColor = (style) => {
144
+ var _a, _b;
145
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
146
+ };
147
+ var inputStyle = (style) => {
148
+ var _a;
149
+ return {
150
+ backgroundColor: bgColor(style),
151
+ borderColor: textColor(style),
152
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
153
+ color: textColor(style)
154
+ };
155
+ };
156
+
136
157
  // 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")
158
+ var import_jsx_runtime3 = require("react/jsx-runtime");
159
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
160
+ "span",
161
+ {
162
+ ...{
163
+ 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"
164
+ },
165
+ children
166
+ }
143
167
  );
144
168
  var InputGroup = ({
169
+ after,
170
+ before,
145
171
  className,
146
172
  error,
147
173
  input,
@@ -152,7 +178,29 @@ var InputGroup = ({
152
178
  }) => {
153
179
  const generated = (0, import_react2.useId)();
154
180
  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;
181
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
182
+ const addons = after != null || before != null;
183
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
184
+ "div",
185
+ {
186
+ ...{
187
+ className: "input flex items-center overflow-hidden",
188
+ style: {
189
+ ...inputStyle(style),
190
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
191
+ // padding beats a layered utility, an inline style beats both.
192
+ padding: 0
193
+ }
194
+ },
195
+ children: [
196
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
197
+ (0, import_react2.cloneElement)(named, {
198
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
199
+ }),
200
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
201
+ ]
202
+ }
203
+ ) : named;
156
204
  const classes = [
157
205
  "input-group"
158
206
  ];
@@ -173,26 +221,32 @@ var InputGroup = ({
173
221
  }
174
222
  },
175
223
  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
- }
224
+ label ? (
225
+ // A real <label> (not a bare <span>) so the field name is announced by
226
+ // screen readers, clicking the text focuses the control, and
227
+ // getByLabel()/role queries can find it. The association comes from
228
+ // `htmlFor`, never from the wrapping — see the note above the id.
229
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
230
+ "label",
231
+ {
232
+ ...{
233
+ className: "space-y-2 block",
234
+ htmlFor: id
235
+ },
236
+ children: [
237
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
238
+ "span",
239
+ {
240
+ ...{
241
+ className: "block"
242
+ },
243
+ children: label
244
+ }
245
+ ),
246
+ control
247
+ ]
248
+ }
249
+ )
196
250
  ) : control,
197
251
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
198
252
  input_group_error_default,
@@ -211,27 +265,6 @@ var InputGroup = ({
211
265
  };
212
266
  var input_group_default = InputGroup;
213
267
 
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
268
  // components/input-text.js
236
269
  var import_jsx_runtime4 = require("react/jsx-runtime");
237
270
  var InputText = ({
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-Y466XTIK.mjs";
4
4
  import {
5
5
  input_group_default
6
- } from "./chunk-MKBY26H7.mjs";
6
+ } from "./chunk-TSVDDA5K.mjs";
7
7
  import "./chunk-OHJMWJAQ.mjs";
8
8
  import "./chunk-Q3UIVGPQ.mjs";
9
9
  import "./chunk-6F23WKP2.mjs";
package/dist/product.js CHANGED
@@ -148,15 +148,70 @@ var InputGroupError = ({
148
148
  };
149
149
  var input_group_error_default = InputGroupError;
150
150
 
151
+ // components/styles.js
152
+ var WHITE = "rgb( 255, 255, 255 )";
153
+ var BLACK = "rgb( 0, 0, 0 )";
154
+ var bgColor = (style) => {
155
+ var _a, _b;
156
+ return ((_b = (_a = style == null ? void 0 : style.background) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || WHITE;
157
+ };
158
+ var textColor = (style) => {
159
+ var _a, _b;
160
+ return ((_b = (_a = style == null ? void 0 : style.text) == null ? void 0 : _a.color) == null ? void 0 : _b.rgb) || BLACK;
161
+ };
162
+ var DEFAULT_FAMILY = "Roboto Flex";
163
+ var FONT_FALLBACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
164
+ var toFontFamily = (family) => '"' + (family || DEFAULT_FAMILY) + '", ' + FONT_FALLBACK;
165
+ var toFontWeight = (variant) => {
166
+ var _a;
167
+ if (!variant) return void 0;
168
+ if (variant.includes("italic")) return (_a = variant.match(/^\d+/)) == null ? void 0 : _a[0];
169
+ if (variant.includes("regular")) return "normal";
170
+ return variant;
171
+ };
172
+ var toFontStyle = (variant) => (variant == null ? void 0 : variant.includes("italic")) ? "italic" : void 0;
173
+ var buttonStyle = (style) => {
174
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
175
+ return {
176
+ 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),
177
+ 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),
178
+ borderRadius: ((_g = style == null ? void 0 : style.button) == null ? void 0 : _g.radius) != null ? style.button.radius / 4 + "px" : void 0,
179
+ 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)
180
+ };
181
+ };
182
+ var headerStyle = (style) => {
183
+ var _a, _b, _c, _d;
184
+ return {
185
+ fontFamily: toFontFamily((_a = style == null ? void 0 : style.heading) == null ? void 0 : _a.family),
186
+ fontWeight: toFontWeight((_b = style == null ? void 0 : style.heading) == null ? void 0 : _b.weight),
187
+ fontStyle: toFontStyle((_c = style == null ? void 0 : style.heading) == null ? void 0 : _c.weight),
188
+ textTransform: (_d = style == null ? void 0 : style.heading) == null ? void 0 : _d.transform
189
+ };
190
+ };
191
+ var inputStyle = (style) => {
192
+ var _a;
193
+ return {
194
+ backgroundColor: bgColor(style),
195
+ borderColor: textColor(style),
196
+ borderRadius: ((_a = style == null ? void 0 : style.input) == null ? void 0 : _a.radius) != null ? style.input.radius / 4 + "px" : void 0,
197
+ color: textColor(style)
198
+ };
199
+ };
200
+
151
201
  // 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")
202
+ var import_jsx_runtime3 = require("react/jsx-runtime");
203
+ var Addon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
204
+ "span",
205
+ {
206
+ ...{
207
+ 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"
208
+ },
209
+ children
210
+ }
158
211
  );
159
212
  var InputGroup = ({
213
+ after,
214
+ before,
160
215
  className,
161
216
  error,
162
217
  input,
@@ -167,7 +222,29 @@ var InputGroup = ({
167
222
  }) => {
168
223
  const generated = (0, import_react2.useId)();
169
224
  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;
225
+ const named = (0, import_react2.isValidElement)(input) && !input.props.id ? (0, import_react2.cloneElement)(input, { id }) : input;
226
+ const addons = after != null || before != null;
227
+ const control = addons && (0, import_react2.isValidElement)(named) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
228
+ "div",
229
+ {
230
+ ...{
231
+ className: "input flex items-center overflow-hidden",
232
+ style: {
233
+ ...inputStyle(style),
234
+ // Inline, not `p-0`: see InputNumber — share's unlayered `.input`
235
+ // padding beats a layered utility, an inline style beats both.
236
+ padding: 0
237
+ }
238
+ },
239
+ children: [
240
+ before != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: before }),
241
+ (0, import_react2.cloneElement)(named, {
242
+ className: [named.props.className, "!border-0 !rounded-none !ring-0 !shadow-none flex-1 min-w-0"].filter(Boolean).join(" ")
243
+ }),
244
+ after != null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Addon, { children: after })
245
+ ]
246
+ }
247
+ ) : named;
171
248
  const classes = [
172
249
  "input-group"
173
250
  ];
@@ -188,26 +265,32 @@ var InputGroup = ({
188
265
  }
189
266
  },
190
267
  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
- }
268
+ label ? (
269
+ // A real <label> (not a bare <span>) so the field name is announced by
270
+ // screen readers, clicking the text focuses the control, and
271
+ // getByLabel()/role queries can find it. The association comes from
272
+ // `htmlFor`, never from the wrapping — see the note above the id.
273
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
274
+ "label",
275
+ {
276
+ ...{
277
+ className: "space-y-2 block",
278
+ htmlFor: id
279
+ },
280
+ children: [
281
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
282
+ "span",
283
+ {
284
+ ...{
285
+ className: "block"
286
+ },
287
+ children: label
288
+ }
289
+ ),
290
+ control
291
+ ]
292
+ }
293
+ )
211
294
  ) : control,
212
295
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
213
296
  input_group_error_default,
@@ -255,56 +338,6 @@ var ChevronDown = (props) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
255
338
  );
256
339
  var chevron_down_default = ChevronDown;
257
340
 
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
341
  // components/input-select.js
309
342
  var import_jsx_runtime5 = require("react/jsx-runtime");
310
343
  var InputSelect = ({
package/dist/product.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  product_default
4
- } from "./chunk-PURM4QR2.mjs";
4
+ } from "./chunk-TFZRXJYH.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";
9
+ import "./chunk-TSVDDA5K.mjs";
10
10
  import "./chunk-OHJMWJAQ.mjs";
11
11
  import "./chunk-Q3UIVGPQ.mjs";
12
12
  import "./chunk-6F23WKP2.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
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;