@optiaxiom/react 0.1.0-next.4 → 0.1.0-next.5
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/input/{Input.css.ts.vanilla-CICpzaz6.css → Input.css.ts.vanilla-CucST5E4.css} +0 -1
- package/dist/assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css +4 -0
- package/dist/avatar/Avatar-css.js +1 -1
- package/dist/box/Box-css.js +1 -1
- package/dist/button/Button-css.js +1 -1
- package/dist/code/Code-css.js +1 -1
- package/dist/field/Field.js +41 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +1 -0
- package/dist/input/Input-css.js +2 -2
- package/dist/kbd/Kbd-css.js +1 -1
- package/dist/separator/Separator-css.js +1 -1
- package/dist/skeleton/Skeleton-css.js +1 -1
- package/dist/sprinkles/sprinkles-css.js +1 -1
- package/dist/styles/layers-css.js +3 -2
- package/dist/text/Text-css.js +1 -1
- package/dist/tooltip/Tooltip.js +2 -1
- package/dist/transition/Transition-css.js +1 -1
- package/dist/transition/Transition.js +2 -1
- package/package.json +4 -4
- package/dist/assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css +0 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
import { PresenceContext } from './PresenceContext.js';
|
|
4
|
+
|
|
5
|
+
const AnimatePresence = ({
|
|
6
|
+
children
|
|
7
|
+
}) => {
|
|
8
|
+
const [exiting, setExiting] = useState(
|
|
9
|
+
/* @__PURE__ */ new Map()
|
|
10
|
+
);
|
|
11
|
+
const lastChildren = useRef(children);
|
|
12
|
+
if (children) {
|
|
13
|
+
lastChildren.current = children;
|
|
14
|
+
}
|
|
15
|
+
const isPresent = !!children;
|
|
16
|
+
const onExitComplete = useCallback((id) => {
|
|
17
|
+
setExiting((state) => {
|
|
18
|
+
state.delete(id);
|
|
19
|
+
return new Map(state.entries());
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
const register = useCallback((id) => {
|
|
23
|
+
setExiting((state) => {
|
|
24
|
+
state.set(id, true);
|
|
25
|
+
return new Map(state.entries());
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!isPresent && [...exiting.values()].some(Boolean)) {
|
|
30
|
+
lastChildren.current = false;
|
|
31
|
+
}
|
|
32
|
+
}, [exiting, isPresent]);
|
|
33
|
+
return /* @__PURE__ */ jsx(PresenceContext.Provider, { value: { isPresent, onExitComplete, register }, children: children || ([...exiting.values()].some(Boolean) ? lastChildren.current : null) });
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { AnimatePresence };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext, useRef, useEffect } from 'react';
|
|
2
|
+
import { PresenceContext } from './PresenceContext.js';
|
|
3
|
+
|
|
4
|
+
const usePresence = () => {
|
|
5
|
+
const { isPresent, onExitComplete, register } = useContext(PresenceContext);
|
|
6
|
+
const id = useRef();
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
return register(id);
|
|
9
|
+
}, [id, register]);
|
|
10
|
+
return !isPresent ? [false, () => onExitComplete(id)] : [true];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { usePresence };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
3
|
import './../assets/src/sprinkles/sprinkles.css.ts.vanilla-NXW-pecy.css';
|
|
4
4
|
import './../assets/src/avatar/Avatar.css.ts.vanilla-DdarHYxU.css';
|
package/dist/box/Box-css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
3
|
import './../assets/src/box/Box.css.ts.vanilla-DMx7YI4c.css';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
3
|
import './../assets/src/button/Button.css.ts.vanilla-VaFYcYGO.css';
|
|
4
4
|
import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
|
package/dist/code/Code-css.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as RadixLabel from '@radix-ui/react-label';
|
|
3
|
+
import { useId } from '@reach/auto-id';
|
|
4
|
+
import { forwardRef, cloneElement } from 'react';
|
|
5
|
+
import { Flex } from '../flex/Flex.js';
|
|
6
|
+
import { Text } from '../text/Text.js';
|
|
7
|
+
|
|
8
|
+
const Field = forwardRef(
|
|
9
|
+
({
|
|
10
|
+
children,
|
|
11
|
+
description,
|
|
12
|
+
disabled,
|
|
13
|
+
error,
|
|
14
|
+
id: idProp,
|
|
15
|
+
label,
|
|
16
|
+
required,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const id = useId(idProp);
|
|
20
|
+
return /* @__PURE__ */ jsxs(Flex, { flexDirection: "column", gap: "2", maxW: "sm", ref, ...props, children: [
|
|
21
|
+
label && /* @__PURE__ */ jsx(Text, { asChild: true, children: /* @__PURE__ */ jsxs(RadixLabel.Root, { htmlFor: id, children: [
|
|
22
|
+
label,
|
|
23
|
+
required && /* @__PURE__ */ jsxs(Text, { "aria-hidden": "true", as: "span", color: "fg.error", children: [
|
|
24
|
+
" ",
|
|
25
|
+
"*"
|
|
26
|
+
] })
|
|
27
|
+
] }) }),
|
|
28
|
+
cloneElement(children, {
|
|
29
|
+
disabled,
|
|
30
|
+
error: !!error,
|
|
31
|
+
id,
|
|
32
|
+
required
|
|
33
|
+
}),
|
|
34
|
+
description && /* @__PURE__ */ jsx(Text, { as: "p", color: "fg.default", fontSize: "sm", children: description }),
|
|
35
|
+
error && /* @__PURE__ */ jsx(Text, { as: "p", color: "fg.error", fontSize: "sm", children: error })
|
|
36
|
+
] });
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
Field.displayName = "@optiaxiom/react/Field";
|
|
40
|
+
|
|
41
|
+
export { Field };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode, ReactElement } from 'react';
|
|
3
3
|
import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
|
|
4
4
|
import * as _vanilla_extract_recipes from '@vanilla-extract/recipes';
|
|
5
5
|
import { RecipeVariants } from '@vanilla-extract/recipes';
|
|
@@ -511,6 +511,17 @@ declare const Flex: react.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<rea
|
|
|
511
511
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
512
512
|
}, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
513
513
|
|
|
514
|
+
type FieldProps = ExtendProps<ComponentPropsWithRef<typeof Flex>, {
|
|
515
|
+
children: ReactElement;
|
|
516
|
+
description?: string;
|
|
517
|
+
disabled?: boolean;
|
|
518
|
+
error?: string;
|
|
519
|
+
id?: string;
|
|
520
|
+
label?: string;
|
|
521
|
+
required?: boolean;
|
|
522
|
+
}>;
|
|
523
|
+
declare const Field: react.ForwardRefExoticComponent<Omit<FieldProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
524
|
+
|
|
514
525
|
declare const Grid: react.ForwardRefExoticComponent<Omit<Omit<Omit<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
515
526
|
ref?: ((instance: HTMLDivElement | null) => void) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
516
527
|
}, "color" | "className"> & Omit<{
|
|
@@ -649,14 +660,16 @@ type SkeletonProps = ExtendProps<ComponentPropsWithRef<typeof Box>, {
|
|
|
649
660
|
declare const Skeleton: react.ForwardRefExoticComponent<Omit<SkeletonProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
650
661
|
|
|
651
662
|
declare const axiom: string;
|
|
663
|
+
declare const base: string;
|
|
652
664
|
declare const reset: string;
|
|
653
665
|
declare const components: string;
|
|
654
666
|
|
|
655
667
|
declare const layers_css_axiom: typeof axiom;
|
|
668
|
+
declare const layers_css_base: typeof base;
|
|
656
669
|
declare const layers_css_components: typeof components;
|
|
657
670
|
declare const layers_css_reset: typeof reset;
|
|
658
671
|
declare namespace layers_css {
|
|
659
|
-
export { layers_css_axiom as axiom, layers_css_components as components, layers_css_reset as reset };
|
|
672
|
+
export { layers_css_axiom as axiom, layers_css_base as base, layers_css_components as components, layers_css_reset as reset };
|
|
660
673
|
}
|
|
661
674
|
|
|
662
675
|
declare const theme: {
|
|
@@ -1773,4 +1786,4 @@ type TooltipProps = ExtendProps<ComponentPropsWithRef<typeof RadixTooltip.Conten
|
|
|
1773
1786
|
}>;
|
|
1774
1787
|
declare const Tooltip: react.ForwardRefExoticComponent<Omit<TooltipProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
1775
1788
|
|
|
1776
|
-
export { Avatar, Box, Button, Code, Flex, Grid, Heading, Input, Kbd, Paper, Progress, Separator, Skeleton, type Sprinkles, Text, Tooltip, extractSprinkles, layers_css as layers, mapResponsiveValue, sprinkles, theme, tokens, tokensDark };
|
|
1789
|
+
export { Avatar, Box, Button, Code, Field, Flex, Grid, Heading, Input, Kbd, Paper, Progress, Separator, Skeleton, type Sprinkles, Text, Tooltip, extractSprinkles, layers_css as layers, mapResponsiveValue, sprinkles, theme, tokens, tokensDark };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { Avatar } from './avatar/Avatar.js';
|
|
|
2
2
|
export { Box } from './box/Box.js';
|
|
3
3
|
export { Button } from './button/Button.js';
|
|
4
4
|
export { Code } from './code/Code.js';
|
|
5
|
+
export { Field } from './field/Field.js';
|
|
5
6
|
export { Flex } from './flex/Flex.js';
|
|
6
7
|
export { Grid } from './grid/Grid.js';
|
|
7
8
|
export { Heading } from './heading/Heading.js';
|
package/dist/input/Input-css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
|
-
import './../assets/src/input/Input.css.ts.vanilla-
|
|
3
|
+
import './../assets/src/input/Input.css.ts.vanilla-CucST5E4.css';
|
|
4
4
|
import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
|
|
5
5
|
|
|
6
6
|
var input = createRuntimeFn({compoundVariants:[],defaultClassName:'_5j10wf6',defaultVariants:{},variantClassNames:{variant:{'default':'_5j10wf7',number:'_5j10wf8'}}});
|
package/dist/kbd/Kbd-css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
3
|
import './../assets/src/separator/Separator.css.ts.vanilla-DYzKo87M.css';
|
|
4
4
|
import { createSprinkles } from '@vanilla-extract/sprinkles/createRuntimeSprinkles';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/styles/theme.css.ts.vanilla-Cb0QJvUK.css';
|
|
3
3
|
import './../assets/src/sprinkles/sprinkles.css.ts.vanilla-NXW-pecy.css';
|
|
4
4
|
import { createMapValueFn } from '@vanilla-extract/sprinkles/createUtils';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
|
|
3
3
|
var axiom = 'optiaxiom';
|
|
4
|
+
var base = 'optiaxiom.base';
|
|
4
5
|
var components = 'optiaxiom._1kfj4ga1';
|
|
5
6
|
var reset = 'optiaxiom._1kfj4ga0';
|
|
6
7
|
|
|
7
|
-
export { axiom, components, reset };
|
|
8
|
+
export { axiom, base, components, reset };
|
package/dist/text/Text-css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './../assets/src/styles/layers.css.ts.vanilla-
|
|
1
|
+
import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
|
|
2
2
|
import './../assets/src/text/Text.css.ts.vanilla-BtaUGYv3.css';
|
|
3
3
|
|
|
4
4
|
var lineClamp = {'1':'_13y7bdy2 _13y7bdy1 _13y7bdy0','2':'_13y7bdy3 _13y7bdy1 _13y7bdy0','3':'_13y7bdy4 _13y7bdy1 _13y7bdy0','4':'_13y7bdy5 _13y7bdy1 _13y7bdy0'};
|
package/dist/tooltip/Tooltip.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { usePresence } from 'framer-motion';
|
|
5
4
|
import { forwardRef, useState, useEffect } from 'react';
|
|
5
|
+
import '../animate-presence/PresenceContext.js';
|
|
6
|
+
import { usePresence } from '../animate-presence/usePresence.js';
|
|
6
7
|
import { base, transitions } from './Transition-css.js';
|
|
7
8
|
|
|
8
9
|
const transitionDuration = {
|
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.5",
|
|
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,16 @@
|
|
|
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",
|
|
30
|
+
"@reach/auto-id": "^0.18.0",
|
|
29
31
|
"@vanilla-extract/recipes": "^0.5.3",
|
|
30
32
|
"@vanilla-extract/sprinkles": "^1.6.2",
|
|
31
33
|
"clsx": "^2.1.1",
|
|
32
|
-
"framer-motion": "^6.0.0",
|
|
33
34
|
"inter-ui": "^4.0.2"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
@@ -43,7 +44,6 @@
|
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "rm -rf dist && NODE_ENV=production rollup -c",
|
|
46
|
-
"bundle-size": "oas-bundle-size",
|
|
47
47
|
"dev": "rm -rf dist && rollup -cw",
|
|
48
48
|
"lint": "oas-lint",
|
|
49
49
|
"test": "vitest"
|