@trainvent/arcubic 0.3.1 → 0.4.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.
- package/README.md +21 -10
- package/dist/core/design.d.ts +63 -0
- package/dist/index.js +26 -4
- package/dist/styles.css +12 -9
- package/dist/tokens.css +2 -2
- package/package.json +1 -1
- /package/dist/{CodeBlock.d.ts → components/CodeBlock.d.ts} +0 -0
- /package/dist/{DirectionSwitch.d.ts → components/DirectionSwitch.d.ts} +0 -0
- /package/dist/{LoadingButton.d.ts → components/LoadingButton.d.ts} +0 -0
- /package/dist/{NativeSelect.d.ts → components/NativeSelect.d.ts} +0 -0
- /package/dist/{Spinner.d.ts → components/Spinner.d.ts} +0 -0
- /package/dist/{index.d.ts → components/index.d.ts} +0 -0
- /package/dist/{portals.d.ts → components/portals.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
# @trainvent/arcubic
|
|
2
2
|
|
|
3
|
-
React 19 components, CSS tokens and bundled OFL fonts.
|
|
3
|
+
React 19 components, CSS tokens and bundled OFL fonts.
|
|
4
|
+
|
|
5
|
+
Install from the public npm registry:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-exact @trainvent/arcubic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Commit package.json and package-lock.json together. The exact version keeps deployments reproducible; Dependabot can propose new releases in a PR without manually editing either file.
|
|
12
|
+
|
|
13
|
+
Import the stylesheet once in your application layout:
|
|
4
14
|
|
|
5
15
|
```tsx
|
|
6
16
|
import '@trainvent/arcubic/styles.css';
|
|
7
|
-
import { Theme, Button } from '@trainvent/arcubic';
|
|
8
|
-
|
|
9
|
-
<Theme appearance="dark"><Button>Get started</Button></Theme>
|
|
10
17
|
```
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
Use the components inside a theme. In Next.js, this provider component is a client component:
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
```tsx
|
|
22
|
+
'use client';
|
|
15
23
|
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
import { Theme, Button } from '@trainvent/arcubic';
|
|
25
|
+
|
|
26
|
+
export default function Example() {
|
|
27
|
+
return <Theme appearance="dark"><Button>Get started</Button></Theme>;
|
|
28
|
+
}
|
|
18
29
|
```
|
|
19
30
|
|
|
20
|
-
|
|
31
|
+
In Next.js, render Theme inside a client provider. The package has a `use client` boundary and includes TypeScript declarations. Theme supplies the Arcubic classes, teal accent, gray neutrals, square geometry and an overlay host for themed portals. Set `appearance` to `light` or `dark`; persistence belongs to the application.
|
|
21
32
|
|
|
22
33
|
Build with `npm run build:react` or create an installable archive with `npm run pack:react` from the repository root (Node 24). The package version follows the root version. `npm run package:release` includes the React archive with the other theme artifacts. Pushing a numeric version tag matching package.json publishes to npm through `.github/workflows/publish-npm.yml` and creates companion downloads through `.github/workflows/release.yml`.
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
See the [maintainer release guide](https://github.com/trainvent/arcubic/blob/main/docs/npm-publishing.md) for the configured publishing workflow. GitHub release archives remain an alternative download format; consumers do not need their URLs for normal npm installation.
|
|
25
36
|
|
|
26
37
|
`styles.css` includes Radix base styles, tokens, components and local fonts. `tokens.css` and `fonts.css` are separate exports for applications needing only those layers. Chakra Petch is the interface font, Lora the reading font, and Geist Mono the code font. Font licenses ship beside the font files.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Platform-independent Arcubic defaults. Adapters map these roles to their UI. */
|
|
2
|
+
export declare const typography: {
|
|
3
|
+
interface: string;
|
|
4
|
+
reading: string;
|
|
5
|
+
code: string;
|
|
6
|
+
caption: number;
|
|
7
|
+
ui: number;
|
|
8
|
+
body: number;
|
|
9
|
+
noteHeading: number;
|
|
10
|
+
uiLineHeight: number;
|
|
11
|
+
bodyLineHeight: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const geometry: {
|
|
14
|
+
radius: number;
|
|
15
|
+
border: number;
|
|
16
|
+
switchHeight: number;
|
|
17
|
+
switchWidthRatio: number;
|
|
18
|
+
switchRimRatio: number;
|
|
19
|
+
switchThumbRatio: number;
|
|
20
|
+
switchInsetRatio: number;
|
|
21
|
+
switchTravelRatio: number;
|
|
22
|
+
switchTriangleWidthRatio: number;
|
|
23
|
+
switchTriangleHeightRatio: number;
|
|
24
|
+
switchSlantRatio: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function designTokens(): Record<string, string>;
|
|
27
|
+
/** Raised and sunken edges of controls such as the switch. Gray values are steps of the neutral
|
|
28
|
+
* scale; accent values are steps of the control's accent family. Mirrors `.arcubic-ui` in
|
|
29
|
+
* src/components/base.css. */
|
|
30
|
+
export declare const bevel: {
|
|
31
|
+
readonly dark: {
|
|
32
|
+
readonly high: {
|
|
33
|
+
readonly gray: 7;
|
|
34
|
+
};
|
|
35
|
+
readonly low: {
|
|
36
|
+
readonly gray: 1;
|
|
37
|
+
};
|
|
38
|
+
readonly face: {
|
|
39
|
+
readonly gray: 4;
|
|
40
|
+
};
|
|
41
|
+
readonly accentHigh: 11;
|
|
42
|
+
readonly accentLow: 7;
|
|
43
|
+
};
|
|
44
|
+
readonly light: {
|
|
45
|
+
readonly high: "#fff";
|
|
46
|
+
readonly low: {
|
|
47
|
+
readonly gray: 8;
|
|
48
|
+
};
|
|
49
|
+
readonly face: {
|
|
50
|
+
readonly gray: 3;
|
|
51
|
+
};
|
|
52
|
+
readonly accentHigh: 6;
|
|
53
|
+
readonly accentLow: 10;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/** Triangle portion of the Le Logo continuous fuse route (no enclosing circle), traced by every
|
|
57
|
+
* Arcubic loader. The fuse is a dash of `fuseDash` out of a path length of 100. */
|
|
58
|
+
export declare const loader: {
|
|
59
|
+
readonly viewBox: "20 -40 860 760";
|
|
60
|
+
readonly route: "M450 9.45 L548.3474 179.7927 L831.5275 670.275 L634.8327 670.275 L68.4725 670.275 L166.8199 499.9323 L514.1917 626.3653 L634.8327 670.275 L570.641 306.2257 L548.3474 179.7927 L265.1673 417.409 L343.9101 388.749 L570.641 306.2257 L556.0899 388.749 L514.1917 626.3653 L450 572.502 L556.0899 388.749 L343.9101 388.749 L450 572.502 L265.1673 417.409 L166.8199 499.9323 L450 9.45";
|
|
61
|
+
readonly fuseDash: 26;
|
|
62
|
+
readonly durationSeconds: 1.8;
|
|
63
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -72,14 +72,36 @@ function CodeBlock({ code, language = "text", filename, lineNumbers = true }) {
|
|
|
72
72
|
// src/components/Spinner.tsx
|
|
73
73
|
import { forwardRef as forwardRef3 } from "react";
|
|
74
74
|
import { Box } from "@radix-ui/themes";
|
|
75
|
+
|
|
76
|
+
// src/core/design.ts
|
|
77
|
+
var geometry = {
|
|
78
|
+
radius: 0,
|
|
79
|
+
border: 1,
|
|
80
|
+
switchHeight: 22,
|
|
81
|
+
switchWidthRatio: 42 / 22,
|
|
82
|
+
switchRimRatio: 2 / 22,
|
|
83
|
+
switchThumbRatio: 18 / 22,
|
|
84
|
+
switchInsetRatio: 4 / 22,
|
|
85
|
+
switchTravelRatio: 16 / 22,
|
|
86
|
+
switchTriangleWidthRatio: 16 / 22,
|
|
87
|
+
switchTriangleHeightRatio: 16 / 22 * Math.sqrt(3) / 2,
|
|
88
|
+
switchSlantRatio: Math.tan(Math.PI / 6)
|
|
89
|
+
};
|
|
90
|
+
var loader = {
|
|
91
|
+
viewBox: "20 -40 860 760",
|
|
92
|
+
route: "M450 9.45 L548.3474 179.7927 L831.5275 670.275 L634.8327 670.275 L68.4725 670.275 L166.8199 499.9323 L514.1917 626.3653 L634.8327 670.275 L570.641 306.2257 L548.3474 179.7927 L265.1673 417.409 L343.9101 388.749 L570.641 306.2257 L556.0899 388.749 L514.1917 626.3653 L450 572.502 L556.0899 388.749 L343.9101 388.749 L450 572.502 L265.1673 417.409 L166.8199 499.9323 L450 9.45",
|
|
93
|
+
fuseDash: 26,
|
|
94
|
+
durationSeconds: 1.8
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/components/Spinner.tsx
|
|
75
98
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
76
|
-
var route = "M450 9.45 L548.3474 179.7927 L831.5275 670.275 L634.8327 670.275 L68.4725 670.275 L166.8199 499.9323 L514.1917 626.3653 L634.8327 670.275 L570.641 306.2257 L548.3474 179.7927 L265.1673 417.409 L343.9101 388.749 L570.641 306.2257 L556.0899 388.749 L514.1917 626.3653 L450 572.502 L556.0899 388.749 L343.9101 388.749 L450 572.502 L265.1673 417.409 L166.8199 499.9323 L450 9.45";
|
|
77
99
|
var Spinner = forwardRef3(({ loading = true, size = "2", children, className, style, "aria-label": label = "Loading", ...props }, ref) => {
|
|
78
100
|
if (!loading) return children;
|
|
79
101
|
const sizes = typeof size === "string" ? `arc-spinner-size-${size}` : Object.entries(size).map(([breakpoint, value]) => `arc-spinner-${breakpoint}-${value}`).join(" ");
|
|
80
|
-
const indicator = /* @__PURE__ */ jsx4(Box, { ...props, asChild: true, children: /* @__PURE__ */ jsx4("span", { ref, className: `arc-triangle-spinner ${sizes} ${className || ""}`, style, role: props["aria-hidden"] ? void 0 : "status", "aria-label": props["aria-hidden"] ? void 0 : label, children: /* @__PURE__ */ jsxs3("svg", { viewBox:
|
|
81
|
-
/* @__PURE__ */ jsx4("path", { className: "arc-spinner-guide", d: route }),
|
|
82
|
-
/* @__PURE__ */ jsx4("path", { className: "arc-spinner-fuse", d: route, pathLength: "100" })
|
|
102
|
+
const indicator = /* @__PURE__ */ jsx4(Box, { ...props, asChild: true, children: /* @__PURE__ */ jsx4("span", { ref, className: `arc-triangle-spinner ${sizes} ${className || ""}`, style, role: props["aria-hidden"] ? void 0 : "status", "aria-label": props["aria-hidden"] ? void 0 : label, children: /* @__PURE__ */ jsxs3("svg", { viewBox: loader.viewBox, "aria-hidden": "true", fill: "none", children: [
|
|
103
|
+
/* @__PURE__ */ jsx4("path", { className: "arc-spinner-guide", d: loader.route }),
|
|
104
|
+
/* @__PURE__ */ jsx4("path", { className: "arc-spinner-fuse", d: loader.route, pathLength: "100" })
|
|
83
105
|
] }) }) });
|
|
84
106
|
return children === void 0 ? indicator : /* @__PURE__ */ jsxs3("span", { className: "arc-spinner-wrap", children: [
|
|
85
107
|
/* @__PURE__ */ jsx4("span", { "aria-hidden": "true", style: { visibility: "hidden" }, children }),
|
package/dist/styles.css
CHANGED
|
@@ -27109,8 +27109,8 @@ SOFTWARE.
|
|
|
27109
27109
|
--arc-switch-thumb-ratio: 0.8181818181818182;
|
|
27110
27110
|
--arc-switch-inset-ratio: 0.18181818181818182;
|
|
27111
27111
|
--arc-switch-travel-ratio: 0.7272727272727273;
|
|
27112
|
-
--arc-switch-triangle-width-ratio: 0.
|
|
27113
|
-
--arc-switch-triangle-height-ratio: 0.
|
|
27112
|
+
--arc-switch-triangle-width-ratio: 0.7272727272727273;
|
|
27113
|
+
--arc-switch-triangle-height-ratio: 0.6298366572977735;
|
|
27114
27114
|
--arc-switch-slant-ratio: 0.5773502691896257;
|
|
27115
27115
|
}
|
|
27116
27116
|
|
|
@@ -27625,10 +27625,14 @@ SOFTWARE.
|
|
|
27625
27625
|
--ds-inset:calc(var(--direction-switch-height) * var(--arc-switch-inset-ratio,.1818181818));
|
|
27626
27626
|
--ds-travel:calc(var(--direction-switch-height) * var(--arc-switch-travel-ratio,.7272727273));
|
|
27627
27627
|
--ds-slant:calc(var(--direction-switch-height) * var(--arc-switch-slant-ratio,.5773502692));
|
|
27628
|
-
--ds-
|
|
27629
|
-
--ds-inner-slant:calc(var(--ds-
|
|
27628
|
+
--ds-corner:var(--ds-rim);
|
|
27629
|
+
--ds-inner-slant:calc(var(--ds-chamber-height) * var(--arc-switch-slant-ratio,.5773502692));
|
|
27630
27630
|
--ds-triangle-width:calc(var(--direction-switch-height) * var(--arc-switch-triangle-width-ratio,.5909090909));
|
|
27631
27631
|
--ds-triangle-height:calc(var(--direction-switch-height) * var(--arc-switch-triangle-height-ratio,.5));
|
|
27632
|
+
--ds-chamber-width:calc(var(--ds-width) - var(--ds-rim) * 3.5);
|
|
27633
|
+
--ds-chamber-height:calc(var(--direction-switch-height) - var(--ds-rim));
|
|
27634
|
+
--ds-travel-x:calc(var(--ds-chamber-width) - var(--ds-triangle-width));
|
|
27635
|
+
--ds-travel-y:calc(var(--ds-chamber-height) - var(--ds-triangle-height));
|
|
27632
27636
|
width:var(--ds-width);min-width:var(--ds-width);height:var(--direction-switch-height);
|
|
27633
27637
|
position:relative;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;vertical-align:middle;
|
|
27634
27638
|
border:0!important;border-radius:0;padding:0;overflow:visible;isolation:isolate;box-shadow:none!important;
|
|
@@ -27636,7 +27640,7 @@ SOFTWARE.
|
|
|
27636
27640
|
background:linear-gradient(120deg,var(--ui-high) 0%,var(--ui-high) 25%,var(--gray-6) 46%,var(--ui-low) 72%,var(--ui-low) 100%)!important;
|
|
27637
27641
|
}
|
|
27638
27642
|
.arcubic-ui .rt-SwitchRoot::before{
|
|
27639
|
-
content:'';position:absolute;inset:var(--ds-rim);z-index:-1;border:0;border-radius:0;
|
|
27643
|
+
content:'';position:absolute;inset:var(--ds-rim);width:var(--ds-chamber-width);height:var(--ds-chamber-height);z-index:-1;border:0;border-radius:0;
|
|
27640
27644
|
clip-path:polygon(0 0,calc(100% - var(--ds-inner-slant)) 0,100% 100%,var(--ds-inner-slant) 100%);
|
|
27641
27645
|
background:linear-gradient(180deg,var(--gray-2),var(--gray-4));
|
|
27642
27646
|
box-shadow:inset 0 calc(var(--ds-rim) * .5) var(--ds-rim) #00000040!important;
|
|
@@ -27647,18 +27651,17 @@ SOFTWARE.
|
|
|
27647
27651
|
}
|
|
27648
27652
|
.arcubic-ui .rt-SwitchRoot[data-state=checked]::before{background:linear-gradient(180deg,var(--teal-2),var(--teal-4))}
|
|
27649
27653
|
.arcubic-ui .rt-SwitchThumb{
|
|
27650
|
-
position:absolute!important;inset:auto!important;left:var(--ds-
|
|
27651
|
-
width:var(--ds-
|
|
27654
|
+
position:absolute!important;inset:auto!important;left:var(--ds-corner)!important;top:var(--ds-rim)!important;
|
|
27655
|
+
width:var(--ds-triangle-width)!important;height:var(--ds-triangle-height)!important;
|
|
27652
27656
|
display:grid;place-items:center;flex:none;border:0!important;border-radius:0!important;
|
|
27653
27657
|
background:transparent!important;box-shadow:none!important;pointer-events:none;
|
|
27654
27658
|
transform:translateX(0)!important;transition:transform .25s cubic-bezier(.2,.8,.2,1);
|
|
27655
27659
|
}
|
|
27656
|
-
.arcubic-ui .rt-SwitchRoot[data-state=checked] .rt-SwitchThumb{transform:
|
|
27660
|
+
.arcubic-ui .rt-SwitchRoot[data-state=checked] .rt-SwitchThumb{transform:translate(var(--ds-travel-x),var(--ds-travel-y))!important}
|
|
27657
27661
|
.arcubic-ui .rt-SwitchThumb::after{
|
|
27658
27662
|
content:'';display:block;width:var(--ds-triangle-width);height:var(--ds-triangle-height);pointer-events:none;
|
|
27659
27663
|
clip-path:polygon(50% 0,100% 100%,0 100%);transform:rotate(180deg);transform-origin:50% 50%;
|
|
27660
27664
|
background:linear-gradient(145deg,var(--gray-12) 20%,var(--gray-10) 85%);
|
|
27661
|
-
filter:drop-shadow(0 calc(var(--ds-rim) * .5) 0 var(--ui-low));
|
|
27662
27665
|
transition:transform .25s cubic-bezier(.2,.8,.2,1),background-color .18s ease;
|
|
27663
27666
|
}
|
|
27664
27667
|
.arcubic-ui .rt-SwitchRoot[data-state=checked] .rt-SwitchThumb::after{
|
package/dist/tokens.css
CHANGED
|
@@ -41,8 +41,8 @@ SOFTWARE.
|
|
|
41
41
|
--arc-switch-thumb-ratio: 0.8181818181818182;
|
|
42
42
|
--arc-switch-inset-ratio: 0.18181818181818182;
|
|
43
43
|
--arc-switch-travel-ratio: 0.7272727272727273;
|
|
44
|
-
--arc-switch-triangle-width-ratio: 0.
|
|
45
|
-
--arc-switch-triangle-height-ratio: 0.
|
|
44
|
+
--arc-switch-triangle-width-ratio: 0.7272727272727273;
|
|
45
|
+
--arc-switch-triangle-height-ratio: 0.6298366572977735;
|
|
46
46
|
--arc-switch-slant-ratio: 0.5773502691896257;
|
|
47
47
|
}
|
|
48
48
|
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|