@cronocode/react-box 0.3.8 → 0.3.9

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,6 @@
1
+ interface Props<T> {
2
+ children: React.ReactNode;
3
+ onSubmit: (obj: T, e: React.FormEvent<HTMLFormElement>) => void;
4
+ }
5
+ export default function FormAsync<T>(props: Props<T>): JSX.Element;
6
+ export {};
@@ -0,0 +1,26 @@
1
+ import { useRef as i, useCallback as a } from "react";
2
+ import c from "../box.js";
3
+ import { jsx as u } from "react/jsx-runtime";
4
+ import "../box.module.css.js";
5
+ import "../utils/utils.js";
6
+ function x(t) {
7
+ const {
8
+ children: n,
9
+ onSubmit: e
10
+ } = t, o = i(null), m = a((r) => {
11
+ r.preventDefault();
12
+ const f = new FormData(o.current), s = Object.fromEntries(f.entries());
13
+ e(s, r);
14
+ }, []);
15
+ return /* @__PURE__ */ u(c, {
16
+ tag: "form",
17
+ props: {
18
+ ref: o,
19
+ onSubmit: m
20
+ },
21
+ children: n
22
+ });
23
+ }
24
+ export {
25
+ x as default
26
+ };
@@ -1,9 +1,10 @@
1
1
  import Box from '../box';
2
2
  declare type BoxProps = React.ComponentProps<typeof Box>;
3
3
  declare type BoxTagProps = Required<BoxProps>['props'];
4
- declare type UncontrolledTextboxCoreTagProps = Omit<BoxTagProps, 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue'>;
4
+ declare type UncontrolledTextboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue'>;
5
5
  declare type UncontrolledTextboxCoreType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
6
6
  interface Props extends Omit<BoxProps, 'props'> {
7
+ name: string;
7
8
  props?: UncontrolledTextboxCoreTagProps;
8
9
  onInput?: (e: React.FormEvent<HTMLInputElement>) => void;
9
10
  onChange?: (e: React.FormEvent<HTMLInputElement>) => void;
@@ -3,31 +3,33 @@ import { jsx as u } from "react/jsx-runtime";
3
3
  import "react";
4
4
  import "../box.module.css.js";
5
5
  import "../utils/utils.js";
6
- function g(t) {
6
+ function b(t) {
7
7
  const {
8
8
  props: o,
9
- type: e,
10
- disabled: r,
11
- placeholder: n,
12
- defaultValue: p,
13
- onInput: a,
14
- onChange: i
15
- } = t, l = {
9
+ name: e,
10
+ type: r,
11
+ disabled: n,
12
+ placeholder: p,
13
+ defaultValue: a,
14
+ onInput: i,
15
+ onChange: l
16
+ } = t, m = {
16
17
  ...o,
17
- type: e || "text",
18
- disabled: r,
19
- placeholder: n,
20
- onInput: a,
21
- onChange: i,
22
- defaultValue: p
18
+ type: r || "text",
19
+ name: e,
20
+ disabled: n,
21
+ placeholder: p,
22
+ onInput: i,
23
+ onChange: l,
24
+ defaultValue: a
23
25
  };
24
26
  return /* @__PURE__ */ u(s, {
25
27
  tag: "input",
26
28
  inline: !0,
27
29
  ...t,
28
- props: l
30
+ props: m
29
31
  });
30
32
  }
31
33
  export {
32
- g as default
34
+ b as default
33
35
  };
@@ -1,22 +1,26 @@
1
1
  declare const variables: {
2
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 ["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"];
4
+ colors: readonly ["none", "transparent", "black", "white", "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
5
  fontColors: readonly ["color1", "color2", "color3", "color4", "color5", "color6", "color7", "color8", "color9", "color10"];
6
6
  bgColors: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
7
7
  borderColors: readonly [1, 2, 3, 4, 5];
8
+ outlineColors: readonly [1, 2, 3, 4, 5];
8
9
  backgrounds: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
9
10
  shadows: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
10
11
  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"];
11
12
  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];
13
+ borderAndOutlineStyles: readonly ["solid", "dashed", "dotted", "double", "groove", "ridge", "inset", "outset", "none", "hidden"];
12
14
  };
13
15
  export declare type SizeType = typeof variables.sizes[number];
14
16
  export declare type ColorType = typeof variables.colors[number];
15
17
  export declare type BaseFontColorType = typeof variables.fontColors[number];
16
18
  export declare type BaseBgColorType = typeof variables.bgColors[number];
17
- export declare type BaseBorderColorType = typeof variables.bgColors[number];
19
+ export declare type BaseBorderColorType = typeof variables.borderColors[number];
20
+ export declare type BaseOutlineColorType = typeof variables.outlineColors[number];
18
21
  export declare type BackgroundType = typeof variables.backgrounds[number];
19
22
  export declare type ShadowType = typeof variables.shadows[number];
20
23
  export declare type CursorType = typeof variables.cursors[number];
21
24
  export declare type FontSizeType = typeof variables.fontSizes[number];
25
+ export declare type BorderAndOutlineStyleType = typeof variables.borderAndOutlineStyles[number];
22
26
  export default variables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "main": "./box.js",
5
5
  "module": "./box.js",
6
6
  "types": "./box.d.ts",