@page-speed/forms 0.7.4 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -227,7 +227,7 @@ It is **not** a BEM-only unstyled package anymore.
227
227
  ### Base conventions
228
228
 
229
229
  - Inputs/triggers are transparent shells with semantic borders/rings
230
- - Fields with values (text-like controls) use `ring-2 ring-ring`
230
+ - Fields with values (text-like controls) use `ring-2 ring-primary`
231
231
  - Error states use destructive border/ring
232
232
  - Dropdown selected rows use muted backgrounds
233
233
 
@@ -1,4 +1,4 @@
1
- import { cn, FieldLabel, FieldDescription, LabelGroup, Field, INPUT_AUTOFILL_RESET_CLASSES, Button, Input, buttonVariants } from './chunk-QHAQYOBT.js';
1
+ import { cn, FieldLabel, FieldDescription, LabelGroup, Field, INPUT_AUTOFILL_RESET_CLASSES, Button, Input, buttonVariants } from './chunk-EQKN2OPX.js';
2
2
  import * as React19 from 'react';
3
3
  import { Dialog as Dialog$1, Checkbox as Checkbox$1, RadioGroup as RadioGroup$1, Switch as Switch$1, Select as Select$1, Popover as Popover$1 } from 'radix-ui';
4
4
  import { Command as Command$1 } from 'cmdk';
@@ -67,7 +67,7 @@ function TextArea({
67
67
  required,
68
68
  className: cn(
69
69
  // Valid value indicator - ring-2 when has value and no error
70
- !error && hasValue && "ring-2 ring-ring",
70
+ !error && hasValue && "ring-2 ring-primary",
71
71
  // Error state - handled by Textarea component via aria-invalid
72
72
  className
73
73
  ),
@@ -203,9 +203,9 @@ function Checkbox2({
203
203
  htmlFor: checkboxId,
204
204
  className: cn(
205
205
  "flex gap-3 p-3 duration-200 select-auto font-normal leading-normal",
206
- showChoiceCard && "border rounded-lg hover:ring-2 hover:ring-ring/50",
207
- showChoiceCard && value && "ring-2 ring-ring",
208
- showChoiceCard && error && "border-destructive",
206
+ showChoiceCard && "border rounded-lg hover:ring-2 hover:ring-primary",
207
+ showChoiceCard && value && "ring-2 ring-primary",
208
+ showChoiceCard && error && "ring-2 ring-destructive",
209
209
  disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
210
210
  className
211
211
  )
@@ -291,12 +291,12 @@ function CheckboxGroup({
291
291
  const containerClass = React19.useMemo(() => {
292
292
  return cn(
293
293
  "w-full grid grid-cols-1 border-0 m-0 p-0 min-w-0",
294
- (layout === "grid" || layout === "inline") && "md:grid-cols-2",
295
- layout === "grid" && "gap-3",
296
- layout === "inline" && "gap-0",
294
+ layout === "grid" && "grid grid-cols-1 md:grid-cols-2 ",
295
+ layout === "inline" && "flex flex-wrap",
296
+ useChoiceCard ? "gap-x-6 space-y-4" : "gap-0",
297
297
  className
298
298
  );
299
- }, [layout, className]);
299
+ }, [layout, className, useChoiceCard]);
300
300
  const groupDescriptionId = description ? `${name}-description` : void 0;
301
301
  const groupAriaDescribedBy = [props["aria-describedby"], groupDescriptionId].filter(Boolean).join(" ") || void 0;
302
302
  return /* @__PURE__ */ React19.createElement(
@@ -470,9 +470,9 @@ function Radio({
470
470
  disabled,
471
471
  required,
472
472
  className: cn(
473
- layout === "grid" && "grid grid-cols-1 md:grid-cols-2",
473
+ layout === "grid" && "grid grid-cols-1 md:grid-cols-2 ",
474
474
  layout === "inline" && "flex flex-wrap",
475
- useChoiceCard ? "gap-3" : "gap-0"
475
+ useChoiceCard ? "gap-x-6 space-y-4" : "gap-0"
476
476
  ),
477
477
  "aria-invalid": error || props["aria-invalid"],
478
478
  "aria-describedby": groupDescriptionId || props["aria-describedby"],
@@ -491,10 +491,10 @@ function Radio({
491
491
  className: cn(
492
492
  "flex gap-3 duration-200",
493
493
  "select-auto font-normal leading-normal",
494
- useChoiceCard && "hover:ring-2 hover:ring-ring",
494
+ useChoiceCard && "hover:ring-2 hover:ring-primary",
495
495
  useChoiceCard && "border rounded-lg p-3",
496
496
  !useChoiceCard && "p-1",
497
- useChoiceCard && isSelected && "ring-2 ring-ring",
497
+ useChoiceCard && isSelected && "ring-2 ring-primary",
498
498
  useChoiceCard && error && "border-destructive",
499
499
  isDisabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
500
500
  )
@@ -650,7 +650,14 @@ function SelectGroup({
650
650
  function SelectValue({
651
651
  ...props
652
652
  }) {
653
- return /* @__PURE__ */ React19.createElement(Select$1.Value, { "data-slot": "select-value", ...props });
653
+ return /* @__PURE__ */ React19.createElement(
654
+ Select$1.Value,
655
+ {
656
+ className: "font-normal",
657
+ "data-slot": "select-value",
658
+ ...props
659
+ }
660
+ );
654
661
  }
655
662
  function SelectTrigger({
656
663
  className,
@@ -931,7 +938,7 @@ function Select2({
931
938
  {
932
939
  className: cn(
933
940
  // Valid value indicator - ring-2 when has value and no error
934
- !error && hasValue && "ring-2 ring-ring",
941
+ !error && hasValue && "ring-2 ring-primary",
935
942
  // Error state - handled by SelectTrigger via aria-invalid
936
943
  className
937
944
  ),
@@ -1365,7 +1372,9 @@ function MultiSelect({
1365
1372
  (option) => option === currentOption
1366
1373
  );
1367
1374
  const nextEnabledIndex = currentEnabledIndex === -1 ? 0 : (currentEnabledIndex + 1) % enabledOptions.length;
1368
- setFocusedIndex(filteredOptions.indexOf(enabledOptions[nextEnabledIndex]));
1375
+ setFocusedIndex(
1376
+ filteredOptions.indexOf(enabledOptions[nextEnabledIndex])
1377
+ );
1369
1378
  break;
1370
1379
  }
1371
1380
  case "ArrowUp": {
@@ -1463,9 +1472,9 @@ function MultiSelect({
1463
1472
  className: cn(
1464
1473
  "flex min-h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm",
1465
1474
  "cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1466
- !error && hasValue && "ring-2 ring-ring",
1475
+ !error && hasValue && "ring-2 ring-primary",
1467
1476
  disabled && "cursor-not-allowed opacity-50 pointer-events-none",
1468
- error && "border-destructive ring-1 ring-destructive"
1477
+ error && "ring-2 ring-destructive"
1469
1478
  ),
1470
1479
  onKeyDown: handleKeyDown,
1471
1480
  onBlur: handleTriggerBlur,
@@ -1558,7 +1567,7 @@ function MultiSelect({
1558
1567
  },
1559
1568
  "Clear All"
1560
1569
  )),
1561
- isMaxReached && /* @__PURE__ */ React19.createElement("div", { className: "border-b border-destructive bg-destructive/80 px-2 py-1 text-xs font-medium text-destructive-foreground" }, "Maximum ", maxSelections, " selection", maxSelections !== 1 ? "s" : "", " ", "reached"),
1570
+ isMaxReached && /* @__PURE__ */ React19.createElement("div", { className: "border-b border-destructive bg-destructive/80 px-2 py-1 text-xs font-medium text-destructive-foreground" }, "Maximum ", maxSelections, " selection", maxSelections !== 1 ? "s" : "", " reached"),
1562
1571
  /* @__PURE__ */ React19.createElement(CommandList, { role: "listbox", "aria-multiselectable": "true" }, /* @__PURE__ */ React19.createElement(CommandEmpty, null, "No options found"), optionGroups.length > 0 ? optionGroups.map((group, groupIndex) => {
1563
1572
  const groupOptions = group.options.filter(
1564
1573
  (option) => filteredOptions.includes(option)
@@ -2332,7 +2341,13 @@ function FileUploadDropzone(props) {
2332
2341
  tabIndex: context.disabled ? -1 : 0,
2333
2342
  ...dropzoneProps,
2334
2343
  className: cn(
2335
- "relative flex select-none flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-6 outline-none transition-colors hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 data-disabled:pointer-events-none data-disabled:opacity-50 data-dragging:border-ring data-dragging:bg-accent/50 data-invalid:border-destructive data-invalid:ring-destructive/20",
2344
+ "relative flex select-none flex-col items-center",
2345
+ "justify-center gap-2 rounded-lg border border-dashed p-6",
2346
+ "outline-none transition-colors hover:ring-2 hover:ring-primary",
2347
+ "focus-visible:ring-2 focus-visible:ring-primary",
2348
+ "data-disabled:pointer-events-none data-disabled:opacity-50 ",
2349
+ "data-dragging:ring-2 data-dragging:ring-primary",
2350
+ "data-invalid:ring-2 data-invalid:ring-destructive",
2336
2351
  className
2337
2352
  ),
2338
2353
  onClick,
@@ -2854,13 +2869,13 @@ function FileInput({
2854
2869
  const metadataElement = React19.useMemo(() => {
2855
2870
  const metaList = [];
2856
2871
  if (accept) {
2857
- metaList.push(`Accepted: ${accept}`);
2872
+ metaList.push(`File type: ${accept}`);
2858
2873
  }
2859
2874
  if (maxSize) {
2860
- metaList.push(`Max size: ${formatFileSize(maxSize)}`);
2875
+ metaList.push(`Max file size: ${formatFileSize(maxSize)}`);
2861
2876
  }
2862
2877
  if (metaList.length > 0) {
2863
- return /* @__PURE__ */ React19.createElement("div", { className: "flex text-center items-center justify-center gap-4" }, metaList.map((str) => /* @__PURE__ */ React19.createElement("span", { key: str, className: "font-sm opacity-75" }, str)));
2878
+ return /* @__PURE__ */ React19.createElement("div", { className: "flex text-center items-center justify-center gap-1 opacity-75 text-xs" }, metaList.map((str) => /* @__PURE__ */ React19.createElement("span", { key: str, className: "relative" }, str)));
2864
2879
  } else {
2865
2880
  return null;
2866
2881
  }
@@ -3428,7 +3443,7 @@ function DatePicker({
3428
3443
  required = false,
3429
3444
  error = false,
3430
3445
  className = "",
3431
- placeholder = "Select date...",
3446
+ placeholder = "Select date",
3432
3447
  format = "MM/dd/yyyy",
3433
3448
  minDate,
3434
3449
  maxDate,
@@ -3527,7 +3542,11 @@ function DatePicker({
3527
3542
  ), /* @__PURE__ */ React19.createElement(Popover, { open: isOpen, onOpenChange: handleOpenChange }, /* @__PURE__ */ React19.createElement("div", { className: "relative" }, showIcon && /* @__PURE__ */ React19.createElement(
3528
3543
  "span",
3529
3544
  {
3530
- className: "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none",
3545
+ className: cn(
3546
+ "absolute left-3 top-1/2 -translate-y-1/2",
3547
+ "pointer-events-none flex items-center justify-center",
3548
+ "pointer-events-none"
3549
+ ),
3531
3550
  "aria-hidden": "true"
3532
3551
  },
3533
3552
  /* @__PURE__ */ React19.createElement(
@@ -3555,8 +3574,8 @@ function DatePicker({
3555
3574
  INPUT_AUTOFILL_RESET_CLASSES,
3556
3575
  showIcon ? "pl-10" : "pl-3",
3557
3576
  clearable && value ? "pr-10" : "pr-3",
3558
- !error && hasValue && "ring-2 ring-ring",
3559
- error && "border-destructive ring-1 ring-destructive"
3577
+ !error && hasValue && "ring-2 ring-primary",
3578
+ error && "ring-2 ring-destructive"
3560
3579
  ),
3561
3580
  value: displayValue,
3562
3581
  onClick: handleInputClick,
@@ -3725,8 +3744,8 @@ function TimePicker({
3725
3744
  INPUT_AUTOFILL_RESET_CLASSES,
3726
3745
  showIcon ? "pl-10" : "pl-3",
3727
3746
  clearable && value ? "pr-10" : "pr-3",
3728
- !error && hasValue && "ring-2 ring-ring",
3729
- error && "border-destructive ring-1 ring-destructive"
3747
+ !error && hasValue && "ring-2 ring-primary",
3748
+ error && "ring-2 ring-destructive"
3730
3749
  ),
3731
3750
  value: nativeValue,
3732
3751
  onChange: handleChange,
@@ -3779,7 +3798,11 @@ function formatDate2(date, format) {
3779
3798
  return format.replace("MM", month).replace("dd", day).replace("yyyy", String(year)).replace("yy", String(year).slice(2));
3780
3799
  }
3781
3800
  function toDayTimestamp(date) {
3782
- return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
3801
+ return new Date(
3802
+ date.getFullYear(),
3803
+ date.getMonth(),
3804
+ date.getDate()
3805
+ ).getTime();
3783
3806
  }
3784
3807
  function isSameDay(date, target) {
3785
3808
  if (!target) return false;
@@ -4028,8 +4051,8 @@ function DateRangePicker({
4028
4051
  INPUT_AUTOFILL_RESET_CLASSES,
4029
4052
  showIcon ? "pl-10" : "pl-3",
4030
4053
  clearable && (rangeStart || rangeEnd) ? "pr-10" : "pr-3",
4031
- !error && hasValue && "ring-2 ring-ring",
4032
- error && "border-destructive ring-1 ring-destructive"
4054
+ !error && hasValue && "ring-2 ring-primary",
4055
+ error && "ring-2 ring-destructive"
4033
4056
  ),
4034
4057
  value: displayValue,
4035
4058
  onClick: handleInputClick,
@@ -4091,5 +4114,5 @@ function DateRangePicker({
4091
4114
  DateRangePicker.displayName = "DateRangePicker";
4092
4115
 
4093
4116
  export { Checkbox2 as Checkbox, CheckboxGroup, DatePicker, DateRangePicker, FileInput, MultiSelect, Radio, Select2 as Select, Switch2 as Switch, TextArea, TimePicker };
4094
- //# sourceMappingURL=chunk-SF6NKDID.js.map
4095
- //# sourceMappingURL=chunk-SF6NKDID.js.map
4117
+ //# sourceMappingURL=chunk-DSK3VLIV.js.map
4118
+ //# sourceMappingURL=chunk-DSK3VLIV.js.map