@vritti/quantum-ui 0.3.3 → 0.3.5
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/Alert.js +1 -1
- package/dist/Avatar.js +4 -4
- package/dist/Badge2.js +2 -2
- package/dist/Breadcrumb.js +1 -1
- package/dist/Button2.js +2 -2
- package/dist/Checkbox2.js +6 -6
- package/dist/Combination.js +3 -3
- package/dist/DateTimePicker.js +2 -2
- package/dist/Dialog.js +1 -1
- package/dist/Label.js +1 -1
- package/dist/Progress.js +2 -2
- package/dist/RadioGroup.js +8 -8
- package/dist/Select.js +2 -2
- package/dist/SelectFilter.js +2 -2
- package/dist/Sidebar.js +3 -3
- package/dist/SingleSelect.js +1 -1
- package/dist/Sonner.js +1 -1
- package/dist/Switch.js +5 -5
- package/dist/TabsSkeleton.js +1 -1
- package/dist/Toggle.js +2 -2
- package/dist/assets/quantum-ui.css +296 -392
- package/dist/calendar2.js +1 -1
- package/dist/cells.js +2 -2
- package/dist/collapsible2.js +1 -1
- package/dist/components/FormattedDate.js +2 -2
- package/dist/components/RichTextEditor.js +1 -1
- package/dist/components/Select.js +4 -4
- package/dist/components/TreeView.js +7 -7
- package/dist/dropdown-menu.js +9 -9
- package/dist/field.js +1 -1
- package/dist/image-component.js +1 -1
- package/dist/index.js +4 -4
- package/dist/index10.js +1499 -102
- package/dist/index10.js.map +1 -1
- package/dist/index11.js +37 -1499
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +476 -29
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +230 -426
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +1073 -214
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +14 -1139
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +20 -14
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +180 -25
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +201 -173
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +69 -203
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +211 -70
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +117 -207
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +71 -123
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +11 -74
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +1134 -13
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +2733 -1103
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +24 -2755
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +4 -32
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +37 -4
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +310 -36
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +7 -309
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +30 -8
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +59 -29
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +10 -59
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +35 -10
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +36810 -27
- package/dist/index35.js.map +1 -1
- package/dist/index4.js +136 -86
- package/dist/index4.js.map +1 -1
- package/dist/index5.js +315 -36745
- package/dist/index5.js.map +1 -1
- package/dist/index6.js +12 -141
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +82 -382
- package/dist/index7.js.map +1 -1
- package/dist/index8.js +42 -12
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +102 -42
- package/dist/index9.js.map +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/select2.js +1 -1
- package/dist/separator2.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/useTimer.js +1 -1
- package/dist/utils/axios.js +1 -1
- package/dist/utils/currency.js +2 -2
- package/dist/utils/format.js +2 -2
- package/dist/utils/money.js +1 -1
- package/dist/utils/timezone.js +1 -1
- package/package.json +1 -1
package/dist/index6.js
CHANGED
|
@@ -1,144 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { u as useControllableState, P as Primitive, c as composeEventHandlers } from './index19.js';
|
|
3
|
-
import { c as createContextScope } from './index20.js';
|
|
4
|
-
import { u as useLayoutEffect2 } from './index28.js';
|
|
5
|
-
import { u as useComposedRefs } from './index12.js';
|
|
6
|
-
import { P as Presence } from './index22.js';
|
|
7
|
-
import { u as useId } from './index24.js';
|
|
8
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { T as TZDate } from './index5.js';
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onOpenChange,
|
|
21
|
-
...collapsibleProps
|
|
22
|
-
} = props;
|
|
23
|
-
const [open, setOpen] = useControllableState({
|
|
24
|
-
prop: openProp,
|
|
25
|
-
defaultProp: defaultOpen ?? false,
|
|
26
|
-
onChange: onOpenChange,
|
|
27
|
-
caller: COLLAPSIBLE_NAME
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ jsx(
|
|
30
|
-
CollapsibleProvider,
|
|
31
|
-
{
|
|
32
|
-
scope: __scopeCollapsible,
|
|
33
|
-
disabled,
|
|
34
|
-
contentId: useId(),
|
|
35
|
-
open,
|
|
36
|
-
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
37
|
-
children: /* @__PURE__ */ jsx(
|
|
38
|
-
Primitive.div,
|
|
39
|
-
{
|
|
40
|
-
"data-state": getState(open),
|
|
41
|
-
"data-disabled": disabled ? "" : void 0,
|
|
42
|
-
...collapsibleProps,
|
|
43
|
-
ref: forwardedRef
|
|
44
|
-
}
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
51
|
-
var TRIGGER_NAME = "CollapsibleTrigger";
|
|
52
|
-
var CollapsibleTrigger = React.forwardRef(
|
|
53
|
-
(props, forwardedRef) => {
|
|
54
|
-
const { __scopeCollapsible, ...triggerProps } = props;
|
|
55
|
-
const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
|
|
56
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
-
Primitive.button,
|
|
58
|
-
{
|
|
59
|
-
type: "button",
|
|
60
|
-
"aria-controls": context.contentId,
|
|
61
|
-
"aria-expanded": context.open || false,
|
|
62
|
-
"data-state": getState(context.open),
|
|
63
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
64
|
-
disabled: context.disabled,
|
|
65
|
-
...triggerProps,
|
|
66
|
-
ref: forwardedRef,
|
|
67
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
CollapsibleTrigger.displayName = TRIGGER_NAME;
|
|
73
|
-
var CONTENT_NAME = "CollapsibleContent";
|
|
74
|
-
var CollapsibleContent = React.forwardRef(
|
|
75
|
-
(props, forwardedRef) => {
|
|
76
|
-
const { forceMount, ...contentProps } = props;
|
|
77
|
-
const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
|
|
78
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
CollapsibleContent.displayName = CONTENT_NAME;
|
|
82
|
-
var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
83
|
-
const { __scopeCollapsible, present, children, ...contentProps } = props;
|
|
84
|
-
const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
|
|
85
|
-
const [isPresent, setIsPresent] = React.useState(present);
|
|
86
|
-
const ref = React.useRef(null);
|
|
87
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
88
|
-
const heightRef = React.useRef(0);
|
|
89
|
-
const height = heightRef.current;
|
|
90
|
-
const widthRef = React.useRef(0);
|
|
91
|
-
const width = widthRef.current;
|
|
92
|
-
const isOpen = context.open || isPresent;
|
|
93
|
-
const isMountAnimationPreventedRef = React.useRef(isOpen);
|
|
94
|
-
const originalStylesRef = React.useRef(void 0);
|
|
95
|
-
React.useEffect(() => {
|
|
96
|
-
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
97
|
-
return () => cancelAnimationFrame(rAF);
|
|
98
|
-
}, []);
|
|
99
|
-
useLayoutEffect2(() => {
|
|
100
|
-
const node = ref.current;
|
|
101
|
-
if (node) {
|
|
102
|
-
originalStylesRef.current = originalStylesRef.current || {
|
|
103
|
-
transitionDuration: node.style.transitionDuration,
|
|
104
|
-
animationName: node.style.animationName
|
|
105
|
-
};
|
|
106
|
-
node.style.transitionDuration = "0s";
|
|
107
|
-
node.style.animationName = "none";
|
|
108
|
-
const rect = node.getBoundingClientRect();
|
|
109
|
-
heightRef.current = rect.height;
|
|
110
|
-
widthRef.current = rect.width;
|
|
111
|
-
if (!isMountAnimationPreventedRef.current) {
|
|
112
|
-
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
|
|
113
|
-
node.style.animationName = originalStylesRef.current.animationName;
|
|
114
|
-
}
|
|
115
|
-
setIsPresent(present);
|
|
116
|
-
}
|
|
117
|
-
}, [context.open, present]);
|
|
118
|
-
return /* @__PURE__ */ jsx(
|
|
119
|
-
Primitive.div,
|
|
120
|
-
{
|
|
121
|
-
"data-state": getState(context.open),
|
|
122
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
123
|
-
id: context.contentId,
|
|
124
|
-
hidden: !isOpen,
|
|
125
|
-
...contentProps,
|
|
126
|
-
ref: composedRefs,
|
|
127
|
-
style: {
|
|
128
|
-
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
|
|
129
|
-
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
|
|
130
|
-
...props.style
|
|
131
|
-
},
|
|
132
|
-
children: isOpen && children
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
});
|
|
136
|
-
function getState(open) {
|
|
137
|
-
return open ? "open" : "closed";
|
|
138
|
-
}
|
|
139
|
-
var Root = Collapsible;
|
|
140
|
-
var Trigger = CollapsibleTrigger;
|
|
141
|
-
var Content = CollapsibleContent;
|
|
3
|
+
/**
|
|
4
|
+
* The function creates accepts a time zone and returns a function that creates
|
|
5
|
+
* a new `TZDate` instance in the time zone from the provided value. Use it to
|
|
6
|
+
* provide the context for the date-fns functions, via the `in` option.
|
|
7
|
+
*
|
|
8
|
+
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
9
|
+
*
|
|
10
|
+
* @returns Function that creates a new `TZDate` instance in the time zone
|
|
11
|
+
*/
|
|
12
|
+
const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));
|
|
142
13
|
|
|
143
|
-
export {
|
|
14
|
+
export { tz as t };
|
|
144
15
|
//# sourceMappingURL=index6.js.map
|
package/dist/index6.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index6.js","sources":["../node_modules/.pnpm/@radix-ui+react-collapsible@1.1.12_@types+react-dom@19.2.3_@types+react@19.2.14__@types_f33eb5e944edcffc4be9ac071951afef/node_modules/@radix-ui/react-collapsible/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collapsible.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { useId } from \"@radix-ui/react-id\";\nimport { jsx } from \"react/jsx-runtime\";\nvar COLLAPSIBLE_NAME = \"Collapsible\";\nvar [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);\nvar [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);\nvar Collapsible = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeCollapsible,\n open: openProp,\n defaultOpen,\n disabled,\n onOpenChange,\n ...collapsibleProps\n } = props;\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: COLLAPSIBLE_NAME\n });\n return /* @__PURE__ */ jsx(\n CollapsibleProvider,\n {\n scope: __scopeCollapsible,\n disabled,\n contentId: useId(),\n open,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": getState(open),\n \"data-disabled\": disabled ? \"\" : void 0,\n ...collapsibleProps,\n ref: forwardedRef\n }\n )\n }\n );\n }\n);\nCollapsible.displayName = COLLAPSIBLE_NAME;\nvar TRIGGER_NAME = \"CollapsibleTrigger\";\nvar CollapsibleTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopeCollapsible, ...triggerProps } = props;\n const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-controls\": context.contentId,\n \"aria-expanded\": context.open || false,\n \"data-state\": getState(context.open),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n disabled: context.disabled,\n ...triggerProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, context.onOpenToggle)\n }\n );\n }\n);\nCollapsibleTrigger.displayName = TRIGGER_NAME;\nvar CONTENT_NAME = \"CollapsibleContent\";\nvar CollapsibleContent = React.forwardRef(\n (props, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });\n }\n);\nCollapsibleContent.displayName = CONTENT_NAME;\nvar CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {\n const { __scopeCollapsible, present, children, ...contentProps } = props;\n const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);\n const [isPresent, setIsPresent] = React.useState(present);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const heightRef = React.useRef(0);\n const height = heightRef.current;\n const widthRef = React.useRef(0);\n const width = widthRef.current;\n const isOpen = context.open || isPresent;\n const isMountAnimationPreventedRef = React.useRef(isOpen);\n const originalStylesRef = React.useRef(void 0);\n React.useEffect(() => {\n const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);\n return () => cancelAnimationFrame(rAF);\n }, []);\n useLayoutEffect(() => {\n const node = ref.current;\n if (node) {\n originalStylesRef.current = originalStylesRef.current || {\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n };\n node.style.transitionDuration = \"0s\";\n node.style.animationName = \"none\";\n const rect = node.getBoundingClientRect();\n heightRef.current = rect.height;\n widthRef.current = rect.width;\n if (!isMountAnimationPreventedRef.current) {\n node.style.transitionDuration = originalStylesRef.current.transitionDuration;\n node.style.animationName = originalStylesRef.current.animationName;\n }\n setIsPresent(present);\n }\n }, [context.open, present]);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": getState(context.open),\n \"data-disabled\": context.disabled ? \"\" : void 0,\n id: context.contentId,\n hidden: !isOpen,\n ...contentProps,\n ref: composedRefs,\n style: {\n [`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,\n [`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,\n ...props.style\n },\n children: isOpen && children\n }\n );\n});\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar Root = Collapsible;\nvar Trigger = CollapsibleTrigger;\nvar Content = CollapsibleContent;\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n Content,\n Root,\n Trigger,\n createCollapsibleScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["useLayoutEffect"],"mappings":";;;;;;;;;AAaA,IAAI,gBAAgB,GAAG,aAAa;AACjC,IAAC,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,GAAG,kBAAkB,CAAC,gBAAgB;AAC5F,IAAI,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,GAAG,wBAAwB,CAAC,gBAAgB,CAAC;AAC7F,IAAI,WAAW,GAAG,KAAK,CAAC,UAAU;AAClC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK;AAC3B,IAAI,MAAM;AACV,MAAM,kBAAkB;AACxB,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,WAAW;AACjB,MAAM,QAAQ;AACd,MAAM,YAAY;AAClB,MAAM,GAAG;AACT,KAAK,GAAG,KAAK;AACb,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,oBAAoB,CAAC;AACjD,MAAM,IAAI,EAAE,QAAQ;AACpB,MAAM,WAAW,EAAE,WAAW,IAAI,KAAK;AACvC,MAAM,QAAQ,EAAE,YAAY;AAC5B,MAAM,MAAM,EAAE;AACd,KAAK,CAAC;AACN,IAAI,uBAAuB,GAAG;AAC9B,MAAM,mBAAmB;AACzB,MAAM;AACN,QAAQ,KAAK,EAAE,kBAAkB;AACjC,QAAQ,QAAQ;AAChB,QAAQ,SAAS,EAAE,KAAK,EAAE;AAC1B,QAAQ,IAAI;AACZ,QAAQ,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,OAAO,CAAC,CAAC,QAAQ,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;AAC1F,QAAQ,QAAQ,kBAAkB,GAAG;AACrC,UAAU,SAAS,CAAC,GAAG;AACvB,UAAU;AACV,YAAY,YAAY,EAAE,QAAQ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CAAC;AAC7B,EAAE,uBAAuB,GAAG;AAC5B,IAAI,SAAS,CAAC,GAAG;AACjB,IAAI;AACJ,MAAM,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;AAC1C,MAAM,eAAe,EAAE,OAAO,CAAC,QAAQ,GAAG,EAAE,GAAG,MAAM;AACrD,MAAM,EAAE,EAAE,OAAO,CAAC,SAAS;AAC3B,MAAM,MAAM,EAAE,CAAC,MAAM;AACrB,MAAM,GAAG,YAAY;AACrB,MAAM,GAAG,EAAE,YAAY;AACvB,MAAM,KAAK,EAAE;AACb,QAAQ,CAAC,CAAC,kCAAkC,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM;AAC/E,QAAQ,CAAC,CAAC,iCAAiC,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,MAAM;AAC5E,QAAQ,GAAG,KAAK,CAAC;AACjB,OAAO;AACP,MAAM,QAAQ,EAAE,MAAM,IAAI;AAC1B;AACA,GAAG;AACH,CAAC,CAAC;AACF,SAAS,QAAQ,CAAC,IAAI,EAAE;AACxB,EAAE,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ;AACjC;AACG,IAAC,IAAI,GAAG;AACR,IAAC,OAAO,GAAG;AACX,IAAC,OAAO,GAAG;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index6.js","sources":["../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tz/index.js"],"sourcesContent":["import { TZDate } from \"../date/index.js\";\n\n/**\n * The function creates accepts a time zone and returns a function that creates\n * a new `TZDate` instance in the time zone from the provided value. Use it to\n * provide the context for the date-fns functions, via the `in` option.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n *\n * @returns Function that creates a new `TZDate` instance in the time zone\n */\nexport const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value));"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,EAAE,GAAG,QAAQ,IAAI,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;;;;","x_google_ignoreList":[0]}
|
package/dist/index7.js
CHANGED
|
@@ -1,394 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* - "short": e.g. "EDT" or "GMT+8".
|
|
16
|
-
* - "long": e.g. "Eastern Daylight Time".
|
|
17
|
-
* - "shortGeneric": e.g. "ET" or "Singapore Time".
|
|
18
|
-
* - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
|
|
19
|
-
*
|
|
20
|
-
* These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
|
|
21
|
-
*
|
|
22
|
-
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
23
|
-
* @param date - Date object to get the time zone name for
|
|
24
|
-
* @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
|
|
25
|
-
*
|
|
26
|
-
* @returns Time zone name (e.g. "Singapore Standard Time")
|
|
27
|
-
*/
|
|
28
|
-
function tzName(timeZone, date, format = "long") {
|
|
29
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
30
|
-
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
|
|
31
|
-
hour: "numeric",
|
|
32
|
-
timeZone: timeZone,
|
|
33
|
-
timeZoneName: format
|
|
34
|
-
}).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
|
|
35
|
-
.slice(2) // Skip the hour and AM/PM parts
|
|
36
|
-
.join(" ");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const offsetFormatCache = {};
|
|
40
|
-
const offsetCache = {};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The function extracts UTC offset in minutes from the given date in specified
|
|
44
|
-
* time zone.
|
|
45
|
-
*
|
|
46
|
-
* Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
|
|
47
|
-
* mirrored to the sign of the offset in the time zone. For Asia/Singapore
|
|
48
|
-
* (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
|
|
49
|
-
*
|
|
50
|
-
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
51
|
-
* @param date - Date to check the offset for
|
|
52
|
-
*
|
|
53
|
-
* @returns UTC offset in minutes
|
|
54
|
-
*/
|
|
55
|
-
function tzOffset(timeZone, date) {
|
|
56
|
-
try {
|
|
57
|
-
const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
|
|
58
|
-
timeZone,
|
|
59
|
-
timeZoneName: "longOffset"
|
|
60
|
-
}).format;
|
|
61
|
-
const offsetStr = format(date).split("GMT")[1];
|
|
62
|
-
if (offsetStr in offsetCache) return offsetCache[offsetStr];
|
|
63
|
-
return calcOffset(offsetStr, offsetStr.split(":"));
|
|
64
|
-
} catch {
|
|
65
|
-
// Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
|
|
66
|
-
// See: https://github.com/nodejs/node/issues/53419
|
|
67
|
-
if (timeZone in offsetCache) return offsetCache[timeZone];
|
|
68
|
-
const captures = timeZone?.match(offsetRe);
|
|
69
|
-
if (captures) return calcOffset(timeZone, captures.slice(1));
|
|
70
|
-
return NaN;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const offsetRe = /([+-]\d\d):?(\d\d)?/;
|
|
74
|
-
function calcOffset(cacheStr, values) {
|
|
75
|
-
const hours = +(values[0] || 0);
|
|
76
|
-
const minutes = +(values[1] || 0);
|
|
77
|
-
// Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
|
|
78
|
-
const seconds = +(values[2] || 0) / 60;
|
|
79
|
-
return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class TZDateMini extends Date {
|
|
83
|
-
//#region static
|
|
84
|
-
|
|
85
|
-
constructor(...args) {
|
|
86
|
-
super();
|
|
87
|
-
if (args.length > 1 && typeof args[args.length - 1] === "string") {
|
|
88
|
-
this.timeZone = args.pop();
|
|
1
|
+
const defaultConfig = {
|
|
2
|
+
csrf: {
|
|
3
|
+
endpoint: "csrf/token",
|
|
4
|
+
enabled: true,
|
|
5
|
+
headerName: "x-csrf-token"
|
|
6
|
+
},
|
|
7
|
+
axios: {
|
|
8
|
+
baseURL: "/api",
|
|
9
|
+
timeout: 3e4,
|
|
10
|
+
withCredentials: true,
|
|
11
|
+
headers: {
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
Accept: "application/json"
|
|
89
14
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
15
|
+
},
|
|
16
|
+
auth: {
|
|
17
|
+
tokenHeaderName: "Authorization",
|
|
18
|
+
tokenPrefix: "Bearer",
|
|
19
|
+
tokenEndpoint: "auth/access-token",
|
|
20
|
+
refreshEndpoint: "auth/refresh-tokens",
|
|
21
|
+
sessionRecoveryEnabled: true
|
|
22
|
+
},
|
|
23
|
+
timeZone: {
|
|
24
|
+
resolveTimeZone: void 0
|
|
25
|
+
},
|
|
26
|
+
currency: {
|
|
27
|
+
resolveCurrency: void 0
|
|
28
|
+
},
|
|
29
|
+
views: {
|
|
30
|
+
viewsEndpoint: "table-views",
|
|
31
|
+
statesEndpoint: "table-states"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const GLOBAL_CONFIG_KEY = "__QUANTUM_UI_CONFIG__";
|
|
35
|
+
function getGlobalConfig() {
|
|
36
|
+
if (typeof window !== "undefined") {
|
|
37
|
+
const globalWindow = window;
|
|
38
|
+
if (!globalWindow[GLOBAL_CONFIG_KEY]) {
|
|
39
|
+
globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };
|
|
107
40
|
}
|
|
41
|
+
return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };
|
|
108
42
|
}
|
|
109
|
-
|
|
110
|
-
return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
//#endregion
|
|
114
|
-
|
|
115
|
-
//#region time zone
|
|
116
|
-
|
|
117
|
-
withTimeZone(timeZone) {
|
|
118
|
-
return new TZDateMini(+this, timeZone);
|
|
119
|
-
}
|
|
120
|
-
getTimezoneOffset() {
|
|
121
|
-
const offset = -tzOffset(this.timeZone, this);
|
|
122
|
-
// Remove the seconds offset
|
|
123
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
124
|
-
return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//#endregion
|
|
128
|
-
|
|
129
|
-
//#region time
|
|
130
|
-
|
|
131
|
-
setTime(time) {
|
|
132
|
-
Date.prototype.setTime.apply(this, arguments);
|
|
133
|
-
syncToInternal(this);
|
|
134
|
-
return +this;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
|
|
139
|
-
//#region date-fns integration
|
|
140
|
-
|
|
141
|
-
[Symbol.for("constructDateFrom")](date) {
|
|
142
|
-
return new TZDateMini(+new Date(date), this.timeZone);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
//#endregion
|
|
43
|
+
return { ...defaultConfig };
|
|
146
44
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Object.getOwnPropertyNames(Date.prototype).forEach(method => {
|
|
151
|
-
if (!re.test(method)) return;
|
|
152
|
-
const utcMethod = method.replace(re, "$1UTC");
|
|
153
|
-
// Filter out methods without UTC counterparts
|
|
154
|
-
if (!TZDateMini.prototype[utcMethod]) return;
|
|
155
|
-
if (method.startsWith("get")) {
|
|
156
|
-
// Delegate to internal date's UTC method
|
|
157
|
-
TZDateMini.prototype[method] = function () {
|
|
158
|
-
return this.internal[utcMethod]();
|
|
159
|
-
};
|
|
160
|
-
} else {
|
|
161
|
-
// Assign regular setter
|
|
162
|
-
TZDateMini.prototype[method] = function () {
|
|
163
|
-
Date.prototype[utcMethod].apply(this.internal, arguments);
|
|
164
|
-
syncFromInternal(this);
|
|
165
|
-
return +this;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// Assign UTC setter
|
|
169
|
-
TZDateMini.prototype[utcMethod] = function () {
|
|
170
|
-
Date.prototype[utcMethod].apply(this, arguments);
|
|
171
|
-
syncToInternal(this);
|
|
172
|
-
return +this;
|
|
173
|
-
};
|
|
45
|
+
function setGlobalConfig(config) {
|
|
46
|
+
if (typeof window !== "undefined") {
|
|
47
|
+
window[GLOBAL_CONFIG_KEY] = config;
|
|
174
48
|
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Function syncs time to internal date, applying the time zone offset.
|
|
179
|
-
*
|
|
180
|
-
* @param {Date} date - Date to sync
|
|
181
|
-
*/
|
|
182
|
-
function syncToInternal(date) {
|
|
183
|
-
date.internal.setTime(+date);
|
|
184
|
-
date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
|
|
185
49
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* Function syncs the internal date UTC values to the date. It allows to get
|
|
189
|
-
* accurate timestamp value.
|
|
190
|
-
*
|
|
191
|
-
* @param {Date} date - The date to sync
|
|
192
|
-
*/
|
|
193
|
-
function syncFromInternal(date) {
|
|
194
|
-
// First we transpose the internal values
|
|
195
|
-
Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
|
|
196
|
-
Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
|
|
197
|
-
|
|
198
|
-
// Now we have to adjust the date to the system time zone
|
|
199
|
-
adjustToSystemTZ(date);
|
|
50
|
+
function defineConfig(config) {
|
|
51
|
+
return config;
|
|
200
52
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Here we get the same hour for both 2 and 3, because the system time zone
|
|
231
|
-
// has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have
|
|
232
|
-
// to adjust the internal date to reflect that.
|
|
233
|
-
//
|
|
234
|
-
// However we want to adjust only if that's the DST hour the change happenes,
|
|
235
|
-
// not the hour where DST moves to.
|
|
236
|
-
|
|
237
|
-
// We calculate the previous hour to see if the time zone offset has changed
|
|
238
|
-
// and we have landed on the DST hour.
|
|
239
|
-
const prevHour = new Date(+date);
|
|
240
|
-
// We use UTC methods here as we don't want to land on the same hour again
|
|
241
|
-
// in case of DST.
|
|
242
|
-
prevHour.setUTCHours(prevHour.getUTCHours() - 1);
|
|
243
|
-
|
|
244
|
-
// Calculate if we are on the system DST hour.
|
|
245
|
-
const systemOffset = -new Date(+date).getTimezoneOffset();
|
|
246
|
-
const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
|
|
247
|
-
const systemDSTChange = systemOffset - prevHourSystemOffset;
|
|
248
|
-
// Detect the DST shift. System DST change will occur both on
|
|
249
|
-
const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
|
|
250
|
-
|
|
251
|
-
// Move the internal date when we are on the system DST hour.
|
|
252
|
-
if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
|
|
253
|
-
|
|
254
|
-
//#endregion
|
|
255
|
-
|
|
256
|
-
//#region System diff adjustment
|
|
257
|
-
|
|
258
|
-
// Now we need to adjust the date, since we just applied internal values.
|
|
259
|
-
// We need to calculate the difference between the system and date time zones
|
|
260
|
-
// and apply it to the date.
|
|
261
|
-
|
|
262
|
-
const offsetDiff = systemOffset - offset;
|
|
263
|
-
if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
|
|
264
|
-
|
|
265
|
-
//#endregion
|
|
266
|
-
|
|
267
|
-
//#region Seconds System diff adjustment
|
|
268
|
-
|
|
269
|
-
const systemDate = new Date(+date);
|
|
270
|
-
// Set the UTC seconds to 0 to isolate the timezone offset in seconds.
|
|
271
|
-
systemDate.setUTCSeconds(0);
|
|
272
|
-
// For negative systemOffset, invert the seconds.
|
|
273
|
-
const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
|
|
274
|
-
|
|
275
|
-
// Calculate the seconds offset based on the timezone offset.
|
|
276
|
-
const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
|
|
277
|
-
if (secondsOffset || systemSecondsOffset) {
|
|
278
|
-
date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
|
|
279
|
-
Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
//#endregion
|
|
283
|
-
|
|
284
|
-
//#region Post-adjustment DST fix
|
|
285
|
-
|
|
286
|
-
const postBaseOffset = tzOffset(date.timeZone, date);
|
|
287
|
-
// Remove the seconds offset
|
|
288
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
289
|
-
const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
|
|
290
|
-
const postSystemOffset = -new Date(+date).getTimezoneOffset();
|
|
291
|
-
const postOffsetDiff = postSystemOffset - postOffset;
|
|
292
|
-
const offsetChanged = postOffset !== offset;
|
|
293
|
-
const postDiff = postOffsetDiff - offsetDiff;
|
|
294
|
-
if (offsetChanged && postDiff) {
|
|
295
|
-
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
|
|
296
|
-
|
|
297
|
-
// Now we need to check if got offset change during the post-adjustment.
|
|
298
|
-
// If so, we also need both dates to reflect that.
|
|
299
|
-
|
|
300
|
-
const newBaseOffset = tzOffset(date.timeZone, date);
|
|
301
|
-
// Remove the seconds offset
|
|
302
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
303
|
-
const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
|
|
304
|
-
const offsetChange = postOffset - newOffset;
|
|
305
|
-
if (offsetChange) {
|
|
306
|
-
date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
|
|
307
|
-
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
|
|
53
|
+
function configureQuantumUI(userConfig) {
|
|
54
|
+
const newConfig = {
|
|
55
|
+
csrf: {
|
|
56
|
+
...defaultConfig.csrf,
|
|
57
|
+
...userConfig.csrf || {}
|
|
58
|
+
},
|
|
59
|
+
axios: {
|
|
60
|
+
...defaultConfig.axios,
|
|
61
|
+
...userConfig.axios || {},
|
|
62
|
+
headers: {
|
|
63
|
+
...defaultConfig.axios.headers,
|
|
64
|
+
...userConfig.axios?.headers || {}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
auth: {
|
|
68
|
+
...defaultConfig.auth,
|
|
69
|
+
...userConfig.auth || {}
|
|
70
|
+
},
|
|
71
|
+
timeZone: {
|
|
72
|
+
...defaultConfig.timeZone,
|
|
73
|
+
...userConfig.timeZone || {}
|
|
74
|
+
},
|
|
75
|
+
currency: {
|
|
76
|
+
...defaultConfig.currency,
|
|
77
|
+
...userConfig.currency || {}
|
|
78
|
+
},
|
|
79
|
+
views: {
|
|
80
|
+
...defaultConfig.views,
|
|
81
|
+
...userConfig.views || {}
|
|
308
82
|
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
//#endregion
|
|
83
|
+
};
|
|
84
|
+
setGlobalConfig(newConfig);
|
|
312
85
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
//#endregion
|
|
322
|
-
|
|
323
|
-
//#region representation
|
|
324
|
-
|
|
325
|
-
toISOString() {
|
|
326
|
-
const [sign, hours, minutes] = this.tzComponents();
|
|
327
|
-
const tz = `${sign}${hours}:${minutes}`;
|
|
328
|
-
return this.internal.toISOString().slice(0, -1) + tz;
|
|
329
|
-
}
|
|
330
|
-
toString() {
|
|
331
|
-
// "Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)";
|
|
332
|
-
return `${this.toDateString()} ${this.toTimeString()}`;
|
|
333
|
-
}
|
|
334
|
-
toDateString() {
|
|
335
|
-
// toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
|
|
336
|
-
const [day, date, month, year] = this.internal.toUTCString().split(" ");
|
|
337
|
-
// "Tue Aug 13 2024"
|
|
338
|
-
return `${day?.slice(0, -1) /* Remove "," */} ${month} ${date} ${year}`;
|
|
339
|
-
}
|
|
340
|
-
toTimeString() {
|
|
341
|
-
// toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
|
|
342
|
-
const time = this.internal.toUTCString().split(" ")[4];
|
|
343
|
-
const [sign, hours, minutes] = this.tzComponents();
|
|
344
|
-
// "07:42:23 GMT+0800 (Singapore Standard Time)"
|
|
345
|
-
return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
|
|
346
|
-
}
|
|
347
|
-
toLocaleString(locales, options) {
|
|
348
|
-
return Date.prototype.toLocaleString.call(this, locales, {
|
|
349
|
-
...options,
|
|
350
|
-
timeZone: options?.timeZone || this.timeZone
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
toLocaleDateString(locales, options) {
|
|
354
|
-
return Date.prototype.toLocaleDateString.call(this, locales, {
|
|
355
|
-
...options,
|
|
356
|
-
timeZone: options?.timeZone || this.timeZone
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
toLocaleTimeString(locales, options) {
|
|
360
|
-
return Date.prototype.toLocaleTimeString.call(this, locales, {
|
|
361
|
-
...options,
|
|
362
|
-
timeZone: options?.timeZone || this.timeZone
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
//#endregion
|
|
367
|
-
|
|
368
|
-
//#region private
|
|
369
|
-
|
|
370
|
-
tzComponents() {
|
|
371
|
-
const offset = this.getTimezoneOffset();
|
|
372
|
-
const sign = offset > 0 ? "-" : "+";
|
|
373
|
-
const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
|
|
374
|
-
const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
|
|
375
|
-
return [sign, hours, minutes];
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
//#endregion
|
|
379
|
-
|
|
380
|
-
withTimeZone(timeZone) {
|
|
381
|
-
return new TZDate(+this, timeZone);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
//#region date-fns integration
|
|
385
|
-
|
|
386
|
-
[Symbol.for("constructDateFrom")](date) {
|
|
387
|
-
return new TZDate(+new Date(date), this.timeZone);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
//#endregion
|
|
86
|
+
function getConfig() {
|
|
87
|
+
return getGlobalConfig();
|
|
88
|
+
}
|
|
89
|
+
function resetConfig() {
|
|
90
|
+
setGlobalConfig({ ...defaultConfig });
|
|
391
91
|
}
|
|
392
92
|
|
|
393
|
-
export {
|
|
93
|
+
export { configureQuantumUI as c, defineConfig as d, getConfig as g, resetConfig as r };
|
|
394
94
|
//# sourceMappingURL=index7.js.map
|