@ekanos/ui 0.1.0 → 0.1.2

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.
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { Switch as Switch$1 } from '@base-ui/react/switch';
3
+
4
+ declare function Switch({ className, size, ...props }: Switch$1.Root.Props & {
5
+ size?: 'sm' | 'default';
6
+ }): React.JSX.Element;
7
+
8
+ export { Switch };
package/dist/switch.js ADDED
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+
3
+ // ../ui/src/shadcn/switch.tsx
4
+ import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
5
+
6
+ // ../ui/src/lib/utils/cn.ts
7
+ import { clsx } from "clsx";
8
+ import { twMerge } from "tailwind-merge";
9
+ function cn(...inputs) {
10
+ return twMerge(clsx(inputs));
11
+ }
12
+
13
+ // ../ui/src/shadcn/switch.tsx
14
+ import { jsx } from "react/jsx-runtime";
15
+ function Switch({
16
+ className,
17
+ size = "default",
18
+ ...props
19
+ }) {
20
+ return /* @__PURE__ */ jsx(
21
+ SwitchPrimitive.Root,
22
+ {
23
+ "data-slot": "switch",
24
+ "data-size": size,
25
+ className: cn(
26
+ "peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",
27
+ className
28
+ ),
29
+ ...props,
30
+ children: /* @__PURE__ */ jsx(
31
+ SwitchPrimitive.Thumb,
32
+ {
33
+ "data-slot": "switch-thumb",
34
+ className: cn(
35
+ "bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-checked:translate-x-[calc(100%-2px)] data-unchecked:translate-x-0"
36
+ )
37
+ }
38
+ )
39
+ }
40
+ );
41
+ }
42
+ export {
43
+ Switch
44
+ };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+
3
+ declare function Textarea({ className, ...props }: React.ComponentProps<'textarea'>): React.JSX.Element;
4
+
5
+ export { Textarea };
@@ -0,0 +1,25 @@
1
+ // ../ui/src/lib/utils/cn.ts
2
+ import { clsx } from "clsx";
3
+ import { twMerge } from "tailwind-merge";
4
+ function cn(...inputs) {
5
+ return twMerge(clsx(inputs));
6
+ }
7
+
8
+ // ../ui/src/shadcn/textarea.tsx
9
+ import { jsx } from "react/jsx-runtime";
10
+ function Textarea({ className, ...props }) {
11
+ return /* @__PURE__ */ jsx(
12
+ "textarea",
13
+ {
14
+ "data-slot": "textarea",
15
+ className: cn(
16
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
17
+ className
18
+ ),
19
+ ...props
20
+ }
21
+ );
22
+ }
23
+ export {
24
+ Textarea
25
+ };
package/dist/theme.css ADDED
@@ -0,0 +1,221 @@
1
+ /*
2
+ * @ekanos/ui — Tailwind CSS v4 preset
3
+ * ------------------------------------------------------------------
4
+ * For partners who run their OWN Tailwind v4 build. Two lines in your entry
5
+ * stylesheet:
6
+ *
7
+ * @import 'tailwindcss';
8
+ * @import '@ekanos/ui/theme.css';
9
+ *
10
+ * That gives you the token values, the base rules, the `dark:` variant, and
11
+ * an `@source` so Tailwind generates the utilities this package's components
12
+ * emit. Do NOT also import `@ekanos/ui/styles.css` — that one is the
13
+ * pre-compiled build for projects with no Tailwind, and loading both means
14
+ * two copies of every utility.
15
+ *
16
+ * The token map below is the OPEN preset: it maps the FULL Fusion semantic
17
+ * surface — surfaces, brand, status, chart, sidebar, assistant, info, the full
18
+ * elevation scale, radius, fonts and the motion keyframes — not merely the
19
+ * subset `@ekanos/ui`'s own components happen to emit. That is deliberate: a
20
+ * partner writing their own Fusion-styled widget (what `ekanos dev` scaffolds)
21
+ * reaches Fusion's tokens ONLY through this file, so an ordinary `bg-chart-1`,
22
+ * `text-info`, `bg-sidebar` or `shadow-widget` in their code must resolve.
23
+ * Tailwind prunes every entry a build does not actually use, so a partner pays
24
+ * for only what they reference. See tokens.css for the value definitions and
25
+ * why the compiled `styles.css` (the closed artifact) stays narrower than this.
26
+ */
27
+
28
+ @import './tokens.css' layer(base);
29
+ @import './base.css' layer(base);
30
+
31
+ /*
32
+ * Tell Tailwind where this package's class strings live, so a partner does not
33
+ * have to add an `@source` for node_modules by hand. Relative to this file:
34
+ * in the published package this file sits in `dist/` next to the bundles.
35
+ */
36
+ @source './*.js';
37
+
38
+ /*
39
+ * Dark mode, three states — matched declaration-for-declaration by the token
40
+ * blocks in tokens.css so `dark:` utilities and token values always flip
41
+ * together:
42
+ *
43
+ * 1. system preference, unless the page explicitly opted into light
44
+ * 2. an explicit `.dark` / `[data-theme='dark']` ancestor, which wins in
45
+ * both directions
46
+ *
47
+ * Fusion itself is class-only (`@variant dark (&:where(.dark, .dark *))`); the
48
+ * media query is added here because a partner app may have no theme toggle at
49
+ * all and should still get a correct dark render.
50
+ */
51
+ @custom-variant dark {
52
+ @media (prefers-color-scheme: dark) {
53
+ &:where(
54
+ :not(.light, .light *, [data-theme='light'], [data-theme='light'] *)
55
+ ) {
56
+ @slot;
57
+ }
58
+ }
59
+
60
+ &:where(.dark, .dark *, [data-theme='dark'], [data-theme='dark'] *) {
61
+ @slot;
62
+ }
63
+ }
64
+
65
+ @theme {
66
+ --color-background: var(--background);
67
+ --color-foreground: var(--foreground);
68
+
69
+ --color-card: var(--card);
70
+ --color-card-foreground: var(--card-foreground);
71
+
72
+ --color-popover: var(--popover);
73
+ --color-popover-foreground: var(--popover-foreground);
74
+
75
+ --color-primary: var(--primary);
76
+ --color-primary-foreground: var(--primary-foreground);
77
+ --color-primary-strong: var(--primary-strong);
78
+
79
+ --color-secondary: var(--secondary);
80
+ --color-secondary-foreground: var(--secondary-foreground);
81
+
82
+ --color-muted: var(--muted);
83
+ --color-muted-foreground: var(--muted-foreground);
84
+
85
+ --color-accent: var(--accent);
86
+ --color-accent-foreground: var(--accent-foreground);
87
+
88
+ --color-destructive: var(--destructive);
89
+ --color-destructive-foreground: var(--destructive-foreground);
90
+ --color-destructive-strong: var(--destructive-strong);
91
+
92
+ --color-warning: var(--warning);
93
+ --color-warning-foreground: var(--warning-foreground);
94
+
95
+ --color-success: var(--success);
96
+ --color-success-foreground: var(--success-foreground);
97
+ --color-success-strong: var(--success-strong);
98
+
99
+ --color-info: var(--info);
100
+ --color-info-foreground: var(--info-foreground);
101
+
102
+ --color-border: var(--border);
103
+ --color-input: var(--input);
104
+ --color-ring: var(--ring);
105
+
106
+ --color-chart-1: var(--chart-1);
107
+ --color-chart-2: var(--chart-2);
108
+ --color-chart-3: var(--chart-3);
109
+ --color-chart-4: var(--chart-4);
110
+ --color-chart-5: var(--chart-5);
111
+
112
+ --color-sidebar: var(--sidebar-background);
113
+ --color-sidebar-foreground: var(--sidebar-foreground);
114
+ --color-sidebar-primary: var(--sidebar-primary);
115
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
116
+ --color-sidebar-accent: var(--sidebar-accent);
117
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
118
+ --color-sidebar-border: var(--sidebar-border);
119
+ --color-sidebar-ring: var(--sidebar-ring);
120
+
121
+ --color-assistant: var(--assistant);
122
+ --color-assistant-foreground: var(--assistant-foreground);
123
+
124
+ --radius-sm: calc(var(--radius) - 4px);
125
+ --radius-md: calc(var(--radius) - 2px);
126
+ --radius-lg: var(--radius);
127
+
128
+ --font-sans: var(--font-sans);
129
+ --font-heading: var(--font-heading);
130
+
131
+ /* Elevation shadow utilities — the full Fusion scale. `@ekanos/ui`'s own
132
+ components only reach `shadow-card`, but a partner widget commonly uses
133
+ `shadow-widget` (and the deeper levels for popovers/modals/overlays), so
134
+ the whole scale is exposed. Tailwind prunes any a build does not use. */
135
+ --shadow-flat: var(--el-flat);
136
+ --shadow-sunken: var(--el-sunken);
137
+ --shadow-inset: var(--el-inset);
138
+ --shadow-card: var(--el-card);
139
+ --shadow-widget: var(--el-widget);
140
+ --shadow-rail: var(--el-rail);
141
+ --shadow-popover: var(--el-popover);
142
+ --shadow-sticky: var(--el-sticky);
143
+ --shadow-modal: var(--el-modal);
144
+ --shadow-overlay: var(--el-overlay);
145
+
146
+ /* Motion — the Fusion keyframe utilities a partner widget may reach for
147
+ (entrance, fades, accordion). Pruned when unused. */
148
+ --animate-widget-enter: widget-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1)
149
+ backwards;
150
+ --animate-fade-in: fade-in 0.4s ease-out backwards;
151
+ --animate-fade-up: fade-up 0.5s;
152
+ --animate-fade-down: fade-down 0.5s;
153
+ --animate-accordion-down: accordion-down 0.2s ease-out;
154
+ --animate-accordion-up: accordion-up 0.2s ease-out;
155
+
156
+ @keyframes widget-enter {
157
+ from {
158
+ opacity: 0;
159
+ transform: translateY(12px);
160
+ }
161
+ to {
162
+ opacity: 1;
163
+ transform: translateY(0);
164
+ }
165
+ }
166
+
167
+ @keyframes fade-in {
168
+ from {
169
+ opacity: 0;
170
+ }
171
+ to {
172
+ opacity: 1;
173
+ }
174
+ }
175
+
176
+ @keyframes fade-up {
177
+ 0% {
178
+ opacity: 0;
179
+ transform: translateY(10px);
180
+ }
181
+ 80% {
182
+ opacity: 0.6;
183
+ }
184
+ 100% {
185
+ opacity: 1;
186
+ transform: translateY(0);
187
+ }
188
+ }
189
+
190
+ @keyframes fade-down {
191
+ 0% {
192
+ opacity: 0;
193
+ transform: translateY(-10px);
194
+ }
195
+ 80% {
196
+ opacity: 0.6;
197
+ }
198
+ 100% {
199
+ opacity: 1;
200
+ transform: translateY(0);
201
+ }
202
+ }
203
+
204
+ @keyframes accordion-down {
205
+ from {
206
+ height: 0;
207
+ }
208
+ to {
209
+ height: var(--accordion-panel-height);
210
+ }
211
+ }
212
+
213
+ @keyframes accordion-up {
214
+ from {
215
+ height: var(--accordion-panel-height);
216
+ }
217
+ to {
218
+ height: 0;
219
+ }
220
+ }
221
+ }