@jenesei-software/jenesei-kit-react 1.0.0 → 1.0.1
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/README.md +0 -1
- package/build/{area-DfCAwCiZ.js → area-3gVEQsJq.js} +20 -22
- package/build/area-3gVEQsJq.js.map +1 -0
- package/build/area-C8w6fMSn.cjs +38 -0
- package/build/area-C8w6fMSn.cjs.map +1 -0
- package/build/{area-9NUxwBGc.cjs → area-E4w7aKuZ.cjs} +2 -2
- package/build/{area-9NUxwBGc.cjs.map → area-E4w7aKuZ.cjs.map} +1 -1
- package/build/{area-BnAddPtl.js → area-EcUYP2tl.js} +2 -2
- package/build/{area-BnAddPtl.js.map → area-EcUYP2tl.js.map} +1 -1
- package/build/area-preview.cjs.js +1 -1
- package/build/area-preview.es.js +1 -1
- package/build/area-skeleton.cjs.js +1 -1
- package/build/area-skeleton.es.js +1 -1
- package/build/build-info.txt +3 -3
- package/build/{component-C2JFFh-k.js → component--cOriuv7.js} +103 -27
- package/build/component--cOriuv7.js.map +1 -0
- package/build/{component-CFMlaYj1.js → component-9m1Ib3fS.js} +2 -2
- package/build/{component-CFMlaYj1.js.map → component-9m1Ib3fS.js.map} +1 -1
- package/build/{component-CuiUpH8H.js → component-B1IQ5CfM.js} +10 -10
- package/build/component-B1IQ5CfM.js.map +1 -0
- package/build/{component-C52VCES6.cjs → component-BnYw0FvH.cjs} +21 -17
- package/build/component-BnYw0FvH.cjs.map +1 -0
- package/build/{component-nFn_uOy_.cjs → component-Bovatz78.cjs} +2 -2
- package/build/{component-nFn_uOy_.cjs.map → component-Bovatz78.cjs.map} +1 -1
- package/build/{component-UW1VzyvB.cjs → component-C0atFCun.cjs} +2 -2
- package/build/{component-UW1VzyvB.cjs.map → component-C0atFCun.cjs.map} +1 -1
- package/build/{component-DZxbW_Jz.js → component-CbPhVNw5.js} +30 -28
- package/build/component-CbPhVNw5.js.map +1 -0
- package/build/component-CbnBTIR5.cjs +2 -0
- package/build/component-CbnBTIR5.cjs.map +1 -0
- package/build/{component-xnEaYd4a.cjs → component-D7A-4DNQ.cjs} +2 -2
- package/build/{component-xnEaYd4a.cjs.map → component-D7A-4DNQ.cjs.map} +1 -1
- package/build/{component-CBshLNEf.js → component-DURhph1i.js} +3 -3
- package/build/{component-CBshLNEf.js.map → component-DURhph1i.js.map} +1 -1
- package/build/component-X4e7zEKk.cjs +90 -0
- package/build/component-X4e7zEKk.cjs.map +1 -0
- package/build/component-accordion.cjs.js +1 -1
- package/build/component-accordion.es.js +1 -1
- package/build/component-button-group.cjs.js +1 -1
- package/build/component-button-group.d.ts +5 -1
- package/build/component-button-group.es.js +1 -1
- package/build/component-button.cjs.js +1 -1
- package/build/component-button.d.ts +6 -2
- package/build/component-button.es.js +1 -1
- package/build/component-checkbox-group.cjs.js +1 -1
- package/build/component-checkbox-group.d.ts +2 -1
- package/build/component-checkbox-group.es.js +1 -1
- package/build/component-checkbox.cjs.js +1 -1
- package/build/component-checkbox.d.ts +2 -1
- package/build/component-checkbox.es.js +1 -1
- package/build/component-date-picker.cjs.js +1 -1
- package/build/component-date-picker.d.ts +93 -70
- package/build/component-date-picker.es.js +1 -1
- package/build/component-icon.cjs.js +1 -1
- package/build/component-icon.es.js +1 -1
- package/build/component-image-button.cjs.js +1 -1
- package/build/component-image-button.d.ts +5 -1
- package/build/component-image-button.es.js +1 -1
- package/build/component-image-select.cjs.js +1 -1
- package/build/component-image-select.d.ts +5 -1
- package/build/component-image-select.es.js +1 -1
- package/build/component-image-slider.cjs.js +1 -1
- package/build/component-image-slider.es.js +1 -1
- package/build/component-image.cjs.js +1 -1
- package/build/component-image.es.js +1 -1
- package/build/component-input-otp.cjs.js +1 -1
- package/build/component-input-otp.d.ts +31 -19
- package/build/component-input-otp.es.js +1 -1
- package/build/component-input.cjs.js +1 -1
- package/build/component-input.d.ts +48 -38
- package/build/component-input.es.js +4 -4
- package/build/component-map.cjs.js +1 -1
- package/build/component-map.es.js +1 -1
- package/build/component-pagination.cjs.js +1 -1
- package/build/component-pagination.d.ts +5 -1
- package/build/component-pagination.es.js +1 -1
- package/build/component-range.cjs.js +1 -1
- package/build/component-range.d.ts +28 -18
- package/build/component-range.es.js +1 -1
- package/build/component-ripple.cjs.js +1 -1
- package/build/component-ripple.es.js +1 -1
- package/build/component-select.cjs.js +1 -1
- package/build/component-select.d.ts +125 -230
- package/build/component-select.es.js +16 -20
- package/build/component-separator.cjs.js +1 -1
- package/build/component-separator.d.ts +3 -2
- package/build/component-separator.es.js +1 -1
- package/build/component-textarea.cjs.js +1 -1
- package/build/component-textarea.d.ts +74 -53
- package/build/component-textarea.es.js +4 -8
- package/build/component-toggle.cjs.js +1 -1
- package/build/component-toggle.es.js +1 -1
- package/build/component-tooltip.cjs.js +1 -1
- package/build/component-tooltip.d.ts +9 -2
- package/build/component-tooltip.es.js +1 -1
- package/build/component-typography.cjs.js +1 -1
- package/build/component-typography.d.ts +8 -2
- package/build/component-typography.es.js +1 -1
- package/build/{component-ByY_9Ryc.js → component-vpCWcIhC.js} +2 -2
- package/build/{component-ByY_9Ryc.js.map → component-vpCWcIhC.js.map} +1 -1
- package/build/{component.components-CaR5gfQW.cjs → component.components-1kRDD3KO.cjs} +2 -2
- package/build/{component.components-CaR5gfQW.cjs.map → component.components-1kRDD3KO.cjs.map} +1 -1
- package/build/{component.components-BAAT5GTH.js → component.components-CQ3LLnFl.js} +5 -5
- package/build/{component.components-BAAT5GTH.js.map → component.components-CQ3LLnFl.js.map} +1 -1
- package/build/{component.constants-DRvp5Bez.js → component.constants-B1rq1PLe.js} +2 -2
- package/build/{component.constants-DRvp5Bez.js.map → component.constants-B1rq1PLe.js.map} +1 -1
- package/build/{component.constants-DbNhxh0k.js → component.constants-B95xyW0s.js} +211 -207
- package/build/component.constants-B95xyW0s.js.map +1 -0
- package/build/{component.constants-BeWW8Ijx.cjs → component.constants-BLHg7rcI.cjs} +2 -2
- package/build/{component.constants-BeWW8Ijx.cjs.map → component.constants-BLHg7rcI.cjs.map} +1 -1
- package/build/component.constants-Gz2mf7IF.cjs +22 -0
- package/build/component.constants-Gz2mf7IF.cjs.map +1 -0
- package/build/{component.styles-BfvB83xM.cjs → component.styles-B-ZAk_1C.cjs} +7 -7
- package/build/component.styles-B-ZAk_1C.cjs.map +1 -0
- package/build/{component.styles-Do1NYZEO.js → component.styles-BI4OuDrG.js} +32 -20
- package/build/component.styles-BI4OuDrG.js.map +1 -0
- package/build/component.styles-BLh29xwF.cjs +10 -0
- package/build/component.styles-BLh29xwF.cjs.map +1 -0
- package/build/component.styles-BnJjm_ES.js +37 -0
- package/build/component.styles-BnJjm_ES.js.map +1 -0
- package/build/{component.styles-RkQwTlwG.js → component.styles-BoBaG6sX.js} +13 -5
- package/build/component.styles-BoBaG6sX.js.map +1 -0
- package/build/component.styles-BrGPrrEb.cjs +39 -0
- package/build/component.styles-BrGPrrEb.cjs.map +1 -0
- package/build/{component.styles-ZtwHuL4x.cjs → component.styles-Bz2vyHqK.cjs} +5 -7
- package/build/component.styles-Bz2vyHqK.cjs.map +1 -0
- package/build/{component.styles-CVBpx4fw.js → component.styles-BzNkEurr.js} +13 -13
- package/build/component.styles-BzNkEurr.js.map +1 -0
- package/build/component.styles-CLn52hJD.cjs +14 -0
- package/build/component.styles-CLn52hJD.cjs.map +1 -0
- package/build/{component.styles-DOPCUXcr.js → component.styles-CRWn1pVi.js} +11 -13
- package/build/component.styles-CRWn1pVi.js.map +1 -0
- package/build/{component.styles-CmEFZfA5.js → component.styles-CccZrbSA.js} +53 -42
- package/build/component.styles-CccZrbSA.js.map +1 -0
- package/build/component.styles-CdtZm7bl.cjs +165 -0
- package/build/component.styles-CdtZm7bl.cjs.map +1 -0
- package/build/{component.styles-BapdQNhL.js → component.styles-CiGPOpxk.js} +5 -5
- package/build/component.styles-CiGPOpxk.js.map +1 -0
- package/build/component.styles-CvJK1eif.cjs +230 -0
- package/build/component.styles-CvJK1eif.cjs.map +1 -0
- package/build/component.styles-D6KuudL3.js +1372 -0
- package/build/component.styles-D6KuudL3.js.map +1 -0
- package/build/{component.styles-DyGfo9t0.cjs → component.styles-DDUGBJle.cjs} +2 -2
- package/build/{component.styles-DyGfo9t0.cjs.map → component.styles-DDUGBJle.cjs.map} +1 -1
- package/build/{component.styles-CTo5NC52.js → component.styles-DMBvhmz6.js} +4 -4
- package/build/{component.styles-CTo5NC52.js.map → component.styles-DMBvhmz6.js.map} +1 -1
- package/build/component.styles-DWoybqna.cjs +137 -0
- package/build/component.styles-DWoybqna.cjs.map +1 -0
- package/build/component.styles-DhI3n-dL.js +213 -0
- package/build/component.styles-DhI3n-dL.js.map +1 -0
- package/build/{component.styles-DxeG9Opm.cjs → component.styles-DjLSmx3e.cjs} +2 -2
- package/build/{component.styles-DxeG9Opm.cjs.map → component.styles-DjLSmx3e.cjs.map} +1 -1
- package/build/component.styles-DqTkSP8L.js +1023 -0
- package/build/component.styles-DqTkSP8L.js.map +1 -0
- package/build/{component.styles-Dok17vPl.js → component.styles-DuIrUV9k.js} +2 -2
- package/build/{component.styles-Dok17vPl.js.map → component.styles-DuIrUV9k.js.map} +1 -1
- package/build/component.styles-DwdN7mQq.cjs +99 -0
- package/build/component.styles-DwdN7mQq.cjs.map +1 -0
- package/build/{component.styles-CV7jTFCg.js → component.styles-iWM1hPGZ.js} +62 -31
- package/build/component.styles-iWM1hPGZ.js.map +1 -0
- package/build/{component.styles-CZu2m0O4.cjs → component.styles-q4ne6jV1.cjs} +2 -2
- package/build/{component.styles-CZu2m0O4.cjs.map → component.styles-q4ne6jV1.cjs.map} +1 -1
- package/build/{component.styles-C6LohBfF.js → component.styles-uPfiNBIy.js} +3 -3
- package/build/{component.styles-C6LohBfF.js.map → component.styles-uPfiNBIy.js.map} +1 -1
- package/build/component.styles-vcNQJK0U.cjs +65 -0
- package/build/component.styles-vcNQJK0U.cjs.map +1 -0
- package/build/component.styles-w3iWQMCq.cjs +13 -0
- package/build/component.styles-w3iWQMCq.cjs.map +1 -0
- package/build/consts.cjs.js.map +1 -1
- package/build/consts.es.js.map +1 -1
- package/build/context-app.cjs.js +1 -1
- package/build/context-app.es.js +1 -1
- package/build/context-dialog.cjs.js +1 -1
- package/build/context-dialog.es.js +1 -1
- package/build/context-sonner.cjs.js +1 -1
- package/build/context-sonner.es.js +1 -1
- package/build/{context.constants-DqYjo5m4.js → context.constants-BAz35AJw.js} +5 -5
- package/build/{context.constants-DqYjo5m4.js.map → context.constants-BAz35AJw.js.map} +1 -1
- package/build/{context.constants-B29-_8v3.cjs → context.constants-BJPyze-d.cjs} +2 -2
- package/build/{context.constants-B29-_8v3.cjs.map → context.constants-BJPyze-d.cjs.map} +1 -1
- package/build/{context.constants-CsZRZ7gH.js → context.constants-COR-ReeN.js} +2 -2
- package/build/{context.constants-CsZRZ7gH.js.map → context.constants-COR-ReeN.js.map} +1 -1
- package/build/{context.constants-BaD7xj_m.cjs → context.constants-fwK8ogSf.cjs} +2 -2
- package/build/{context.constants-BaD7xj_m.cjs.map → context.constants-fwK8ogSf.cjs.map} +1 -1
- package/build/{context.hooks-gyzZSaVi.js → context.hooks-Bs1dD25S.js} +4 -4
- package/build/{context.hooks-gyzZSaVi.js.map → context.hooks-Bs1dD25S.js.map} +1 -1
- package/build/{context.hooks-CTi-CVKx.cjs → context.hooks-KAyS_7Pj.cjs} +3 -3
- package/build/{context.hooks-CTi-CVKx.cjs.map → context.hooks-KAyS_7Pj.cjs.map} +1 -1
- package/build/functions.cjs.js.map +1 -1
- package/build/functions.es.js +7 -4
- package/build/functions.es.js.map +1 -1
- package/build/hooks-use-deep-compare-memoize.d.ts +1 -1
- package/build/index.cjs.js +1 -1
- package/build/index.d.ts +289 -227
- package/build/index.es.js +133 -139
- package/build/{style-CEGJOjRW.js → style-Bvt_Melk.js} +32 -12
- package/build/style-Bvt_Melk.js.map +1 -0
- package/build/{style-DeAgDHyI.js → style-DjCgiI7l.js} +3 -3
- package/build/{style-DeAgDHyI.js.map → style-DjCgiI7l.js.map} +1 -1
- package/build/style-add.cjs.js +1 -1
- package/build/style-add.d.ts +11 -1
- package/build/style-add.es.js +6 -4
- package/build/{style-CtGd1JVB.cjs → style-eIuUYu9x.cjs} +2 -2
- package/build/{style-CtGd1JVB.cjs.map → style-eIuUYu9x.cjs.map} +1 -1
- package/build/style-error.cjs.js +1 -1
- package/build/style-error.es.js +1 -1
- package/build/{style-Dm74EPGE.cjs → style-f3_KtJIt.cjs} +30 -14
- package/build/style-f3_KtJIt.cjs.map +1 -0
- package/build/style-theme.cjs.js +1 -1
- package/build/style-theme.es.js +1 -1
- package/build/{theme.global-bN9HlSWE.js → theme.global-B46v_8eu.js} +2 -1
- package/build/{theme.global-bN9HlSWE.js.map → theme.global-B46v_8eu.js.map} +1 -1
- package/build/{theme.global-D6XU05Et.cjs → theme.global-BdZkriPJ.cjs} +2 -1
- package/build/{theme.global-D6XU05Et.cjs.map → theme.global-BdZkriPJ.cjs.map} +1 -1
- package/build/{use-BVj4dgbW.js → use-B6rT81uF.js} +6 -6
- package/build/{use-BVj4dgbW.js.map → use-B6rT81uF.js.map} +1 -1
- package/build/{use-BhofoOgk.cjs → use-BnaBipTR.cjs} +2 -2
- package/build/{use-BhofoOgk.cjs.map → use-BnaBipTR.cjs.map} +1 -1
- package/build/use-C1l0O0Qo.cjs.map +1 -1
- package/build/use-DT0XgvJT.js.map +1 -1
- package/package.json +2 -12
- package/build/area-ClrrGVJG.cjs +0 -40
- package/build/area-ClrrGVJG.cjs.map +0 -1
- package/build/area-DfCAwCiZ.js.map +0 -1
- package/build/component-BnI7BIp-.cjs +0 -2
- package/build/component-BnI7BIp-.cjs.map +0 -1
- package/build/component-C2JFFh-k.js.map +0 -1
- package/build/component-C52VCES6.cjs.map +0 -1
- package/build/component-CuiUpH8H.js.map +0 -1
- package/build/component-D1NPhRuV.cjs +0 -90
- package/build/component-D1NPhRuV.cjs.map +0 -1
- package/build/component-DZxbW_Jz.js.map +0 -1
- package/build/component.constants-D9wVZ3zy.cjs +0 -22
- package/build/component.constants-D9wVZ3zy.cjs.map +0 -1
- package/build/component.constants-DbNhxh0k.js.map +0 -1
- package/build/component.styles-B1DIataj.cjs +0 -10
- package/build/component.styles-B1DIataj.cjs.map +0 -1
- package/build/component.styles-BFwkFWkd.cjs +0 -39
- package/build/component.styles-BFwkFWkd.cjs.map +0 -1
- package/build/component.styles-BSEA2Dqn.cjs +0 -8
- package/build/component.styles-BSEA2Dqn.cjs.map +0 -1
- package/build/component.styles-BapdQNhL.js.map +0 -1
- package/build/component.styles-BfvB83xM.cjs.map +0 -1
- package/build/component.styles-Bn6ylF83.js +0 -859
- package/build/component.styles-Bn6ylF83.js.map +0 -1
- package/build/component.styles-BsZIuwWJ.cjs +0 -140
- package/build/component.styles-BsZIuwWJ.cjs.map +0 -1
- package/build/component.styles-CEBh8X5q.js +0 -20
- package/build/component.styles-CEBh8X5q.js.map +0 -1
- package/build/component.styles-CPsxMKVK.cjs +0 -73
- package/build/component.styles-CPsxMKVK.cjs.map +0 -1
- package/build/component.styles-CV7jTFCg.js.map +0 -1
- package/build/component.styles-CVBpx4fw.js.map +0 -1
- package/build/component.styles-CmBcHREH.cjs +0 -13
- package/build/component.styles-CmBcHREH.cjs.map +0 -1
- package/build/component.styles-CmEFZfA5.js.map +0 -1
- package/build/component.styles-DHIw8p8e.cjs +0 -158
- package/build/component.styles-DHIw8p8e.cjs.map +0 -1
- package/build/component.styles-DOPCUXcr.js.map +0 -1
- package/build/component.styles-Dj3h7jd9.cjs +0 -165
- package/build/component.styles-Dj3h7jd9.cjs.map +0 -1
- package/build/component.styles-Do1NYZEO.js.map +0 -1
- package/build/component.styles-DpkFoWEh.cjs +0 -81
- package/build/component.styles-DpkFoWEh.cjs.map +0 -1
- package/build/component.styles-DqsBDAEo.js +0 -202
- package/build/component.styles-DqsBDAEo.js.map +0 -1
- package/build/component.styles-Du2y0R4W.js +0 -177
- package/build/component.styles-Du2y0R4W.js.map +0 -1
- package/build/component.styles-RkQwTlwG.js.map +0 -1
- package/build/component.styles-ZtwHuL4x.cjs.map +0 -1
- package/build/style-CEGJOjRW.js.map +0 -1
- package/build/style-Dm74EPGE.cjs.map +0 -1
|
@@ -1,859 +0,0 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports } from "./jsx-runtime-BrDlu8eK.js";
|
|
2
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
3
|
-
import { AnimatePresence, motion } from "framer-motion";
|
|
4
|
-
import moment from "moment";
|
|
5
|
-
import { memo, useState, useRef, useMemo, useCallback, useEffect } from "react";
|
|
6
|
-
import { c as Button } from "./component-DZxbW_Jz.js";
|
|
7
|
-
import { ListLanguage, MapThemeList } from "./consts.es.js";
|
|
8
|
-
import { b as ErrorMessage } from "./style-DeAgDHyI.js";
|
|
9
|
-
import { K as KEY_SIZE_DATA } from "./theme.global-bN9HlSWE.js";
|
|
10
|
-
import styled, { css } from "styled-components";
|
|
11
|
-
import { e as StyledInputCSS, g as StyledMotionInput } from "./component.styles-Du2y0R4W.js";
|
|
12
|
-
import { h as addRemoveOutline, g as addBorder, b as addTransition, a as addRemoveScrollbar } from "./style-CEGJOjRW.js";
|
|
13
|
-
import { a as addSX } from "./style-plT9Ah7t.js";
|
|
14
|
-
import { I as Icon } from "./component.styles-BapdQNhL.js";
|
|
15
|
-
const DEFAULT_MAX_VIEW = 5;
|
|
16
|
-
const DEFAULT_MIN_VIEW = 5;
|
|
17
|
-
const DEFAULT_OVERSCAN = 1;
|
|
18
|
-
const DEFAULT_LABEL_EMPTY_OPTION = "No options";
|
|
19
|
-
const Select = (props) => {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
21
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
22
|
-
const [isAnimating, setIsAnimating] = useState(false);
|
|
23
|
-
const [isAll, setIsAll] = useState(((_b = (_a = props == null ? void 0 : props.footer) == null ? void 0 : _a.selectAll) == null ? void 0 : _b.defaultValue) ?? false);
|
|
24
|
-
const refInput = useRef(null);
|
|
25
|
-
const parentListRef = useRef(null);
|
|
26
|
-
const wrapperRef = useRef(null);
|
|
27
|
-
const maxViewLength = useMemo(() => props.maxView ?? DEFAULT_MAX_VIEW, [props.maxView]);
|
|
28
|
-
const minViewLength = useMemo(() => props.minView ?? DEFAULT_MIN_VIEW, [props.minView]);
|
|
29
|
-
const optionsLength = useMemo(() => props.option.length, [props.option.length]);
|
|
30
|
-
const isFooter = useMemo(() => !!(props == null ? void 0 : props.footer), [props.footer]);
|
|
31
|
-
const isErase = useMemo(() => {
|
|
32
|
-
var _a2;
|
|
33
|
-
return !!((_a2 = props == null ? void 0 : props.footer) == null ? void 0 : _a2.erase);
|
|
34
|
-
}, [props.footer]);
|
|
35
|
-
const isSelectAll = useMemo(() => {
|
|
36
|
-
var _a2;
|
|
37
|
-
return !!((_a2 = props == null ? void 0 : props.footer) == null ? void 0 : _a2.selectAll);
|
|
38
|
-
}, [props.footer]);
|
|
39
|
-
const sizeHeight = useMemo(() => KEY_SIZE_DATA[props.size].height, [props.size]);
|
|
40
|
-
const height = useMemo(
|
|
41
|
-
() => sizeHeight * (optionsLength < maxViewLength ? optionsLength < minViewLength ? minViewLength : optionsLength : maxViewLength) + (isFooter ? sizeHeight : 0),
|
|
42
|
-
[sizeHeight, optionsLength, maxViewLength, minViewLength, isFooter]
|
|
43
|
-
);
|
|
44
|
-
const radius = useMemo(() => KEY_SIZE_DATA[props.size].radius, [props.size]);
|
|
45
|
-
const isSelectedItem = useCallback(
|
|
46
|
-
(option) => {
|
|
47
|
-
return isAll || (props.value ?? []).includes(option);
|
|
48
|
-
},
|
|
49
|
-
[isAll, props.value]
|
|
50
|
-
);
|
|
51
|
-
const handleEraseOnClick = useCallback(
|
|
52
|
-
(event) => {
|
|
53
|
-
var _a2, _b2;
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
event.stopPropagation();
|
|
56
|
-
if ((_b2 = (_a2 = props.footer) == null ? void 0 : _a2.erase) == null ? void 0 : _b2.onCLick) {
|
|
57
|
-
props.footer.erase.onCLick();
|
|
58
|
-
} else {
|
|
59
|
-
props.onChange([]);
|
|
60
|
-
}
|
|
61
|
-
setIsAll(false);
|
|
62
|
-
},
|
|
63
|
-
[props]
|
|
64
|
-
);
|
|
65
|
-
const handleSelectAllOnClick = useCallback(
|
|
66
|
-
(event) => {
|
|
67
|
-
var _a2, _b2, _c2, _d2, _e2;
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
event.stopPropagation();
|
|
70
|
-
if (((_a2 = props == null ? void 0 : props.inputProps) == null ? void 0 : _a2.value) !== "") {
|
|
71
|
-
return props.onChange(props.option);
|
|
72
|
-
}
|
|
73
|
-
if (isAll) {
|
|
74
|
-
setIsAll(false);
|
|
75
|
-
props.onChange(props.option);
|
|
76
|
-
} else {
|
|
77
|
-
if ((_c2 = (_b2 = props.footer) == null ? void 0 : _b2.selectAll) == null ? void 0 : _c2.onCLick) {
|
|
78
|
-
(_e2 = (_d2 = props.footer) == null ? void 0 : _d2.selectAll) == null ? void 0 : _e2.onCLick();
|
|
79
|
-
} else {
|
|
80
|
-
setIsAll(true);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
[isAll, props]
|
|
85
|
-
);
|
|
86
|
-
const handleOnBlurEasy = useCallback(() => {
|
|
87
|
-
var _a2, _b2;
|
|
88
|
-
setIsOpen(false);
|
|
89
|
-
(_a2 = wrapperRef == null ? void 0 : wrapperRef.current) == null ? void 0 : _a2.blur();
|
|
90
|
-
(_b2 = refInput == null ? void 0 : refInput.current) == null ? void 0 : _b2.blur();
|
|
91
|
-
}, []);
|
|
92
|
-
const handleOnBlur = useCallback(
|
|
93
|
-
(event) => {
|
|
94
|
-
var _a2;
|
|
95
|
-
if (props == null ? void 0 : props.isDisabled) return;
|
|
96
|
-
if (event.relatedTarget && ((_a2 = parentListRef.current) == null ? void 0 : _a2.contains(event.relatedTarget))) return;
|
|
97
|
-
if (props.onBlur && event) props.onBlur(event);
|
|
98
|
-
handleOnBlurEasy();
|
|
99
|
-
},
|
|
100
|
-
[handleOnBlurEasy, props]
|
|
101
|
-
);
|
|
102
|
-
const handleOptionOnClick = useCallback(
|
|
103
|
-
(option) => {
|
|
104
|
-
if (props.isOnClickOptionClose) {
|
|
105
|
-
handleOnBlurEasy();
|
|
106
|
-
}
|
|
107
|
-
if (props.isMulti) {
|
|
108
|
-
if (isAll) {
|
|
109
|
-
const index = props.option.findIndex((selectedItems) => selectedItems.value === option.value);
|
|
110
|
-
const newValue = [...props.option.slice(0, index), ...props.option.slice(index + 1)];
|
|
111
|
-
props.onChange(newValue);
|
|
112
|
-
} else {
|
|
113
|
-
const index = props.value.findIndex((selectedItems) => selectedItems.value === option.value);
|
|
114
|
-
if (index === -1 && (!props.maxView || props.value.length < props.maxView)) {
|
|
115
|
-
const newValues = [...props.value ?? [], option];
|
|
116
|
-
props.onChange(newValues);
|
|
117
|
-
if (newValues.length == props.option.length) {
|
|
118
|
-
return setIsAll(true);
|
|
119
|
-
}
|
|
120
|
-
} else if (index !== -1) {
|
|
121
|
-
const newValue = [...props.value.slice(0, index), ...props.value.slice(index + 1)];
|
|
122
|
-
props.onChange(newValue);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
props.onChange([option]);
|
|
127
|
-
}
|
|
128
|
-
return setIsAll(false);
|
|
129
|
-
},
|
|
130
|
-
[handleOnBlurEasy, isAll, props]
|
|
131
|
-
);
|
|
132
|
-
const handleListOptionOpenEffect = useCallback(() => {
|
|
133
|
-
setIsAnimating(false);
|
|
134
|
-
setIsOpen(true);
|
|
135
|
-
}, []);
|
|
136
|
-
const handleOnOpen = useCallback(() => {
|
|
137
|
-
setIsAnimating(false);
|
|
138
|
-
setIsOpen(true);
|
|
139
|
-
}, []);
|
|
140
|
-
const handleOnFocusEasy = useCallback(() => {
|
|
141
|
-
if (isAnimating) return;
|
|
142
|
-
if (isOpen) return;
|
|
143
|
-
setIsAnimating(true);
|
|
144
|
-
handleOnOpen();
|
|
145
|
-
}, [handleOnOpen, isAnimating, isOpen]);
|
|
146
|
-
const handleOnFocus = useCallback(
|
|
147
|
-
(event) => {
|
|
148
|
-
if (props == null ? void 0 : props.isDisabled) return;
|
|
149
|
-
if (props.onFocus) props.onFocus(event);
|
|
150
|
-
handleOnFocusEasy();
|
|
151
|
-
},
|
|
152
|
-
[handleOnFocusEasy, props]
|
|
153
|
-
);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
if (isOpen) handleOnOpen();
|
|
156
|
-
}, [height]);
|
|
157
|
-
const handleMouseDown = useCallback((event) => {
|
|
158
|
-
if (parentListRef.current && parentListRef.current.contains(event.target)) {
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
}
|
|
161
|
-
}, []);
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
164
|
-
return () => {
|
|
165
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
166
|
-
};
|
|
167
|
-
}, [handleMouseDown]);
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
const handleClickOutside = (event) => {
|
|
170
|
-
if (parentListRef.current && refInput.current && !parentListRef.current.contains(event.target) && !refInput.current.contains(event.target)) {
|
|
171
|
-
handleOnBlurEasy();
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
175
|
-
return () => {
|
|
176
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
177
|
-
};
|
|
178
|
-
}, [handleOnBlurEasy]);
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
if (isOpen) {
|
|
181
|
-
handleListOptionOpenEffect();
|
|
182
|
-
}
|
|
183
|
-
}, [handleListOptionOpenEffect, isOpen, props.option]);
|
|
184
|
-
const listVirtualizer = useVirtualizer({
|
|
185
|
-
count: optionsLength,
|
|
186
|
-
estimateSize: props.getEstimateSize ? props.getEstimateSize : () => sizeHeight,
|
|
187
|
-
getScrollElement: () => parentListRef.current,
|
|
188
|
-
overscan: DEFAULT_OVERSCAN,
|
|
189
|
-
paddingEnd: isFooter ? sizeHeight : 0
|
|
190
|
-
});
|
|
191
|
-
const handleFetchNextPage = useCallback(
|
|
192
|
-
(containerRefElement) => {
|
|
193
|
-
if (containerRefElement) {
|
|
194
|
-
const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
|
|
195
|
-
if (scrollHeight - scrollTop - clientHeight < height && !props.isFetching && props.fetchNextPage) {
|
|
196
|
-
props.fetchNextPage();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
[height, props]
|
|
201
|
-
);
|
|
202
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
203
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
204
|
-
SelectWrapper,
|
|
205
|
-
{
|
|
206
|
-
$size: props.size,
|
|
207
|
-
$genre: props.genre,
|
|
208
|
-
$sx: props.sx,
|
|
209
|
-
$radius: radius,
|
|
210
|
-
$isDisabled: props == null ? void 0 : props.isDisabled,
|
|
211
|
-
$parentListHeight: isOpen ? height : 0,
|
|
212
|
-
onFocus: handleOnFocus,
|
|
213
|
-
onBlur: handleOnBlur,
|
|
214
|
-
ref: wrapperRef,
|
|
215
|
-
animate: {
|
|
216
|
-
zIndex: isOpen ? "10" : "auto",
|
|
217
|
-
"--after-height": isOpen ? `${height + 1}px` : `0px`
|
|
218
|
-
},
|
|
219
|
-
transition: { duration: 0.2 },
|
|
220
|
-
children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
222
|
-
SelectStyledInput,
|
|
223
|
-
{
|
|
224
|
-
tabIndex: 0,
|
|
225
|
-
id: props.id,
|
|
226
|
-
name: props.name,
|
|
227
|
-
$genre: props.genre,
|
|
228
|
-
$size: props.size,
|
|
229
|
-
placeholder: props.placeholder,
|
|
230
|
-
$error: props == null ? void 0 : props.error,
|
|
231
|
-
$isLoading: (_c = props == null ? void 0 : props.inputProps) == null ? void 0 : _c.isLoading,
|
|
232
|
-
$isNiceNumber: (_d = props == null ? void 0 : props.inputProps) == null ? void 0 : _d.isNiceNumber,
|
|
233
|
-
$postfixChildren: (_e = props == null ? void 0 : props.inputProps) == null ? void 0 : _e.postfixChildren,
|
|
234
|
-
$prefixChildren: (_f = props.inputProps) == null ? void 0 : _f.prefixChildren,
|
|
235
|
-
$isBold: (_g = props == null ? void 0 : props.inputProps) == null ? void 0 : _g.isBold,
|
|
236
|
-
$isCenter: (_h = props == null ? void 0 : props.inputProps) == null ? void 0 : _h.isCenter,
|
|
237
|
-
$sx: (_i = props == null ? void 0 : props.inputProps) == null ? void 0 : _i.sx,
|
|
238
|
-
disabled: props == null ? void 0 : props.isDisabled,
|
|
239
|
-
$isDisabled: props == null ? void 0 : props.isDisabled,
|
|
240
|
-
readOnly: (_j = props == null ? void 0 : props.inputProps) == null ? void 0 : _j.isReadOnly,
|
|
241
|
-
required: (_k = props == null ? void 0 : props.inputProps) == null ? void 0 : _k.isRequired,
|
|
242
|
-
defaultValue: (_l = props == null ? void 0 : props.inputProps) == null ? void 0 : _l.defaultValue,
|
|
243
|
-
value: ((_m = props == null ? void 0 : props.inputProps) == null ? void 0 : _m.value) ?? "",
|
|
244
|
-
type: (_n = props == null ? void 0 : props.inputProps) == null ? void 0 : _n.type,
|
|
245
|
-
onChange: (event) => {
|
|
246
|
-
var _a2, _b2;
|
|
247
|
-
return ((_a2 = props == null ? void 0 : props.inputProps) == null ? void 0 : _a2.onChange) && ((_b2 = props == null ? void 0 : props.inputProps) == null ? void 0 : _b2.onChange(event.target.value));
|
|
248
|
-
},
|
|
249
|
-
onBlur: (_o = props == null ? void 0 : props.inputProps) == null ? void 0 : _o.onBlur,
|
|
250
|
-
onFocus: (_p = props == null ? void 0 : props.inputProps) == null ? void 0 : _p.onFocus,
|
|
251
|
-
onClick: handleOnFocusEasy,
|
|
252
|
-
animate: {
|
|
253
|
-
borderBottomLeftRadius: isOpen ? `0px` : `${radius}px`,
|
|
254
|
-
borderBottomRightRadius: isOpen ? `0px` : `${radius}px`
|
|
255
|
-
},
|
|
256
|
-
transition: { duration: 0.2 },
|
|
257
|
-
ref: refInput
|
|
258
|
-
}
|
|
259
|
-
),
|
|
260
|
-
props.isShowSelectInputIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
261
|
-
SelectInputIcon,
|
|
262
|
-
{
|
|
263
|
-
size: props.size,
|
|
264
|
-
type: "id",
|
|
265
|
-
name: "Select",
|
|
266
|
-
$genre: props.genre,
|
|
267
|
-
$checked: isOpen,
|
|
268
|
-
$size: props.size,
|
|
269
|
-
tabIndex: -1
|
|
270
|
-
}
|
|
271
|
-
),
|
|
272
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
273
|
-
DropdownListParent,
|
|
274
|
-
{
|
|
275
|
-
ref: parentListRef,
|
|
276
|
-
$genre: props.genre,
|
|
277
|
-
$isShowScroll: optionsLength > maxViewLength,
|
|
278
|
-
$isFooter: isFooter,
|
|
279
|
-
$size: props.size,
|
|
280
|
-
onScroll: (e) => handleFetchNextPage(e.target),
|
|
281
|
-
initial: { opacity: 0, height: 0 },
|
|
282
|
-
animate: {
|
|
283
|
-
height: `${height + 1}px`,
|
|
284
|
-
display: "flex",
|
|
285
|
-
opacity: 1,
|
|
286
|
-
zIndex: "1"
|
|
287
|
-
},
|
|
288
|
-
exit: {
|
|
289
|
-
height: "0px",
|
|
290
|
-
display: "none",
|
|
291
|
-
opacity: 0,
|
|
292
|
-
zIndex: "auto"
|
|
293
|
-
},
|
|
294
|
-
transition: { duration: 0.2 },
|
|
295
|
-
style: {
|
|
296
|
-
maxHeight: `${height + 1}px`
|
|
297
|
-
},
|
|
298
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
299
|
-
DropdownList,
|
|
300
|
-
{
|
|
301
|
-
style: {
|
|
302
|
-
height: `${listVirtualizer.getTotalSize()}px`,
|
|
303
|
-
minHeight: `${height}px`
|
|
304
|
-
},
|
|
305
|
-
children: [
|
|
306
|
-
!props.isEmptyOption ? listVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
307
|
-
const item = props.option[virtualRow.index];
|
|
308
|
-
const checked = isSelectedItem(item);
|
|
309
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
310
|
-
ContainerDropdownOption,
|
|
311
|
-
{
|
|
312
|
-
checked,
|
|
313
|
-
onClick: () => handleOptionOnClick(item),
|
|
314
|
-
virtualRowSize: virtualRow.size,
|
|
315
|
-
virtualRowStart: virtualRow.start,
|
|
316
|
-
label: item.label,
|
|
317
|
-
genre: props.genre,
|
|
318
|
-
size: props.size,
|
|
319
|
-
isShowDropdownOptionIcon: props.isShowDropdownOptionIcon,
|
|
320
|
-
...props.optionProps
|
|
321
|
-
},
|
|
322
|
-
virtualRow.index
|
|
323
|
-
);
|
|
324
|
-
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
325
|
-
ContainerDropdownOption,
|
|
326
|
-
{
|
|
327
|
-
isNotShowHoverStyle: true,
|
|
328
|
-
checked: false,
|
|
329
|
-
onClick: () => {
|
|
330
|
-
},
|
|
331
|
-
virtualRowSize: ((_q = props == null ? void 0 : props.getEstimateSize) == null ? void 0 : _q.call(props, 0)) ?? sizeHeight,
|
|
332
|
-
virtualRowStart: 0,
|
|
333
|
-
label: props.labelEmptyOption ?? DEFAULT_LABEL_EMPTY_OPTION,
|
|
334
|
-
genre: props.genre,
|
|
335
|
-
size: props.size,
|
|
336
|
-
...props.optionProps,
|
|
337
|
-
isShowDropdownOptionIcon: props.isShowDropdownOptionIcon
|
|
338
|
-
},
|
|
339
|
-
0
|
|
340
|
-
),
|
|
341
|
-
isFooter && /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownFooter, { $isErase: isErase, $isSelectAll: isSelectAll, $genre: props.genre, $size: props.size, children: [
|
|
342
|
-
props.footer.selectAll && /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownSelectAll, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
343
|
-
Button,
|
|
344
|
-
{
|
|
345
|
-
isFullSize: true,
|
|
346
|
-
genre: props.genre,
|
|
347
|
-
onClick: handleSelectAllOnClick,
|
|
348
|
-
size: "medium",
|
|
349
|
-
isHiddenBorder: true,
|
|
350
|
-
children: props.footer.selectAll.label
|
|
351
|
-
}
|
|
352
|
-
) }),
|
|
353
|
-
props.footer.erase && /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownErase, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
354
|
-
Button,
|
|
355
|
-
{
|
|
356
|
-
isFullSize: true,
|
|
357
|
-
genre: props.genre,
|
|
358
|
-
onClick: handleEraseOnClick,
|
|
359
|
-
size: "medium",
|
|
360
|
-
isHiddenBorder: true,
|
|
361
|
-
children: props.footer.erase.label
|
|
362
|
-
}
|
|
363
|
-
) })
|
|
364
|
-
] })
|
|
365
|
-
]
|
|
366
|
-
}
|
|
367
|
-
)
|
|
368
|
-
}
|
|
369
|
-
) : null })
|
|
370
|
-
]
|
|
371
|
-
}
|
|
372
|
-
),
|
|
373
|
-
(props == null ? void 0 : props.error) ? /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorMessage, { ...props.error, size: (props == null ? void 0 : props.error.size) ?? props.size }) : null
|
|
374
|
-
] });
|
|
375
|
-
};
|
|
376
|
-
const ContainerDropdownOptionComponent = (params) => {
|
|
377
|
-
const handleKeyDown = (event) => {
|
|
378
|
-
if (event.key === "Enter") {
|
|
379
|
-
params.onClick();
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
383
|
-
DropdownOption,
|
|
384
|
-
{
|
|
385
|
-
tabIndex: 0,
|
|
386
|
-
onClick: params.onClick,
|
|
387
|
-
onKeyDown: handleKeyDown,
|
|
388
|
-
$error: params.error,
|
|
389
|
-
$isCenter: params.isCenter,
|
|
390
|
-
$isNotShowHoverStyle: params.isNotShowHoverStyle,
|
|
391
|
-
$isLoading: params.isLoading,
|
|
392
|
-
$postfixChildren: params.postfixChildren,
|
|
393
|
-
$prefixChildren: params.prefixChildren,
|
|
394
|
-
$genre: params.genre,
|
|
395
|
-
$size: params.size,
|
|
396
|
-
$isBold: params.isBold,
|
|
397
|
-
$checked: params.checked,
|
|
398
|
-
style: {
|
|
399
|
-
height: `${params.virtualRowSize}px`,
|
|
400
|
-
transform: `translateY(${params.virtualRowStart}px)`
|
|
401
|
-
},
|
|
402
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "relative", display: "contents" }, tabIndex: -1, "aria-hidden": "true", "aria-readonly": "true", children: [
|
|
403
|
-
params.label,
|
|
404
|
-
params.isShowDropdownOptionIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
405
|
-
DropdownOptionIcon,
|
|
406
|
-
{
|
|
407
|
-
tabIndex: -1,
|
|
408
|
-
size: params.size,
|
|
409
|
-
type: "checkbox",
|
|
410
|
-
name: "Arrow",
|
|
411
|
-
$genre: params.genre,
|
|
412
|
-
$checked: params.checked,
|
|
413
|
-
$size: params.size
|
|
414
|
-
}
|
|
415
|
-
),
|
|
416
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
417
|
-
DropdownOptionLayout,
|
|
418
|
-
{
|
|
419
|
-
$isNotShowHoverStyle: params.isNotShowHoverStyle,
|
|
420
|
-
$genre: params.genre,
|
|
421
|
-
$size: params.size,
|
|
422
|
-
$isBold: params.isBold,
|
|
423
|
-
$checked: params.checked
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
] })
|
|
427
|
-
}
|
|
428
|
-
);
|
|
429
|
-
};
|
|
430
|
-
const ContainerDropdownOption = memo(ContainerDropdownOptionComponent);
|
|
431
|
-
const SelectLanguage = (props) => {
|
|
432
|
-
const option = ListLanguage;
|
|
433
|
-
const [viewOption, setViewOption] = useState(option);
|
|
434
|
-
const [query, setQuery] = useState("");
|
|
435
|
-
const [isEmptyOption, setIsEmptyOption] = useState(false);
|
|
436
|
-
const handleSelectChange = (option2) => {
|
|
437
|
-
var _a;
|
|
438
|
-
props.onChange((_a = option2[0]) == null ? void 0 : _a.value.toString());
|
|
439
|
-
setQuery("");
|
|
440
|
-
};
|
|
441
|
-
const handleQueryChange = useCallback(
|
|
442
|
-
(value2) => {
|
|
443
|
-
setQuery(value2);
|
|
444
|
-
props.onChange("");
|
|
445
|
-
if (value2 === "") {
|
|
446
|
-
setIsEmptyOption(option.length === 0);
|
|
447
|
-
setViewOption(option);
|
|
448
|
-
} else {
|
|
449
|
-
const filteredOptions = option.filter(
|
|
450
|
-
(option2) => Object.values(option2).some((field) => field == null ? void 0 : field.toString().toLowerCase().includes(value2.toLowerCase()))
|
|
451
|
-
);
|
|
452
|
-
setViewOption(filteredOptions);
|
|
453
|
-
setIsEmptyOption(filteredOptions.length === 0);
|
|
454
|
-
}
|
|
455
|
-
},
|
|
456
|
-
[option, props]
|
|
457
|
-
);
|
|
458
|
-
const [value, setValue] = useState(option.find((e) => e.value === props.value));
|
|
459
|
-
useEffect(() => {
|
|
460
|
-
if ((value == null ? void 0 : value.value) !== props.value) setValue(option.find((e) => e.value === props.value));
|
|
461
|
-
}, [option, props.value]);
|
|
462
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
463
|
-
Select,
|
|
464
|
-
{
|
|
465
|
-
...props,
|
|
466
|
-
option: viewOption,
|
|
467
|
-
isEmptyOption,
|
|
468
|
-
minView: 1,
|
|
469
|
-
maxView: 8,
|
|
470
|
-
isOnClickOptionClose: true,
|
|
471
|
-
value: value ? [value] : [],
|
|
472
|
-
onChange: handleSelectChange,
|
|
473
|
-
inputProps: {
|
|
474
|
-
...props.inputProps,
|
|
475
|
-
variety: "standard",
|
|
476
|
-
isReadOnly: true,
|
|
477
|
-
value: (value == null ? void 0 : value.placeholder) ?? query,
|
|
478
|
-
onChange: handleQueryChange
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
);
|
|
482
|
-
};
|
|
483
|
-
const SelectMonth = (props) => {
|
|
484
|
-
const { value, onChange, startDate, endDate, monthsLocale, isShortLabel } = props;
|
|
485
|
-
const year = moment(value).utc().year();
|
|
486
|
-
const months = useMemo(() => {
|
|
487
|
-
return monthsLocale.map((monthItem) => {
|
|
488
|
-
const monthIndex = moment().month(monthItem.value).month();
|
|
489
|
-
const monthMoment = moment.utc().year(year).month(monthIndex).startOf("month");
|
|
490
|
-
const isDisabled = startDate && monthMoment.isBefore(moment.utc(startDate), "month") || endDate && monthMoment.isAfter(moment.utc(endDate), "month");
|
|
491
|
-
return {
|
|
492
|
-
value: monthMoment.valueOf(),
|
|
493
|
-
label: isShortLabel ? monthItem.localeShort : monthItem.localeLong,
|
|
494
|
-
placeholder: isShortLabel ? monthItem.localeShort : monthItem.localeLong,
|
|
495
|
-
search: `${monthItem.localeLong.toLowerCase()}, ${monthIndex + 1}`,
|
|
496
|
-
isDisabled,
|
|
497
|
-
monthValue: monthItem.value
|
|
498
|
-
};
|
|
499
|
-
});
|
|
500
|
-
}, [monthsLocale, year, startDate, endDate, isShortLabel]);
|
|
501
|
-
const handleSelectChange = (option) => {
|
|
502
|
-
var _a, _b;
|
|
503
|
-
const selectedValue = Number((_a = option[0]) == null ? void 0 : _a.value);
|
|
504
|
-
const selectedMonthValue = moment((_b = option[0]) == null ? void 0 : _b.value).utc().month();
|
|
505
|
-
const currentMoment = moment(value).utc();
|
|
506
|
-
const currentYear = currentMoment.year();
|
|
507
|
-
const currentDay = currentMoment.date();
|
|
508
|
-
const newValue = moment().utc().year(currentYear).month(selectedMonthValue).date(currentDay).startOf("day");
|
|
509
|
-
if (newValue.isValid()) {
|
|
510
|
-
onChange(newValue.valueOf());
|
|
511
|
-
} else {
|
|
512
|
-
onChange(selectedValue);
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
const selectedMonth = useMemo(() => {
|
|
516
|
-
return months.find(
|
|
517
|
-
(month) => moment(value).utc().isSameOrAfter(moment(month.value).startOf("month")) && moment(value).utc().isBefore(moment(month.value).endOf("month"))
|
|
518
|
-
);
|
|
519
|
-
}, [months, value]);
|
|
520
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
521
|
-
Select,
|
|
522
|
-
{
|
|
523
|
-
...props,
|
|
524
|
-
option: months.filter((e) => !e.isDisabled),
|
|
525
|
-
minView: 1,
|
|
526
|
-
maxView: 5,
|
|
527
|
-
isOnClickOptionClose: true,
|
|
528
|
-
value: selectedMonth ? [selectedMonth] : [],
|
|
529
|
-
onChange: handleSelectChange,
|
|
530
|
-
inputProps: {
|
|
531
|
-
...props.inputProps,
|
|
532
|
-
isCenter: true,
|
|
533
|
-
variety: "standard",
|
|
534
|
-
value: (selectedMonth == null ? void 0 : selectedMonth.placeholder) ?? props.placeholder,
|
|
535
|
-
isReadOnly: true
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
);
|
|
539
|
-
};
|
|
540
|
-
const SelectYear = (props) => {
|
|
541
|
-
const { value, onChange, startDate, endDate, sortOrder = "desc" } = props;
|
|
542
|
-
const startYear = moment(startDate).utc().year();
|
|
543
|
-
const endYear = moment(endDate).utc().year();
|
|
544
|
-
const years = useMemo(() => {
|
|
545
|
-
const yearArray = Array.from({ length: endYear - startYear + 1 }, (_, index) => {
|
|
546
|
-
const year = startYear + index;
|
|
547
|
-
return {
|
|
548
|
-
value: moment().year(year).utc().startOf("year").valueOf(),
|
|
549
|
-
label: moment().year(year).utc().format("YYYY"),
|
|
550
|
-
placeholder: moment().year(year).utc().format("YYYY"),
|
|
551
|
-
search: `${moment().year(year).utc().format("YYYY").toLowerCase()}`
|
|
552
|
-
};
|
|
553
|
-
});
|
|
554
|
-
return sortOrder === "asc" ? yearArray.sort((a, b) => a.value - b.value) : yearArray.sort((a, b) => b.value - a.value);
|
|
555
|
-
}, [endYear, startYear, sortOrder]);
|
|
556
|
-
const handleSelectChange = (option) => {
|
|
557
|
-
var _a, _b;
|
|
558
|
-
const selectedValue = Number((_a = option[0]) == null ? void 0 : _a.value);
|
|
559
|
-
const selectedYearValue = moment((_b = option[0]) == null ? void 0 : _b.value).utc().year();
|
|
560
|
-
const currentMoment = moment(value).utc();
|
|
561
|
-
const currentMonth = currentMoment.month();
|
|
562
|
-
const currentDay = currentMoment.date();
|
|
563
|
-
const newValue = moment().utc().year(selectedYearValue).month(currentMonth).date(currentDay).startOf("day");
|
|
564
|
-
if (newValue.isValid()) {
|
|
565
|
-
onChange(newValue.valueOf());
|
|
566
|
-
} else {
|
|
567
|
-
onChange(selectedValue);
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
const selectedYear = useMemo(() => {
|
|
571
|
-
return years.find(
|
|
572
|
-
(year) => moment(value).utc().isSameOrAfter(moment(year.value)) && moment(value).utc().isBefore(moment(year.value).endOf("year"))
|
|
573
|
-
);
|
|
574
|
-
}, [years, value]);
|
|
575
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
576
|
-
Select,
|
|
577
|
-
{
|
|
578
|
-
...props,
|
|
579
|
-
option: years,
|
|
580
|
-
minView: 1,
|
|
581
|
-
maxView: 5,
|
|
582
|
-
isOnClickOptionClose: true,
|
|
583
|
-
value: selectedYear ? [selectedYear] : [],
|
|
584
|
-
onChange: handleSelectChange,
|
|
585
|
-
optionProps: {
|
|
586
|
-
isCenter: true,
|
|
587
|
-
variety: "standard",
|
|
588
|
-
...props.optionProps
|
|
589
|
-
},
|
|
590
|
-
inputProps: {
|
|
591
|
-
...props.inputProps,
|
|
592
|
-
isCenter: true,
|
|
593
|
-
isNiceNumber: true,
|
|
594
|
-
variety: "standard",
|
|
595
|
-
value: (selectedYear == null ? void 0 : selectedYear.placeholder) ?? props.placeholder,
|
|
596
|
-
isReadOnly: true
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
);
|
|
600
|
-
};
|
|
601
|
-
const SelectMapTheme = (props) => {
|
|
602
|
-
const options = useMemo(() => MapThemeList, []);
|
|
603
|
-
const optionsNormalize = useMemo(
|
|
604
|
-
() => MapThemeList.map((e) => ({ label: e.name, value: e.name, placeholder: e.name })),
|
|
605
|
-
[]
|
|
606
|
-
);
|
|
607
|
-
const [viewOption, setViewOption] = useState(optionsNormalize);
|
|
608
|
-
const [query, setQuery] = useState("");
|
|
609
|
-
const [isEmptyOption, setIsEmptyOption] = useState(false);
|
|
610
|
-
const handleSelectChange = (option) => {
|
|
611
|
-
const findOption = options.find((e) => e.name === option[0].value);
|
|
612
|
-
if (findOption) {
|
|
613
|
-
props.onChange(findOption);
|
|
614
|
-
} else {
|
|
615
|
-
props.onChange(null);
|
|
616
|
-
}
|
|
617
|
-
setQuery("");
|
|
618
|
-
};
|
|
619
|
-
const handleQueryChange = useCallback(
|
|
620
|
-
(value2) => {
|
|
621
|
-
setQuery(value2);
|
|
622
|
-
props.onChange(null);
|
|
623
|
-
if (value2 === "") {
|
|
624
|
-
setIsEmptyOption(optionsNormalize.length === 0);
|
|
625
|
-
setViewOption(optionsNormalize);
|
|
626
|
-
} else {
|
|
627
|
-
const filteredOptions = optionsNormalize.filter(
|
|
628
|
-
(option) => Object.values(option).some((field) => field == null ? void 0 : field.toString().toLowerCase().includes(value2.toLowerCase()))
|
|
629
|
-
);
|
|
630
|
-
setViewOption(filteredOptions);
|
|
631
|
-
setIsEmptyOption(filteredOptions.length === 0);
|
|
632
|
-
}
|
|
633
|
-
},
|
|
634
|
-
[optionsNormalize, props]
|
|
635
|
-
);
|
|
636
|
-
const [value, setValue] = useState(
|
|
637
|
-
optionsNormalize.find((e) => e.value === props.value.name)
|
|
638
|
-
);
|
|
639
|
-
useEffect(() => {
|
|
640
|
-
if ((value == null ? void 0 : value.value) !== props.value.name) setValue(optionsNormalize.find((e) => e.value === props.value.name));
|
|
641
|
-
}, [options, props.value]);
|
|
642
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
643
|
-
Select,
|
|
644
|
-
{
|
|
645
|
-
...props,
|
|
646
|
-
option: viewOption,
|
|
647
|
-
isEmptyOption,
|
|
648
|
-
minView: 1,
|
|
649
|
-
maxView: 8,
|
|
650
|
-
isOnClickOptionClose: true,
|
|
651
|
-
value: value ? [value] : [],
|
|
652
|
-
onChange: handleSelectChange,
|
|
653
|
-
inputProps: {
|
|
654
|
-
...props.inputProps,
|
|
655
|
-
variety: "standard",
|
|
656
|
-
isReadOnly: true,
|
|
657
|
-
value: (value == null ? void 0 : value.placeholder) ?? query,
|
|
658
|
-
onChange: handleQueryChange
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
);
|
|
662
|
-
};
|
|
663
|
-
const SelectWrapper = styled(motion.div)`
|
|
664
|
-
width: 100%;
|
|
665
|
-
position: relative;
|
|
666
|
-
height: fit-content;
|
|
667
|
-
${(props) => !props.$isDisabled && css`
|
|
668
|
-
&:focus-within {
|
|
669
|
-
&:after {
|
|
670
|
-
content: '';
|
|
671
|
-
position: absolute;
|
|
672
|
-
top: -1px;
|
|
673
|
-
left: -1px;
|
|
674
|
-
bottom: -1px;
|
|
675
|
-
right: -1px;
|
|
676
|
-
outline: 2px ${props.theme.states.focus} solid;
|
|
677
|
-
outline-offset: 1px;
|
|
678
|
-
border-radius: ${`${props.$radius + 1}px`};
|
|
679
|
-
pointer-events: none;
|
|
680
|
-
height: calc(100% + var(--after-height) + 2px);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
`}
|
|
684
|
-
|
|
685
|
-
outline: none !important;
|
|
686
|
-
|
|
687
|
-
&:focus-visible {
|
|
688
|
-
outline: none !important;
|
|
689
|
-
}
|
|
690
|
-
${addSX};
|
|
691
|
-
`;
|
|
692
|
-
const DropdownListParentSize = css`
|
|
693
|
-
${(props) => props.$size && DropdownListParentSizeConstructor(KEY_SIZE_DATA[props.$size])};
|
|
694
|
-
`;
|
|
695
|
-
const DropdownListParentSizeConstructor = (props) => css`
|
|
696
|
-
border-radius: 0px 0px ${props.radius}px ${props.radius}px;
|
|
697
|
-
`;
|
|
698
|
-
const DropdownListParent = styled(motion.div)`
|
|
699
|
-
outline: none;
|
|
700
|
-
display: none;
|
|
701
|
-
|
|
702
|
-
height: 0px;
|
|
703
|
-
width: 100%;
|
|
704
|
-
|
|
705
|
-
position: absolute;
|
|
706
|
-
|
|
707
|
-
overflow: hidden;
|
|
708
|
-
overflow-y: auto;
|
|
709
|
-
|
|
710
|
-
margin: 0;
|
|
711
|
-
padding: 0;
|
|
712
|
-
|
|
713
|
-
background: ${(props) => props.theme.colors.input[props.$genre].background.rest};
|
|
714
|
-
border: solid 1px ${(props) => props.theme.colors.input[props.$genre].border.rest};
|
|
715
|
-
border-top: 0px !important;
|
|
716
|
-
${DropdownListParentSize};
|
|
717
|
-
${(props) => !props.$isShowScroll && addRemoveScrollbar};
|
|
718
|
-
`;
|
|
719
|
-
const DropdownList = styled.ul`
|
|
720
|
-
list-style: none;
|
|
721
|
-
|
|
722
|
-
position: relative;
|
|
723
|
-
|
|
724
|
-
display: flex;
|
|
725
|
-
flex-direction: column;
|
|
726
|
-
|
|
727
|
-
width: 100%;
|
|
728
|
-
|
|
729
|
-
transform: translateZ(0);
|
|
730
|
-
`;
|
|
731
|
-
const DropdownOption = styled.li`
|
|
732
|
-
${StyledInputCSS};
|
|
733
|
-
width: 100%;
|
|
734
|
-
border: 0px;
|
|
735
|
-
display: flex;
|
|
736
|
-
align-items: center;
|
|
737
|
-
border-radius: 0;
|
|
738
|
-
opacity: 1;
|
|
739
|
-
${addRemoveOutline};
|
|
740
|
-
${addBorder};
|
|
741
|
-
&:last-child {
|
|
742
|
-
border-radius: 0px 0px ${(props) => KEY_SIZE_DATA[props.$size].radius}px
|
|
743
|
-
${(props) => KEY_SIZE_DATA[props.$size].radius}px;
|
|
744
|
-
}
|
|
745
|
-
cursor: pointer;
|
|
746
|
-
position: absolute;
|
|
747
|
-
top: 0;
|
|
748
|
-
left: 0;
|
|
749
|
-
`;
|
|
750
|
-
const DropdownOptionHoverAndCheckedSize = css`
|
|
751
|
-
${(props) => DropdownOptionHoverAndCheckedSizeConstructor(KEY_SIZE_DATA[props.$size])};
|
|
752
|
-
`;
|
|
753
|
-
const DropdownOptionHoverAndCheckedSizeConstructor = (props) => css`
|
|
754
|
-
width: calc(100% - ${props.padding - 6}px);
|
|
755
|
-
height: calc(100% - ${props.padding - 4}px);
|
|
756
|
-
border-radius: ${props.radius}px;
|
|
757
|
-
`;
|
|
758
|
-
const DropdownOptionLayout = styled.div`
|
|
759
|
-
position: absolute;
|
|
760
|
-
width: 100%;
|
|
761
|
-
height: 100%;
|
|
762
|
-
margin-left: auto;
|
|
763
|
-
margin-right: auto;
|
|
764
|
-
left: 0;
|
|
765
|
-
right: 0;
|
|
766
|
-
${DropdownOptionHoverAndCheckedSize};
|
|
767
|
-
border-style: solid;
|
|
768
|
-
border-width: 1px;
|
|
769
|
-
border-color: transparent;
|
|
770
|
-
|
|
771
|
-
${addTransition};
|
|
772
|
-
|
|
773
|
-
${(props) => !props.$isNotShowHoverStyle && css`
|
|
774
|
-
&:hover {
|
|
775
|
-
background: ${props.theme.colors.select[props.$genre].background.select};
|
|
776
|
-
color: ${props.theme.colors.select[props.$genre].color.select};
|
|
777
|
-
}
|
|
778
|
-
`}
|
|
779
|
-
${(props) => props.$checked && css`
|
|
780
|
-
background: ${props.theme.colors.select[props.$genre].background.select};
|
|
781
|
-
border-color: ${props.theme.colors.select[props.$genre].border.select};
|
|
782
|
-
color: ${props.theme.colors.select[props.$genre].color.select};
|
|
783
|
-
`}
|
|
784
|
-
`;
|
|
785
|
-
const DropdownOptionIconSize = css`
|
|
786
|
-
${(props) => DropdownOptionIconSizeConstructor(KEY_SIZE_DATA[props.$size])};
|
|
787
|
-
`;
|
|
788
|
-
const DropdownOptionIconSizeConstructor = (props) => css`
|
|
789
|
-
right: ${props.padding - 6}px;
|
|
790
|
-
height: ${props.height}px;
|
|
791
|
-
`;
|
|
792
|
-
const DropdownOptionIcon = styled(Icon)`
|
|
793
|
-
position: absolute;
|
|
794
|
-
right: 0;
|
|
795
|
-
height: 100%;
|
|
796
|
-
align-items: center;
|
|
797
|
-
${DropdownOptionIconSize};
|
|
798
|
-
color: ${(props) => props.$checked ? props.theme.colors.select[props.$genre].border.select : props.theme.colors.input[props.$genre].border.rest};
|
|
799
|
-
`;
|
|
800
|
-
const SelectInputIcon = styled(Icon)`
|
|
801
|
-
position: absolute;
|
|
802
|
-
user-select: none;
|
|
803
|
-
pointer-events: none;
|
|
804
|
-
right: 0;
|
|
805
|
-
top: 0;
|
|
806
|
-
align-items: center;
|
|
807
|
-
${DropdownOptionIconSize};
|
|
808
|
-
color: ${(props) => props.$checked ? props.theme.colors.select[props.$genre].border.select : props.theme.colors.input[props.$genre].border.rest};
|
|
809
|
-
`;
|
|
810
|
-
const DropdownFooter = styled.li`
|
|
811
|
-
${StyledInputCSS};
|
|
812
|
-
display: flex;
|
|
813
|
-
align-items: center;
|
|
814
|
-
border-radius: 0;
|
|
815
|
-
opacity: 1;
|
|
816
|
-
border: 0px;
|
|
817
|
-
cursor: pointer;
|
|
818
|
-
position: sticky;
|
|
819
|
-
bottom: 0;
|
|
820
|
-
padding: 0px;
|
|
821
|
-
flex-shrink: 0;
|
|
822
|
-
margin-top: auto;
|
|
823
|
-
`;
|
|
824
|
-
const DropdownErase = styled.div`
|
|
825
|
-
margin-left: auto;
|
|
826
|
-
height: 100%;
|
|
827
|
-
`;
|
|
828
|
-
const DropdownSelectAll = styled.div`
|
|
829
|
-
margin-right: auto;
|
|
830
|
-
height: 100%;
|
|
831
|
-
`;
|
|
832
|
-
const SelectStyledInput = styled(StyledMotionInput)`
|
|
833
|
-
${addRemoveOutline};
|
|
834
|
-
${addSX};
|
|
835
|
-
`;
|
|
836
|
-
export {
|
|
837
|
-
ContainerDropdownOption as C,
|
|
838
|
-
DropdownListParentSize as D,
|
|
839
|
-
Select as S,
|
|
840
|
-
SelectLanguage as a,
|
|
841
|
-
SelectMonth as b,
|
|
842
|
-
SelectYear as c,
|
|
843
|
-
SelectMapTheme as d,
|
|
844
|
-
SelectWrapper as e,
|
|
845
|
-
DropdownListParentSizeConstructor as f,
|
|
846
|
-
DropdownListParent as g,
|
|
847
|
-
DropdownList as h,
|
|
848
|
-
DropdownOption as i,
|
|
849
|
-
DropdownOptionHoverAndCheckedSize as j,
|
|
850
|
-
DropdownOptionHoverAndCheckedSizeConstructor as k,
|
|
851
|
-
DropdownOptionLayout as l,
|
|
852
|
-
DropdownOptionIcon as m,
|
|
853
|
-
SelectInputIcon as n,
|
|
854
|
-
DropdownFooter as o,
|
|
855
|
-
DropdownErase as p,
|
|
856
|
-
DropdownSelectAll as q,
|
|
857
|
-
SelectStyledInput as r
|
|
858
|
-
};
|
|
859
|
-
//# sourceMappingURL=component.styles-Bn6ylF83.js.map
|