@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260418101320 → 0.8.1-dev.20260420045704
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.js +17 -15
- package/dist/index.mjs +17 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1150,10 +1150,10 @@ var timeZoneAbbreviations = {
|
|
|
1150
1150
|
// src/components/controls/view/DateView.tsx
|
|
1151
1151
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1152
1152
|
var DateView = (props) => {
|
|
1153
|
+
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1153
1154
|
const getTimeZoneAbbreviation = (timeZone) => {
|
|
1154
1155
|
return timeZoneAbbreviations[timeZone] || timeZone;
|
|
1155
1156
|
};
|
|
1156
|
-
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1157
1157
|
const getRelativeTime = (dateString) => {
|
|
1158
1158
|
const now = /* @__PURE__ */ new Date();
|
|
1159
1159
|
const date = new Date(
|
|
@@ -1169,6 +1169,7 @@ var DateView = (props) => {
|
|
|
1169
1169
|
if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
|
|
1170
1170
|
if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
|
|
1171
1171
|
return new Intl.DateTimeFormat("en", {
|
|
1172
|
+
timeZone: userTimeZone,
|
|
1172
1173
|
day: "2-digit",
|
|
1173
1174
|
month: "short",
|
|
1174
1175
|
year: "numeric"
|
|
@@ -1202,37 +1203,38 @@ var DateView = (props) => {
|
|
|
1202
1203
|
if (format === "relative") {
|
|
1203
1204
|
return getRelativeTime(dateString);
|
|
1204
1205
|
}
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
|
|
1209
|
-
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
1206
|
+
const parsedDate = new Date(
|
|
1207
|
+
dateString.includes("Z") ? dateString : dateString + "Z"
|
|
1208
|
+
);
|
|
1210
1209
|
if (props.controlType === "date") {
|
|
1211
1210
|
return new Intl.DateTimeFormat("en", {
|
|
1211
|
+
timeZone: userTimeZone,
|
|
1212
1212
|
day: "2-digit",
|
|
1213
1213
|
month: "short",
|
|
1214
1214
|
year: "numeric"
|
|
1215
|
-
}).format(
|
|
1215
|
+
}).format(parsedDate);
|
|
1216
1216
|
}
|
|
1217
1217
|
if (props.controlType === "time") {
|
|
1218
|
-
return `${formatTime(
|
|
1218
|
+
return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
|
|
1219
1219
|
userTimeZone
|
|
1220
|
-
)} (${getTimePeriod(
|
|
1220
|
+
)} (${getTimePeriod(parsedDate)})`;
|
|
1221
1221
|
}
|
|
1222
|
-
return
|
|
1222
|
+
return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
1223
|
+
timeZone: userTimeZone,
|
|
1223
1224
|
day: "2-digit",
|
|
1224
1225
|
month: "short",
|
|
1225
1226
|
year: "numeric",
|
|
1226
1227
|
hour: "2-digit",
|
|
1227
1228
|
minute: "2-digit"
|
|
1228
|
-
}).format(
|
|
1229
|
+
}).format(parsedDate) : new Intl.DateTimeFormat("en", {
|
|
1230
|
+
timeZone: userTimeZone,
|
|
1229
1231
|
day: "2-digit",
|
|
1230
1232
|
month: "short",
|
|
1231
1233
|
year: "numeric",
|
|
1232
1234
|
hour: "2-digit",
|
|
1233
1235
|
minute: "2-digit",
|
|
1234
1236
|
second: "2-digit"
|
|
1235
|
-
}).format(
|
|
1237
|
+
}).format(parsedDate);
|
|
1236
1238
|
};
|
|
1237
1239
|
let localDateTime = "";
|
|
1238
1240
|
let timeZoneAbbreviation = "";
|
|
@@ -1402,7 +1404,7 @@ var MultilineTextInput = (props) => {
|
|
|
1402
1404
|
maxLength: props?.attributes?.maxLength,
|
|
1403
1405
|
disabled: props?.attributes?.readOnly,
|
|
1404
1406
|
minLength: props?.attributes?.minLength,
|
|
1405
|
-
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm"
|
|
1407
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm input"
|
|
1406
1408
|
}
|
|
1407
1409
|
),
|
|
1408
1410
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
@@ -1617,7 +1619,7 @@ var Select = (props) => {
|
|
|
1617
1619
|
onChange: textChangeHandler,
|
|
1618
1620
|
required: props.attributes?.required,
|
|
1619
1621
|
disabled: props.attributes?.readOnly,
|
|
1620
|
-
className: "peer py-1.5 block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none",
|
|
1622
|
+
className: "peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none",
|
|
1621
1623
|
children: [
|
|
1622
1624
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
1623
1625
|
list.map((item, index) => {
|
|
@@ -1787,7 +1789,7 @@ var NumberInput = (props) => {
|
|
|
1787
1789
|
disabled: props?.attributes?.readOnly,
|
|
1788
1790
|
max: props?.attributes?.maxValue,
|
|
1789
1791
|
min: props?.attributes?.minValue,
|
|
1790
|
-
className: "peer py-1.5 block w-full rounded shadow-sm number-input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
1792
|
+
className: "peer py-1.5 block w-full rounded shadow-sm number-input input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
1791
1793
|
}
|
|
1792
1794
|
),
|
|
1793
1795
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
package/dist/index.mjs
CHANGED
|
@@ -162,10 +162,10 @@ var timeZoneAbbreviations = {
|
|
|
162
162
|
// src/components/controls/view/DateView.tsx
|
|
163
163
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
164
164
|
var DateView = (props) => {
|
|
165
|
+
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
165
166
|
const getTimeZoneAbbreviation = (timeZone) => {
|
|
166
167
|
return timeZoneAbbreviations[timeZone] || timeZone;
|
|
167
168
|
};
|
|
168
|
-
const userTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
169
169
|
const getRelativeTime = (dateString) => {
|
|
170
170
|
const now = /* @__PURE__ */ new Date();
|
|
171
171
|
const date = new Date(
|
|
@@ -181,6 +181,7 @@ var DateView = (props) => {
|
|
|
181
181
|
if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
|
|
182
182
|
if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
|
|
183
183
|
return new Intl.DateTimeFormat("en", {
|
|
184
|
+
timeZone: userTimeZone,
|
|
184
185
|
day: "2-digit",
|
|
185
186
|
month: "short",
|
|
186
187
|
year: "numeric"
|
|
@@ -214,37 +215,38 @@ var DateView = (props) => {
|
|
|
214
215
|
if (format === "relative") {
|
|
215
216
|
return getRelativeTime(dateString);
|
|
216
217
|
}
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const valDate = dateString.includes("Z") ? new Date(dateString) : /* @__PURE__ */ new Date(dateString + "Z");
|
|
221
|
-
const localDate = new Date(valDate.getTime() - offsetMilliseconds);
|
|
218
|
+
const parsedDate = new Date(
|
|
219
|
+
dateString.includes("Z") ? dateString : dateString + "Z"
|
|
220
|
+
);
|
|
222
221
|
if (props.controlType === "date") {
|
|
223
222
|
return new Intl.DateTimeFormat("en", {
|
|
223
|
+
timeZone: userTimeZone,
|
|
224
224
|
day: "2-digit",
|
|
225
225
|
month: "short",
|
|
226
226
|
year: "numeric"
|
|
227
|
-
}).format(
|
|
227
|
+
}).format(parsedDate);
|
|
228
228
|
}
|
|
229
229
|
if (props.controlType === "time") {
|
|
230
|
-
return `${formatTime(
|
|
230
|
+
return `${formatTime(parsedDate)} ${getTimeZoneAbbreviation(
|
|
231
231
|
userTimeZone
|
|
232
|
-
)} (${getTimePeriod(
|
|
232
|
+
)} (${getTimePeriod(parsedDate)})`;
|
|
233
233
|
}
|
|
234
|
-
return
|
|
234
|
+
return parsedDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
|
|
235
|
+
timeZone: userTimeZone,
|
|
235
236
|
day: "2-digit",
|
|
236
237
|
month: "short",
|
|
237
238
|
year: "numeric",
|
|
238
239
|
hour: "2-digit",
|
|
239
240
|
minute: "2-digit"
|
|
240
|
-
}).format(
|
|
241
|
+
}).format(parsedDate) : new Intl.DateTimeFormat("en", {
|
|
242
|
+
timeZone: userTimeZone,
|
|
241
243
|
day: "2-digit",
|
|
242
244
|
month: "short",
|
|
243
245
|
year: "numeric",
|
|
244
246
|
hour: "2-digit",
|
|
245
247
|
minute: "2-digit",
|
|
246
248
|
second: "2-digit"
|
|
247
|
-
}).format(
|
|
249
|
+
}).format(parsedDate);
|
|
248
250
|
};
|
|
249
251
|
let localDateTime = "";
|
|
250
252
|
let timeZoneAbbreviation = "";
|
|
@@ -414,7 +416,7 @@ var MultilineTextInput = (props) => {
|
|
|
414
416
|
maxLength: props?.attributes?.maxLength,
|
|
415
417
|
disabled: props?.attributes?.readOnly,
|
|
416
418
|
minLength: props?.attributes?.minLength,
|
|
417
|
-
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm"
|
|
419
|
+
className: "peer mt-1 py-1.5 block w-full rounded shadow-sm input"
|
|
418
420
|
}
|
|
419
421
|
),
|
|
420
422
|
/* @__PURE__ */ jsx10("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
|
@@ -629,7 +631,7 @@ var Select = (props) => {
|
|
|
629
631
|
onChange: textChangeHandler,
|
|
630
632
|
required: props.attributes?.required,
|
|
631
633
|
disabled: props.attributes?.readOnly,
|
|
632
|
-
className: "peer py-1.5 block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none",
|
|
634
|
+
className: "peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none",
|
|
633
635
|
children: [
|
|
634
636
|
/* @__PURE__ */ jsx13("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
635
637
|
list.map((item, index) => {
|
|
@@ -799,7 +801,7 @@ var NumberInput = (props) => {
|
|
|
799
801
|
disabled: props?.attributes?.readOnly,
|
|
800
802
|
max: props?.attributes?.maxValue,
|
|
801
803
|
min: props?.attributes?.minValue,
|
|
802
|
-
className: "peer py-1.5 block w-full rounded shadow-sm number-input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
804
|
+
className: "peer py-1.5 block w-full rounded shadow-sm number-input input\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none\n "
|
|
803
805
|
}
|
|
804
806
|
),
|
|
805
807
|
/* @__PURE__ */ jsx16("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage ? props.attributes.errorMessage : "" })
|
package/package.json
CHANGED