@duskmoon-dev/components 0.4.1 → 0.5.1

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.
@@ -2147,6 +2147,7 @@ var SelectRoot = forwardRef6(({
2147
2147
  "aria-invalid": ariaInvalid,
2148
2148
  "aria-label": ariaLabel,
2149
2149
  "aria-labelledby": ariaLabelledBy,
2150
+ "aria-required": ariaRequired,
2150
2151
  children,
2151
2152
  className,
2152
2153
  defaultValue,
@@ -2283,6 +2284,7 @@ var SelectRoot = forwardRef6(({
2283
2284
  "aria-invalid": ariaInvalid,
2284
2285
  "aria-label": ariaLabel,
2285
2286
  "aria-labelledby": ariaLabelledBy,
2287
+ "aria-required": ariaRequired,
2286
2288
  "aria-haspopup": "listbox",
2287
2289
  "aria-expanded": open,
2288
2290
  onClick: () => setOpen((current) => !current),
@@ -2297,7 +2299,20 @@ var SelectRoot = forwardRef6(({
2297
2299
  /* @__PURE__ */ jsx8("span", {
2298
2300
  className: selectIconClass,
2299
2301
  "aria-hidden": "true",
2300
- children: "v"
2302
+ children: /* @__PURE__ */ jsx8("svg", {
2303
+ width: "16",
2304
+ height: "16",
2305
+ viewBox: "0 0 24 24",
2306
+ fill: "none",
2307
+ stroke: "currentColor",
2308
+ strokeWidth: "2",
2309
+ strokeLinecap: "round",
2310
+ strokeLinejoin: "round",
2311
+ "aria-hidden": "true",
2312
+ children: /* @__PURE__ */ jsx8("path", {
2313
+ d: "m6 9 6 6 6-6"
2314
+ })
2315
+ })
2301
2316
  })
2302
2317
  ]
2303
2318
  }),
@@ -2306,7 +2321,19 @@ var SelectRoot = forwardRef6(({
2306
2321
  className: selectClearClass,
2307
2322
  "aria-label": "Clear selection",
2308
2323
  onClick: clearValue,
2309
- children: "x"
2324
+ children: /* @__PURE__ */ jsx8("svg", {
2325
+ width: "14",
2326
+ height: "14",
2327
+ viewBox: "0 0 24 24",
2328
+ fill: "none",
2329
+ stroke: "currentColor",
2330
+ strokeWidth: "2",
2331
+ strokeLinecap: "round",
2332
+ "aria-hidden": "true",
2333
+ children: /* @__PURE__ */ jsx8("path", {
2334
+ d: "m6 6 12 12M6 18 18 6"
2335
+ })
2336
+ })
2310
2337
  }) : null,
2311
2338
  open ? /* @__PURE__ */ jsxs7("div", {
2312
2339
  className: selectDropdownClass,
@@ -1645,6 +1645,7 @@ var SelectRoot = forwardRef4(({
1645
1645
  "aria-invalid": ariaInvalid,
1646
1646
  "aria-label": ariaLabel,
1647
1647
  "aria-labelledby": ariaLabelledBy,
1648
+ "aria-required": ariaRequired,
1648
1649
  children,
1649
1650
  className,
1650
1651
  defaultValue,
@@ -1781,6 +1782,7 @@ var SelectRoot = forwardRef4(({
1781
1782
  "aria-invalid": ariaInvalid,
1782
1783
  "aria-label": ariaLabel,
1783
1784
  "aria-labelledby": ariaLabelledBy,
1785
+ "aria-required": ariaRequired,
1784
1786
  "aria-haspopup": "listbox",
1785
1787
  "aria-expanded": open,
1786
1788
  onClick: () => setOpen((current) => !current),
@@ -1795,7 +1797,20 @@ var SelectRoot = forwardRef4(({
1795
1797
  /* @__PURE__ */ jsx5("span", {
1796
1798
  className: selectIconClass,
1797
1799
  "aria-hidden": "true",
1798
- children: "v"
1800
+ children: /* @__PURE__ */ jsx5("svg", {
1801
+ width: "16",
1802
+ height: "16",
1803
+ viewBox: "0 0 24 24",
1804
+ fill: "none",
1805
+ stroke: "currentColor",
1806
+ strokeWidth: "2",
1807
+ strokeLinecap: "round",
1808
+ strokeLinejoin: "round",
1809
+ "aria-hidden": "true",
1810
+ children: /* @__PURE__ */ jsx5("path", {
1811
+ d: "m6 9 6 6 6-6"
1812
+ })
1813
+ })
1799
1814
  })
1800
1815
  ]
1801
1816
  }),
@@ -1804,7 +1819,19 @@ var SelectRoot = forwardRef4(({
1804
1819
  className: selectClearClass,
1805
1820
  "aria-label": "Clear selection",
1806
1821
  onClick: clearValue,
1807
- children: "x"
1822
+ children: /* @__PURE__ */ jsx5("svg", {
1823
+ width: "14",
1824
+ height: "14",
1825
+ viewBox: "0 0 24 24",
1826
+ fill: "none",
1827
+ stroke: "currentColor",
1828
+ strokeWidth: "2",
1829
+ strokeLinecap: "round",
1830
+ "aria-hidden": "true",
1831
+ children: /* @__PURE__ */ jsx5("path", {
1832
+ d: "m6 6 12 12M6 18 18 6"
1833
+ })
1834
+ })
1808
1835
  }) : null,
1809
1836
  open ? /* @__PURE__ */ jsxs5("div", {
1810
1837
  className: selectDropdownClass,
@@ -1637,6 +1637,7 @@ var SelectRoot = forwardRef4(({
1637
1637
  "aria-invalid": ariaInvalid,
1638
1638
  "aria-label": ariaLabel,
1639
1639
  "aria-labelledby": ariaLabelledBy,
1640
+ "aria-required": ariaRequired,
1640
1641
  children,
1641
1642
  className,
1642
1643
  defaultValue,
@@ -1773,6 +1774,7 @@ var SelectRoot = forwardRef4(({
1773
1774
  "aria-invalid": ariaInvalid,
1774
1775
  "aria-label": ariaLabel,
1775
1776
  "aria-labelledby": ariaLabelledBy,
1777
+ "aria-required": ariaRequired,
1776
1778
  "aria-haspopup": "listbox",
1777
1779
  "aria-expanded": open,
1778
1780
  onClick: () => setOpen((current) => !current),
@@ -1787,7 +1789,20 @@ var SelectRoot = forwardRef4(({
1787
1789
  /* @__PURE__ */ jsx5("span", {
1788
1790
  className: selectIconClass,
1789
1791
  "aria-hidden": "true",
1790
- children: "v"
1792
+ children: /* @__PURE__ */ jsx5("svg", {
1793
+ width: "16",
1794
+ height: "16",
1795
+ viewBox: "0 0 24 24",
1796
+ fill: "none",
1797
+ stroke: "currentColor",
1798
+ strokeWidth: "2",
1799
+ strokeLinecap: "round",
1800
+ strokeLinejoin: "round",
1801
+ "aria-hidden": "true",
1802
+ children: /* @__PURE__ */ jsx5("path", {
1803
+ d: "m6 9 6 6 6-6"
1804
+ })
1805
+ })
1791
1806
  })
1792
1807
  ]
1793
1808
  }),
@@ -1796,7 +1811,19 @@ var SelectRoot = forwardRef4(({
1796
1811
  className: selectClearClass,
1797
1812
  "aria-label": "Clear selection",
1798
1813
  onClick: clearValue,
1799
- children: "x"
1814
+ children: /* @__PURE__ */ jsx5("svg", {
1815
+ width: "14",
1816
+ height: "14",
1817
+ viewBox: "0 0 24 24",
1818
+ fill: "none",
1819
+ stroke: "currentColor",
1820
+ strokeWidth: "2",
1821
+ strokeLinecap: "round",
1822
+ "aria-hidden": "true",
1823
+ children: /* @__PURE__ */ jsx5("path", {
1824
+ d: "m6 6 12 12M6 18 18 6"
1825
+ })
1826
+ })
1800
1827
  }) : null,
1801
1828
  open ? /* @__PURE__ */ jsxs5("div", {
1802
1829
  className: selectDropdownClass,
@@ -2137,6 +2137,7 @@ var SelectRoot = forwardRef6(({
2137
2137
  "aria-invalid": ariaInvalid,
2138
2138
  "aria-label": ariaLabel,
2139
2139
  "aria-labelledby": ariaLabelledBy,
2140
+ "aria-required": ariaRequired,
2140
2141
  children,
2141
2142
  className,
2142
2143
  defaultValue,
@@ -2273,6 +2274,7 @@ var SelectRoot = forwardRef6(({
2273
2274
  "aria-invalid": ariaInvalid,
2274
2275
  "aria-label": ariaLabel,
2275
2276
  "aria-labelledby": ariaLabelledBy,
2277
+ "aria-required": ariaRequired,
2276
2278
  "aria-haspopup": "listbox",
2277
2279
  "aria-expanded": open,
2278
2280
  onClick: () => setOpen((current) => !current),
@@ -2287,7 +2289,20 @@ var SelectRoot = forwardRef6(({
2287
2289
  /* @__PURE__ */ jsx8("span", {
2288
2290
  className: selectIconClass,
2289
2291
  "aria-hidden": "true",
2290
- children: "v"
2292
+ children: /* @__PURE__ */ jsx8("svg", {
2293
+ width: "16",
2294
+ height: "16",
2295
+ viewBox: "0 0 24 24",
2296
+ fill: "none",
2297
+ stroke: "currentColor",
2298
+ strokeWidth: "2",
2299
+ strokeLinecap: "round",
2300
+ strokeLinejoin: "round",
2301
+ "aria-hidden": "true",
2302
+ children: /* @__PURE__ */ jsx8("path", {
2303
+ d: "m6 9 6 6 6-6"
2304
+ })
2305
+ })
2291
2306
  })
2292
2307
  ]
2293
2308
  }),
@@ -2296,7 +2311,19 @@ var SelectRoot = forwardRef6(({
2296
2311
  className: selectClearClass,
2297
2312
  "aria-label": "Clear selection",
2298
2313
  onClick: clearValue,
2299
- children: "x"
2314
+ children: /* @__PURE__ */ jsx8("svg", {
2315
+ width: "14",
2316
+ height: "14",
2317
+ viewBox: "0 0 24 24",
2318
+ fill: "none",
2319
+ stroke: "currentColor",
2320
+ strokeWidth: "2",
2321
+ strokeLinecap: "round",
2322
+ "aria-hidden": "true",
2323
+ children: /* @__PURE__ */ jsx8("path", {
2324
+ d: "m6 6 12 12M6 18 18 6"
2325
+ })
2326
+ })
2300
2327
  }) : null,
2301
2328
  open ? /* @__PURE__ */ jsxs7("div", {
2302
2329
  className: selectDropdownClass,
@@ -88,6 +88,7 @@ var InputNumber = forwardRef(({
88
88
  onStep,
89
89
  parser = parseNumber,
90
90
  precision,
91
+ readOnly,
91
92
  size = "md",
92
93
  status,
93
94
  step = 1,
@@ -107,7 +108,7 @@ var InputNumber = forwardRef(({
107
108
  return normalized;
108
109
  }
109
110
  function stepValue(type) {
110
- if (disabled)
111
+ if (disabled || readOnly)
111
112
  return;
112
113
  const offset = type === "up" ? step : -step;
113
114
  const base = typeof currentValue === "number" ? currentValue : 0;
@@ -129,11 +130,15 @@ var InputNumber = forwardRef(({
129
130
  inputMode: "decimal",
130
131
  className: inputNumberInputClass,
131
132
  disabled,
133
+ readOnly,
132
134
  value: displayValue,
133
- onChange: (event) => emitChange(parser(event.currentTarget.value)),
135
+ onChange: (event) => {
136
+ if (!readOnly)
137
+ emitChange(parser(event.currentTarget.value));
138
+ },
134
139
  onKeyDown: (event) => {
135
140
  onKeyDown?.(event);
136
- if (!keyboard || event.defaultPrevented)
141
+ if (readOnly || !keyboard || event.defaultPrevented)
137
142
  return;
138
143
  if (event.key === "ArrowUp") {
139
144
  event.preventDefault();
@@ -151,7 +156,7 @@ var InputNumber = forwardRef(({
151
156
  /* @__PURE__ */ jsx("button", {
152
157
  type: "button",
153
158
  className: inputNumberControlClass,
154
- disabled: disabled || max !== undefined && Number(currentValue) >= max,
159
+ disabled: disabled || readOnly || max !== undefined && Number(currentValue) >= max,
155
160
  "aria-label": "Increase value",
156
161
  onClick: () => stepValue("up"),
157
162
  children: "+"
@@ -159,7 +164,7 @@ var InputNumber = forwardRef(({
159
164
  /* @__PURE__ */ jsx("button", {
160
165
  type: "button",
161
166
  className: inputNumberControlClass,
162
- disabled: disabled || min !== undefined && Number(currentValue) <= min,
167
+ disabled: disabled || readOnly || min !== undefined && Number(currentValue) <= min,
163
168
  "aria-label": "Decrease value",
164
169
  onClick: () => stepValue("down"),
165
170
  children: "-"
@@ -1,6 +1,8 @@
1
1
  import React from "react";
2
2
  import type { CompiledForm, FormErrors, RenderableSchema, FormValue } from "./json-schema-form";
3
3
  export type JsonSchemaFormProps = {
4
+ /** Additional classes for the generated native form; default classes are preserved. */
5
+ className?: string;
4
6
  value?: FormValue;
5
7
  defaultValue?: FormValue;
6
8
  onChange?: (value: FormValue) => void;
@@ -16,4 +18,4 @@ export type JsonSchemaFormProps = {
16
18
  schema: RenderableSchema;
17
19
  compiled?: never;
18
20
  });
19
- export declare function JsonSchemaForm({ compiled: suppliedCompiled, schema, value: controlledValue, defaultValue, onChange, errors: suppliedErrors, onErrorsChange, onSubmit, onReset, }: JsonSchemaFormProps): React.JSX.Element;
21
+ export declare function JsonSchemaForm({ className, compiled: suppliedCompiled, schema, value: controlledValue, defaultValue, onChange, errors: suppliedErrors, onErrorsChange, onSubmit, onReset, }: JsonSchemaFormProps): React.JSX.Element;
@@ -3328,6 +3328,7 @@ var InputNumber = forwardRef11(({
3328
3328
  onStep,
3329
3329
  parser = parseNumber,
3330
3330
  precision,
3331
+ readOnly,
3331
3332
  size = "md",
3332
3333
  status,
3333
3334
  step = 1,
@@ -3347,7 +3348,7 @@ var InputNumber = forwardRef11(({
3347
3348
  return normalized;
3348
3349
  }
3349
3350
  function stepValue(type) {
3350
- if (disabled)
3351
+ if (disabled || readOnly)
3351
3352
  return;
3352
3353
  const offset = type === "up" ? step : -step;
3353
3354
  const base = typeof currentValue === "number" ? currentValue : 0;
@@ -3369,11 +3370,15 @@ var InputNumber = forwardRef11(({
3369
3370
  inputMode: "decimal",
3370
3371
  className: inputNumberInputClass,
3371
3372
  disabled,
3373
+ readOnly,
3372
3374
  value: displayValue,
3373
- onChange: (event) => emitChange(parser(event.currentTarget.value)),
3375
+ onChange: (event) => {
3376
+ if (!readOnly)
3377
+ emitChange(parser(event.currentTarget.value));
3378
+ },
3374
3379
  onKeyDown: (event) => {
3375
3380
  onKeyDown?.(event);
3376
- if (!keyboard || event.defaultPrevented)
3381
+ if (readOnly || !keyboard || event.defaultPrevented)
3377
3382
  return;
3378
3383
  if (event.key === "ArrowUp") {
3379
3384
  event.preventDefault();
@@ -3391,7 +3396,7 @@ var InputNumber = forwardRef11(({
3391
3396
  /* @__PURE__ */ jsx12("button", {
3392
3397
  type: "button",
3393
3398
  className: inputNumberControlClass,
3394
- disabled: disabled || max !== undefined && Number(currentValue) >= max,
3399
+ disabled: disabled || readOnly || max !== undefined && Number(currentValue) >= max,
3395
3400
  "aria-label": "Increase value",
3396
3401
  onClick: () => stepValue("up"),
3397
3402
  children: "+"
@@ -3399,7 +3404,7 @@ var InputNumber = forwardRef11(({
3399
3404
  /* @__PURE__ */ jsx12("button", {
3400
3405
  type: "button",
3401
3406
  className: inputNumberControlClass,
3402
- disabled: disabled || min !== undefined && Number(currentValue) <= min,
3407
+ disabled: disabled || readOnly || min !== undefined && Number(currentValue) <= min,
3403
3408
  "aria-label": "Decrease value",
3404
3409
  onClick: () => stepValue("down"),
3405
3410
  children: "-"
@@ -4207,6 +4212,7 @@ var SelectRoot = forwardRef16(({
4207
4212
  "aria-invalid": ariaInvalid,
4208
4213
  "aria-label": ariaLabel,
4209
4214
  "aria-labelledby": ariaLabelledBy,
4215
+ "aria-required": ariaRequired,
4210
4216
  children,
4211
4217
  className,
4212
4218
  defaultValue,
@@ -4343,6 +4349,7 @@ var SelectRoot = forwardRef16(({
4343
4349
  "aria-invalid": ariaInvalid,
4344
4350
  "aria-label": ariaLabel,
4345
4351
  "aria-labelledby": ariaLabelledBy,
4352
+ "aria-required": ariaRequired,
4346
4353
  "aria-haspopup": "listbox",
4347
4354
  "aria-expanded": open,
4348
4355
  onClick: () => setOpen((current) => !current),
@@ -4357,7 +4364,20 @@ var SelectRoot = forwardRef16(({
4357
4364
  /* @__PURE__ */ jsx17("span", {
4358
4365
  className: selectIconClass,
4359
4366
  "aria-hidden": "true",
4360
- children: "v"
4367
+ children: /* @__PURE__ */ jsx17("svg", {
4368
+ width: "16",
4369
+ height: "16",
4370
+ viewBox: "0 0 24 24",
4371
+ fill: "none",
4372
+ stroke: "currentColor",
4373
+ strokeWidth: "2",
4374
+ strokeLinecap: "round",
4375
+ strokeLinejoin: "round",
4376
+ "aria-hidden": "true",
4377
+ children: /* @__PURE__ */ jsx17("path", {
4378
+ d: "m6 9 6 6 6-6"
4379
+ })
4380
+ })
4361
4381
  })
4362
4382
  ]
4363
4383
  }),
@@ -4366,7 +4386,19 @@ var SelectRoot = forwardRef16(({
4366
4386
  className: selectClearClass,
4367
4387
  "aria-label": "Clear selection",
4368
4388
  onClick: clearValue,
4369
- children: "x"
4389
+ children: /* @__PURE__ */ jsx17("svg", {
4390
+ width: "14",
4391
+ height: "14",
4392
+ viewBox: "0 0 24 24",
4393
+ fill: "none",
4394
+ stroke: "currentColor",
4395
+ strokeWidth: "2",
4396
+ strokeLinecap: "round",
4397
+ "aria-hidden": "true",
4398
+ children: /* @__PURE__ */ jsx17("path", {
4399
+ d: "m6 6 12 12M6 18 18 6"
4400
+ })
4401
+ })
4370
4402
  }) : null,
4371
4403
  open ? /* @__PURE__ */ jsxs15("div", {
4372
4404
  className: selectDropdownClass,
@@ -7258,6 +7290,7 @@ function newItem(schema) {
7258
7290
  return "";
7259
7291
  }
7260
7292
  function JsonSchemaForm({
7293
+ className,
7261
7294
  compiled: suppliedCompiled,
7262
7295
  schema,
7263
7296
  value: controlledValue,
@@ -7617,7 +7650,7 @@ function JsonSchemaForm({
7617
7650
  ref: formRef,
7618
7651
  className: "schema-form-container",
7619
7652
  children: /* @__PURE__ */ jsxs22("form", {
7620
- className: "form form-vertical schema-form",
7653
+ className: ["form form-vertical schema-form", className].filter(Boolean).join(" "),
7621
7654
  noValidate: true,
7622
7655
  onSubmit: (event) => {
7623
7656
  event.preventDefault();
@@ -177,6 +177,7 @@ var SelectRoot = forwardRef(({
177
177
  "aria-invalid": ariaInvalid,
178
178
  "aria-label": ariaLabel,
179
179
  "aria-labelledby": ariaLabelledBy,
180
+ "aria-required": ariaRequired,
180
181
  children,
181
182
  className,
182
183
  defaultValue,
@@ -313,6 +314,7 @@ var SelectRoot = forwardRef(({
313
314
  "aria-invalid": ariaInvalid,
314
315
  "aria-label": ariaLabel,
315
316
  "aria-labelledby": ariaLabelledBy,
317
+ "aria-required": ariaRequired,
316
318
  "aria-haspopup": "listbox",
317
319
  "aria-expanded": open,
318
320
  onClick: () => setOpen((current) => !current),
@@ -327,7 +329,20 @@ var SelectRoot = forwardRef(({
327
329
  /* @__PURE__ */ jsx("span", {
328
330
  className: selectIconClass,
329
331
  "aria-hidden": "true",
330
- children: "v"
332
+ children: /* @__PURE__ */ jsx("svg", {
333
+ width: "16",
334
+ height: "16",
335
+ viewBox: "0 0 24 24",
336
+ fill: "none",
337
+ stroke: "currentColor",
338
+ strokeWidth: "2",
339
+ strokeLinecap: "round",
340
+ strokeLinejoin: "round",
341
+ "aria-hidden": "true",
342
+ children: /* @__PURE__ */ jsx("path", {
343
+ d: "m6 9 6 6 6-6"
344
+ })
345
+ })
331
346
  })
332
347
  ]
333
348
  }),
@@ -336,7 +351,19 @@ var SelectRoot = forwardRef(({
336
351
  className: selectClearClass,
337
352
  "aria-label": "Clear selection",
338
353
  onClick: clearValue,
339
- children: "x"
354
+ children: /* @__PURE__ */ jsx("svg", {
355
+ width: "14",
356
+ height: "14",
357
+ viewBox: "0 0 24 24",
358
+ fill: "none",
359
+ stroke: "currentColor",
360
+ strokeWidth: "2",
361
+ strokeLinecap: "round",
362
+ "aria-hidden": "true",
363
+ children: /* @__PURE__ */ jsx("path", {
364
+ d: "m6 6 12 12M6 18 18 6"
365
+ })
366
+ })
340
367
  }) : null,
341
368
  open ? /* @__PURE__ */ jsxs("div", {
342
369
  className: selectDropdownClass,
@@ -1 +1 @@
1
- export declare const version = "0.4.1";
1
+ export declare const version = "0.5.1";