@acoustte-digital-services/digitalstore-controls 0.13.0 → 0.15.0

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/index.d.mts CHANGED
@@ -21,6 +21,7 @@ declare const ViewControlTypes: {
21
21
  statusView: string;
22
22
  statusBgView: string;
23
23
  multilineTextView: string;
24
+ booleanView: string;
24
25
  text: string;
25
26
  };
26
27
 
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ declare const ViewControlTypes: {
21
21
  statusView: string;
22
22
  statusBgView: string;
23
23
  multilineTextView: string;
24
+ booleanView: string;
24
25
  text: string;
25
26
  };
26
27
 
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ __export(index_exports, {
50
50
  module.exports = __toCommonJS(index_exports);
51
51
 
52
52
  // src/controls/view/ViewControl.tsx
53
- var import_react10 = __toESM(require("react"));
53
+ var import_react11 = __toESM(require("react"));
54
54
 
55
55
  // src/controls/view/LineTextView.tsx
56
56
  var import_react = __toESM(require("react"));
@@ -182,12 +182,57 @@ var ViewControlTypes = {
182
182
  statusView: "statusView",
183
183
  statusBgView: "statusBgView",
184
184
  multilineTextView: "multilineTextView",
185
+ booleanView: "booleanView",
185
186
  text: "text"
186
187
  };
187
188
  var ViewControlTypes_default = ViewControlTypes;
188
189
 
189
- // src/controls/view/ViewControl.tsx
190
+ // src/controls/view/BooleanView.tsx
191
+ var import_react10 = __toESM(require("react"));
190
192
  var import_jsx_runtime10 = require("react/jsx-runtime");
193
+ var BooleanView = (props) => {
194
+ const { value, customProps } = props;
195
+ const showOnlyTrueIcon = customProps == null ? void 0 : customProps.showOnlyTrueIcon;
196
+ console.log("BooleanView Debug:", {
197
+ value,
198
+ type: typeof value,
199
+ customProps,
200
+ showOnlyTrueIcon
201
+ });
202
+ const booleanValue = import_react10.default.useMemo(() => {
203
+ if (typeof value === "boolean") return value;
204
+ if (typeof value === "string") {
205
+ return value.toLowerCase() === "true";
206
+ }
207
+ if (typeof value === "number") {
208
+ return value === 1;
209
+ }
210
+ return false;
211
+ }, [value]);
212
+ if (showOnlyTrueIcon) {
213
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.default.Fragment, { children: booleanValue === true && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
214
+ "svg",
215
+ {
216
+ className: "w-15 h-8 text-green-600",
217
+ fill: "currentColor",
218
+ viewBox: "0 0 20 20",
219
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
220
+ "path",
221
+ {
222
+ fillRule: "evenodd",
223
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
224
+ clipRule: "evenodd"
225
+ }
226
+ )
227
+ }
228
+ ) });
229
+ }
230
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.default.Fragment, { children: booleanValue ? "true" : "false" });
231
+ };
232
+ var BooleanView_default = BooleanView;
233
+
234
+ // src/controls/view/ViewControl.tsx
235
+ var import_jsx_runtime11 = require("react/jsx-runtime");
191
236
  var ViewControl = (props) => {
192
237
  const ControlComponents = {
193
238
  [ViewControlTypes_default.lineTextView]: LineTextView_default,
@@ -199,10 +244,11 @@ var ViewControl = (props) => {
199
244
  [ViewControlTypes_default.statusView]: StatusView_default,
200
245
  [ViewControlTypes_default.statusBgView]: StatusBgView_default,
201
246
  [ViewControlTypes_default.multilineTextView]: MultilineTextView_default,
202
- [ViewControlTypes_default.lineTextView]: LineTextView_default
247
+ [ViewControlTypes_default.lineTextView]: LineTextView_default,
248
+ [ViewControlTypes_default.booleanView]: BooleanView_default
203
249
  };
204
250
  const SelectedControlComponent = ControlComponents[props.controlType];
205
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react10.default.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectedControlComponent, __spreadValues({}, props)) : "Control not found" });
251
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.default.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SelectedControlComponent, __spreadValues({}, props)) : "Control not found" });
206
252
  };
207
253
  var ViewControl_default = ViewControl;
208
254
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ var __spreadValues = (a, b) => {
16
16
  };
17
17
 
18
18
  // src/controls/view/ViewControl.tsx
19
- import React10 from "react";
19
+ import React11 from "react";
20
20
 
21
21
  // src/controls/view/LineTextView.tsx
22
22
  import React from "react";
@@ -148,12 +148,57 @@ var ViewControlTypes = {
148
148
  statusView: "statusView",
149
149
  statusBgView: "statusBgView",
150
150
  multilineTextView: "multilineTextView",
151
+ booleanView: "booleanView",
151
152
  text: "text"
152
153
  };
153
154
  var ViewControlTypes_default = ViewControlTypes;
154
155
 
155
- // src/controls/view/ViewControl.tsx
156
+ // src/controls/view/BooleanView.tsx
157
+ import React10 from "react";
156
158
  import { jsx as jsx10 } from "react/jsx-runtime";
159
+ var BooleanView = (props) => {
160
+ const { value, customProps } = props;
161
+ const showOnlyTrueIcon = customProps == null ? void 0 : customProps.showOnlyTrueIcon;
162
+ console.log("BooleanView Debug:", {
163
+ value,
164
+ type: typeof value,
165
+ customProps,
166
+ showOnlyTrueIcon
167
+ });
168
+ const booleanValue = React10.useMemo(() => {
169
+ if (typeof value === "boolean") return value;
170
+ if (typeof value === "string") {
171
+ return value.toLowerCase() === "true";
172
+ }
173
+ if (typeof value === "number") {
174
+ return value === 1;
175
+ }
176
+ return false;
177
+ }, [value]);
178
+ if (showOnlyTrueIcon) {
179
+ return /* @__PURE__ */ jsx10(React10.Fragment, { children: booleanValue === true && /* @__PURE__ */ jsx10(
180
+ "svg",
181
+ {
182
+ className: "w-15 h-8 text-green-600",
183
+ fill: "currentColor",
184
+ viewBox: "0 0 20 20",
185
+ children: /* @__PURE__ */ jsx10(
186
+ "path",
187
+ {
188
+ fillRule: "evenodd",
189
+ d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
190
+ clipRule: "evenodd"
191
+ }
192
+ )
193
+ }
194
+ ) });
195
+ }
196
+ return /* @__PURE__ */ jsx10(React10.Fragment, { children: booleanValue ? "true" : "false" });
197
+ };
198
+ var BooleanView_default = BooleanView;
199
+
200
+ // src/controls/view/ViewControl.tsx
201
+ import { jsx as jsx11 } from "react/jsx-runtime";
157
202
  var ViewControl = (props) => {
158
203
  const ControlComponents = {
159
204
  [ViewControlTypes_default.lineTextView]: LineTextView_default,
@@ -165,10 +210,11 @@ var ViewControl = (props) => {
165
210
  [ViewControlTypes_default.statusView]: StatusView_default,
166
211
  [ViewControlTypes_default.statusBgView]: StatusBgView_default,
167
212
  [ViewControlTypes_default.multilineTextView]: MultilineTextView_default,
168
- [ViewControlTypes_default.lineTextView]: LineTextView_default
213
+ [ViewControlTypes_default.lineTextView]: LineTextView_default,
214
+ [ViewControlTypes_default.booleanView]: BooleanView_default
169
215
  };
170
216
  const SelectedControlComponent = ControlComponents[props.controlType];
171
- return /* @__PURE__ */ jsx10(React10.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx10(SelectedControlComponent, __spreadValues({}, props)) : "Control not found" });
217
+ return /* @__PURE__ */ jsx11(React11.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx11(SelectedControlComponent, __spreadValues({}, props)) : "Control not found" });
172
218
  };
173
219
  var ViewControl_default = ViewControl;
174
220
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls",
3
- "version": "0.13.0",
3
+ "version": "0.15.0",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",