@optiaxiom/react 0.1.0-next.3 → 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.
@@ -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,11 @@
1
+ import { createContext } from 'react';
2
+
3
+ const PresenceContext = createContext({
4
+ isPresent: true,
5
+ onExitComplete: (_id) => {
6
+ },
7
+ register: (_id) => {
8
+ }
9
+ });
10
+
11
+ export { PresenceContext };
@@ -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 };
@@ -3,9 +3,8 @@
3
3
  ._1jn0ep0 {
4
4
  border: 0 solid var(--ax-colors-border-default);
5
5
  box-sizing: border-box;
6
- font: inherit;
6
+ font-family: var(--ax-fontFamily-sans);
7
7
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
8
- font-size: 100%;
9
8
  margin: 0;
10
9
  padding: 0;
11
10
  }
@@ -14,6 +13,10 @@
14
13
  color: inherit;
15
14
  height: 0;
16
15
  }
16
+ ._1jn0ep0:is(h1, h2, h3, h4, h5, h6) {
17
+ font-size: inherit;
18
+ font-weight: inherit;
19
+ }
17
20
  ._1jn0ep0:is(b, strong) {
18
21
  font-weight: bolder;
19
22
  }
@@ -24,6 +27,7 @@
24
27
  }
25
28
  ._1jn0ep0:is(button, input, optgroup, select, textarea) {
26
29
  color: inherit;
30
+ font-size: 100%;
27
31
  letter-spacing: inherit;
28
32
  }
29
33
  ._1jn0ep0:is(button, input:where([type=button], [type=reset], [type=submit])) {
@@ -9,7 +9,6 @@
9
9
  color: var(--ax-colors-fg-default);
10
10
  display: flex;
11
11
  flex-direction: row;
12
- font-family: var(--ax-fontFamily-sans);
13
12
  }
14
13
  ._5j10wf0:focus-within:is([data-invalid="true"]) {
15
14
  outline-color: var(--ax-colors-red-200);
@@ -29,7 +28,6 @@
29
28
  ._5j10wf0[data-disabled="true"] {
30
29
  background-color: var(--ax-colors-bg-disabled);
31
30
  border-color: var(--ax-colors-border-secondary);
32
- cursor: not-allowed;
33
31
  pointer-events: none;
34
32
  }
35
33
  ._5j10wf0[data-invalid="true"] {
@@ -55,7 +53,6 @@
55
53
  }
56
54
  ._5j10wf6 {
57
55
  background: var(--ax-colors-transparent);
58
- font-family: var(--ax-fontFamily-sans);
59
56
  width: 100%;
60
57
  }
61
58
  ._5j10wf6:focus-visible {
@@ -0,0 +1,4 @@
1
+ @layer optiaxiom;
2
+ @layer optiaxiom.base;
3
+ @layer optiaxiom._1kfj4ga0;
4
+ @layer optiaxiom._1kfj4ga1;
@@ -1,10 +1,10 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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';
5
5
  import { createRuntimeFn } from '@vanilla-extract/recipes/createRuntimeFn';
6
6
 
7
7
  var avatar = createRuntimeFn({compoundVariants:[],defaultClassName:'t64xwph',defaultVariants:{},variantClassNames:{colorScheme:{blue:'yukyx7a yukyx797',brand:'yukyx7f yukyx79f',dark:'yukyx7p yukyx79m',gray:'yukyx7t yukyx79t',green:'yukyx713 yukyx7a3',magenta:'yukyx71d yukyx7aa',neutral:'yukyx71h yukyx7ah',orange:'yukyx71t yukyx7aq',purple:'yukyx71x yukyx7au',red:'yukyx722 yukyx7b2',slate:'yukyx72c yukyx7bc',yellow:'yukyx72n yukyx7bn'},size:{xs:'yukyx7oo yukyx71m8 yukyx7h4',sm:'yukyx7os yukyx71mc yukyx7h8',md:'yukyx7ow yukyx71mg yukyx7hc',lg:'yukyx7p0 yukyx71mk yukyx7hg',xl:'yukyx7p4 yukyx71mo yukyx7hk'}}});
8
- var fallback = createRuntimeFn({compoundVariants:[],defaultClassName:'t64xwp15 yukyx78l yukyx7q4 yukyx71no yukyx7ec yukyx7f0 yukyx7d4 yukyx7qg yukyx7dy',defaultVariants:{},variantClassNames:{size:{xs:'yukyx71co yukyx71es',sm:'yukyx71cs yukyx71ew',md:'yukyx71cw yukyx71f0',lg:'yukyx71d0 yukyx71f4',xl:'yukyx71dc yukyx71fg'}}});
8
+ var fallback = createRuntimeFn({compoundVariants:[],defaultClassName:'t64xwp15 yukyx78l yukyx7q4 yukyx71no yukyx7ec yukyx7f0 yukyx7qg yukyx7dy',defaultVariants:{},variantClassNames:{size:{xs:'yukyx71co yukyx71es',sm:'yukyx71cs yukyx71ew',md:'yukyx71cw yukyx71f0',lg:'yukyx71d0 yukyx71f4',xl:'yukyx71dc yukyx71fg'}}});
9
9
 
10
10
  export { avatar, fallback };
@@ -1,6 +1,6 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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/box/Box.css.ts.vanilla-CfxlZUmV.css';
3
+ import './../assets/src/box/Box.css.ts.vanilla-DMx7YI4c.css';
4
4
 
5
5
  var base = '_1jn0ep0';
6
6
 
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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';
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
1
+ import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
2
  import './../assets/src/code/Code.css.ts.vanilla-Dz07Qp9h.css';
3
3
 
4
4
  var base = 'go7emt0';
@@ -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 };
@@ -23,18 +23,7 @@ const Heading = forwardRef(
23
23
  ({ asChild, children, level = "1", variant, ...props }, ref) => {
24
24
  const Comp = asChild ? Slot : mapLevelToTag[level];
25
25
  const fontSize = mapTagToFontSize[variant ?? mapLevelToTag[level]];
26
- return /* @__PURE__ */ jsx(
27
- Text,
28
- {
29
- asChild: true,
30
- fontFamily: "sans",
31
- fontSize,
32
- fontWeight: "700",
33
- ref,
34
- ...props,
35
- children: /* @__PURE__ */ jsx(Comp, { children })
36
- }
37
- );
26
+ return /* @__PURE__ */ jsx(Text, { asChild: true, fontSize, fontWeight: "700", ref, ...props, children: /* @__PURE__ */ jsx(Comp, { children }) });
38
27
  }
39
28
  );
40
29
  Heading.displayName = "@optiaxiom/react/Heading";
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';
@@ -1,6 +1,6 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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-BfvNp8CZ.css';
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'}}});
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
1
+ import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
2
  import './../assets/src/kbd/Kbd.css.ts.vanilla-DB-l95Nr.css';
3
3
 
4
4
  var base = 'q5e32p0';
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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-D6EvK_O8.css';
1
+ import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
2
  import './../assets/src/skeleton/Skeleton.css.ts.vanilla-Cl5oEbvn.css';
3
3
 
4
4
  var base = '_15dwmwy0';
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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-D6EvK_O8.css';
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 };
@@ -1,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
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/text/Text.js CHANGED
@@ -17,7 +17,6 @@ const Text = forwardRef(
17
17
  truncate$1 && truncate,
18
18
  className
19
19
  ),
20
- fontFamily: "sans",
21
20
  fontSize: "md",
22
21
  ref,
23
22
  ...props,
@@ -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,4 +1,4 @@
1
- import './../assets/src/styles/layers.css.ts.vanilla-D6EvK_O8.css';
1
+ import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
2
  import './../assets/src/transition/Transition.css.ts.vanilla-qjeQECVe.css';
3
3
 
4
4
  var base = '_1p67mhc0';
@@ -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.3",
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
- "module": "dist/index.js",
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"
@@ -1,3 +0,0 @@
1
- @layer optiaxiom;
2
- @layer optiaxiom._1kfj4ga0;
3
- @layer optiaxiom._1kfj4ga1;