@nr1e/qwik-ui 1.0.1 → 1.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.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
+ const qwik = require("@builder.io/qwik");
5
+ function formatDateTime(date, timeZone, locale) {
6
+ const dateObj = typeof date === "string" ? new Date(date) : date;
7
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
8
+ timeZone,
9
+ year: "numeric",
10
+ month: "long",
11
+ day: "numeric",
12
+ hour: "numeric",
13
+ minute: "2-digit",
14
+ hour12: true,
15
+ timeZoneName: "short"
16
+ }).format(dateObj);
17
+ }
18
+ const FormatDateTime = qwik.component$((props) => {
19
+ const date = qwik.useSignal(null);
20
+ if (!props.date) return null;
21
+ qwik.useVisibleTask$(() => {
22
+ if (props.date) {
23
+ let timeZone = props.timeZone;
24
+ if (!props.timeZone) {
25
+ timeZone = localStorage.getItem("timezone");
26
+ if (!timeZone || timeZone === "auto") {
27
+ timeZone = null;
28
+ }
29
+ }
30
+ date.value = formatDateTime(props.date, timeZone ?? void 0, props.locale ?? void 0);
31
+ }
32
+ });
33
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
34
+ children: date.value
35
+ });
36
+ });
37
+ exports.FormatDateTime = FormatDateTime;
@@ -0,0 +1,37 @@
1
+ import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
2
+ import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik";
3
+ function formatDateTime(date, timeZone, locale) {
4
+ const dateObj = typeof date === "string" ? new Date(date) : date;
5
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
6
+ timeZone,
7
+ year: "numeric",
8
+ month: "long",
9
+ day: "numeric",
10
+ hour: "numeric",
11
+ minute: "2-digit",
12
+ hour12: true,
13
+ timeZoneName: "short"
14
+ }).format(dateObj);
15
+ }
16
+ const FormatDateTime = component$((props) => {
17
+ const date = useSignal(null);
18
+ if (!props.date) return null;
19
+ useVisibleTask$(() => {
20
+ if (props.date) {
21
+ let timeZone = props.timeZone;
22
+ if (!props.timeZone) {
23
+ timeZone = localStorage.getItem("timezone");
24
+ if (!timeZone || timeZone === "auto") {
25
+ timeZone = null;
26
+ }
27
+ }
28
+ date.value = formatDateTime(props.date, timeZone ?? void 0, props.locale ?? void 0);
29
+ }
30
+ });
31
+ return /* @__PURE__ */ jsx(Fragment, {
32
+ children: date.value
33
+ });
34
+ });
35
+ export {
36
+ FormatDateTime
37
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
+ const qwik = require("@builder.io/qwik");
5
+ function formatDate(date, timeZone, locale) {
6
+ const dateObj = typeof date === "string" ? new Date(date) : date;
7
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
8
+ timeZone,
9
+ year: "numeric",
10
+ month: "short",
11
+ day: "numeric"
12
+ }).format(dateObj);
13
+ }
14
+ const FormatDate = qwik.component$((props) => {
15
+ const date = qwik.useSignal(null);
16
+ if (!props.date) return null;
17
+ qwik.useVisibleTask$(() => {
18
+ if (props.date) {
19
+ let timeZone = props.timeZone;
20
+ if (!props.timeZone) {
21
+ timeZone = localStorage.getItem("timezone");
22
+ if (!timeZone || timeZone === "auto") {
23
+ timeZone = null;
24
+ }
25
+ }
26
+ date.value = formatDate(props.date, timeZone ?? void 0, props.locale ?? void 0);
27
+ }
28
+ });
29
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
30
+ children: date.value
31
+ });
32
+ });
33
+ exports.FormatDate = FormatDate;
@@ -0,0 +1,33 @@
1
+ import { jsx, Fragment } from "@builder.io/qwik/jsx-runtime";
2
+ import { component$, useSignal, useVisibleTask$ } from "@builder.io/qwik";
3
+ function formatDate(date, timeZone, locale) {
4
+ const dateObj = typeof date === "string" ? new Date(date) : date;
5
+ return new Intl.DateTimeFormat(locale ?? "en-US", {
6
+ timeZone,
7
+ year: "numeric",
8
+ month: "short",
9
+ day: "numeric"
10
+ }).format(dateObj);
11
+ }
12
+ const FormatDate = component$((props) => {
13
+ const date = useSignal(null);
14
+ if (!props.date) return null;
15
+ useVisibleTask$(() => {
16
+ if (props.date) {
17
+ let timeZone = props.timeZone;
18
+ if (!props.timeZone) {
19
+ timeZone = localStorage.getItem("timezone");
20
+ if (!timeZone || timeZone === "auto") {
21
+ timeZone = null;
22
+ }
23
+ }
24
+ date.value = formatDate(props.date, timeZone ?? void 0, props.locale ?? void 0);
25
+ }
26
+ });
27
+ return /* @__PURE__ */ jsx(Fragment, {
28
+ children: date.value
29
+ });
30
+ });
31
+ export {
32
+ FormatDate
33
+ };
@@ -10,6 +10,8 @@ const checkboxField = require("./components/checkbox-field.qwik.cjs");
10
10
  const dialog = require("./components/dialog.qwik.cjs");
11
11
  const dock = require("./components/dock.qwik.cjs");
12
12
  const fixedCenterBottom = require("./components/fixed-center-bottom.qwik.cjs");
13
+ const formatDate = require("./components/format-date.qwik.cjs");
14
+ const formatDateTime = require("./components/format-date-time.qwik.cjs");
13
15
  const dropUp = require("./components/drop-up.qwik.cjs");
14
16
  const googleSignInButton = require("./components/google-sign-in-button.qwik.cjs");
15
17
  const gtm = require("./components/gtm.qwik.cjs");
@@ -34,6 +36,8 @@ exports.DockButton = dock.DockButton;
34
36
  exports.DockLabel = dock.DockLabel;
35
37
  exports.DockLink = dock.DockLink;
36
38
  exports.FixedCenterBottom = fixedCenterBottom.FixedCenterBottom;
39
+ exports.FormatDate = formatDate.FormatDate;
40
+ exports.FormatDateTime = formatDateTime.FormatDateTime;
37
41
  exports.DropUp = dropUp.DropUp;
38
42
  exports.DropUpButton = dropUp.DropUpButton;
39
43
  exports.DropUpButtonSelector = dropUp.DropUpButtonSelector;
@@ -8,6 +8,8 @@ import { CheckboxField } from "./components/checkbox-field.qwik.mjs";
8
8
  import { Dialog } from "./components/dialog.qwik.mjs";
9
9
  import { Dock, DockButton, DockLabel, DockLink } from "./components/dock.qwik.mjs";
10
10
  import { FixedCenterBottom } from "./components/fixed-center-bottom.qwik.mjs";
11
+ import { FormatDate } from "./components/format-date.qwik.mjs";
12
+ import { FormatDateTime } from "./components/format-date-time.qwik.mjs";
11
13
  import { DropUp, DropUpButton, DropUpButtonSelector, DropUpLink, DropUpSubmenu } from "./components/drop-up.qwik.mjs";
12
14
  import { GoogleSignInButton } from "./components/google-sign-in-button.qwik.mjs";
13
15
  import { GtmBody, GtmHead } from "./components/gtm.qwik.mjs";
@@ -38,6 +40,8 @@ export {
38
40
  DropUpLink,
39
41
  DropUpSubmenu,
40
42
  FixedCenterBottom,
43
+ FormatDate,
44
+ FormatDateTime,
41
45
  GoogleSignInButton,
42
46
  GtmBody,
43
47
  GtmHead,
@@ -0,0 +1,6 @@
1
+ export interface FormatDateTimeProps {
2
+ timeZone?: string | null;
3
+ locale?: string | null;
4
+ date: Date | string | null;
5
+ }
6
+ export declare const FormatDateTime: import("@builder.io/qwik").Component<FormatDateTimeProps>;
@@ -0,0 +1,6 @@
1
+ export interface FormatDateProps {
2
+ timeZone?: string | null;
3
+ locale?: string | null;
4
+ date: Date | string | null;
5
+ }
6
+ export declare const FormatDate: import("@builder.io/qwik").Component<FormatDateProps>;
@@ -8,6 +8,8 @@ export * from './components/checkbox-field';
8
8
  export * from './components/dialog';
9
9
  export * from './components/dock';
10
10
  export * from './components/fixed-center-bottom';
11
+ export * from './components/format-date';
12
+ export * from './components/format-date-time';
11
13
  export * from './components/drop-up';
12
14
  export * from './components/google-sign-in-button';
13
15
  export * from './components/gtm';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nr1e/qwik-ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "NR1E Qwik UI Library",
5
5
  "author": "NR1E, Inc.",
6
6
  "publishConfig": {
@@ -36,7 +36,7 @@
36
36
  "peerDependencies": {
37
37
  "@builder.io/qwik-city": "1.19.0",
38
38
  "tailwindcss-animated": "2.0.0",
39
- "@nr1e/qwik-icons": "0.0.24"
39
+ "@nr1e/qwik-icons": "0.0.25"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@builder.io/qwik": "1.19.0",