@xenide-io/the-old-ui-theme 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-SHF57J7U.mjs → chunk-FDMD3IIN.mjs} +1573 -652
  3. package/dist/index-D1RTT2Ap.d.mts +1044 -0
  4. package/dist/index-D1RTT2Ap.d.ts +1044 -0
  5. package/dist/index.d.mts +10 -7
  6. package/dist/index.d.ts +10 -7
  7. package/dist/index.js +1705 -744
  8. package/dist/index.mjs +61 -1
  9. package/dist/tailwind-preset.js +7 -0
  10. package/dist/tailwind-preset.mjs +7 -0
  11. package/dist/ui.d.mts +3 -2
  12. package/dist/ui.d.ts +3 -2
  13. package/dist/ui.js +1584 -666
  14. package/dist/ui.mjs +31 -1
  15. package/package.json +18 -4
  16. package/src/app/globals.css +1005 -227
  17. package/src/components/icons/IconBase.tsx +20 -12
  18. package/src/components/icons/createIconBase.tsx +12 -7
  19. package/src/components/icons/icons.tsx +208 -18
  20. package/src/components/sections/AlertShowcase.tsx +2 -1
  21. package/src/components/sections/BadgeShowcase.tsx +1 -1
  22. package/src/components/sections/ButtonShowcase.tsx +6 -10
  23. package/src/components/sections/CardShowcase.tsx +22 -6
  24. package/src/components/sections/DropdownShowcase.tsx +4 -6
  25. package/src/components/sections/FilterChipsShowcase.tsx +74 -26
  26. package/src/components/sections/FormShowcase.tsx +2 -1
  27. package/src/components/sections/IconShowcase.tsx +86 -206
  28. package/src/components/sections/KbdShowcase.tsx +47 -21
  29. package/src/components/sections/ModalShowcase.tsx +7 -6
  30. package/src/components/sections/ProductLayoutsShowcase.tsx +138 -0
  31. package/src/components/sections/ProgressShowcase.tsx +50 -53
  32. package/src/components/sections/SwapShowcase.tsx +13 -5
  33. package/src/components/ui/Alert.tsx +28 -19
  34. package/src/components/ui/AuthLayout.tsx +58 -0
  35. package/src/components/ui/Badge.tsx +10 -5
  36. package/src/components/ui/Button.tsx +22 -12
  37. package/src/components/ui/ButtonChrome.tsx +1 -1
  38. package/src/components/ui/Calendar.tsx +6 -7
  39. package/src/components/ui/Card.tsx +21 -11
  40. package/src/components/ui/CollapsibleSection.tsx +11 -11
  41. package/src/components/ui/DropdownMenu.tsx +189 -65
  42. package/src/components/ui/FilterBar.tsx +165 -0
  43. package/src/components/ui/FilterChips.tsx +65 -35
  44. package/src/components/ui/FilterControls.tsx +30 -0
  45. package/src/components/ui/FormField.tsx +69 -0
  46. package/src/components/ui/Input.tsx +166 -140
  47. package/src/components/ui/Kbd.tsx +88 -13
  48. package/src/components/ui/Loader.tsx +96 -0
  49. package/src/components/ui/Modal.tsx +66 -36
  50. package/src/components/ui/SettingsLayout.tsx +94 -0
  51. package/src/components/ui/ShowcaseWrapper.tsx +4 -16
  52. package/src/components/ui/Stepper.tsx +5 -6
  53. package/src/components/ui/first-slice.test.tsx +98 -0
  54. package/src/components/ui/index.ts +62 -3
  55. package/src/components/ui/interaction-primitives.test.tsx +77 -0
  56. package/src/components/ui/kbd-icons.test.tsx +90 -0
  57. package/src/components/ui/product-patterns.test.tsx +77 -0
  58. package/src/styles/themes.css +411 -1
  59. package/tailwind-preset.ts +7 -0
  60. package/dist/index-CmS6hcUk.d.mts +0 -753
  61. package/dist/index-CmS6hcUk.d.ts +0 -753
@@ -1,50 +1,80 @@
1
1
  "use client";
2
2
 
3
- import { cn } from "@/lib/cn";
3
+ import type { ReactNode } from "react";
4
4
  import { IconClose } from "@/components/icons";
5
+ import { cn } from "@/lib/cn";
5
6
 
6
- interface FilterChip {
7
+ export interface FilterChip {
7
8
  id: string;
8
- label: string;
9
+ label: ReactNode;
10
+ value?: ReactNode;
9
11
  active?: boolean;
12
+ removeLabel?: string;
10
13
  }
11
14
 
12
- interface FilterChipsProps {
13
- chips: FilterChip[];
14
- onToggle: (id: string) => void;
15
- onRemove: (id: string) => void;
15
+ export interface FilterChipsProps {
16
+ chips: readonly FilterChip[];
17
+ onToggle?: (id: string) => void;
18
+ onRemove?: (id: string) => void;
16
19
  className?: string;
20
+ "aria-label"?: string;
17
21
  }
18
22
 
19
- export function FilterChips({ chips, onToggle, onRemove, className }: FilterChipsProps) {
23
+ export function FilterChips({
24
+ chips,
25
+ onToggle,
26
+ onRemove,
27
+ className,
28
+ "aria-label": ariaLabel = "Applied filters",
29
+ }: FilterChipsProps) {
20
30
  return (
21
- <div className={cn("flex flex-wrap gap-2", className)}>
22
- {chips.map((chip) => (
23
- <button
24
- key={chip.id}
25
- type="button"
26
- onClick={() => onToggle(chip.id)}
27
- className={cn(
28
- "inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-medium transition-colors",
29
- chip.active
30
- ? "bg-ph-brand text-white"
31
- : "bg-ph-muted text-ph-subtle hover:bg-ph-border hover:text-ph-ink"
32
- )}
33
- >
34
- {chip.label}
35
- {chip.active && (
36
- <span
37
- onClick={(e) => {
38
- e.stopPropagation();
39
- onRemove(chip.id);
40
- }}
41
- className="ml-0.5 flex h-4 w-4 cursor-pointer items-center justify-center rounded-full hover:bg-white/20"
42
- >
43
- <IconClose className="h-3 w-3" />
44
- </span>
45
- )}
46
- </button>
47
- ))}
31
+ <div className={cn("ph-filter-chips", className)} role="group" aria-label={ariaLabel}>
32
+ {chips.map((chip) => {
33
+ const label = chip.removeLabel ?? getChipText(chip);
34
+ const content = (
35
+ <>
36
+ <span className="ph-filter-chip__label">{chip.label}</span>
37
+ {chip.value != null ? <span className="ph-filter-chip__value">{chip.value}</span> : null}
38
+ </>
39
+ );
40
+
41
+ return (
42
+ <span
43
+ key={chip.id}
44
+ className={cn("ph-filter-chip", chip.active && "ph-filter-chip--active")}
45
+ data-state={chip.active ? "on" : "off"}
46
+ >
47
+ {onToggle ? (
48
+ <button
49
+ type="button"
50
+ className="ph-filter-chip__main"
51
+ aria-pressed={Boolean(chip.active)}
52
+ onClick={() => onToggle(chip.id)}
53
+ >
54
+ {content}
55
+ </button>
56
+ ) : (
57
+ <span className="ph-filter-chip__main">{content}</span>
58
+ )}
59
+ {chip.active && onRemove ? (
60
+ <button
61
+ type="button"
62
+ className="ph-filter-chip__remove"
63
+ aria-label={`Remove ${label} filter`}
64
+ onClick={() => onRemove(chip.id)}
65
+ >
66
+ <IconClose className="h-3 w-3" aria-hidden />
67
+ </button>
68
+ ) : null}
69
+ </span>
70
+ );
71
+ })}
48
72
  </div>
49
73
  );
50
74
  }
75
+
76
+ function getChipText(chip: FilterChip) {
77
+ const label = typeof chip.label === "string" || typeof chip.label === "number" ? String(chip.label) : chip.id;
78
+ const value = typeof chip.value === "string" || typeof chip.value === "number" ? String(chip.value) : null;
79
+ return value ? `${label}: ${value}` : label;
80
+ }
@@ -0,0 +1,30 @@
1
+ import type { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { cn } from "@/lib/cn";
3
+ import { FilterBar, type FilterBarProps } from "@/components/ui/FilterBar";
4
+ import { FilterChips, type FilterChipsProps } from "@/components/ui/FilterChips";
5
+
6
+ export interface FilterControlsProps extends ComponentPropsWithoutRef<"div"> {
7
+ children: ReactNode;
8
+ barProps?: Omit<FilterBarProps, "children">;
9
+ chipsProps?: FilterChipsProps;
10
+ emptyState?: ReactNode;
11
+ }
12
+
13
+ /** Combines filter controls and their applied chips without owning filter state. */
14
+ export function FilterControls({
15
+ children,
16
+ barProps,
17
+ chipsProps,
18
+ emptyState,
19
+ className,
20
+ ...props
21
+ }: FilterControlsProps) {
22
+ const hasChips = Boolean(chipsProps?.chips.length);
23
+
24
+ return (
25
+ <div className={cn("ph-filter-controls", className)} {...props}>
26
+ <FilterBar {...barProps}>{children}</FilterBar>
27
+ {hasChips && chipsProps ? <FilterChips {...chipsProps} /> : emptyState ?? null}
28
+ </div>
29
+ );
30
+ }
@@ -0,0 +1,69 @@
1
+ import { useId, type HTMLAttributes, type ReactNode } from "react";
2
+ import { cn } from "@/lib/cn";
3
+
4
+ export interface FormFieldControlProps {
5
+ id: string;
6
+ "aria-describedby"?: string;
7
+ "aria-errormessage"?: string;
8
+ "aria-invalid"?: true;
9
+ }
10
+
11
+ export interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
12
+ controlId?: string;
13
+ label?: ReactNode;
14
+ hideLabel?: boolean;
15
+ helperText?: ReactNode;
16
+ error?: ReactNode;
17
+ required?: boolean;
18
+ disabled?: boolean;
19
+ children: ReactNode | ((controlProps: FormFieldControlProps) => ReactNode);
20
+ }
21
+
22
+ export function FormField({
23
+ controlId,
24
+ label,
25
+ hideLabel = false,
26
+ helperText,
27
+ error,
28
+ required = false,
29
+ disabled = false,
30
+ children,
31
+ className,
32
+ ...props
33
+ }: FormFieldProps) {
34
+ const generatedId = useId();
35
+ const id = controlId ?? generatedId;
36
+ const descriptionId = helperText && !error ? `${id}-description` : undefined;
37
+ const errorId = error ? `${id}-error` : undefined;
38
+ const controlProps: FormFieldControlProps = {
39
+ id,
40
+ "aria-describedby": descriptionId,
41
+ "aria-errormessage": errorId,
42
+ "aria-invalid": error ? true : undefined,
43
+ };
44
+
45
+ return (
46
+ <div className={cn("ph-field", className)} {...props}>
47
+ {label ? (
48
+ <label
49
+ htmlFor={id}
50
+ className={cn("ph-label", hideLabel && "sr-only", disabled && "opacity-50")}
51
+ >
52
+ {label}
53
+ {required ? <span aria-hidden="true"> *</span> : null}
54
+ </label>
55
+ ) : null}
56
+ {typeof children === "function" ? children(controlProps) : children}
57
+ {descriptionId ? (
58
+ <p id={descriptionId} className="mt-1 text-xs text-ph-subtle">
59
+ {helperText}
60
+ </p>
61
+ ) : null}
62
+ {errorId ? (
63
+ <p id={errorId} className="mt-1 text-xs font-medium text-ph-danger">
64
+ {error}
65
+ </p>
66
+ ) : null}
67
+ </div>
68
+ );
69
+ }