@optiaxiom/react 0.1.0-next.5 → 0.1.0-next.7

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.
Files changed (44) hide show
  1. package/dist/assets/src/avatar/Avatar.css.ts.vanilla-CihLlW6Z.css +6 -0
  2. package/dist/assets/src/button/{Button.css.ts.vanilla-VaFYcYGO.css → Button.css.ts.vanilla-DJjt3whH.css} +40 -37
  3. package/dist/assets/src/button-group/ButtonGroup.css.ts.vanilla-4BGjgIuZ.css +4 -0
  4. package/dist/assets/src/input/Input.css.ts.vanilla-X0R-SsOp.css +32 -0
  5. package/dist/assets/src/separator/{Separator.css.ts.vanilla-DYzKo87M.css → Separator.css.ts.vanilla-C_EYtori.css} +8 -14
  6. package/dist/assets/src/sprinkles/{sprinkles.css.ts.vanilla-NXW-pecy.css → sprinkles.css.ts.vanilla-Cj5eURGG.css} +2308 -1652
  7. package/dist/assets/src/styles/{theme.css.ts.vanilla-Cb0QJvUK.css → theme.css.ts.vanilla-BftJbjRk.css} +28 -2
  8. package/dist/assets/src/text/{Text.css.ts.vanilla-BtaUGYv3.css → Text.css.ts.vanilla-DK_dMlGe.css} +0 -4
  9. package/dist/assets/src/transition/{Transition.css.ts.vanilla-qjeQECVe.css → Transition.css.ts.vanilla-COX8x_Bo.css} +18 -9
  10. package/dist/avatar/Avatar-css.js +4 -6
  11. package/dist/avatar/Avatar.js +2 -3
  12. package/dist/box/Box-css.js +4 -3
  13. package/dist/box/Box.js +2 -2
  14. package/dist/button/Button-css.js +7 -5
  15. package/dist/button/Button.js +41 -28
  16. package/dist/button-group/ButtonGroup-css.js +7 -0
  17. package/dist/button-group/ButtonGroup.js +24 -0
  18. package/dist/code/Code-css.js +3 -2
  19. package/dist/code/Code.js +2 -3
  20. package/dist/index.d.ts +326 -375
  21. package/dist/index.js +4 -0
  22. package/dist/input/Input-css.js +5 -5
  23. package/dist/input/Input.js +2 -3
  24. package/dist/kbd/Kbd-css.js +4 -3
  25. package/dist/kbd/Kbd.js +3 -4
  26. package/dist/progress/Progress.js +18 -16
  27. package/dist/separator/Separator-css.js +4 -4
  28. package/dist/separator/Separator.js +1 -5
  29. package/dist/skeleton/Skeleton-css.js +3 -2
  30. package/dist/skeleton/Skeleton.js +2 -3
  31. package/dist/sprinkles/sprinkles-css.js +3 -3
  32. package/dist/styles/theme-css.js +2 -2
  33. package/dist/text/Text-css.js +4 -4
  34. package/dist/text/Text.js +3 -8
  35. package/dist/tokens/borderRadius.js +1 -1
  36. package/dist/tokens/spacing.js +6 -0
  37. package/dist/tokens/zIndex.js +2 -1
  38. package/dist/tooltip/Tooltip.js +16 -5
  39. package/dist/transition/Transition-css.js +5 -4
  40. package/dist/transition/Transition.js +9 -19
  41. package/dist/vanilla-extract/recipeRuntime.js +51 -0
  42. package/package.json +1 -2
  43. package/dist/assets/src/avatar/Avatar.css.ts.vanilla-DdarHYxU.css +0 -11
  44. package/dist/assets/src/input/Input.css.ts.vanilla-CucST5E4.css +0 -67
@@ -1,7 +1,7 @@
1
1
  import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
- import './../assets/src/text/Text.css.ts.vanilla-BtaUGYv3.css';
2
+ import './../assets/src/text/Text.css.ts.vanilla-DK_dMlGe.css';
3
+ import { recipeRuntime } from '../vanilla-extract/recipeRuntime.js';
3
4
 
4
- var lineClamp = {'1':'_13y7bdy2 _13y7bdy1 _13y7bdy0','2':'_13y7bdy3 _13y7bdy1 _13y7bdy0','3':'_13y7bdy4 _13y7bdy1 _13y7bdy0','4':'_13y7bdy5 _13y7bdy1 _13y7bdy0'};
5
- var truncate = '_13y7bdy6 _13y7bdy0';
5
+ var text = recipeRuntime((function(){var x={variants:{lineClamp:{'1':[{overflow:'hidden'},'_13y7bdy0','_13y7bdy1','_13y7bdy2'],'2':[undefined,'_13y7bdy0','_13y7bdy1','_13y7bdy3'],'3':[undefined,'_13y7bdy0','_13y7bdy1','_13y7bdy4'],'4':[undefined,'_13y7bdy0','_13y7bdy1','_13y7bdy5']},truncate:{true:[undefined,'_13y7bdy0',{whiteSpace:'nowrap'}]}}};x.variants.lineClamp['2'][0]=x.variants.lineClamp['1'][0];x.variants.lineClamp['3'][0]=x.variants.lineClamp['1'][0];x.variants.lineClamp['4'][0]=x.variants.lineClamp['1'][0];x.variants.truncate.true[0]=x.variants.lineClamp['1'][0];return x;}()));
6
6
 
7
- export { lineClamp, truncate };
7
+ export { text };
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 { lineClamp, truncate } from './Text-css.js';
5
+ import { text } from './Text-css.js';
7
6
 
8
7
  const Text = forwardRef(
9
- ({ as = "p", asChild, children, className, lineClamp: lineClamp$1, truncate: truncate$1, ...props }, ref) => {
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
  }
@@ -6,7 +6,7 @@ const borderRadius = {
6
6
  md: rem("6px"),
7
7
  lg: rem("8px"),
8
8
  xl: rem("12px"),
9
- full: "100%",
9
+ full: "9999px",
10
10
  none: "0"
11
11
  };
12
12
 
@@ -7,11 +7,17 @@ const spacing = {
7
7
  lg: rem("24px"),
8
8
  xl: rem("32px"),
9
9
  "0": "0",
10
+ "1": rem("1px"),
10
11
  "2": rem("2px"),
12
+ "3": rem("3px"),
11
13
  "4": rem("4px"),
14
+ "5": rem("5px"),
12
15
  "6": rem("6px"),
16
+ "7": rem("7px"),
13
17
  "8": rem("8px"),
18
+ "9": rem("9px"),
14
19
  "10": rem("10px"),
20
+ "11": rem("11px"),
15
21
  "12": rem("12px"),
16
22
  "16": rem("16px"),
17
23
  "20": rem("20px"),
@@ -5,7 +5,8 @@ const zIndex = {
5
5
  "30": "30",
6
6
  "40": "40",
7
7
  "50": "50",
8
- auto: "auto"
8
+ auto: "auto",
9
+ popover: "1500"
9
10
  };
10
11
 
11
12
  export { zIndex };
@@ -8,14 +8,25 @@ import { Text } from '../text/Text.js';
8
8
  import { Transition } from '../transition/Transition.js';
9
9
 
10
10
  const Tooltip = forwardRef(
11
- ({ children, content, delayDuration, withArrow, ...props }, ref) => {
11
+ ({ children, content, delayDuration, withArrow, z = "popover", ...props }, ref) => {
12
12
  const [open, setOpen] = useState(false);
13
13
  return /* @__PURE__ */ jsx(RadixTooltip.Provider, { delayDuration, children: /* @__PURE__ */ jsxs(RadixTooltip.Root, { onOpenChange: setOpen, open, children: [
14
14
  /* @__PURE__ */ jsx(RadixTooltip.Trigger, { asChild: true, ref, children }),
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(Box, { bg: "dark.600", color: "white", px: "6", py: "4", rounded: "sm", children: [
16
- /* @__PURE__ */ jsx(Text, { fontSize: "sm", children: content }),
17
- withArrow && /* @__PURE__ */ jsx(RadixTooltip.Arrow, {})
18
- ] }) }) }) }) })
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
+ ) }) }) }) })
19
30
  ] }) });
20
31
  }
21
32
  );
@@ -1,7 +1,8 @@
1
1
  import './../assets/src/styles/layers.css.ts.vanilla-D5zCXZwe.css';
2
- import './../assets/src/transition/Transition.css.ts.vanilla-qjeQECVe.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 base = '_1p67mhc0';
5
- var transitions = {fade:'_1p67mhc1','fade-down':'_1p67mhc2','fade-left':'_1p67mhc3','fade-right':'_1p67mhc4','fade-up':'_1p67mhc5',pop:'_1p67mhc6','pop-down':'_1p67mhc7','pop-left':'_1p67mhc8','pop-right':'_1p67mhc9','pop-up':'_1p67mhca'};
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 { base, transitions };
8
+ export { transition, transitionDuration };
@@ -1,18 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { Slot } from '@radix-ui/react-slot';
3
- import clsx from 'clsx';
4
2
  import { forwardRef, useState, useEffect } from 'react';
5
3
  import '../animate-presence/PresenceContext.js';
6
4
  import { usePresence } from '../animate-presence/usePresence.js';
7
- import { base, transitions } from './Transition-css.js';
5
+ import { Box } from '../box/Box.js';
6
+ import { transitionDuration, transition } from './Transition-css.js';
8
7
 
9
- const transitionDuration = {
10
- sm: 250,
11
- md: 400,
12
- lg: 550
13
- };
14
8
  const Transition = forwardRef(
15
- ({ children, className, duration = "sm", style, type = "fade", ...props }, ref) => {
9
+ ({ children, className, duration = "sm", type = "fade", ...props }, ref) => {
16
10
  const [isPresent, safeToRemove] = usePresence();
17
11
  const [enter, setEnter] = useState(false);
18
12
  useEffect(() => {
@@ -22,18 +16,14 @@ const Transition = forwardRef(
22
16
  !isPresent && setTimeout(safeToRemove, transitionDuration[duration]);
23
17
  }, [isPresent]);
24
18
  return /* @__PURE__ */ jsx(
25
- Slot,
19
+ Box,
26
20
  {
27
- className: clsx(
28
- className,
29
- base,
30
- enter !== isPresent && transitions[type]
31
- ),
21
+ asChild: true,
32
22
  ref,
33
- style: {
34
- ...style,
35
- transitionDuration: `${transitionDuration[duration]}ms`
36
- },
23
+ ...transition(
24
+ { duration, type: enter !== isPresent ? type : void 0 },
25
+ className
26
+ ),
37
27
  ...props,
38
28
  children
39
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,7 +6,7 @@
6
6
  "url": "https://github.com/optimizely-axiom/optiaxiom.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "0.1.0-next.5",
9
+ "version": "0.1.0-next.7",
10
10
  "files": [
11
11
  "dist/**",
12
12
  "LICENSE"
@@ -28,7 +28,6 @@
28
28
  "@radix-ui/react-slot": "^1.0.2",
29
29
  "@radix-ui/react-tooltip": "^1.0.7",
30
30
  "@reach/auto-id": "^0.18.0",
31
- "@vanilla-extract/recipes": "^0.5.3",
32
31
  "@vanilla-extract/sprinkles": "^1.6.2",
33
32
  "clsx": "^2.1.1",
34
33
  "inter-ui": "^4.0.2"
@@ -1,11 +0,0 @@
1
- @layer optiaxiom._1kfj4ga1;
2
- @layer optiaxiom._1kfj4ga1 {
3
- .t64xwph {
4
- align-items: center;
5
- border-radius: 100%;
6
- display: inline-flex;
7
- justify-content: center;
8
- overflow: hidden;
9
- user-select: none;
10
- }
11
- }
@@ -1,67 +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
- pointer-events: none;
32
- }
33
- ._5j10wf0[data-invalid="true"] {
34
- border-color: var(--ax-colors-border-error);
35
- }
36
- ._5j10wf1 {
37
- font-size: var(--ax-fontSize-sm-fontSize);
38
- height: 24px;
39
- line-height: var(--ax-fontSize-sm-lineHeight);
40
- padding: 8px 8px;
41
- }
42
- ._5j10wf2 {
43
- font-size: var(--ax-fontSize-md-fontSize);
44
- height: 32px;
45
- line-height: var(--ax-fontSize-md-lineHeight);
46
- padding: 8px 8px;
47
- }
48
- ._5j10wf3 {
49
- font-size: var(--ax-fontSize-lg-fontSize);
50
- height: 40px;
51
- line-height: var(--ax-fontSize-lg-lineHeight);
52
- padding: 4px 8px;
53
- }
54
- ._5j10wf6 {
55
- background: var(--ax-colors-transparent);
56
- width: 100%;
57
- }
58
- ._5j10wf6:focus-visible {
59
- outline-width: 0px;
60
- }
61
- ._5j10wf7 {
62
- text-align: start;
63
- }
64
- ._5j10wf8 {
65
- text-align: end;
66
- }
67
- }