@ox0/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 (2) hide show
  1. package/dist/index.js +194 -0
  2. package/package.json +29 -0
package/dist/index.js ADDED
@@ -0,0 +1,194 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE__ox0_i18n_ad8e896a__ from "@ox0/i18n";
2
+ import "@ox0/tokens/styles.css";
3
+ const sizeStyles = {
4
+ lg: "0.875rem 1rem",
5
+ md: "0.625rem 0.875rem",
6
+ sm: "0.5rem 0.75rem"
7
+ };
8
+ const variantStyles = {
9
+ ghost: {
10
+ background: "transparent",
11
+ border: "1px solid transparent",
12
+ color: "var(--ox0-color-foreground)"
13
+ },
14
+ primary: {
15
+ background: "var(--ox0-color-accent)",
16
+ border: "1px solid var(--ox0-color-accent)",
17
+ color: "white"
18
+ },
19
+ secondary: {
20
+ background: "var(--ox0-color-surface)",
21
+ border: "1px solid var(--ox0-color-border)",
22
+ color: "var(--ox0-color-foreground)"
23
+ }
24
+ };
25
+ function Button({ children, size = "md", style, type = "button", variant = "secondary", ...props }) {
26
+ return /*#__PURE__*/ React.createElement("button", {
27
+ ...props,
28
+ style: {
29
+ alignItems: "center",
30
+ background: variantStyles[variant].background,
31
+ border: variantStyles[variant].border,
32
+ borderRadius: "var(--ox0-radius-md)",
33
+ boxShadow: "var(--ox0-shadow-sm)",
34
+ color: variantStyles[variant].color,
35
+ cursor: "pointer",
36
+ display: "inline-flex",
37
+ font: "inherit",
38
+ gap: "0.5rem",
39
+ justifyContent: "center",
40
+ lineHeight: 1.2,
41
+ padding: sizeStyles[size],
42
+ ...style
43
+ },
44
+ type: type
45
+ }, children);
46
+ }
47
+ function Checkbox({ label, ...props }) {
48
+ return /*#__PURE__*/ React.createElement("label", {
49
+ style: {
50
+ alignItems: "center",
51
+ display: "inline-flex",
52
+ gap: "0.5rem"
53
+ }
54
+ }, /*#__PURE__*/ React.createElement("input", {
55
+ ...props,
56
+ type: "checkbox"
57
+ }), label ? /*#__PURE__*/ React.createElement("span", null, label) : null);
58
+ }
59
+ function Dialog({ children, footer, isOpen, title }) {
60
+ if (!isOpen) return null;
61
+ return /*#__PURE__*/ React.createElement("div", {
62
+ style: {
63
+ alignItems: "center",
64
+ background: "rgb(16 32 51 / 0.4)",
65
+ display: "grid",
66
+ inset: 0,
67
+ padding: "1.5rem",
68
+ position: "fixed"
69
+ }
70
+ }, /*#__PURE__*/ React.createElement("dialog", {
71
+ "aria-modal": "true",
72
+ open: true,
73
+ style: {
74
+ background: "var(--ox0-color-surface)",
75
+ border: "1px solid var(--ox0-color-border)",
76
+ borderRadius: "var(--ox0-radius-md)",
77
+ boxShadow: "0 20px 40px rgb(16 32 51 / 0.15)",
78
+ display: "grid",
79
+ gap: "1rem",
80
+ margin: "0 auto",
81
+ maxWidth: "32rem",
82
+ padding: "1rem",
83
+ width: "100%"
84
+ }
85
+ }, title ? /*#__PURE__*/ React.createElement("strong", null, title) : null, /*#__PURE__*/ React.createElement("div", null, children), footer ? /*#__PURE__*/ React.createElement("div", null, footer) : null));
86
+ }
87
+ function IconButton({ icon, ...props }) {
88
+ return /*#__PURE__*/ React.createElement(Button, props, icon);
89
+ }
90
+ function Popover({ children, isOpen }) {
91
+ if (!isOpen) return null;
92
+ return /*#__PURE__*/ React.createElement("div", {
93
+ style: {
94
+ background: "var(--ox0-color-surface)",
95
+ border: "1px solid var(--ox0-color-border)",
96
+ borderRadius: "var(--ox0-radius-md)",
97
+ boxShadow: "0 16px 32px rgb(16 32 51 / 0.12)",
98
+ padding: "0.75rem"
99
+ }
100
+ }, children);
101
+ }
102
+ function Switch({ label, ...props }) {
103
+ const ariaChecked = "boolean" == typeof props.checked ? props.checked : "boolean" == typeof props.defaultChecked ? props.defaultChecked : false;
104
+ return /*#__PURE__*/ React.createElement("label", {
105
+ style: {
106
+ alignItems: "center",
107
+ display: "inline-flex",
108
+ gap: "0.5rem"
109
+ }
110
+ }, /*#__PURE__*/ React.createElement("input", {
111
+ ...props,
112
+ "aria-checked": ariaChecked,
113
+ role: "switch",
114
+ type: "checkbox"
115
+ }), label ? /*#__PURE__*/ React.createElement("span", null, label) : null);
116
+ }
117
+ function TextField({ description, errorMessage, id, label, style, ...props }) {
118
+ return /*#__PURE__*/ React.createElement("div", {
119
+ style: {
120
+ color: "var(--ox0-color-foreground)",
121
+ display: "grid",
122
+ fontSize: "0.875rem",
123
+ gap: "0.375rem"
124
+ }
125
+ }, label ? /*#__PURE__*/ React.createElement("label", {
126
+ htmlFor: id
127
+ }, label) : null, /*#__PURE__*/ React.createElement("input", {
128
+ ...props,
129
+ id: id,
130
+ style: {
131
+ background: "var(--ox0-color-surface)",
132
+ border: "1px solid var(--ox0-color-border)",
133
+ borderRadius: "var(--ox0-radius-md)",
134
+ color: "var(--ox0-color-foreground)",
135
+ font: "inherit",
136
+ padding: "0.625rem 0.75rem",
137
+ ...style
138
+ }
139
+ }), description ? /*#__PURE__*/ React.createElement("span", {
140
+ style: {
141
+ color: "var(--ox0-color-muted)",
142
+ fontSize: "0.75rem"
143
+ }
144
+ }, description) : null, errorMessage ? /*#__PURE__*/ React.createElement("span", {
145
+ style: {
146
+ color: "#b42318",
147
+ fontSize: "0.75rem"
148
+ }
149
+ }, errorMessage) : null);
150
+ }
151
+ function Grid({ children, columns = "repeat(auto-fit, minmax(12rem, 1fr))", gap = "var(--ox0-space-md)" }) {
152
+ return /*#__PURE__*/ React.createElement("div", {
153
+ style: {
154
+ display: "grid",
155
+ gap,
156
+ gridTemplateColumns: columns
157
+ }
158
+ }, children);
159
+ }
160
+ function Inline({ children, gap = "var(--ox0-space-md)" }) {
161
+ return /*#__PURE__*/ React.createElement("div", {
162
+ style: {
163
+ alignItems: "center",
164
+ display: "flex",
165
+ flexWrap: "wrap",
166
+ gap
167
+ }
168
+ }, children);
169
+ }
170
+ function Split({ children }) {
171
+ return /*#__PURE__*/ React.createElement("div", {
172
+ style: {
173
+ alignItems: "center",
174
+ display: "flex",
175
+ gap: "var(--ox0-space-md)",
176
+ justifyContent: "space-between"
177
+ }
178
+ }, children);
179
+ }
180
+ function Stack({ children, gap = "var(--ox0-space-md)" }) {
181
+ return /*#__PURE__*/ React.createElement("div", {
182
+ style: {
183
+ display: "grid",
184
+ gap
185
+ }
186
+ }, children);
187
+ }
188
+ function Ox0Provider({ children, locale, messages }) {
189
+ return /*#__PURE__*/ React.createElement(__WEBPACK_EXTERNAL_MODULE__ox0_i18n_ad8e896a__.Ox0I18nProvider, {
190
+ locale: locale,
191
+ messages: messages
192
+ }, children);
193
+ }
194
+ export { Button, Checkbox, Dialog, Grid, IconButton, Inline, Ox0Provider, Popover, Split, Stack, Switch, TextField };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@ox0/ui",
3
+ "version": "0.1.0",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "dependencies": {
18
+ "react": "^19.0.0",
19
+ "@ox0/hooks": "0.1.0",
20
+ "@ox0/i18n": "0.1.0",
21
+ "@ox0/tokens": "0.1.0"
22
+ },
23
+ "scripts": {
24
+ "build": "rslib build -c ../../rslib.config.ts",
25
+ "typecheck": "tsc -p tsconfig.json",
26
+ "lint": "oxlint .",
27
+ "test": "vitest run"
28
+ }
29
+ }