frame.theme 0.0.2 → 0.0.3

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,6 +1,7 @@
1
1
  export declare function NumberInput(props: {
2
2
  value: string;
3
3
  onChange: (value: string) => void;
4
+ checkValue: (value: string, setError: (error: string) => void) => void;
4
5
  label: string;
5
6
  defaultValue?: string;
6
7
  sh?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../src/NumberInput.tsx"],"names":[],"mappings":"AASA,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAmGA"}
1
+ {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../src/NumberInput.tsx"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,+BAyGA"}
@@ -1,63 +1,59 @@
1
- import { TextField as e } from "@mui/material";
2
- import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
- import { jsx as a } from "react/jsx-runtime";
1
+ import { TextField as e, useTheme as t } from "@mui/material";
2
+ import { useEffect as n, useRef as r, useState as i } from "react";
3
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
4
  //#region src/NumberInput.tsx
5
- function o(o) {
6
- let [s, c] = i(""), l = r(null), u = t((e) => {
7
- let t = parseFloat(e);
8
- t < 0 ? c(o.errorMessage?.negative || "Number must be\npositive") : t === 0 ? c(o.errorMessage?.notNull || "Number must not be zero") : o.sh !== void 0 && t > o.sh ? c(o.errorMessage?.largerThanSH || "must not be greater than\nthe Box height") : c(t > 40 ? o.errorMessage?.tooLarge || "Number must not be\ngreater than 40" : "");
9
- }, [o.errorMessage, o.sh]);
5
+ function s(s) {
6
+ let c = "NumberInput", l = t(), [u, d] = i(""), f = r(null);
10
7
  return n(() => {
11
- u(o.value);
12
- }, [
13
- o.value,
14
- o.errorMessage,
15
- o.sh,
16
- u
17
- ]), n(() => {
18
- let e = l.current;
8
+ let e = f.current;
19
9
  if (!e) return;
20
10
  let t = (e) => {
21
11
  let t = e.target;
22
- if (t && t.value !== o.value) {
12
+ if (t && t.value !== s.value) {
23
13
  let e = t.value;
24
- u(e), o.onChange(e);
14
+ s.checkValue(e, d), s.onChange(e);
25
15
  }
26
16
  };
27
17
  return e.addEventListener("input", t), e.addEventListener("change", t), () => {
28
18
  e.removeEventListener("input", t), e.removeEventListener("change", t);
29
19
  };
30
20
  }, [
31
- o.value,
32
- o.onChange,
33
- o.errorMessage,
34
- o.sh,
35
- o,
36
- u
37
- ]), /* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(e, {
38
- "data-testid": `NumberInput.Textfield.${o.dataTestid}`,
21
+ s.value,
22
+ s.onChange,
23
+ s.errorMessage,
24
+ s.sh,
25
+ s
26
+ ]), console.log(`error: ${u}`), /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a(e, {
27
+ "data-testid": `${c}.Textfield.${s.dataTestid}`,
39
28
  focused: !0,
40
29
  color: "secondary",
41
- label: o.label,
30
+ label: s.label,
42
31
  variant: "filled",
43
- value: o.value,
32
+ value: s.value,
33
+ sx: { width: "150px" },
44
34
  slotProps: {
45
- input: {
46
- "data-testid": `Centration.${o.dataTestid}`,
47
- style: { color: "white" },
48
- ref: l,
49
- readOnly: o.readonly ?? !1
50
- },
35
+ input: { style: {
36
+ color: "white",
37
+ backgroundColor: l.palette.primary.main
38
+ } },
51
39
  formHelperText: { sx: { whiteSpace: "pre-line" } }
52
40
  },
53
41
  type: "number",
54
42
  onChange: (e) => {
55
43
  let t = e.target.value;
56
- u(t), o.onChange(t);
44
+ s.checkValue(t, d), s.onChange(t);
57
45
  },
58
- error: !!s,
59
- helperText: s
60
- }) });
46
+ error: !!u,
47
+ helperText: u
48
+ }), /* @__PURE__ */ a(e, {
49
+ "data-testid": `${c}.Textfield.${s.dataTestid}.filled.success`,
50
+ focused: !0,
51
+ color: "success",
52
+ label: "Filled success",
53
+ variant: "filled",
54
+ value: s.value,
55
+ type: "number"
56
+ })] });
61
57
  }
62
58
  //#endregion
63
- export { o as NumberInput };
59
+ export { s as NumberInput };
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "frame.theme",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A sample theme for the Frame project",
5
5
  "type": "module",
6
6
  "author": "Christian Todd <Christian.Todd@rodenstock.com>",
7
7
  "license": "UNLICENSED",
8
+ "main": "./dist/index.js",
8
9
  "types": "./dist/index.d.ts",
9
10
  "files": [
10
11
  "dist"
@@ -25,22 +26,21 @@
25
26
  "@emotion/react": "^11.14.0",
26
27
  "@emotion/styled": "^11.14.1",
27
28
  "@mui/material": "^9.3.1",
28
- "frame.theme": "^0.0.1",
29
29
  "react": "^19.2.8",
30
30
  "react-dom": "^19.2.8"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@eslint/js": "^10.0.1",
34
- "@types/node": "^24.13.3",
34
+ "@types/node": "^26.3.0",
35
35
  "@types/react": "^19.2.17",
36
- "@types/react-dom": "^19.2.3",
36
+ "@types/react-dom": "^19.2.5",
37
37
  "@vitejs/plugin-react": "^6.0.4",
38
- "eslint": "^10.8.0",
38
+ "eslint": "^10.9.1",
39
39
  "eslint-plugin-react-hooks": "^7.1.1",
40
40
  "eslint-plugin-react-refresh": "^0.5.3",
41
41
  "globals": "^17.7.0",
42
42
  "typescript": "~6.0.2",
43
- "typescript-eslint": "^8.65.0",
43
+ "typescript-eslint": "^8.68.0",
44
44
  "vite": "^8.2.0",
45
45
  "vite-plugin-dts": "^5.0.3"
46
46
  }