@ctlyst.id/internal-ui 3.3.2 → 3.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/index.js +85 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -35,16 +35,11 @@ var src_exports = {};
|
|
35
35
|
__export(src_exports, {
|
36
36
|
Accordion: () => import_react3.Accordion,
|
37
37
|
AccordionButton: () => import_react3.AccordionButton,
|
38
|
-
AccordionButtonProps: () => import_react3.AccordionButtonProps,
|
39
38
|
AccordionEye: () => AccordionEye,
|
40
39
|
AccordionIcon: () => import_react3.AccordionIcon,
|
41
|
-
AccordionIconProps: () => import_react3.AccordionIconProps,
|
42
40
|
AccordionIndicator: () => AccordionIndicator,
|
43
41
|
AccordionItem: () => import_react3.AccordionItem,
|
44
|
-
AccordionItemProps: () => import_react3.AccordionItemProps,
|
45
42
|
AccordionPanel: () => import_react3.AccordionPanel,
|
46
|
-
AccordionPanelProps: () => import_react3.AccordionPanelProps,
|
47
|
-
AccordionProps: () => import_react3.AccordionProps,
|
48
43
|
AccordionProvider: () => import_react3.AccordionProvider,
|
49
44
|
Alert: () => Alert,
|
50
45
|
AlertAction: () => AlertAction,
|
@@ -305,10 +300,6 @@ __export(src_exports, {
|
|
305
300
|
Tr: () => import_react79.Tr,
|
306
301
|
UnorderedList: () => import_react51.UnorderedList,
|
307
302
|
Uploader: () => uploader_default,
|
308
|
-
UseAccordionItemProps: () => import_react3.UseAccordionItemProps,
|
309
|
-
UseAccordionItemReturn: () => import_react3.UseAccordionItemReturn,
|
310
|
-
UseAccordionProps: () => import_react3.UseAccordionProps,
|
311
|
-
UseAccordionReturn: () => import_react3.UseAccordionReturn,
|
312
303
|
UseBreakpointOptions: () => import_react91.UseBreakpointOptions,
|
313
304
|
UseCheckboxGroupProps: () => import_react16.UseCheckboxGroupProps,
|
314
305
|
UseCheckboxGroupReturn: () => import_react16.UseCheckboxGroupReturn,
|
@@ -4785,10 +4776,82 @@ var import_react81 = require("@chakra-ui/react");
|
|
4785
4776
|
var import_react82 = require("@chakra-ui/react");
|
4786
4777
|
|
4787
4778
|
// src/components/time-input/components/index.tsx
|
4788
|
-
var
|
4779
|
+
var import_react84 = require("@chakra-ui/react");
|
4789
4780
|
var import_internal_icon10 = require("@ctlyst.id/internal-icon");
|
4790
|
-
var
|
4791
|
-
|
4781
|
+
var import_react85 = require("react");
|
4782
|
+
|
4783
|
+
// src/components/time-input/components/integration.tsx
|
4784
|
+
var import_timescape = require("@zamiru/timescape");
|
4785
|
+
var import_timescape2 = require("@zamiru/timescape");
|
4786
|
+
var import_react83 = require("react");
|
4787
|
+
var useTimescape = (options = {}) => {
|
4788
|
+
var _a;
|
4789
|
+
const { date, onChangeDate, ...rest } = options;
|
4790
|
+
const [manager] = (0, import_react83.useState)(() => new import_timescape.TimescapeManager(date, rest));
|
4791
|
+
const onChangeDateRef = (0, import_react83.useRef)(onChangeDate);
|
4792
|
+
(0, import_react83.useLayoutEffect)(() => {
|
4793
|
+
onChangeDateRef.current = onChangeDate;
|
4794
|
+
}, [onChangeDate]);
|
4795
|
+
const [optionsState, update] = (0, import_react83.useState)(() => ({
|
4796
|
+
date,
|
4797
|
+
...rest
|
4798
|
+
}));
|
4799
|
+
(0, import_react83.useEffect)(() => {
|
4800
|
+
manager.resync();
|
4801
|
+
return () => {
|
4802
|
+
manager.remove();
|
4803
|
+
};
|
4804
|
+
}, [manager]);
|
4805
|
+
(0, import_react83.useEffect)(() => {
|
4806
|
+
return manager.on("changeDate", (nextDate) => {
|
4807
|
+
var _a2;
|
4808
|
+
(_a2 = onChangeDateRef.current) == null ? void 0 : _a2.call(onChangeDateRef, nextDate);
|
4809
|
+
update((value) => ({ ...value, date: nextDate }));
|
4810
|
+
});
|
4811
|
+
}, [manager]);
|
4812
|
+
const timestamp = (_a = optionsState.date) == null ? void 0 : _a.getTime();
|
4813
|
+
(0, import_react83.useEffect)(() => {
|
4814
|
+
manager.date = timestamp;
|
4815
|
+
manager.minDate = optionsState.minDate;
|
4816
|
+
manager.maxDate = optionsState.maxDate;
|
4817
|
+
manager.hour12 = optionsState.hour12;
|
4818
|
+
manager.wrapAround = optionsState.wrapAround;
|
4819
|
+
manager.digits = optionsState.digits;
|
4820
|
+
manager.snapToStep = optionsState.snapToStep;
|
4821
|
+
}, [
|
4822
|
+
manager,
|
4823
|
+
timestamp,
|
4824
|
+
optionsState.minDate,
|
4825
|
+
optionsState.maxDate,
|
4826
|
+
optionsState.hour12,
|
4827
|
+
optionsState.wrapAround,
|
4828
|
+
optionsState.digits,
|
4829
|
+
optionsState.snapToStep
|
4830
|
+
]);
|
4831
|
+
return {
|
4832
|
+
_manager: manager,
|
4833
|
+
getInputProps: (type, opts) => ({
|
4834
|
+
_ref: (element) => {
|
4835
|
+
if (!element) return;
|
4836
|
+
manager.registerElement(element, type, opts == null ? void 0 : opts.autofocus);
|
4837
|
+
if (opts == null ? void 0 : opts.ref) opts.ref.current = element;
|
4838
|
+
},
|
4839
|
+
get ref() {
|
4840
|
+
return this._ref;
|
4841
|
+
},
|
4842
|
+
set ref(value) {
|
4843
|
+
this._ref = value;
|
4844
|
+
}
|
4845
|
+
}),
|
4846
|
+
getRootProps: () => ({
|
4847
|
+
ref: (element) => element && manager.registerRoot(element)
|
4848
|
+
}),
|
4849
|
+
options: optionsState,
|
4850
|
+
update
|
4851
|
+
};
|
4852
|
+
};
|
4853
|
+
|
4854
|
+
// src/components/time-input/components/index.tsx
|
4792
4855
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
4793
4856
|
var Time = class {
|
4794
4857
|
constructor(hours, minutes, seconds) {
|
@@ -4803,9 +4866,9 @@ var Time = class {
|
|
4803
4866
|
return `${this.hours}:${this.minutes}:${this.seconds}`;
|
4804
4867
|
}
|
4805
4868
|
};
|
4806
|
-
var InputTimeArea = (0,
|
4869
|
+
var InputTimeArea = (0, import_react84.forwardRef)((props, ref) => {
|
4807
4870
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
4808
|
-
|
4871
|
+
import_react84.Input,
|
4809
4872
|
{
|
4810
4873
|
_focusWithin: {
|
4811
4874
|
bg: "neutral.300"
|
@@ -4821,7 +4884,7 @@ var InputTimeArea = (0, import_react83.forwardRef)((props, ref) => {
|
|
4821
4884
|
}
|
4822
4885
|
);
|
4823
4886
|
});
|
4824
|
-
var TimeInput2 = (0,
|
4887
|
+
var TimeInput2 = (0, import_react84.forwardRef)(
|
4825
4888
|
({
|
4826
4889
|
config: config2,
|
4827
4890
|
label,
|
@@ -4841,11 +4904,11 @@ var TimeInput2 = (0, import_react83.forwardRef)(
|
|
4841
4904
|
defaultDate.setHours(0, 0, 0, 0);
|
4842
4905
|
const date = dateVal ? new Date(dateVal) : defaultDate;
|
4843
4906
|
const timeValue = new Time();
|
4844
|
-
const { getRootProps, getInputProps, options, update, _manager } =
|
4907
|
+
const { getRootProps, getInputProps, options, update, _manager } = useTimescape({
|
4845
4908
|
date,
|
4846
4909
|
...config2
|
4847
4910
|
});
|
4848
|
-
(0,
|
4911
|
+
(0, import_react85.useEffect)(() => {
|
4849
4912
|
var _a, _b, _c, _d, _e, _f;
|
4850
4913
|
timeValue.hours = (_b = (_a = options == null ? void 0 : options.date) == null ? void 0 : _a.getHours()) != null ? _b : 0;
|
4851
4914
|
timeValue.minutes = (_d = (_c = options == null ? void 0 : options.date) == null ? void 0 : _c.getMinutes()) != null ? _d : 0;
|
@@ -4854,14 +4917,14 @@ var TimeInput2 = (0, import_react83.forwardRef)(
|
|
4854
4917
|
onChangeTime(timeValue);
|
4855
4918
|
}
|
4856
4919
|
}, [options.date]);
|
4857
|
-
(0,
|
4920
|
+
(0, import_react85.useImperativeHandle)(ref, () => ({
|
4858
4921
|
focus() {
|
4859
4922
|
_manager.focusField("hours");
|
4860
4923
|
}
|
4861
4924
|
}));
|
4862
4925
|
const rootProps = getRootProps();
|
4863
4926
|
const hoursProps = getInputProps("hours");
|
4864
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
4927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react84.Box, { ...boxProps, ...rootProps, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
4865
4928
|
field_default,
|
4866
4929
|
{
|
4867
4930
|
isError,
|
@@ -4871,7 +4934,7 @@ var TimeInput2 = (0, import_react83.forwardRef)(
|
|
4871
4934
|
isDisabled,
|
4872
4935
|
isSuccess,
|
4873
4936
|
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
4874
|
-
|
4937
|
+
import_react84.InputGroup,
|
4875
4938
|
{
|
4876
4939
|
borderRadius: "sm",
|
4877
4940
|
backgroundColor: isDisabled ? "neutral.300" : "white.high",
|
@@ -4879,7 +4942,7 @@ var TimeInput2 = (0, import_react83.forwardRef)(
|
|
4879
4942
|
alignItems: "center",
|
4880
4943
|
gap: 3,
|
4881
4944
|
children: [
|
4882
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_react84.Flex, { gap: 1, width: "100%", alignItems: "center", pl: 2, children: [
|
4883
4946
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(InputTimeArea, { ...hoursProps }),
|
4884
4947
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: ":" }),
|
4885
4948
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(InputTimeArea, { ...getInputProps("minutes") }),
|
@@ -4887,7 +4950,7 @@ var TimeInput2 = (0, import_react83.forwardRef)(
|
|
4887
4950
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: ":" }),
|
4888
4951
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(InputTimeArea, { ...getInputProps("seconds") })
|
4889
4952
|
] }),
|
4890
|
-
options.hour12 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
4953
|
+
options.hour12 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react84.Input, { p: 0, ...getInputProps("am/pm") })
|
4891
4954
|
] }),
|
4892
4955
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_internal_icon10.Clock, { color: "neutral.400" }),
|
4893
4956
|
addOnRight
|
@@ -7038,16 +7101,11 @@ var import_react104 = require("@chakra-ui/react");
|
|
7038
7101
|
0 && (module.exports = {
|
7039
7102
|
Accordion,
|
7040
7103
|
AccordionButton,
|
7041
|
-
AccordionButtonProps,
|
7042
7104
|
AccordionEye,
|
7043
7105
|
AccordionIcon,
|
7044
|
-
AccordionIconProps,
|
7045
7106
|
AccordionIndicator,
|
7046
7107
|
AccordionItem,
|
7047
|
-
AccordionItemProps,
|
7048
7108
|
AccordionPanel,
|
7049
|
-
AccordionPanelProps,
|
7050
|
-
AccordionProps,
|
7051
7109
|
AccordionProvider,
|
7052
7110
|
Alert,
|
7053
7111
|
AlertAction,
|
@@ -7308,10 +7366,6 @@ var import_react104 = require("@chakra-ui/react");
|
|
7308
7366
|
Tr,
|
7309
7367
|
UnorderedList,
|
7310
7368
|
Uploader,
|
7311
|
-
UseAccordionItemProps,
|
7312
|
-
UseAccordionItemReturn,
|
7313
|
-
UseAccordionProps,
|
7314
|
-
UseAccordionReturn,
|
7315
7369
|
UseBreakpointOptions,
|
7316
7370
|
UseCheckboxGroupProps,
|
7317
7371
|
UseCheckboxGroupReturn,
|