@optiaxiom/react 0.1.0-next.4 → 0.1.0-next.6
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/dist/animate-presence/AnimatePresence.js +36 -0
- package/dist/animate-presence/PresenceContext.js +11 -0
- package/dist/animate-presence/usePresence.js +13 -0
- package/dist/assets/src/avatar/Avatar.css.ts.vanilla-CihLlW6Z.css +6 -0
- package/dist/assets/src/button/{Button.css.ts.vanilla-VaFYcYGO.css → Button.css.ts.vanilla-CAppQRyC.css} +10 -37
- package/dist/assets/src/button-group/ButtonGroup.css.ts.vanilla-xsXT6MRu.css +28 -0
- package/dist/assets/src/input/Input.css.ts.vanilla-X0R-SsOp.css +32 -0
- package/dist/assets/src/separator/{Separator.css.ts.vanilla-DYzKo87M.css → Separator.css.ts.vanilla-C_EYtori.css} +8 -14
- package/dist/assets/src/sprinkles/{sprinkles.css.ts.vanilla-NXW-pecy.css → sprinkles.css.ts.vanilla-CDl96MYc.css} +1659 -1651
- package/dist/assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css +4 -0
- package/dist/assets/src/styles/{theme.css.ts.vanilla-Cb0QJvUK.css → theme.css.ts.vanilla-0B4GnT52.css} +4 -2
- package/dist/assets/src/text/{Text.css.ts.vanilla-BtaUGYv3.css → Text.css.ts.vanilla-DK_dMlGe.css} +0 -4
- package/dist/assets/src/transition/{Transition.css.ts.vanilla-qjeQECVe.css → Transition.css.ts.vanilla-COX8x_Bo.css} +18 -9
- package/dist/avatar/Avatar-css.js +5 -7
- package/dist/avatar/Avatar.js +2 -3
- package/dist/box/Box-css.js +5 -4
- package/dist/box/Box.js +2 -2
- package/dist/button/Button-css.js +5 -5
- package/dist/button/Button.js +9 -19
- package/dist/button-group/ButtonGroup-css.js +7 -0
- package/dist/button-group/ButtonGroup.js +54 -0
- package/dist/code/Code-css.js +4 -3
- package/dist/code/Code.js +2 -3
- package/dist/field/Field.js +41 -0
- package/dist/index.d.ts +304 -371
- package/dist/index.js +5 -0
- package/dist/input/Input-css.js +6 -6
- package/dist/input/Input.js +2 -3
- package/dist/kbd/Kbd-css.js +5 -4
- package/dist/kbd/Kbd.js +3 -4
- package/dist/progress/Progress.js +18 -16
- package/dist/separator/Separator-css.js +5 -5
- package/dist/separator/Separator.js +1 -5
- package/dist/skeleton/Skeleton-css.js +4 -3
- package/dist/skeleton/Skeleton.js +2 -3
- package/dist/sprinkles/sprinkles-css.js +4 -4
- package/dist/styles/layers-css.js +3 -2
- package/dist/styles/theme-css.js +2 -2
- package/dist/text/Text-css.js +5 -5
- package/dist/text/Text.js +3 -8
- package/dist/tokens/borderRadius.js +1 -1
- package/dist/tokens/zIndex.js +2 -1
- package/dist/tooltip/Tooltip.js +18 -6
- package/dist/transition/Transition-css.js +6 -5
- package/dist/transition/Transition.js +11 -20
- package/dist/vanilla-extract/recipeRuntime.js +51 -0
- package/package.json +4 -5
- package/dist/assets/src/avatar/Avatar.css.ts.vanilla-DdarHYxU.css +0 -11
- package/dist/assets/src/input/Input.css.ts.vanilla-CICpzaz6.css +0 -68
- package/dist/assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css +0 -3
package/dist/text/Text.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
3
|
import { forwardRef } from 'react';
|
|
5
4
|
import { Box } from '../box/Box.js';
|
|
6
|
-
import {
|
|
5
|
+
import { text } from './Text-css.js';
|
|
7
6
|
|
|
8
7
|
const Text = forwardRef(
|
|
9
|
-
({ as = "p", asChild, children, className, lineClamp
|
|
8
|
+
({ as = "p", asChild, children, className, lineClamp, truncate, ...props }, ref) => {
|
|
10
9
|
const Comp = asChild ? Slot : as;
|
|
11
10
|
return /* @__PURE__ */ jsx(
|
|
12
11
|
Box,
|
|
13
12
|
{
|
|
14
13
|
asChild: true,
|
|
15
|
-
className: clsx(
|
|
16
|
-
lineClamp$1 && lineClamp[lineClamp$1],
|
|
17
|
-
truncate$1 && truncate,
|
|
18
|
-
className
|
|
19
|
-
),
|
|
20
14
|
fontSize: "md",
|
|
21
15
|
ref,
|
|
16
|
+
...text({ lineClamp, truncate }, className),
|
|
22
17
|
...props,
|
|
23
18
|
children: /* @__PURE__ */ jsx(Comp, { children })
|
|
24
19
|
}
|
package/dist/tokens/zIndex.js
CHANGED
package/dist/tooltip/Tooltip.js
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
3
|
-
import { AnimatePresence } from 'framer-motion';
|
|
4
3
|
import { forwardRef, useState } from 'react';
|
|
4
|
+
import { AnimatePresence } from '../animate-presence/AnimatePresence.js';
|
|
5
|
+
import '../animate-presence/PresenceContext.js';
|
|
5
6
|
import { Box } from '../box/Box.js';
|
|
6
7
|
import { Text } from '../text/Text.js';
|
|
7
8
|
import { Transition } from '../transition/Transition.js';
|
|
8
9
|
|
|
9
10
|
const Tooltip = forwardRef(
|
|
10
|
-
({ children, content, delayDuration, withArrow, ...props }, ref) => {
|
|
11
|
+
({ children, content, delayDuration, withArrow, z = "popover", ...props }, ref) => {
|
|
11
12
|
const [open, setOpen] = useState(false);
|
|
12
13
|
return /* @__PURE__ */ jsx(RadixTooltip.Provider, { delayDuration, children: /* @__PURE__ */ jsxs(RadixTooltip.Root, { onOpenChange: setOpen, open, children: [
|
|
13
14
|
/* @__PURE__ */ jsx(RadixTooltip.Trigger, { asChild: true, ref, children }),
|
|
14
|
-
/* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(RadixTooltip.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(Transition, { type: "pop", children: /* @__PURE__ */ jsx(RadixTooltip.Content, { asChild: true, sideOffset: 5, ...props, children: /* @__PURE__ */ jsxs(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(RadixTooltip.Portal, { forceMount: true, children: /* @__PURE__ */ jsx(Transition, { type: "pop", children: /* @__PURE__ */ jsx(RadixTooltip.Content, { asChild: true, sideOffset: 5, ...props, children: /* @__PURE__ */ jsxs(
|
|
16
|
+
Box,
|
|
17
|
+
{
|
|
18
|
+
bg: "dark.600",
|
|
19
|
+
color: "white",
|
|
20
|
+
px: "6",
|
|
21
|
+
py: "4",
|
|
22
|
+
rounded: "sm",
|
|
23
|
+
z,
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Text, { fontSize: "sm", children: content }),
|
|
26
|
+
withArrow && /* @__PURE__ */ jsx(RadixTooltip.Arrow, {})
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
) }) }) }) })
|
|
18
30
|
] }) });
|
|
19
31
|
}
|
|
20
32
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
2
|
-
import './../assets/src/transition/Transition.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
|
+
import './../assets/src/transition/Transition.css.ts.vanilla-COX8x_Bo.css';
|
|
3
|
+
import { recipeRuntime } from '../vanilla-extract/recipeRuntime.js';
|
|
3
4
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
5
|
+
var transition = recipeRuntime({base:'_1p67mhc0',variants:{duration:{sm:'_1p67mhc1',md:'_1p67mhc2',lg:'_1p67mhc3'},type:{fade:'_1p67mhc4','fade-down':'_1p67mhc5','fade-left':'_1p67mhc6','fade-right':'_1p67mhc7','fade-up':'_1p67mhc8',pop:'_1p67mhc9','pop-down':'_1p67mhca','pop-left':'_1p67mhcb','pop-right':'_1p67mhcc','pop-up':'_1p67mhcd'}}});
|
|
6
|
+
var transitionDuration = {sm:250,md:400,lg:550};
|
|
6
7
|
|
|
7
|
-
export {
|
|
8
|
+
export { transition, transitionDuration };
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { usePresence } from 'framer-motion';
|
|
5
2
|
import { forwardRef, useState, useEffect } from 'react';
|
|
6
|
-
import
|
|
3
|
+
import '../animate-presence/PresenceContext.js';
|
|
4
|
+
import { usePresence } from '../animate-presence/usePresence.js';
|
|
5
|
+
import { Box } from '../box/Box.js';
|
|
6
|
+
import { transitionDuration, transition } from './Transition-css.js';
|
|
7
7
|
|
|
8
|
-
const transitionDuration = {
|
|
9
|
-
sm: 250,
|
|
10
|
-
md: 400,
|
|
11
|
-
lg: 550
|
|
12
|
-
};
|
|
13
8
|
const Transition = forwardRef(
|
|
14
|
-
({ children, className, duration = "sm",
|
|
9
|
+
({ children, className, duration = "sm", type = "fade", ...props }, ref) => {
|
|
15
10
|
const [isPresent, safeToRemove] = usePresence();
|
|
16
11
|
const [enter, setEnter] = useState(false);
|
|
17
12
|
useEffect(() => {
|
|
@@ -21,18 +16,14 @@ const Transition = forwardRef(
|
|
|
21
16
|
!isPresent && setTimeout(safeToRemove, transitionDuration[duration]);
|
|
22
17
|
}, [isPresent]);
|
|
23
18
|
return /* @__PURE__ */ jsx(
|
|
24
|
-
|
|
19
|
+
Box,
|
|
25
20
|
{
|
|
26
|
-
|
|
27
|
-
className,
|
|
28
|
-
base,
|
|
29
|
-
enter !== isPresent && transitions[type]
|
|
30
|
-
),
|
|
21
|
+
asChild: true,
|
|
31
22
|
ref,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
...transition(
|
|
24
|
+
{ duration, type: enter !== isPresent ? type : void 0 },
|
|
25
|
+
className
|
|
26
|
+
),
|
|
36
27
|
...props,
|
|
37
28
|
children
|
|
38
29
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const recipeRuntime = ({
|
|
2
|
+
base = {},
|
|
3
|
+
variants,
|
|
4
|
+
variantsCompounded = []
|
|
5
|
+
}) => {
|
|
6
|
+
return (options, className) => {
|
|
7
|
+
const selections = options ?? {};
|
|
8
|
+
const classNames = className ? [className] : [];
|
|
9
|
+
const sprinkleProps = {};
|
|
10
|
+
function process(rule) {
|
|
11
|
+
for (const item of Array.isArray(rule) ? rule : [rule]) {
|
|
12
|
+
if (typeof item === "string") {
|
|
13
|
+
classNames.push(item);
|
|
14
|
+
} else {
|
|
15
|
+
for (const [name, value] of Object.entries(item)) {
|
|
16
|
+
sprinkleProps[name] = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
process(base);
|
|
22
|
+
for (const variantName in variants) {
|
|
23
|
+
if (!selections[variantName]) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const variant = variants[variantName];
|
|
27
|
+
const selection = typeof selections[variantName] === "boolean" ? selections[variantName] ? "true" : "false" : selections[variantName];
|
|
28
|
+
process(variant[selection]);
|
|
29
|
+
}
|
|
30
|
+
for (const { style, variants: variants2 } of variantsCompounded) {
|
|
31
|
+
if (!shouldApplyCompound(variants2, selections)) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
process(style);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
...sprinkleProps,
|
|
38
|
+
className: classNames.join(" ")
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const shouldApplyCompound = (compoundCheck, selections) => {
|
|
43
|
+
for (const key of Object.keys(compoundCheck)) {
|
|
44
|
+
if (compoundCheck[key] !== selections[key]) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { recipeRuntime };
|
package/package.json
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"url": "https://github.com/optimizely-axiom/optiaxiom.git"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "0.1.0-next.
|
|
9
|
+
"version": "0.1.0-next.6",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**",
|
|
12
12
|
"LICENSE"
|
|
13
13
|
],
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
|
-
"
|
|
15
|
+
"exports": "./dist/index.js",
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"*.css"
|
|
18
18
|
],
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"@fontsource-variable/fira-code": "^5.0.18",
|
|
22
22
|
"@radix-ui/react-avatar": "^1.0.4",
|
|
23
23
|
"@radix-ui/react-compose-refs": "^1.0.1",
|
|
24
|
+
"@radix-ui/react-label": "^2.0.2",
|
|
24
25
|
"@radix-ui/react-primitive": "^1.0.3",
|
|
25
26
|
"@radix-ui/react-progress": "^1.0.3",
|
|
26
27
|
"@radix-ui/react-separator": "^1.0.3",
|
|
27
28
|
"@radix-ui/react-slot": "^1.0.2",
|
|
28
29
|
"@radix-ui/react-tooltip": "^1.0.7",
|
|
29
|
-
"@
|
|
30
|
+
"@reach/auto-id": "^0.18.0",
|
|
30
31
|
"@vanilla-extract/sprinkles": "^1.6.2",
|
|
31
32
|
"clsx": "^2.1.1",
|
|
32
|
-
"framer-motion": "^6.0.0",
|
|
33
33
|
"inter-ui": "^4.0.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "rm -rf dist && NODE_ENV=production rollup -c",
|
|
46
|
-
"bundle-size": "oas-bundle-size",
|
|
47
46
|
"dev": "rm -rf dist && rollup -cw",
|
|
48
47
|
"lint": "oas-lint",
|
|
49
48
|
"test": "vitest"
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
@layer optiaxiom._1kfj4ga1;
|
|
2
|
-
@layer optiaxiom._1kfj4ga1 {
|
|
3
|
-
._5j10wf0 {
|
|
4
|
-
align-items: center;
|
|
5
|
-
border: 1px;
|
|
6
|
-
border-color: var(--ax-colors-border-default);
|
|
7
|
-
border-radius: var(--ax-borderRadius-sm);
|
|
8
|
-
border-style: solid;
|
|
9
|
-
color: var(--ax-colors-fg-default);
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
}
|
|
13
|
-
._5j10wf0:focus-within:is([data-invalid="true"]) {
|
|
14
|
-
outline-color: var(--ax-colors-red-200);
|
|
15
|
-
outline-offset: 1px;
|
|
16
|
-
outline-style: solid;
|
|
17
|
-
outline-width: 2px;
|
|
18
|
-
}
|
|
19
|
-
._5j10wf0:focus-within:not([data-invalid="true"]) {
|
|
20
|
-
outline-color: var(--ax-colors-brand-200);
|
|
21
|
-
outline-offset: 1px;
|
|
22
|
-
outline-style: solid;
|
|
23
|
-
outline-width: 2px;
|
|
24
|
-
}
|
|
25
|
-
._5j10wf0:hover {
|
|
26
|
-
border-color: var(--ax-colors-border-brand);
|
|
27
|
-
}
|
|
28
|
-
._5j10wf0[data-disabled="true"] {
|
|
29
|
-
background-color: var(--ax-colors-bg-disabled);
|
|
30
|
-
border-color: var(--ax-colors-border-secondary);
|
|
31
|
-
cursor: not-allowed;
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
}
|
|
34
|
-
._5j10wf0[data-invalid="true"] {
|
|
35
|
-
border-color: var(--ax-colors-border-error);
|
|
36
|
-
}
|
|
37
|
-
._5j10wf1 {
|
|
38
|
-
font-size: var(--ax-fontSize-sm-fontSize);
|
|
39
|
-
height: 24px;
|
|
40
|
-
line-height: var(--ax-fontSize-sm-lineHeight);
|
|
41
|
-
padding: 8px 8px;
|
|
42
|
-
}
|
|
43
|
-
._5j10wf2 {
|
|
44
|
-
font-size: var(--ax-fontSize-md-fontSize);
|
|
45
|
-
height: 32px;
|
|
46
|
-
line-height: var(--ax-fontSize-md-lineHeight);
|
|
47
|
-
padding: 8px 8px;
|
|
48
|
-
}
|
|
49
|
-
._5j10wf3 {
|
|
50
|
-
font-size: var(--ax-fontSize-lg-fontSize);
|
|
51
|
-
height: 40px;
|
|
52
|
-
line-height: var(--ax-fontSize-lg-lineHeight);
|
|
53
|
-
padding: 4px 8px;
|
|
54
|
-
}
|
|
55
|
-
._5j10wf6 {
|
|
56
|
-
background: var(--ax-colors-transparent);
|
|
57
|
-
width: 100%;
|
|
58
|
-
}
|
|
59
|
-
._5j10wf6:focus-visible {
|
|
60
|
-
outline-width: 0px;
|
|
61
|
-
}
|
|
62
|
-
._5j10wf7 {
|
|
63
|
-
text-align: start;
|
|
64
|
-
}
|
|
65
|
-
._5j10wf8 {
|
|
66
|
-
text-align: end;
|
|
67
|
-
}
|
|
68
|
-
}
|