@multiplatform.one/frappe-ui 10.4.0 → 10.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.
- package/dist/cjs/fields/Color/index.cjs +2 -2
- package/dist/cjs/fields/Color/index.native.cjs +2 -2
- package/dist/cjs/fields/Color/index.native.js +2 -2
- package/dist/cjs/fields/Color/index.native.js.map +1 -1
- package/dist/esm/fields/Color/index.mjs +2 -2
- package/dist/esm/fields/Color/index.mjs.map +1 -1
- package/dist/esm/fields/Color/index.native.js +2 -2
- package/dist/esm/fields/Color/index.native.js.map +1 -1
- package/dist/jsx/fields/Color/index.mjs +2 -2
- package/dist/jsx/fields/Color/index.mjs.map +1 -1
- package/dist/jsx/fields/Color/index.native.cjs +2 -2
- package/dist/jsx/fields/Color/index.native.js +2 -2
- package/dist/jsx/fields/Color/index.native.js.map +1 -1
- package/package.json +14 -14
- package/src/fields/Color/Color.presets.spec.tsx +63 -0
- package/src/fields/Color/index.tsx +2 -2
|
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(Color_exports);
|
|
|
24
24
|
var import_forms = require("@multiplatform.one/forms");
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
function Color(props) {
|
|
27
|
-
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
27
|
+
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
28
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {
|
|
29
29
|
name,
|
|
30
30
|
form,
|
|
@@ -44,7 +44,7 @@ function Color(props) {
|
|
|
44
44
|
disabled,
|
|
45
45
|
placeholder,
|
|
46
46
|
format: "hex",
|
|
47
|
-
presetColors,
|
|
47
|
+
presetColors: showPresets ? presetColors : [],
|
|
48
48
|
onBlur,
|
|
49
49
|
mode,
|
|
50
50
|
preserveValue
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(Color_exports);
|
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
27
|
var import_forms = require("@multiplatform.one/forms");
|
|
28
28
|
function Color(props) {
|
|
29
|
-
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
29
|
+
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
30
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {
|
|
31
31
|
name,
|
|
32
32
|
form,
|
|
@@ -46,7 +46,7 @@ function Color(props) {
|
|
|
46
46
|
disabled,
|
|
47
47
|
placeholder,
|
|
48
48
|
format: "hex",
|
|
49
|
-
presetColors,
|
|
49
|
+
presetColors: showPresets ? presetColors : [],
|
|
50
50
|
onBlur,
|
|
51
51
|
mode,
|
|
52
52
|
preserveValue
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(Color_exports);
|
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
27
|
var import_forms = require("@multiplatform.one/forms");
|
|
28
28
|
function Color(props) {
|
|
29
|
-
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
29
|
+
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
30
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {
|
|
31
31
|
name,
|
|
32
32
|
form,
|
|
@@ -46,7 +46,7 @@ function Color(props) {
|
|
|
46
46
|
disabled,
|
|
47
47
|
placeholder,
|
|
48
48
|
format: "hex",
|
|
49
|
-
presetColors,
|
|
49
|
+
presetColors: showPresets ? presetColors : [],
|
|
50
50
|
onBlur,
|
|
51
51
|
mode,
|
|
52
52
|
preserveValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/fields/Color/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Color_exports = {};\n__export(Color_exports, {\n Color: () => Color\n});\nmodule.exports = __toCommonJS(Color_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/fields/Color/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Color_exports = {};\n__export(Color_exports, {\n Color: () => Color\n});\nmodule.exports = __toCommonJS(Color_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n showPresets = true,\n presetColors,\n ...fieldProps\n } = props;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {\n name,\n form,\n validators,\n value,\n onChange,\n defaultValue,\n label: fieldProps.label,\n labelProps: fieldProps.labelProps,\n error: fieldProps.error,\n helperText: fieldProps.helperText,\n readOnly: fieldProps.readOnly,\n skeleton: fieldProps.skeleton,\n required: fieldProps.required,\n id: fieldProps.id,\n size: fieldProps.size,\n disabled,\n placeholder,\n format: \"hex\",\n presetColors: showPresets ? presetColors : [],\n onBlur,\n mode,\n preserveValue\n });\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,aAAa,MACf,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,eAAe,QAAQ,0BAA0B;AACrD,SAAS,MAAM,OAAO;CACpB,IAAI,EACF,cACA,MACA,MACA,MACA,QACA,UACA,eACA,YACA,UACA,OAEA,cAAc,WACd,cAAc,MACd,cACA,GAAG,eACD;CACJ,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,aAAa;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,IAAI,WAAW;EACf,MAAM,WAAW;EACjB;EACA;EACA,QAAQ;EACR,cAAc,cAAc,eAAe,CAAC;EAC5C;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -2,7 +2,7 @@ import { ColorPicker } from "@multiplatform.one/forms";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
function Color(props) {
|
|
5
|
-
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
5
|
+
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
6
6
|
return /* @__PURE__ */ jsx(ColorPicker, {
|
|
7
7
|
name,
|
|
8
8
|
form,
|
|
@@ -22,7 +22,7 @@ function Color(props) {
|
|
|
22
22
|
disabled,
|
|
23
23
|
placeholder,
|
|
24
24
|
format: "hex",
|
|
25
|
-
presetColors,
|
|
25
|
+
presetColors: showPresets ? presetColors : [],
|
|
26
26
|
onBlur,
|
|
27
27
|
mode,
|
|
28
28
|
preserveValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FormsColorPicker"],"sources":["esm/fields/Color/index.js"],"sourcesContent":["import { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction Color(props) {\n const {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["FormsColorPicker"],"sources":["esm/fields/Color/index.js"],"sourcesContent":["import { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction Color(props) {\n const {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n showPresets = true,\n presetColors,\n ...fieldProps\n } = props;\n return /* @__PURE__ */ jsx(\n FormsColorPicker,\n {\n name,\n form,\n validators,\n value,\n onChange,\n defaultValue,\n label: fieldProps.label,\n labelProps: fieldProps.labelProps,\n error: fieldProps.error,\n helperText: fieldProps.helperText,\n readOnly: fieldProps.readOnly,\n skeleton: fieldProps.skeleton,\n required: fieldProps.required,\n id: fieldProps.id,\n size: fieldProps.size,\n disabled,\n placeholder,\n format: \"hex\",\n presetColors: showPresets ? presetColors : [],\n onBlur,\n mode,\n preserveValue\n }\n );\n}\nexport {\n Color\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,MAAM,OAAO;CACpB,MAAM,EACJ,cACA,MACA,MACA,MACA,QACA,UACA,eACA,YACA,UACA,OAEA,cAAc,WACd,cAAc,MACd,cACA,GAAG,eACD;CACJ,OAAuB,oBACrBA,aACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,IAAI,WAAW;EACf,MAAM,WAAW;EACjB;EACA;EACA,QAAQ;EACR,cAAc,cAAc,eAAe,CAAC;EAC5C;EACA;EACA;CACF,CACF;AACF"}
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ColorPicker } from "@multiplatform.one/forms";
|
|
3
3
|
|
|
4
4
|
function Color(props) {
|
|
5
|
-
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
5
|
+
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
6
6
|
return /* @__PURE__ */ jsx(ColorPicker, {
|
|
7
7
|
name,
|
|
8
8
|
form,
|
|
@@ -22,7 +22,7 @@ function Color(props) {
|
|
|
22
22
|
disabled,
|
|
23
23
|
placeholder,
|
|
24
24
|
format: "hex",
|
|
25
|
-
presetColors,
|
|
25
|
+
presetColors: showPresets ? presetColors : [],
|
|
26
26
|
onBlur,
|
|
27
27
|
mode,
|
|
28
28
|
preserveValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":["FormsColorPicker"],"sources":["esm/fields/Color/index.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n
|
|
1
|
+
{"version":3,"file":"index.native.js","names":["FormsColorPicker"],"sources":["esm/fields/Color/index.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n showPresets = true,\n presetColors,\n ...fieldProps\n } = props;\n return /* @__PURE__ */ _jsx(FormsColorPicker, {\n name,\n form,\n validators,\n value,\n onChange,\n defaultValue,\n label: fieldProps.label,\n labelProps: fieldProps.labelProps,\n error: fieldProps.error,\n helperText: fieldProps.helperText,\n readOnly: fieldProps.readOnly,\n skeleton: fieldProps.skeleton,\n required: fieldProps.required,\n id: fieldProps.id,\n size: fieldProps.size,\n disabled,\n placeholder,\n format: \"hex\",\n presetColors: showPresets ? presetColors : [],\n onBlur,\n mode,\n preserveValue\n });\n}\nexport {\n Color\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,MAAM,OAAO;CACpB,IAAI,EACF,cACA,MACA,MACA,MACA,QACA,UACA,eACA,YACA,UACA,OAEA,cAAc,WACd,cAAc,MACd,cACA,GAAG,eACD;CACJ,OAAuB,oBAAKA,aAAkB;EAC5C;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,IAAI,WAAW;EACf,MAAM,WAAW;EACjB;EACA;EACA,QAAQ;EACR,cAAc,cAAc,eAAe,CAAC;EAC5C;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -2,7 +2,7 @@ import { ColorPicker } from "@multiplatform.one/forms";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
function Color(props) {
|
|
5
|
-
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
5
|
+
const { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
6
6
|
return /* @__PURE__ */ jsx(ColorPicker, {
|
|
7
7
|
name,
|
|
8
8
|
form,
|
|
@@ -22,7 +22,7 @@ function Color(props) {
|
|
|
22
22
|
disabled,
|
|
23
23
|
placeholder,
|
|
24
24
|
format: "hex",
|
|
25
|
-
presetColors,
|
|
25
|
+
presetColors: showPresets ? presetColors : [],
|
|
26
26
|
onBlur,
|
|
27
27
|
mode,
|
|
28
28
|
preserveValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FormsColorPicker"],"sources":["jsx/fields/Color/index.js"],"sourcesContent":["import { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction Color(props) {\n const {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["FormsColorPicker"],"sources":["jsx/fields/Color/index.js"],"sourcesContent":["import { ColorPicker as FormsColorPicker } from \"@multiplatform.one/forms\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction Color(props) {\n const {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n showPresets = true,\n presetColors,\n ...fieldProps\n } = props;\n return /* @__PURE__ */ jsx(\n FormsColorPicker,\n {\n name,\n form,\n validators,\n value,\n onChange,\n defaultValue,\n label: fieldProps.label,\n labelProps: fieldProps.labelProps,\n error: fieldProps.error,\n helperText: fieldProps.helperText,\n readOnly: fieldProps.readOnly,\n skeleton: fieldProps.skeleton,\n required: fieldProps.required,\n id: fieldProps.id,\n size: fieldProps.size,\n disabled,\n placeholder,\n format: \"hex\",\n presetColors: showPresets ? presetColors : [],\n onBlur,\n mode,\n preserveValue\n }\n );\n}\nexport {\n Color\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAEA,SAAS,MAAM,OAAO;CACpB,MAAM,EACJ,cACA,MACA,MACA,MACA,QACA,UACA,eACA,YACA,UACA,OAEA,cAAc,WACd,cAAc,MACd,cACA,GAAG,eACD;CACJ,OAAuB,oBACrBA,aACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,IAAI,WAAW;EACf,MAAM,WAAW;EACjB;EACA;EACA,QAAQ;EACR,cAAc,cAAc,eAAe,CAAC;EAC5C;EACA;EACA;CACF,CACF;AACF"}
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(Color_exports);
|
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
27
|
var import_forms = require("@multiplatform.one/forms");
|
|
28
28
|
function Color(props) {
|
|
29
|
-
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
29
|
+
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
30
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {
|
|
31
31
|
name,
|
|
32
32
|
form,
|
|
@@ -46,7 +46,7 @@ function Color(props) {
|
|
|
46
46
|
disabled,
|
|
47
47
|
placeholder,
|
|
48
48
|
format: "hex",
|
|
49
|
-
presetColors,
|
|
49
|
+
presetColors: showPresets ? presetColors : [],
|
|
50
50
|
onBlur,
|
|
51
51
|
mode,
|
|
52
52
|
preserveValue
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(Color_exports);
|
|
|
26
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
27
|
var import_forms = require("@multiplatform.one/forms");
|
|
28
28
|
function Color(props) {
|
|
29
|
-
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000",
|
|
29
|
+
var { defaultValue, form, mode, name, onBlur, onChange, preserveValue, validators, disabled, value, placeholder = "#000000", showPresets = true, presetColors, ...fieldProps } = props;
|
|
30
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {
|
|
31
31
|
name,
|
|
32
32
|
form,
|
|
@@ -46,7 +46,7 @@ function Color(props) {
|
|
|
46
46
|
disabled,
|
|
47
47
|
placeholder,
|
|
48
48
|
format: "hex",
|
|
49
|
-
presetColors,
|
|
49
|
+
presetColors: showPresets ? presetColors : [],
|
|
50
50
|
onBlur,
|
|
51
51
|
mode,
|
|
52
52
|
preserveValue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/fields/Color/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Color_exports = {};\n__export(Color_exports, {\n Color: () => Color\n});\nmodule.exports = __toCommonJS(Color_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/fields/Color/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Color_exports = {};\n__export(Color_exports, {\n Color: () => Color\n});\nmodule.exports = __toCommonJS(Color_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_forms = require(\"@multiplatform.one/forms\");\nfunction Color(props) {\n var {\n defaultValue,\n form,\n mode,\n name,\n onBlur,\n onChange,\n preserveValue,\n validators,\n disabled,\n value,\n // hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing\n placeholder = \"#000000\",\n showPresets = true,\n presetColors,\n ...fieldProps\n } = props;\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_forms.ColorPicker, {\n name,\n form,\n validators,\n value,\n onChange,\n defaultValue,\n label: fieldProps.label,\n labelProps: fieldProps.labelProps,\n error: fieldProps.error,\n helperText: fieldProps.helperText,\n readOnly: fieldProps.readOnly,\n skeleton: fieldProps.skeleton,\n required: fieldProps.required,\n id: fieldProps.id,\n size: fieldProps.size,\n disabled,\n placeholder,\n format: \"hex\",\n presetColors: showPresets ? presetColors : [],\n onBlur,\n mode,\n preserveValue\n });\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,SAAS,eAAe,EACtB,aAAa,MACf,CAAC;AACD,OAAO,UAAU,aAAa,aAAa;AAC3C,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,eAAe,QAAQ,0BAA0B;AACrD,SAAS,MAAM,OAAO;CACpB,IAAI,EACF,cACA,MACA,MACA,MACA,QACA,UACA,eACA,YACA,UACA,OAEA,cAAc,WACd,cAAc,MACd,cACA,GAAG,eACD;CACJ,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa,aAAa;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,OAAO,WAAW;EAClB,YAAY,WAAW;EACvB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,IAAI,WAAW;EACf,MAAM,WAAW;EACjB;EACA;EACA,QAAQ;EACR,cAAc,cAAc,eAAe,CAAC;EAC5C;EACA;EACA;CACF,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/frappe-ui",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.1",
|
|
4
4
|
"description": "Pre-wired Tamagui components for Frappe doctypes with live data",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cross-platform",
|
|
@@ -91,16 +91,16 @@
|
|
|
91
91
|
"access": "public"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@multiplatform.one/components": "^10.
|
|
95
|
-
"@multiplatform.one/desktop": "^10.
|
|
96
|
-
"@multiplatform.one/forms": "^10.
|
|
97
|
-
"@multiplatform.one/frappe": "^10.
|
|
98
|
-
"@multiplatform.one/markdown": "^10.
|
|
99
|
-
"@multiplatform.one/platform": "^10.
|
|
100
|
-
"@multiplatform.one/rich-text": "^10.
|
|
101
|
-
"@multiplatform.one/store": "^10.
|
|
102
|
-
"@multiplatform.one/table": "^10.
|
|
103
|
-
"@multiplatform.one/theme": "^10.
|
|
94
|
+
"@multiplatform.one/components": "^10.5.1",
|
|
95
|
+
"@multiplatform.one/desktop": "^10.5.1",
|
|
96
|
+
"@multiplatform.one/forms": "^10.5.1",
|
|
97
|
+
"@multiplatform.one/frappe": "^10.5.1",
|
|
98
|
+
"@multiplatform.one/markdown": "^10.5.1",
|
|
99
|
+
"@multiplatform.one/platform": "^10.5.1",
|
|
100
|
+
"@multiplatform.one/rich-text": "^10.5.1",
|
|
101
|
+
"@multiplatform.one/store": "^10.5.1",
|
|
102
|
+
"@multiplatform.one/table": "^10.5.1",
|
|
103
|
+
"@multiplatform.one/theme": "^10.5.1",
|
|
104
104
|
"@phosphor-icons/react": "^2.1.10",
|
|
105
105
|
"@tamagui/colors": "3.2.3",
|
|
106
106
|
"@tanstack/db": "0.11.3",
|
|
@@ -117,9 +117,9 @@
|
|
|
117
117
|
"tamagui": "3.2.3"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@multiplatform.one/config": "10.
|
|
121
|
-
"@multiplatform.one/storybook": "10.
|
|
122
|
-
"@multiplatform.one/test-utils": "10.
|
|
120
|
+
"@multiplatform.one/config": "10.5.1",
|
|
121
|
+
"@multiplatform.one/storybook": "10.5.1",
|
|
122
|
+
"@multiplatform.one/test-utils": "10.5.1",
|
|
123
123
|
"@tamagui/build": "3.2.3",
|
|
124
124
|
"@testing-library/jest-dom": "^7.0.1",
|
|
125
125
|
"@testing-library/react": "^16.3.3",
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Color is a thin ColorPicker adapter, so its contract is the props it forwards.
|
|
2
|
+
import { cleanup } from "@testing-library/react";
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
5
|
+
|
|
6
|
+
vi.mock("@multiplatform.one/forms", async (importOriginal) => ({
|
|
7
|
+
...((await importOriginal()) as Record<string, unknown>),
|
|
8
|
+
ColorPicker: ({ presetColors }: { presetColors?: string[] }) => (
|
|
9
|
+
<div data-testid="picker" data-presets={JSON.stringify(presetColors ?? null)} />
|
|
10
|
+
),
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
const { Color } = await import("./index");
|
|
14
|
+
|
|
15
|
+
afterEach(cleanup);
|
|
16
|
+
|
|
17
|
+
function forwardedPresets(ui: React.ReactElement) {
|
|
18
|
+
const { getByTestId } = renderWithProviders(ui);
|
|
19
|
+
return getByTestId("picker").getAttribute("data-presets");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe("Color forwards showPresets to the picker (FZ-11793)", () => {
|
|
23
|
+
it("leaves the presets alone by default, so the picker falls back to the theme's", () => {
|
|
24
|
+
expect(forwardedPresets(<Color label="Brand" value="#10B981" onChange={vi.fn()} />)).toBe(
|
|
25
|
+
"null",
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("empties them when showPresets is false", () => {
|
|
30
|
+
expect(
|
|
31
|
+
forwardedPresets(
|
|
32
|
+
<Color label="Brand" value="#10B981" onChange={vi.fn()} showPresets={false} />,
|
|
33
|
+
),
|
|
34
|
+
).toBe("[]");
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("empties them even when the consumer also named its own", () => {
|
|
38
|
+
expect(
|
|
39
|
+
forwardedPresets(
|
|
40
|
+
<Color
|
|
41
|
+
label="Brand"
|
|
42
|
+
value="#10B981"
|
|
43
|
+
onChange={vi.fn()}
|
|
44
|
+
showPresets={false}
|
|
45
|
+
presetColors={["#ff0000", "#00ff00"]}
|
|
46
|
+
/>,
|
|
47
|
+
),
|
|
48
|
+
).toBe("[]");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("passes the consumer's own presets through when they are shown", () => {
|
|
52
|
+
expect(
|
|
53
|
+
forwardedPresets(
|
|
54
|
+
<Color
|
|
55
|
+
label="Brand"
|
|
56
|
+
value="#10B981"
|
|
57
|
+
onChange={vi.fn()}
|
|
58
|
+
presetColors={["#ff0000", "#00ff00"]}
|
|
59
|
+
/>,
|
|
60
|
+
),
|
|
61
|
+
).toBe('["#ff0000","#00ff00"]');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -62,7 +62,7 @@ export function Color<
|
|
|
62
62
|
value,
|
|
63
63
|
// hex-escape: a Color field stores hex; the placeholder shows that format and paints nothing
|
|
64
64
|
placeholder = "#000000",
|
|
65
|
-
|
|
65
|
+
showPresets = true,
|
|
66
66
|
presetColors,
|
|
67
67
|
...fieldProps
|
|
68
68
|
} = props as ColorProps<TData, TName> & Record<string, unknown>;
|
|
@@ -87,7 +87,7 @@ export function Color<
|
|
|
87
87
|
disabled={disabled}
|
|
88
88
|
placeholder={placeholder}
|
|
89
89
|
format="hex"
|
|
90
|
-
presetColors={presetColors}
|
|
90
|
+
presetColors={showPresets ? presetColors : []}
|
|
91
91
|
onBlur={onBlur}
|
|
92
92
|
mode={mode}
|
|
93
93
|
preserveValue={preserveValue}
|