@cronocode/react-box 0.3.4 → 0.3.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.
@@ -1,9 +1,13 @@
1
1
  import Box from '../box';
2
2
  declare type BoxProps = React.ComponentProps<typeof Box>;
3
- interface Props extends BoxProps {
3
+ declare type BoxTagProps = Required<BoxProps>['props'];
4
+ declare type ButtonTagProps = Omit<BoxTagProps, 'type' | 'onClick' | 'disabled'>;
5
+ declare type ButtonType = Required<React.ComponentProps<'button'>>['type'];
6
+ interface Props extends Omit<BoxProps, 'props'> {
7
+ props?: ButtonTagProps;
8
+ type?: ButtonType;
4
9
  onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
5
- type?: React.ComponentProps<'button'>['type'];
6
10
  disabled?: boolean;
7
11
  }
8
- export default function Button(props: Props): JSX.Element;
12
+ export default function ButtonCore(props: Props): JSX.Element;
9
13
  export {};
@@ -1,27 +1,27 @@
1
- import i from "../box.js";
1
+ import s from "../box.js";
2
2
  import { jsx as u } from "react/jsx-runtime";
3
3
  import "react";
4
+ import "../box.module.css.js";
4
5
  import "../utils/utils.js";
5
6
  function l(t) {
6
7
  const {
7
- props: o,
8
- onClick: r,
9
- type: n,
10
- disabled: p
11
- } = t, e = {
12
- onClick: r,
13
- type: n || "button",
8
+ tag: o,
9
+ type: r,
10
+ onClick: n,
14
11
  disabled: p,
15
- ...o
16
- }, s = {
17
- ...t,
18
12
  props: e
13
+ } = t, i = {
14
+ ...e,
15
+ type: r || "button",
16
+ onClick: n,
17
+ disabled: p
19
18
  };
20
- return /* @__PURE__ */ u(i, {
21
- tag: "button",
19
+ return /* @__PURE__ */ u(s, {
20
+ tag: o || "button",
22
21
  cursor: "pointer",
23
22
  inline: !0,
24
- ...s
23
+ ...t,
24
+ props: i
25
25
  });
26
26
  }
27
27
  export {
@@ -1,32 +1,17 @@
1
- import m from "../box.js";
2
- import { jsx as s } from "react/jsx-runtime";
1
+ import t from "../box.js";
2
+ import { jsx as r } from "react/jsx-runtime";
3
3
  import "react";
4
+ import "../box.module.css.js";
4
5
  import "../utils/utils.js";
5
- function u(i) {
6
+ function x(i) {
6
7
  const {
7
- wrap: n,
8
- jc: e,
9
- ai: t,
10
- ac: r,
11
- d: l,
12
- grow: o,
13
- shrink: a,
14
- as: f,
15
- inline: x
8
+ inline: o
16
9
  } = i;
17
- return /* @__PURE__ */ s(m, {
18
- display: x ? "inline-flex" : "flex",
19
- flexWrap: n,
20
- justifyContent: e,
21
- alignItems: t,
22
- alignContent: r,
23
- direction: l,
24
- flexGrow: o,
25
- flexShrink: a,
26
- alignSelf: f,
10
+ return /* @__PURE__ */ r(t, {
11
+ display: o ? "inline-flex" : "flex",
27
12
  ...i
28
13
  });
29
14
  }
30
15
  export {
31
- u as default
16
+ x as default
32
17
  };
@@ -1,10 +1,13 @@
1
1
  import Box from '../box';
2
2
  declare type BoxProps = React.ComponentProps<typeof Box>;
3
- declare type UncontrolledTextboxCoreTypeAttribute = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
4
- interface Props extends BoxProps {
3
+ declare type BoxTagProps = Required<BoxProps>['props'];
4
+ declare type UncontrolledTextboxCoreTagProps = Omit<BoxTagProps, 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue'>;
5
+ declare type UncontrolledTextboxCoreType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
6
+ interface Props extends Omit<BoxProps, 'props'> {
7
+ props?: UncontrolledTextboxCoreTagProps;
5
8
  onInput?: (e: React.FormEvent<HTMLInputElement>) => void;
6
9
  onChange?: (e: React.FormEvent<HTMLInputElement>) => void;
7
- type?: UncontrolledTextboxCoreTypeAttribute;
10
+ type?: UncontrolledTextboxCoreType;
8
11
  placeholder?: string;
9
12
  disabled?: boolean;
10
13
  defaultValue?: string | number;
@@ -1,32 +1,31 @@
1
- import u from "../box.js";
2
- import { jsx as c } from "react/jsx-runtime";
1
+ import s from "../box.js";
2
+ import { jsx as u } from "react/jsx-runtime";
3
3
  import "react";
4
+ import "../box.module.css.js";
4
5
  import "../utils/utils.js";
5
- function g(o) {
6
+ function g(t) {
6
7
  const {
7
- props: t,
8
+ props: o,
8
9
  type: e,
9
- disabled: n,
10
- placeholder: r,
10
+ disabled: r,
11
+ placeholder: n,
11
12
  defaultValue: p,
12
13
  onInput: a,
13
- onChange: s
14
- } = o, i = {
14
+ onChange: i
15
+ } = t, l = {
16
+ ...o,
15
17
  type: e || "text",
16
- disabled: n,
17
- placeholder: r,
18
+ disabled: r,
19
+ placeholder: n,
18
20
  onInput: a,
19
- onChange: s,
20
- defaultValue: p,
21
- ...t
22
- }, l = {
23
- ...o,
24
- props: i
21
+ onChange: i,
22
+ defaultValue: p
25
23
  };
26
- return /* @__PURE__ */ c(u, {
24
+ return /* @__PURE__ */ u(s, {
27
25
  tag: "input",
28
26
  inline: !0,
29
- ...l
27
+ ...t,
28
+ props: l
30
29
  });
31
30
  }
32
31
  export {
@@ -1,12 +1,22 @@
1
1
  declare const variables: {
2
- sizes: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100];
2
+ sizes: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100];
3
3
  sizeMultiplier: number;
4
- colors: readonly ["primary", "primaryLight", "primaryDark", "secondary", "secondaryLight", "secondaryDark", "tertiary", "tertiaryLight", "tertiaryDark", "blue", "blueLight", "blueDark", "red", "redLight", "redDark", "purple", "purpleLight", "purpleDark", "yellow", "yellowLight", "yellowDark", "pink", "pinkLight", "pinkDark", "green", "greenLight", "greenDark", "orange", "orangeLight", "orangeDark", "navy", "navyLight", "navyDark", "teal", "tealLight", "tealDark", "violet", "violetLight", "violetDark", "black", "white", "gray", "grayLight", "grayDark", "brown", "brownLight", "brownDark", "orange", "orangeLight", "orangeDark"];
4
+ colors: readonly ["black", "white", "transparent", "primary", "primaryLight", "primaryDark", "secondary", "secondaryLight", "secondaryDark", "tertiary", "tertiaryLight", "tertiaryDark", "blue", "blueLight", "blueDark", "red", "redLight", "redDark", "purple", "purpleLight", "purpleDark", "yellow", "yellowLight", "yellowDark", "pink", "pinkLight", "pinkDark", "green", "greenLight", "greenDark", "orange", "orangeLight", "orangeDark", "navy", "navyLight", "navyDark", "teal", "tealLight", "tealDark", "violet", "violetLight", "violetDark", "gray", "grayLight", "grayDark", "brown", "brownLight", "brownDark", "orange", "orangeLight", "orangeDark"];
5
+ fontColors: readonly ["color1", "color2", "color3", "color4", "color5", "color6", "color7", "color8", "color9", "color10"];
6
+ bgColors: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
7
+ borderColors: readonly [1, 2, 3, 4, 5];
8
+ backgrounds: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
9
+ shadows: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
5
10
  cursors: readonly ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "e-resize", "n-resize", "ne-resize", "nw-resize", "s-resize", "se-resize", "sw-resize", "w-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "col-resize", "row-resize", "all-scroll", "zoom-in", "zoom-out", "grab", "grabbing"];
6
11
  fontSizes: readonly [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 54, 58, 64, 70, 78, 86, 96];
7
12
  };
8
13
  export declare type SizeType = typeof variables.sizes[number];
9
14
  export declare type ColorType = typeof variables.colors[number];
15
+ export declare type BaseFontColorType = typeof variables.fontColors[number];
16
+ export declare type BaseBgColorType = typeof variables.bgColors[number];
17
+ export declare type BaseBorderColorType = typeof variables.bgColors[number];
18
+ export declare type BackgroundType = typeof variables.backgrounds[number];
19
+ export declare type ShadowType = typeof variables.shadows[number];
10
20
  export declare type CursorType = typeof variables.cursors[number];
11
21
  export declare type FontSizeType = typeof variables.fontSizes[number];
12
22
  export default variables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "main": "./box.js",
5
5
  "module": "./box.js",
6
6
  "types": "./box.d.ts",
@@ -43,6 +43,7 @@
43
43
  "@cronocode/identity-factory": "^0.0.6",
44
44
  "@types/node": "^18.7.14",
45
45
  "@types/react": "^18.0.18",
46
+ "@types/react-dom": "^18.0.6",
46
47
  "@vitejs/plugin-react": "^2.0.1",
47
48
  "autoprefixer": "^10.4.8",
48
49
  "postcss": "^8.4.16",