@blockle/blocks-react 2.5.0 → 2.5.1

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.
@@ -1,8 +1,12 @@
1
- import { Atoms } from '@blockle/blocks-core';
1
+ import { Atoms, ComponentThemes, vars } from '@blockle/blocks-core';
2
2
  export type DividerProps = {
3
+ alignment?: 'start' | 'center' | 'end';
3
4
  className?: string;
4
- color?: Atoms['backgroundColor'];
5
+ color?: keyof typeof vars.color;
6
+ children?: React.ReactNode;
7
+ size?: ComponentThemes['divider']['variants']['size'];
5
8
  style?: React.CSSProperties;
9
+ gap?: Atoms['gap'];
6
10
  };
7
11
  export declare const Divider: React.FC<DividerProps>;
8
12
  //# sourceMappingURL=Divider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../src/components/display/Divider/Divider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,sBAAsB,CAAC;AAO9D,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAiB1C,CAAC"}
1
+ {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../src/components/display/Divider/Divider.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,eAAe,EAEpB,IAAI,EACL,MAAM,sBAAsB,CAAC;AAa9B,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,OAAO,IAAI,CAAC,KAAK,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8B1C,CAAC"}
@@ -1,25 +1,40 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { classnames } from "@blockle/blocks-core";
4
- import { useComponentStyleDefaultProps } from "../../../hooks/useComponentStyles/useComponentStyleDefaultProps.js";
3
+ import { vars, classnames } from "@blockle/blocks-core";
5
4
  import { useComponentStyles } from "../../../hooks/useComponentStyles/useComponentStyles.js";
6
5
  import { Box } from "../../layout/Box/Box.js";
7
- import { divider } from "./divider.css.js";
6
+ import { divider, dividerColorVar } from "./divider.css.js";
7
+ function getVanillaVarName(variable) {
8
+ return (variable ?? "").replace(/var\((.+)\)/, "$1");
9
+ }
10
+ const dividerColorVarName = getVanillaVarName(dividerColorVar);
8
11
  const Divider = ({
12
+ alignment = "center",
9
13
  className,
10
14
  color,
15
+ children,
16
+ size,
17
+ gap = 2,
11
18
  ...restProps
12
19
  }) => {
13
- const dividerClass = useComponentStyles("divider", { root: true });
14
- const dividerDefaults = useComponentStyleDefaultProps("divider");
20
+ const dividerClass = useComponentStyles("divider", {
21
+ root: true,
22
+ variants: { size }
23
+ });
15
24
  return /* @__PURE__ */ jsx(
16
25
  Box,
17
26
  {
18
27
  role: "separator",
28
+ "aria-orientation": "horizontal",
19
29
  inlineSize: "full",
20
- backgroundColor: color ?? dividerDefaults.color,
30
+ gap,
21
31
  className: classnames(className, dividerClass, divider),
22
- ...restProps
32
+ "data-alignment": alignment,
33
+ style: {
34
+ [dividerColorVarName]: color ? vars.color[color] : "currentColor"
35
+ },
36
+ ...restProps,
37
+ children
23
38
  }
24
39
  );
25
40
  };
@@ -1,2 +1,3 @@
1
+ export declare const dividerColorVar: `var(--${string})`;
1
2
  export declare const divider: string;
2
3
  //# sourceMappingURL=divider.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"divider.css.d.ts","sourceRoot":"","sources":["../../../../src/components/display/Divider/divider.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,QAOlB,CAAC"}
1
+ {"version":3,"file":"divider.css.d.ts","sourceRoot":"","sources":["../../../../src/components/display/Divider/divider.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,oBAAc,CAAC;AAE3C,eAAO,MAAM,OAAO,QAiClB,CAAC"}
@@ -1,16 +1,44 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { layers } from "@blockle/blocks-core";
3
- import { style } from "@vanilla-extract/css";
3
+ import { style, createVar } from "@vanilla-extract/css";
4
4
  setFileScope("src/components/display/Divider/divider.css.ts", "@blockle/blocks-react");
5
+ const dividerColorVar = createVar();
5
6
  const divider = style({
6
7
  "@layer": {
7
8
  [layers.molecule]: {
9
+ display: "flex",
10
+ alignItems: "center",
11
+ justifyContent: "center",
8
12
  clear: "both",
9
- blockSize: "1px"
13
+ minBlockSize: "1px",
14
+ ":empty": {
15
+ gap: 0
16
+ },
17
+ ":before": {
18
+ flex: 1,
19
+ content: '""',
20
+ display: "block",
21
+ backgroundColor: dividerColorVar
22
+ },
23
+ ":after": {
24
+ flex: 1,
25
+ content: '""',
26
+ display: "block",
27
+ backgroundColor: dividerColorVar
28
+ },
29
+ selectors: {
30
+ '&[data-alignment="start"]:before': {
31
+ maxInlineSize: "3rem"
32
+ },
33
+ '&[data-alignment="end"]:after': {
34
+ maxInlineSize: "3rem"
35
+ }
36
+ }
10
37
  }
11
38
  }
12
39
  });
13
40
  endFileScope();
14
41
  export {
15
- divider
42
+ divider,
43
+ dividerColorVar
16
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockle/blocks-react",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "React hooks and components for Blockle",
5
5
  "type": "module",
6
6
  "exports": {