omnira-ui 0.1.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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +145 -0
  3. package/cli/omnira-init.mjs +260 -0
  4. package/cli/presets.mjs +386 -0
  5. package/components/ui/AppStoreButton/AppStoreButton.module.css +87 -0
  6. package/components/ui/AppStoreButton/AppStoreButton.tsx +114 -0
  7. package/components/ui/AppStoreButton/index.ts +2 -0
  8. package/components/ui/Avatar/Avatar.module.css +76 -0
  9. package/components/ui/Avatar/Avatar.tsx +102 -0
  10. package/components/ui/Avatar/index.ts +2 -0
  11. package/components/ui/Badge/Badge.module.css +120 -0
  12. package/components/ui/Badge/Badge.tsx +25 -0
  13. package/components/ui/Badge/index.ts +2 -0
  14. package/components/ui/BadgeGroup/BadgeGroup.module.css +214 -0
  15. package/components/ui/BadgeGroup/BadgeGroup.tsx +88 -0
  16. package/components/ui/BadgeGroup/index.ts +2 -0
  17. package/components/ui/Browser/Browser.module.css +105 -0
  18. package/components/ui/Browser/Browser.tsx +54 -0
  19. package/components/ui/Browser/index.ts +2 -0
  20. package/components/ui/Button/Button.module.css +188 -0
  21. package/components/ui/Button/Button.tsx +74 -0
  22. package/components/ui/Button/index.ts +2 -0
  23. package/components/ui/ButtonUtility/ButtonUtility.module.css +154 -0
  24. package/components/ui/ButtonUtility/ButtonUtility.tsx +65 -0
  25. package/components/ui/ButtonUtility/index.ts +2 -0
  26. package/components/ui/Card/Card.module.css +80 -0
  27. package/components/ui/Card/Card.tsx +39 -0
  28. package/components/ui/Card/index.ts +2 -0
  29. package/components/ui/Checkbox/Checkbox.module.css +92 -0
  30. package/components/ui/Checkbox/Checkbox.tsx +95 -0
  31. package/components/ui/Checkbox/index.ts +2 -0
  32. package/components/ui/Collapse/Collapse.module.css +60 -0
  33. package/components/ui/Collapse/Collapse.tsx +100 -0
  34. package/components/ui/Collapse/index.ts +2 -0
  35. package/components/ui/CreditCard/CreditCard.module.css +117 -0
  36. package/components/ui/CreditCard/CreditCard.tsx +86 -0
  37. package/components/ui/CreditCard/index.ts +2 -0
  38. package/components/ui/Dropdown/Dropdown.module.css +269 -0
  39. package/components/ui/Dropdown/Dropdown.tsx +419 -0
  40. package/components/ui/Dropdown/index.ts +31 -0
  41. package/components/ui/GridLines/GridLines.module.css +95 -0
  42. package/components/ui/GridLines/GridLines.tsx +10 -0
  43. package/components/ui/GridLines/index.ts +1 -0
  44. package/components/ui/Illustration/Illustration.module.css +10 -0
  45. package/components/ui/Illustration/Illustration.tsx +96 -0
  46. package/components/ui/Illustration/index.ts +2 -0
  47. package/components/ui/Input/Input.module.css +217 -0
  48. package/components/ui/Input/Input.tsx +93 -0
  49. package/components/ui/Input/index.ts +2 -0
  50. package/components/ui/Phone/Phone.module.css +104 -0
  51. package/components/ui/Phone/Phone.tsx +54 -0
  52. package/components/ui/Phone/index.ts +2 -0
  53. package/components/ui/PinInput/PinInput.module.css +104 -0
  54. package/components/ui/PinInput/PinInput.tsx +210 -0
  55. package/components/ui/PinInput/index.ts +1 -0
  56. package/components/ui/ProgressBar/ProgressBar.module.css +180 -0
  57. package/components/ui/ProgressBar/ProgressBar.tsx +206 -0
  58. package/components/ui/ProgressBar/index.ts +2 -0
  59. package/components/ui/QRCode/QRCode.module.css +13 -0
  60. package/components/ui/QRCode/QRCode.tsx +128 -0
  61. package/components/ui/QRCode/index.ts +2 -0
  62. package/components/ui/RadioButton/RadioButton.module.css +92 -0
  63. package/components/ui/RadioButton/RadioButton.tsx +134 -0
  64. package/components/ui/RadioButton/index.ts +2 -0
  65. package/components/ui/RadioGroup/RadioGroup.module.css +382 -0
  66. package/components/ui/RadioGroup/RadioGroup.tsx +292 -0
  67. package/components/ui/RadioGroup/index.ts +1 -0
  68. package/components/ui/Rating/Rating.module.css +99 -0
  69. package/components/ui/Rating/Rating.tsx +123 -0
  70. package/components/ui/Rating/index.ts +2 -0
  71. package/components/ui/Select/Select.module.css +371 -0
  72. package/components/ui/Select/Select.tsx +507 -0
  73. package/components/ui/Select/index.ts +2 -0
  74. package/components/ui/SidebarNavigation/SidebarDual.tsx +71 -0
  75. package/components/ui/SidebarNavigation/SidebarFeatureCard.module.css +351 -0
  76. package/components/ui/SidebarNavigation/SidebarFeatureCard.tsx +388 -0
  77. package/components/ui/SidebarNavigation/SidebarNavigation.module.css +610 -0
  78. package/components/ui/SidebarNavigation/SidebarParts.tsx +215 -0
  79. package/components/ui/SidebarNavigation/SidebarSectionDividers.tsx +46 -0
  80. package/components/ui/SidebarNavigation/SidebarSectionHeadings.tsx +52 -0
  81. package/components/ui/SidebarNavigation/SidebarSimple.tsx +46 -0
  82. package/components/ui/SidebarNavigation/SidebarSlim.tsx +48 -0
  83. package/components/ui/SidebarNavigation/index.ts +29 -0
  84. package/components/ui/SidebarNavigation/types.ts +27 -0
  85. package/components/ui/Slider/Slider.module.css +93 -0
  86. package/components/ui/Slider/Slider.tsx +118 -0
  87. package/components/ui/Slider/index.ts +2 -0
  88. package/components/ui/SocialButton/SocialButton.module.css +223 -0
  89. package/components/ui/SocialButton/SocialButton.tsx +185 -0
  90. package/components/ui/SocialButton/index.ts +2 -0
  91. package/components/ui/Tag/Tag.module.css +203 -0
  92. package/components/ui/Tag/Tag.tsx +161 -0
  93. package/components/ui/Tag/index.ts +2 -0
  94. package/components/ui/TextEditor/TextEditor.module.css +182 -0
  95. package/components/ui/TextEditor/TextEditor.tsx +323 -0
  96. package/components/ui/TextEditor/index.ts +1 -0
  97. package/components/ui/Textarea/Textarea.module.css +75 -0
  98. package/components/ui/Textarea/Textarea.tsx +59 -0
  99. package/components/ui/Textarea/index.ts +2 -0
  100. package/components/ui/Toggle/Toggle.module.css +118 -0
  101. package/components/ui/Toggle/Toggle.tsx +77 -0
  102. package/components/ui/Toggle/index.ts +2 -0
  103. package/components/ui/Tooltip/Tooltip.module.css +95 -0
  104. package/components/ui/Tooltip/Tooltip.tsx +55 -0
  105. package/components/ui/Tooltip/index.ts +2 -0
  106. package/components/ui/VideoPlayer/VideoPlayer.module.css +120 -0
  107. package/components/ui/VideoPlayer/VideoPlayer.tsx +229 -0
  108. package/components/ui/VideoPlayer/index.ts +2 -0
  109. package/lib/cn.ts +3 -0
  110. package/lib/copy-to-clipboard.ts +21 -0
  111. package/package.json +61 -0
@@ -0,0 +1,13 @@
1
+ .wrap {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ border-radius: var(--radius-lg);
6
+ overflow: hidden;
7
+ border: 1px solid var(--color-border-standard);
8
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
9
+ }
10
+
11
+ .svg {
12
+ display: block;
13
+ }
@@ -0,0 +1,128 @@
1
+ "use client";
2
+
3
+ import { useMemo, forwardRef } from "react";
4
+ import { cn } from "@/lib/cn";
5
+ import styles from "./QRCode.module.css";
6
+
7
+ export interface QRCodeProps {
8
+ value: string;
9
+ size?: "sm" | "md" | "lg";
10
+ color?: string;
11
+ bgColor?: string;
12
+ className?: string;
13
+ }
14
+
15
+ const sizePx: Record<string, number> = {
16
+ sm: 128,
17
+ md: 200,
18
+ lg: 280,
19
+ };
20
+
21
+ export const QRCode = forwardRef<HTMLDivElement, QRCodeProps>(
22
+ (
23
+ {
24
+ value,
25
+ size = "md",
26
+ color,
27
+ bgColor,
28
+ className,
29
+ },
30
+ ref,
31
+ ) => {
32
+ const dim = sizePx[size];
33
+ const matrix = useMemo(() => generateQR(value), [value]);
34
+ const cellSize = dim / matrix.length;
35
+
36
+ return (
37
+ <div
38
+ ref={ref}
39
+ className={cn(styles.wrap, className)}
40
+ style={{ width: dim, height: dim }}
41
+ >
42
+ <svg
43
+ width={dim}
44
+ height={dim}
45
+ viewBox={`0 0 ${dim} ${dim}`}
46
+ className={styles.svg}
47
+ >
48
+ <rect
49
+ width={dim}
50
+ height={dim}
51
+ fill={bgColor || "var(--color-bg-card)"}
52
+ rx="8"
53
+ />
54
+ {matrix.map((row, y) =>
55
+ row.map((cell, x) =>
56
+ cell ? (
57
+ <rect
58
+ key={`${y}-${x}`}
59
+ x={x * cellSize}
60
+ y={y * cellSize}
61
+ width={cellSize}
62
+ height={cellSize}
63
+ rx={cellSize * 0.15}
64
+ fill={color || "var(--color-text-primary)"}
65
+ />
66
+ ) : null,
67
+ ),
68
+ )}
69
+ </svg>
70
+ </div>
71
+ );
72
+ },
73
+ );
74
+
75
+ QRCode.displayName = "QRCode";
76
+
77
+ /**
78
+ * Minimal QR-like pattern generator.
79
+ * This creates a deterministic grid pattern based on the input string.
80
+ * For production use, integrate a proper QR encoding library.
81
+ */
82
+ function generateQR(value: string): boolean[][] {
83
+ const size = 25;
84
+ const matrix: boolean[][] = Array.from({ length: size }, () =>
85
+ Array(size).fill(false),
86
+ );
87
+
88
+ // Finder patterns (top-left, top-right, bottom-left)
89
+ const drawFinder = (ox: number, oy: number) => {
90
+ for (let y = 0; y < 7; y++) {
91
+ for (let x = 0; x < 7; x++) {
92
+ const isOuter = y === 0 || y === 6 || x === 0 || x === 6;
93
+ const isInner = x >= 2 && x <= 4 && y >= 2 && y <= 4;
94
+ if (isOuter || isInner) matrix[oy + y][ox + x] = true;
95
+ }
96
+ }
97
+ };
98
+
99
+ drawFinder(0, 0);
100
+ drawFinder(size - 7, 0);
101
+ drawFinder(0, size - 7);
102
+
103
+ // Timing patterns
104
+ for (let i = 8; i < size - 8; i++) {
105
+ matrix[6][i] = i % 2 === 0;
106
+ matrix[i][6] = i % 2 === 0;
107
+ }
108
+
109
+ // Data area — hash-based fill
110
+ let hash = 0;
111
+ for (let i = 0; i < value.length; i++) {
112
+ hash = ((hash << 5) - hash + value.charCodeAt(i)) | 0;
113
+ }
114
+
115
+ for (let y = 0; y < size; y++) {
116
+ for (let x = 0; x < size; x++) {
117
+ if (matrix[y][x]) continue;
118
+ // Skip finder + margin zones
119
+ if ((x < 8 && y < 8) || (x >= size - 8 && y < 8) || (x < 8 && y >= size - 8)) continue;
120
+ if (x === 6 || y === 6) continue;
121
+
122
+ const seed = (hash ^ (x * 31 + y * 37 + x * y * 13)) >>> 0;
123
+ matrix[y][x] = seed % 3 !== 0;
124
+ }
125
+ }
126
+
127
+ return matrix;
128
+ }
@@ -0,0 +1,2 @@
1
+ export { QRCode } from "./QRCode";
2
+ export type { QRCodeProps } from "./QRCode";
@@ -0,0 +1,92 @@
1
+ /* ── Group ── */
2
+ .group {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 12px;
6
+ }
7
+
8
+ /* ── Wrapper ── */
9
+ .wrapper {
10
+ display: flex;
11
+ align-items: flex-start;
12
+ gap: 10px;
13
+ cursor: pointer;
14
+ }
15
+
16
+ .wrapperDisabled {
17
+ opacity: 0.5;
18
+ cursor: not-allowed;
19
+ pointer-events: none;
20
+ }
21
+
22
+ /* ── Radio circle ── */
23
+ .radio {
24
+ flex-shrink: 0;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ border-radius: 50%;
29
+ background: var(--color-bg-input);
30
+ border: 1px solid var(--color-border-standard);
31
+ cursor: pointer;
32
+ transition: all 0.2s;
33
+ padding: 0;
34
+ }
35
+
36
+ .radio:hover {
37
+ border-color: var(--color-border-lime-strong);
38
+ }
39
+
40
+ .radioChecked {
41
+ background: var(--color-bg-input);
42
+ border-color: var(--color-lime);
43
+ }
44
+
45
+ /* Radio sizes */
46
+ .radio_sm {
47
+ width: 18px;
48
+ height: 18px;
49
+ }
50
+
51
+ .radio_md {
52
+ width: 22px;
53
+ height: 22px;
54
+ }
55
+
56
+ /* ── Inner dot ── */
57
+ .dot {
58
+ border-radius: 50%;
59
+ background: var(--color-lime);
60
+ }
61
+
62
+ .dot_sm {
63
+ width: 8px;
64
+ height: 8px;
65
+ }
66
+
67
+ .dot_md {
68
+ width: 10px;
69
+ height: 10px;
70
+ }
71
+
72
+ /* ── Text ── */
73
+ .textWrap {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: 2px;
77
+ cursor: pointer;
78
+ padding-top: 0px;
79
+ }
80
+
81
+ .label {
82
+ font-size: 14px;
83
+ font-weight: 500;
84
+ color: var(--color-text-primary);
85
+ line-height: 1.3;
86
+ }
87
+
88
+ .hint {
89
+ font-size: 12px;
90
+ color: var(--color-text-tertiary);
91
+ line-height: 1.4;
92
+ }
@@ -0,0 +1,134 @@
1
+ "use client";
2
+
3
+ import { createContext, useContext, useState, useCallback, forwardRef, useId } from "react";
4
+ import { cn } from "@/lib/cn";
5
+ import styles from "./RadioButton.module.css";
6
+
7
+ /* ── Group Context ── */
8
+ interface RadioGroupCtx {
9
+ value: string;
10
+ onChange: (value: string) => void;
11
+ size: "sm" | "md";
12
+ disabled: boolean;
13
+ }
14
+
15
+ const Ctx = createContext<RadioGroupCtx | null>(null);
16
+
17
+ /* ── RadioGroup ── */
18
+ export interface RadioGroupProps {
19
+ children: React.ReactNode;
20
+ defaultValue?: string;
21
+ value?: string;
22
+ onChange?: (value: string) => void;
23
+ size?: "sm" | "md";
24
+ disabled?: boolean;
25
+ className?: string;
26
+ "aria-label"?: string;
27
+ }
28
+
29
+ export function RadioGroup({
30
+ children,
31
+ defaultValue = "",
32
+ value: controlledValue,
33
+ onChange,
34
+ size = "sm",
35
+ disabled = false,
36
+ className,
37
+ ...props
38
+ }: RadioGroupProps) {
39
+ const [internalValue, setInternalValue] = useState(defaultValue);
40
+ const isControlled = controlledValue !== undefined;
41
+ const value = isControlled ? controlledValue : internalValue;
42
+
43
+ const handleChange = useCallback(
44
+ (v: string) => {
45
+ if (!isControlled) setInternalValue(v);
46
+ onChange?.(v);
47
+ },
48
+ [isControlled, onChange],
49
+ );
50
+
51
+ return (
52
+ <Ctx.Provider value={{ value, onChange: handleChange, size, disabled }}>
53
+ <div
54
+ role="radiogroup"
55
+ aria-label={props["aria-label"]}
56
+ className={cn(styles.group, className)}
57
+ >
58
+ {children}
59
+ </div>
60
+ </Ctx.Provider>
61
+ );
62
+ }
63
+
64
+ /* ── RadioButton ── */
65
+ export interface RadioButtonProps {
66
+ label?: string;
67
+ hint?: string;
68
+ value: string;
69
+ size?: "sm" | "md";
70
+ disabled?: boolean;
71
+ checked?: boolean;
72
+ onChange?: (value: string) => void;
73
+ className?: string;
74
+ }
75
+
76
+ export const RadioButton = forwardRef<HTMLButtonElement, RadioButtonProps>(
77
+ (
78
+ {
79
+ label,
80
+ hint,
81
+ value,
82
+ size: sizeProp,
83
+ disabled: disabledProp,
84
+ checked: checkedProp,
85
+ onChange: onChangeProp,
86
+ className,
87
+ },
88
+ ref,
89
+ ) => {
90
+ const ctx = useContext(Ctx);
91
+ const size = sizeProp ?? ctx?.size ?? "sm";
92
+ const disabled = disabledProp ?? ctx?.disabled ?? false;
93
+ const checked = checkedProp ?? (ctx ? ctx.value === value : false);
94
+
95
+ const handleClick = () => {
96
+ if (disabled) return;
97
+ if (ctx) {
98
+ ctx.onChange(value);
99
+ } else {
100
+ onChangeProp?.(value);
101
+ }
102
+ };
103
+
104
+ return (
105
+ <div className={cn(styles.wrapper, disabled && styles.wrapperDisabled, className)}>
106
+ <button
107
+ ref={ref}
108
+ type="button"
109
+ role="radio"
110
+ aria-checked={checked}
111
+ disabled={disabled}
112
+ onClick={handleClick}
113
+ className={cn(
114
+ styles.radio,
115
+ styles[`radio_${size}`],
116
+ checked && styles.radioChecked,
117
+ )}
118
+ >
119
+ {checked && (
120
+ <span className={cn(styles.dot, styles[`dot_${size}`])} />
121
+ )}
122
+ </button>
123
+ {(label || hint) && (
124
+ <div className={styles.textWrap} onClick={handleClick}>
125
+ {label && <span className={styles.label}>{label}</span>}
126
+ {hint && <span className={styles.hint}>{hint}</span>}
127
+ </div>
128
+ )}
129
+ </div>
130
+ );
131
+ },
132
+ );
133
+
134
+ RadioButton.displayName = "RadioButton";
@@ -0,0 +1,2 @@
1
+ export { RadioButton, RadioGroup } from "./RadioButton";
2
+ export type { RadioButtonProps, RadioGroupProps } from "./RadioButton";