react-kui 3.1.2 → 3.2.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.zh-CN.md +3 -1
- package/ai/kui-components.json +918 -324
- package/es/_virtual/_rolldown/runtime.js +1 -1
- package/es/affix/index.js +1 -1
- package/es/alert/index.js +11 -4
- package/es/anchor/anchor-context.js +1 -1
- package/es/anchor/anchor-link.js +1 -1
- package/es/anchor/anchor.js +1 -1
- package/es/auto-complete/index.js +371 -347
- package/es/avatar/avatar-group-context.js +1 -1
- package/es/avatar/avatar-group.js +1 -1
- package/es/avatar/avatar.js +1 -1
- package/es/back-top/index.js +1 -1
- package/es/badge/index.js +10 -8
- package/es/base/teleport.js +1 -1
- package/es/base/transition-props.js +1 -1
- package/es/base/transition.js +1 -1
- package/es/breadcrumb/breadcrumb-context.js +1 -1
- package/es/breadcrumb/breadcrumb-item.js +1 -1
- package/es/breadcrumb/breadcrumb.js +1 -1
- package/es/button/button-group-context.js +1 -1
- package/es/button/button-group.js +1 -1
- package/es/button/button.js +13 -6
- package/es/calendar/index.js +20 -6
- package/es/card/index.js +11 -4
- package/es/carousel/carousel-context.js +1 -1
- package/es/carousel/carousel-item.js +1 -1
- package/es/carousel/carousel.js +1 -1
- package/es/carousel/drag.js +1 -1
- package/es/cascader/index.js +13 -10
- package/es/check-card/check-card-group.js +3 -3
- package/es/check-card/check-card.js +155 -141
- package/es/check-card/context.js +1 -1
- package/es/checkbox/checkbox-group-context.js +1 -1
- package/es/checkbox/checkbox-group.js +3 -3
- package/es/checkbox/checkbox.js +64 -244
- package/es/checkbox/index.js +1 -1
- package/es/collapse/collapse-panel.js +1 -1
- package/es/collapse/collapse.js +96 -82
- package/es/color-picker/alpha.js +1 -1
- package/es/color-picker/hue.js +1 -1
- package/es/color-picker/index.js +7 -7
- package/es/color-picker/mode.js +2 -2
- package/es/color-picker/paint.js +1 -1
- package/es/color-picker/presets.js +1 -1
- package/es/components.js +4 -4
- package/es/config/config-context.js +16 -3
- package/es/config/context.js +29 -2
- package/es/config/index.js +31 -12
- package/es/config/popup-host.js +106 -0
- package/es/config/size-context.js +1 -1
- package/es/config/use-config-appearance.js +62 -2
- package/es/const/var.js +6 -2
- package/es/date-picker/index.js +404 -885
- package/es/descriptions/descriptions-item.js +1 -1
- package/es/descriptions/descriptions.js +1 -1
- package/es/divider/index.js +1 -1
- package/es/drawer/index.js +328 -240
- package/es/dropdown/dropdown-button.js +69 -51
- package/es/dropdown/dropdown-context.js +1 -1
- package/es/dropdown/dropdown.js +137 -93
- package/es/dropdown/trigger.js +85 -33
- package/es/empty/index.js +3 -4
- package/es/feature-card/index.js +15 -4
- package/es/feedback-panel/index.js +95 -81
- package/es/flame-wrap/index.js +116 -109
- package/es/flame-wrap/types.js +54 -6
- package/es/flex/index.js +1 -1
- package/es/form/field-context.js +16 -2
- package/es/form/form-context.js +1 -1
- package/es/form/form-item.js +7 -6
- package/es/form/form.js +1 -1
- package/es/form/utils.js +1 -1
- package/es/grid/grid-item.js +1 -1
- package/es/grid/grid.js +1 -1
- package/es/grid/useBreakpoint.js +1 -1
- package/es/icon/index.js +1 -1
- package/es/image/group.js +1 -1
- package/es/image/image-group-context.js +1 -1
- package/es/image/image.js +137 -123
- package/es/image/instance.js +1 -1
- package/es/image/preview.js +1 -1
- package/es/image/utils.js +1 -1
- package/es/index.js +3 -3
- package/es/input/index.js +3 -3
- package/es/input/input-base.js +7 -7
- package/es/input/input-box.js +2 -2
- package/es/input/input-group.js +43 -127
- package/es/input/input.js +1 -1
- package/es/input/textarea.js +28 -114
- package/es/input-number/index.js +7 -5
- package/es/input-otp/index.js +5 -5
- package/es/input-tag/index.js +5 -5
- package/es/kanban/index.js +79 -63
- package/es/layout/index.js +1 -1
- package/es/layout/layout-context.js +1 -1
- package/es/list-panel/index.js +96 -83
- package/es/loading/index.js +1 -1
- package/es/loading/loading-bar.js +1 -1
- package/es/locale/de.js +10 -2
- package/es/locale/el.js +10 -2
- package/es/locale/en.js +10 -2
- package/es/locale/fr.js +10 -2
- package/es/locale/it.js +10 -2
- package/es/locale/ja.js +10 -2
- package/es/locale/ko.js +10 -2
- package/es/locale/ru.js +10 -2
- package/es/locale/th.js +10 -2
- package/es/locale/uk.js +10 -2
- package/es/locale/vi.js +10 -2
- package/es/locale/zh-CN.js +10 -2
- package/es/locale/zh-TW.js +10 -2
- package/es/mentions/index.js +291 -286
- package/es/menu/menu-context.js +1 -1
- package/es/menu/menu-divider.js +1 -1
- package/es/menu/menu-group.js +1 -1
- package/es/menu/menu-item.js +1 -1
- package/es/menu/menu-keyboard.js +41 -2
- package/es/menu/menu.js +268 -222
- package/es/menu/recursive-menu.js +1 -1
- package/es/menu/sub-menu.js +81 -23
- package/es/message/index.js +1 -1
- package/es/modal/api.js +46 -12
- package/es/modal/modal.js +441 -345
- package/es/modal/toast.js +177 -64
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
- package/es/notice/container.js +1 -1
- package/es/notice/content.js +1 -1
- package/es/notice/index.js +1 -1
- package/es/notice/instance.js +1 -1
- package/es/page/index.js +13 -8
- package/es/page/responsive.js +1 -1
- package/es/page-header/index.js +1 -1
- package/es/popconfirm/index.js +36 -35
- package/es/poptip/index.js +47 -45
- package/es/popup/index.js +5 -2
- package/es/popup/layers.js +11 -2
- package/es/progress/index.js +1 -1
- package/es/qrcode/index.js +13 -7
- package/es/radio/radio-button.js +51 -44
- package/es/radio/radio-group-context.js +1 -1
- package/es/radio/radio-group.js +49 -52
- package/es/radio/radio.js +46 -197
- package/es/rate/index.js +1 -1
- package/es/rate/star.js +1 -1
- package/es/result/index.js +1 -1
- package/es/ripple/index.js +104 -97
- package/es/ripple/types.js +71 -18
- package/es/row-col/col.js +1 -1
- package/es/row-col/row.js +1 -1
- package/es/segmented/index.js +112 -92
- package/es/select/option.js +1 -1
- package/es/select/select.js +29 -29
- package/es/skeleton/skeleton-avatar.js +1 -1
- package/es/skeleton/skeleton-button.js +1 -1
- package/es/skeleton/skeleton-image.js +1 -1
- package/es/skeleton/skeleton-text.js +1 -1
- package/es/skeleton/skeleton.js +1 -1
- package/es/skeleton/use-skeleton-loading.js +1 -1
- package/es/slider/index.js +1 -1
- package/es/slider/thumb.js +1 -1
- package/es/space/index.js +1 -1
- package/es/spin/index.js +1 -1
- package/es/splitter/splitter-panel.js +1 -1
- package/es/splitter/splitter.js +1 -1
- package/es/stat-card/countup.js +2 -2
- package/es/stat-card/rollup.js +1 -1
- package/es/stat-card/stat-card.js +16 -7
- package/es/stat-card/stat-number.js +4 -3
- package/es/stat-card/utils/countup.js +1 -1
- package/es/stat-card/utils/odometer.js +1 -1
- package/es/stat-card/utils/stat-item-key.js +22 -0
- package/es/steps/index.js +1 -1
- package/es/switch/index.js +3 -3
- package/es/table/column-setting.js +104 -115
- package/es/table/index.js +556 -207
- package/es/table/utils.js +140 -3
- package/es/tabs/tab-panel.js +1 -1
- package/es/tabs/tabs.js +1 -1
- package/es/tag/index.js +12 -5
- package/es/time-line/timeline-item.js +1 -1
- package/es/time-line/timeline.js +1 -1
- package/es/tooltip/index.js +114 -94
- package/es/tour/index.js +1 -1
- package/es/transfer/index.js +190 -172
- package/es/tree/index.js +55 -44
- package/es/tree/utils.js +1 -1
- package/es/tree-select/index.js +259 -781
- package/es/typography/index.js +1 -1
- package/es/upload/file-list.js +1 -1
- package/es/upload/index.js +5 -6
- package/es/upload/picture-sort.js +1 -1
- package/es/upload/selector.js +1 -1
- package/es/utils/checked.js +1 -1
- package/es/utils/color.js +25 -2
- package/es/utils/css.js +19 -0
- package/es/utils/focus.js +63 -0
- package/es/utils/number.js +1 -1
- package/es/utils/overlay-order.js +18 -0
- package/es/utils/overlay-stack.js +33 -0
- package/es/utils/placement.js +1 -1
- package/es/utils/popup.js +1 -1
- package/es/utils/promise.js +18 -0
- package/es/utils/react-node.js +55 -30
- package/es/utils/selection-tags.js +6 -4
- package/es/utils/share.js +5 -2
- package/es/utils/theme.js +1 -1
- package/es/utils/transition.js +1 -1
- package/es/utils/use-value.js +1 -1
- package/es/virtual-list/index.js +1 -1
- package/es/virtual-list/range.js +3 -2
- package/es/watermark/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +2 -2
- package/lib/locale/el.cjs +2 -2
- package/lib/locale/en.cjs +2 -2
- package/lib/locale/fr.cjs +2 -2
- package/lib/locale/it.cjs +2 -2
- package/lib/locale/ja.cjs +2 -2
- package/lib/locale/ko.cjs +2 -2
- package/lib/locale/ru.cjs +2 -2
- package/lib/locale/th.cjs +2 -2
- package/lib/locale/uk.cjs +2 -2
- package/lib/locale/vi.cjs +2 -2
- package/lib/locale/zh-CN.cjs +2 -2
- package/lib/locale/zh-TW.cjs +2 -2
- package/package.json +4 -3
- package/readme.md +3 -1
- package/style/base.css +2 -2
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +2 -2
- package/types/alert/index.d.cts +2 -2
- package/types/alert/index.d.ts +2 -2
- package/types/auto-complete/index.d.cts +7 -1
- package/types/auto-complete/index.d.ts +7 -1
- package/types/badge/index.d.cts +2 -1
- package/types/badge/index.d.ts +2 -1
- package/types/button/button.d.cts +2 -2
- package/types/button/button.d.ts +2 -2
- package/types/card/index.d.cts +3 -3
- package/types/card/index.d.ts +3 -3
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/cascader/types.d.cts +2 -0
- package/types/cascader/types.d.ts +2 -0
- package/types/check-card/context.d.cts +4 -3
- package/types/check-card/context.d.ts +4 -3
- package/types/check-card/index.d.cts +1 -1
- package/types/check-card/index.d.ts +1 -1
- package/types/check-card/types.d.cts +3 -4
- package/types/check-card/types.d.ts +3 -4
- package/types/checkbox/checkbox-group.d.cts +2 -2
- package/types/checkbox/checkbox-group.d.ts +2 -2
- package/types/checkbox/checkbox.d.cts +2 -2
- package/types/checkbox/checkbox.d.ts +2 -2
- package/types/collapse/collapse.d.cts +3 -3
- package/types/collapse/collapse.d.ts +3 -3
- package/types/color-picker/index.d.cts +3 -1
- package/types/color-picker/index.d.ts +3 -1
- package/types/components.d.cts +2 -2
- package/types/components.d.ts +2 -2
- package/types/config/config-context.d.cts +15 -2
- package/types/config/config-context.d.ts +15 -2
- package/types/config/context.d.cts +6 -0
- package/types/config/context.d.ts +6 -0
- package/types/config/popup-host.d.cts +16 -0
- package/types/config/popup-host.d.ts +16 -0
- package/types/config/use-config-appearance.d.cts +41 -2
- package/types/config/use-config-appearance.d.ts +41 -2
- package/types/const/types.d.cts +30 -1
- package/types/const/types.d.ts +30 -1
- package/types/const/var.d.cts +6 -1
- package/types/const/var.d.ts +6 -1
- package/types/date-picker/index.d.cts +3 -1
- package/types/date-picker/index.d.ts +3 -1
- package/types/descriptions/descriptions.d.cts +2 -2
- package/types/descriptions/descriptions.d.ts +2 -2
- package/types/drawer/index.d.cts +1 -0
- package/types/drawer/index.d.ts +1 -0
- package/types/dropdown/dropdown-button.d.cts +5 -2
- package/types/dropdown/dropdown-button.d.ts +5 -2
- package/types/dropdown/dropdown-context.d.cts +6 -0
- package/types/dropdown/dropdown-context.d.ts +6 -0
- package/types/dropdown/dropdown.d.cts +2 -0
- package/types/dropdown/dropdown.d.ts +2 -0
- package/types/feature-card/index.d.cts +3 -3
- package/types/feature-card/index.d.ts +3 -3
- package/types/feedback-panel/index.d.cts +3 -3
- package/types/feedback-panel/index.d.ts +3 -3
- package/types/flame-wrap/types.d.cts +18 -0
- package/types/flame-wrap/types.d.ts +18 -0
- package/types/form/field-context.d.cts +2 -0
- package/types/form/field-context.d.ts +2 -0
- package/types/image/image.d.cts +2 -2
- package/types/image/image.d.ts +2 -2
- package/types/input/input-group.d.cts +2 -2
- package/types/input/input-group.d.ts +2 -2
- package/types/input-number/index.d.cts +2 -0
- package/types/input-number/index.d.ts +2 -0
- package/types/kanban/index.d.cts +3 -2
- package/types/kanban/index.d.ts +3 -2
- package/types/list-panel/index.d.cts +3 -3
- package/types/list-panel/index.d.ts +3 -3
- package/types/locale/de.d.cts +6 -0
- package/types/locale/de.d.ts +6 -0
- package/types/locale/el.d.cts +6 -0
- package/types/locale/el.d.ts +6 -0
- package/types/locale/en.d.cts +6 -0
- package/types/locale/en.d.ts +6 -0
- package/types/locale/fr.d.cts +6 -0
- package/types/locale/fr.d.ts +6 -0
- package/types/locale/it.d.cts +6 -0
- package/types/locale/it.d.ts +6 -0
- package/types/locale/ja.d.cts +6 -0
- package/types/locale/ja.d.ts +6 -0
- package/types/locale/ko.d.cts +6 -0
- package/types/locale/ko.d.ts +6 -0
- package/types/locale/ru.d.cts +6 -0
- package/types/locale/ru.d.ts +6 -0
- package/types/locale/th.d.cts +6 -0
- package/types/locale/th.d.ts +6 -0
- package/types/locale/uk.d.cts +6 -0
- package/types/locale/uk.d.ts +6 -0
- package/types/locale/vi.d.cts +6 -0
- package/types/locale/vi.d.ts +6 -0
- package/types/locale/zh-CN.d.cts +6 -0
- package/types/locale/zh-CN.d.ts +6 -0
- package/types/locale/zh-TW.d.cts +6 -0
- package/types/locale/zh-TW.d.ts +6 -0
- package/types/mentions/index.d.cts +2 -0
- package/types/mentions/index.d.ts +2 -0
- package/types/menu/menu-keyboard.d.cts +23 -0
- package/types/menu/menu-keyboard.d.ts +23 -0
- package/types/modal/api.d.cts +6 -1
- package/types/modal/api.d.ts +6 -1
- package/types/modal/modal.d.cts +1 -0
- package/types/modal/modal.d.ts +1 -0
- package/types/modal/toast.d.cts +8 -2
- package/types/modal/toast.d.ts +8 -2
- package/types/page/index.d.cts +2 -2
- package/types/page/index.d.ts +2 -2
- package/types/popconfirm/index.d.cts +2 -0
- package/types/popconfirm/index.d.ts +2 -0
- package/types/poptip/index.d.cts +2 -0
- package/types/poptip/index.d.ts +2 -0
- package/types/popup/layers.d.cts +2 -0
- package/types/popup/layers.d.ts +2 -0
- package/types/qrcode/index.d.cts +2 -2
- package/types/qrcode/index.d.ts +2 -2
- package/types/radio/radio-button.d.cts +2 -2
- package/types/radio/radio-button.d.ts +2 -2
- package/types/radio/radio-group.d.cts +2 -2
- package/types/radio/radio-group.d.ts +2 -2
- package/types/radio/radio.d.cts +2 -2
- package/types/radio/radio.d.ts +2 -2
- package/types/ripple/types.d.cts +18 -0
- package/types/ripple/types.d.ts +18 -0
- package/types/segmented/index.d.cts +2 -1
- package/types/segmented/index.d.ts +2 -1
- package/types/select/select.d.cts +2 -0
- package/types/select/select.d.ts +2 -0
- package/types/stat-card/stat-card.d.cts +3 -3
- package/types/stat-card/stat-card.d.ts +3 -3
- package/types/stat-card/utils/stat-item-key.d.cts +11 -0
- package/types/stat-card/utils/stat-item-key.d.ts +11 -0
- package/types/table/column-setting.d.cts +4 -4
- package/types/table/column-setting.d.ts +4 -4
- package/types/table/index.d.cts +2 -2
- package/types/table/index.d.ts +2 -2
- package/types/table/types.d.cts +21 -2
- package/types/table/types.d.ts +21 -2
- package/types/table/utils.d.cts +75 -0
- package/types/table/utils.d.ts +75 -0
- package/types/tag/index.d.cts +2 -2
- package/types/tag/index.d.ts +2 -2
- package/types/tooltip/index.d.cts +2 -0
- package/types/tooltip/index.d.ts +2 -0
- package/types/transfer/index.d.cts +3 -2
- package/types/transfer/index.d.ts +3 -2
- package/types/tree-select/index.d.cts +3 -1
- package/types/tree-select/index.d.ts +3 -1
- package/types/utils/checked.d.cts +1 -1
- package/types/utils/checked.d.ts +1 -1
- package/types/utils/color.d.cts +13 -0
- package/types/utils/color.d.ts +13 -0
- package/types/utils/css.d.cts +2 -0
- package/types/utils/css.d.ts +2 -0
- package/types/utils/focus.d.cts +5 -0
- package/types/utils/focus.d.ts +5 -0
- package/types/utils/overlay-order.d.cts +6 -0
- package/types/utils/overlay-order.d.ts +6 -0
- package/types/utils/overlay-stack.d.cts +13 -0
- package/types/utils/overlay-stack.d.ts +13 -0
- package/types/utils/promise.d.cts +5 -0
- package/types/utils/promise.d.ts +5 -0
- package/types/utils/react-node.d.cts +10 -0
- package/types/utils/react-node.d.ts +10 -0
package/es/checkbox/checkbox.js
CHANGED
|
@@ -1,289 +1,109 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { resolvePaintedTheme, useFormAppearance } from "../config/use-config-appearance.js";
|
|
10
10
|
import { Check } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
11
11
|
import Icon from "../icon/index.js";
|
|
12
12
|
import { useValue } from "../utils/use-value.js";
|
|
13
13
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
14
14
|
import { getValueWithType } from "../utils/checked.js";
|
|
15
15
|
import { CheckboxGroupContext } from "./checkbox-group-context.js";
|
|
16
|
-
import { c } from "react/compiler-runtime";
|
|
17
16
|
import clsx from "clsx";
|
|
18
17
|
import { useContext, useLayoutEffect, useRef } from "react";
|
|
19
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
19
|
//#region components/checkbox/checkbox.tsx
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let ariaInvalid;
|
|
25
|
-
let ariaLabelledby;
|
|
26
|
-
let ariaRequired;
|
|
27
|
-
let checked;
|
|
28
|
-
let children;
|
|
29
|
-
let id;
|
|
30
|
-
let label;
|
|
31
|
-
let onChange;
|
|
32
|
-
let onClick;
|
|
33
|
-
let rest;
|
|
34
|
-
let sizeProp;
|
|
35
|
-
let t1;
|
|
36
|
-
let t2;
|
|
37
|
-
let t3;
|
|
38
|
-
let t4;
|
|
39
|
-
let t5;
|
|
40
|
-
let themeProp;
|
|
41
|
-
let value;
|
|
42
|
-
if ($[0] !== t0) {
|
|
43
|
-
({checked, valueType: t1, value, label, theme: themeProp, disabled: t2, readOnly: t3, indeterminate: t4, size: sizeProp, onChange, children, className: t5, id, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onClick, ...rest} = t0);
|
|
44
|
-
$[0] = t0;
|
|
45
|
-
$[1] = ariaDescribedby;
|
|
46
|
-
$[2] = ariaInvalid;
|
|
47
|
-
$[3] = ariaLabelledby;
|
|
48
|
-
$[4] = ariaRequired;
|
|
49
|
-
$[5] = checked;
|
|
50
|
-
$[6] = children;
|
|
51
|
-
$[7] = id;
|
|
52
|
-
$[8] = label;
|
|
53
|
-
$[9] = onChange;
|
|
54
|
-
$[10] = onClick;
|
|
55
|
-
$[11] = rest;
|
|
56
|
-
$[12] = sizeProp;
|
|
57
|
-
$[13] = t1;
|
|
58
|
-
$[14] = t2;
|
|
59
|
-
$[15] = t3;
|
|
60
|
-
$[16] = t4;
|
|
61
|
-
$[17] = t5;
|
|
62
|
-
$[18] = themeProp;
|
|
63
|
-
$[19] = value;
|
|
64
|
-
} else {
|
|
65
|
-
ariaDescribedby = $[1];
|
|
66
|
-
ariaInvalid = $[2];
|
|
67
|
-
ariaLabelledby = $[3];
|
|
68
|
-
ariaRequired = $[4];
|
|
69
|
-
checked = $[5];
|
|
70
|
-
children = $[6];
|
|
71
|
-
id = $[7];
|
|
72
|
-
label = $[8];
|
|
73
|
-
onChange = $[9];
|
|
74
|
-
onClick = $[10];
|
|
75
|
-
rest = $[11];
|
|
76
|
-
sizeProp = $[12];
|
|
77
|
-
t1 = $[13];
|
|
78
|
-
t2 = $[14];
|
|
79
|
-
t3 = $[15];
|
|
80
|
-
t4 = $[16];
|
|
81
|
-
t5 = $[17];
|
|
82
|
-
themeProp = $[18];
|
|
83
|
-
value = $[19];
|
|
84
|
-
}
|
|
85
|
-
const valueType = t1 === void 0 ? "boolean" : t1;
|
|
86
|
-
const disabled = t2 === void 0 ? false : t2;
|
|
87
|
-
const readOnly = t3 === void 0 ? false : t3;
|
|
88
|
-
const indeterminate = t4 === void 0 ? false : t4;
|
|
89
|
-
const className = t5 === void 0 ? "" : t5;
|
|
90
|
-
const inheritedAppearance = useConfigAppearance();
|
|
91
|
-
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
20
|
+
var PAINTED_THEMES = ["fill", "outline"];
|
|
21
|
+
var Checkbox = ({ checked, valueType = "boolean", value, label, theme: themeProp, disabled = false, readOnly = false, indeterminate = false, size: sizeProp, onChange, children, className = "", id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, onClick, ...rest }) => {
|
|
22
|
+
const inheritedAppearance = useFormAppearance();
|
|
92
23
|
const size = sizeProp ?? inheritedAppearance.size;
|
|
93
24
|
const group = useContext(CheckboxGroupContext);
|
|
94
25
|
const inputRef = useRef(null);
|
|
95
26
|
const isGroup = !!group;
|
|
96
27
|
const groupChecked = isGroup && group.value ? group.value.indexOf(value) > -1 : false;
|
|
97
|
-
const [localChecked, setLocalChecked] = useValue(checked,
|
|
28
|
+
const [localChecked, setLocalChecked] = useValue(checked, (next) => next ?? false);
|
|
98
29
|
const isChecked = isGroup ? groupChecked : localChecked;
|
|
99
30
|
const currentDisabled = disabled || isGroup && group.disabled;
|
|
100
31
|
const currentReadOnly = readOnly || Boolean(isGroup && group.readOnly);
|
|
101
|
-
const currentTheme = themeProp ?? group?.theme ?? theme;
|
|
32
|
+
const currentTheme = resolvePaintedTheme(themeProp ?? group?.theme ?? inheritedAppearance.theme, PAINTED_THEMES) ?? "fill";
|
|
102
33
|
const currentSize = sizeProp ?? group?.size ?? size;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
value: isGroup ? value : getValueWithType(newChecked, valueType),
|
|
111
|
-
label: labelVal
|
|
112
|
-
};
|
|
113
|
-
onChange?.(eventObj);
|
|
114
|
-
group?.onChange?.(eventObj);
|
|
34
|
+
const emitValue = (newChecked) => {
|
|
35
|
+
if (!isGroup) setLocalChecked(newChecked);
|
|
36
|
+
const labelVal = label ?? children ?? (typeof value === "string" || typeof value === "number" ? value : void 0);
|
|
37
|
+
const eventObj = {
|
|
38
|
+
checked: newChecked,
|
|
39
|
+
value: isGroup ? value : getValueWithType(newChecked, valueType),
|
|
40
|
+
label: labelVal
|
|
115
41
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
$[32] = t7;
|
|
137
|
-
} else t7 = $[32];
|
|
138
|
-
const handleInputChange = t7;
|
|
139
|
-
let t8;
|
|
140
|
-
if ($[33] !== indeterminate) {
|
|
141
|
-
t8 = () => {
|
|
142
|
-
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
143
|
-
};
|
|
144
|
-
$[33] = indeterminate;
|
|
145
|
-
$[34] = t8;
|
|
146
|
-
} else t8 = $[34];
|
|
147
|
-
useLayoutEffect(t8);
|
|
148
|
-
const t9 = currentTheme === "fill";
|
|
149
|
-
const t10 = isChecked && !indeterminate;
|
|
150
|
-
const t11 = currentSize === "small";
|
|
151
|
-
const t12 = currentSize === "large";
|
|
152
|
-
let t13;
|
|
153
|
-
if ($[35] !== className || $[36] !== currentDisabled || $[37] !== currentReadOnly || $[38] !== indeterminate || $[39] !== t10 || $[40] !== t11 || $[41] !== t12 || $[42] !== t9) {
|
|
154
|
-
t13 = clsx("k-checkbox", {
|
|
155
|
-
"k-checkbox-fill": t9,
|
|
156
|
-
"k-checkbox-disabled": currentDisabled,
|
|
157
|
-
"k-checkbox-readonly": currentReadOnly,
|
|
158
|
-
"k-checkbox-checked": t10,
|
|
159
|
-
"k-checkbox-indeterminate": indeterminate,
|
|
160
|
-
"k-checkbox-sm": t11,
|
|
161
|
-
"k-checkbox-lg": t12
|
|
162
|
-
}, className);
|
|
163
|
-
$[35] = className;
|
|
164
|
-
$[36] = currentDisabled;
|
|
165
|
-
$[37] = currentReadOnly;
|
|
166
|
-
$[38] = indeterminate;
|
|
167
|
-
$[39] = t10;
|
|
168
|
-
$[40] = t11;
|
|
169
|
-
$[41] = t12;
|
|
170
|
-
$[42] = t9;
|
|
171
|
-
$[43] = t13;
|
|
172
|
-
} else t13 = $[43];
|
|
173
|
-
const rootClasses = t13;
|
|
174
|
-
let t14;
|
|
175
|
-
if ($[44] !== indeterminate || $[45] !== isChecked) {
|
|
176
|
-
t14 = isChecked && !indeterminate ? /* @__PURE__ */ jsx(Icon, { type: Check }) : null;
|
|
177
|
-
$[44] = indeterminate;
|
|
178
|
-
$[45] = isChecked;
|
|
179
|
-
$[46] = t14;
|
|
180
|
-
} else t14 = $[46];
|
|
181
|
-
const innerNode = t14;
|
|
42
|
+
onChange?.(eventObj);
|
|
43
|
+
group?.onChange?.(eventObj);
|
|
44
|
+
};
|
|
45
|
+
const handleInputChange = (e) => {
|
|
46
|
+
if (currentDisabled || currentReadOnly) return;
|
|
47
|
+
emitValue(e.target.checked);
|
|
48
|
+
};
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
51
|
+
});
|
|
52
|
+
const rootClasses = clsx("k-checkbox", {
|
|
53
|
+
[`k-checkbox-${currentTheme}`]: true,
|
|
54
|
+
"k-checkbox-disabled": currentDisabled,
|
|
55
|
+
"k-checkbox-readonly": currentReadOnly,
|
|
56
|
+
"k-checkbox-checked": isChecked && !indeterminate,
|
|
57
|
+
"k-checkbox-indeterminate": indeterminate,
|
|
58
|
+
"k-checkbox-sm": currentSize === "small",
|
|
59
|
+
"k-checkbox-lg": currentSize === "large"
|
|
60
|
+
}, className);
|
|
61
|
+
const innerNode = isChecked && !indeterminate ? /* @__PURE__ */ jsx(Icon, { type: Check }) : null;
|
|
182
62
|
const labelNode = label ?? children;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
63
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
64
|
+
className: rootClasses,
|
|
65
|
+
"aria-readonly": currentReadOnly || void 0,
|
|
66
|
+
...rest,
|
|
67
|
+
onClick: (event) => {
|
|
187
68
|
if (currentDisabled) {
|
|
188
69
|
event.preventDefault();
|
|
189
70
|
event.stopPropagation();
|
|
190
71
|
return;
|
|
191
72
|
}
|
|
192
73
|
onClick?.(event);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
$[48] = onClick;
|
|
196
|
-
$[49] = t16;
|
|
197
|
-
} else t16 = $[49];
|
|
198
|
-
const t17 = indeterminate ? "mixed" : isChecked;
|
|
199
|
-
const t18 = currentReadOnly || void 0;
|
|
200
|
-
let t19;
|
|
201
|
-
if ($[50] !== currentReadOnly) {
|
|
202
|
-
t19 = (event_0) => {
|
|
203
|
-
if (currentReadOnly) event_0.preventDefault();
|
|
204
|
-
};
|
|
205
|
-
$[50] = currentReadOnly;
|
|
206
|
-
$[51] = t19;
|
|
207
|
-
} else t19 = $[51];
|
|
208
|
-
const t20 = !!isChecked;
|
|
209
|
-
let t21;
|
|
210
|
-
if ($[52] !== ariaDescribedby || $[53] !== ariaInvalid || $[54] !== ariaLabelledby || $[55] !== ariaRequired || $[56] !== currentDisabled || $[57] !== currentReadOnly || $[58] !== handleInputChange || $[59] !== id || $[60] !== t17 || $[61] !== t18 || $[62] !== t19 || $[63] !== t20) {
|
|
211
|
-
t21 = /* @__PURE__ */ jsx("input", {
|
|
212
|
-
id,
|
|
213
|
-
type: "checkbox",
|
|
214
|
-
ref: inputRef,
|
|
215
|
-
className: "k-checkbox-input",
|
|
216
|
-
disabled: currentDisabled,
|
|
217
|
-
readOnly: currentReadOnly,
|
|
218
|
-
"aria-checked": t17,
|
|
219
|
-
"aria-readonly": t18,
|
|
220
|
-
"aria-labelledby": ariaLabelledby,
|
|
221
|
-
"aria-describedby": ariaDescribedby,
|
|
222
|
-
"aria-invalid": ariaInvalid,
|
|
223
|
-
"aria-required": ariaRequired,
|
|
224
|
-
onClick: t19,
|
|
225
|
-
checked: t20,
|
|
226
|
-
onChange: handleInputChange
|
|
227
|
-
});
|
|
228
|
-
$[52] = ariaDescribedby;
|
|
229
|
-
$[53] = ariaInvalid;
|
|
230
|
-
$[54] = ariaLabelledby;
|
|
231
|
-
$[55] = ariaRequired;
|
|
232
|
-
$[56] = currentDisabled;
|
|
233
|
-
$[57] = currentReadOnly;
|
|
234
|
-
$[58] = handleInputChange;
|
|
235
|
-
$[59] = id;
|
|
236
|
-
$[60] = t17;
|
|
237
|
-
$[61] = t18;
|
|
238
|
-
$[62] = t19;
|
|
239
|
-
$[63] = t20;
|
|
240
|
-
$[64] = t21;
|
|
241
|
-
} else t21 = $[64];
|
|
242
|
-
let t22;
|
|
243
|
-
if ($[65] !== innerNode || $[66] !== t21) {
|
|
244
|
-
t22 = /* @__PURE__ */ jsxs("span", {
|
|
74
|
+
},
|
|
75
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
245
76
|
className: "k-checkbox-symbol",
|
|
246
|
-
children: [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
77
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
78
|
+
id,
|
|
79
|
+
type: "checkbox",
|
|
80
|
+
ref: inputRef,
|
|
81
|
+
className: "k-checkbox-input",
|
|
82
|
+
disabled: currentDisabled,
|
|
83
|
+
readOnly: currentReadOnly,
|
|
84
|
+
"aria-checked": indeterminate ? "mixed" : isChecked,
|
|
85
|
+
"aria-readonly": currentReadOnly || void 0,
|
|
86
|
+
"aria-label": ariaLabel,
|
|
87
|
+
"aria-labelledby": ariaLabelledby,
|
|
88
|
+
"aria-describedby": ariaDescribedby,
|
|
89
|
+
"aria-invalid": ariaInvalid,
|
|
90
|
+
"aria-required": ariaRequired,
|
|
91
|
+
onClick: (event_0) => {
|
|
92
|
+
if (currentReadOnly) event_0.preventDefault();
|
|
93
|
+
},
|
|
94
|
+
checked: !!isChecked,
|
|
95
|
+
onChange: handleInputChange
|
|
96
|
+
}), innerNode]
|
|
97
|
+
}), labelNode ? /* @__PURE__ */ jsx("span", {
|
|
255
98
|
className: "k-checkbox-label",
|
|
256
99
|
children: labelNode
|
|
257
|
-
}) : null
|
|
258
|
-
|
|
259
|
-
$[69] = t23;
|
|
260
|
-
} else t23 = $[69];
|
|
261
|
-
let t24;
|
|
262
|
-
if ($[70] !== rest || $[71] !== rootClasses || $[72] !== t15 || $[73] !== t16 || $[74] !== t22 || $[75] !== t23) {
|
|
263
|
-
t24 = /* @__PURE__ */ jsxs("label", {
|
|
264
|
-
className: rootClasses,
|
|
265
|
-
"aria-readonly": t15,
|
|
266
|
-
...rest,
|
|
267
|
-
onClick: t16,
|
|
268
|
-
children: [t22, t23]
|
|
269
|
-
});
|
|
270
|
-
$[70] = rest;
|
|
271
|
-
$[71] = rootClasses;
|
|
272
|
-
$[72] = t15;
|
|
273
|
-
$[73] = t16;
|
|
274
|
-
$[74] = t22;
|
|
275
|
-
$[75] = t23;
|
|
276
|
-
$[76] = t24;
|
|
277
|
-
} else t24 = $[76];
|
|
278
|
-
return t24;
|
|
100
|
+
}) : null]
|
|
101
|
+
});
|
|
279
102
|
};
|
|
280
103
|
var checkbox_default = createFormFieldComponent(Checkbox, {
|
|
281
104
|
valueProp: "checked",
|
|
282
105
|
getFieldValue: (value) => value === true || value === 1 || value === "1",
|
|
283
106
|
getChangeValue: (event) => event.checked
|
|
284
107
|
});
|
|
285
|
-
function _temp(next) {
|
|
286
|
-
return next ?? false;
|
|
287
|
-
}
|
|
288
108
|
//#endregion
|
|
289
109
|
export { checkbox_default as default };
|
package/es/checkbox/index.js
CHANGED
package/es/collapse/collapse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -7,15 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { getChildren } from "../utils/react-node.js";
|
|
10
|
-
import { normalizeSurfaceShape, useConfigAppearance } from "../config/use-config-appearance.js";
|
|
10
|
+
import { normalizeSurfaceShape, resolvePaintedTheme, useConfigAppearance } from "../config/use-config-appearance.js";
|
|
11
11
|
import { useValue } from "../utils/use-value.js";
|
|
12
12
|
import { c } from "react/compiler-runtime";
|
|
13
13
|
import clsx from "clsx";
|
|
14
14
|
import React, { useState } from "react";
|
|
15
15
|
import { jsx } from "react/jsx-runtime";
|
|
16
16
|
//#region components/collapse/collapse.tsx
|
|
17
|
+
var PAINTED_THEMES = [
|
|
18
|
+
"fill",
|
|
19
|
+
"outline",
|
|
20
|
+
"plain",
|
|
21
|
+
"solid",
|
|
22
|
+
"dashed"
|
|
23
|
+
];
|
|
17
24
|
var Collapse = (t0) => {
|
|
18
|
-
const $ = c(
|
|
25
|
+
const $ = c(49);
|
|
19
26
|
let children;
|
|
20
27
|
let onChange;
|
|
21
28
|
let onOpenKeysChange;
|
|
@@ -55,37 +62,44 @@ var Collapse = (t0) => {
|
|
|
55
62
|
const sample = t2 === void 0 ? false : t2;
|
|
56
63
|
const className = t3 === void 0 ? "" : t3;
|
|
57
64
|
const inheritedAppearance = useConfigAppearance();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
$[
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
65
|
+
let t4;
|
|
66
|
+
if ($[11] !== inheritedAppearance || $[12] !== themeProp) {
|
|
67
|
+
t4 = resolvePaintedTheme(themeProp ?? inheritedAppearance.theme, PAINTED_THEMES) ?? "outline";
|
|
68
|
+
$[11] = inheritedAppearance;
|
|
69
|
+
$[12] = themeProp;
|
|
70
|
+
$[13] = t4;
|
|
71
|
+
} else t4 = $[13];
|
|
72
|
+
const theme = t4;
|
|
73
|
+
const t5 = shapeProp ?? inheritedAppearance.shape ?? "round";
|
|
74
|
+
let t6;
|
|
75
|
+
if ($[14] !== t5) {
|
|
76
|
+
t6 = normalizeSurfaceShape(t5);
|
|
77
|
+
$[14] = t5;
|
|
78
|
+
$[15] = t6;
|
|
79
|
+
} else t6 = $[15];
|
|
80
|
+
const shape = t6;
|
|
67
81
|
const [innerActiveKeys, setInnerActiveKeys] = useValue(openKeys, _temp);
|
|
68
82
|
const activeKeys = innerActiveKeys;
|
|
69
|
-
let
|
|
70
|
-
if ($[
|
|
71
|
-
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
} else
|
|
75
|
-
const [keyRegistry, setKeyRegistry] = useState(
|
|
83
|
+
let t7;
|
|
84
|
+
if ($[16] !== openKeys) {
|
|
85
|
+
t7 = () => new Map((openKeys ?? []).map(_temp2));
|
|
86
|
+
$[16] = openKeys;
|
|
87
|
+
$[17] = t7;
|
|
88
|
+
} else t7 = $[17];
|
|
89
|
+
const [keyRegistry, setKeyRegistry] = useState(t7);
|
|
76
90
|
let resolvedKeys;
|
|
77
|
-
if ($[
|
|
91
|
+
if ($[18] !== activeKeys || $[19] !== keyRegistry) {
|
|
78
92
|
resolvedKeys = new Map(keyRegistry);
|
|
79
93
|
activeKeys.forEach((key_0) => resolvedKeys.set(String(key_0), key_0));
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
} else resolvedKeys = $[
|
|
94
|
+
$[18] = activeKeys;
|
|
95
|
+
$[19] = keyRegistry;
|
|
96
|
+
$[20] = resolvedKeys;
|
|
97
|
+
} else resolvedKeys = $[20];
|
|
84
98
|
if (activeKeys.some((key_1) => keyRegistry.get(String(key_1)) !== key_1)) setKeyRegistry(resolvedKeys);
|
|
85
99
|
const keysEqual = _temp3;
|
|
86
|
-
let
|
|
87
|
-
if ($[
|
|
88
|
-
|
|
100
|
+
let t8;
|
|
101
|
+
if ($[21] !== accordion || $[22] !== activeKeys || $[23] !== onChange || $[24] !== onOpenKeysChange || $[25] !== setInnerActiveKeys) {
|
|
102
|
+
t8 = (key_2) => {
|
|
89
103
|
if (!key_2 && key_2 !== 0) return;
|
|
90
104
|
let nextKeys = [...activeKeys];
|
|
91
105
|
if (nextKeys.findIndex((item) => keysEqual(item, key_2)) >= 0) nextKeys = accordion ? [] : nextKeys.filter((k) => !keysEqual(k, key_2));
|
|
@@ -94,34 +108,34 @@ var Collapse = (t0) => {
|
|
|
94
108
|
onOpenKeysChange?.(nextKeys);
|
|
95
109
|
onChange?.(key_2);
|
|
96
110
|
};
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
} else
|
|
104
|
-
const handleExpand =
|
|
105
|
-
let
|
|
106
|
-
if ($[
|
|
107
|
-
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else
|
|
114
|
-
const classes =
|
|
111
|
+
$[21] = accordion;
|
|
112
|
+
$[22] = activeKeys;
|
|
113
|
+
$[23] = onChange;
|
|
114
|
+
$[24] = onOpenKeysChange;
|
|
115
|
+
$[25] = setInnerActiveKeys;
|
|
116
|
+
$[26] = t8;
|
|
117
|
+
} else t8 = $[26];
|
|
118
|
+
const handleExpand = t8;
|
|
119
|
+
let t9;
|
|
120
|
+
if ($[27] !== className || $[28] !== sample || $[29] !== shape || $[30] !== theme) {
|
|
121
|
+
t9 = clsx("k-collapse", { "k-collapse-sample": sample }, `k-collapse-${theme}`, `k-collapse-${shape}`, className);
|
|
122
|
+
$[27] = className;
|
|
123
|
+
$[28] = sample;
|
|
124
|
+
$[29] = shape;
|
|
125
|
+
$[30] = theme;
|
|
126
|
+
$[31] = t9;
|
|
127
|
+
} else t9 = $[31];
|
|
128
|
+
const classes = t9;
|
|
115
129
|
let t10;
|
|
116
130
|
let t11;
|
|
117
|
-
let
|
|
118
|
-
if ($[
|
|
131
|
+
let t12;
|
|
132
|
+
if ($[32] !== activeKeys || $[33] !== children || $[34] !== classes || $[35] !== handleExpand || $[36] !== resolvedKeys || $[37] !== rest) {
|
|
119
133
|
const childList = getChildren(children);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
let
|
|
123
|
-
if ($[
|
|
124
|
-
|
|
134
|
+
t10 = classes;
|
|
135
|
+
t11 = rest;
|
|
136
|
+
let t13;
|
|
137
|
+
if ($[41] !== activeKeys || $[42] !== handleExpand || $[43] !== resolvedKeys) {
|
|
138
|
+
t13 = (child, index_0) => {
|
|
125
139
|
if (!React.isValidElement(child)) return child;
|
|
126
140
|
const rawKey = child.props.panelKey ?? child.key ?? index_0;
|
|
127
141
|
const key_3 = child.props.panelKey ?? resolvedKeys.get(String(rawKey)) ?? rawKey;
|
|
@@ -132,39 +146,39 @@ var Collapse = (t0) => {
|
|
|
132
146
|
onExpand: handleExpand
|
|
133
147
|
});
|
|
134
148
|
};
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
} else
|
|
140
|
-
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
149
|
+
$[41] = activeKeys;
|
|
150
|
+
$[42] = handleExpand;
|
|
151
|
+
$[43] = resolvedKeys;
|
|
152
|
+
$[44] = t13;
|
|
153
|
+
} else t13 = $[44];
|
|
154
|
+
t12 = childList.map(t13);
|
|
155
|
+
$[32] = activeKeys;
|
|
156
|
+
$[33] = children;
|
|
157
|
+
$[34] = classes;
|
|
158
|
+
$[35] = handleExpand;
|
|
159
|
+
$[36] = resolvedKeys;
|
|
160
|
+
$[37] = rest;
|
|
161
|
+
$[38] = t10;
|
|
162
|
+
$[39] = t11;
|
|
163
|
+
$[40] = t12;
|
|
150
164
|
} else {
|
|
151
|
-
t10 = $[
|
|
152
|
-
t11 = $[
|
|
153
|
-
|
|
165
|
+
t10 = $[38];
|
|
166
|
+
t11 = $[39];
|
|
167
|
+
t12 = $[40];
|
|
154
168
|
}
|
|
155
|
-
let
|
|
156
|
-
if ($[
|
|
157
|
-
|
|
158
|
-
className:
|
|
159
|
-
...
|
|
160
|
-
children:
|
|
169
|
+
let t13;
|
|
170
|
+
if ($[45] !== t10 || $[46] !== t11 || $[47] !== t12) {
|
|
171
|
+
t13 = /* @__PURE__ */ jsx("div", {
|
|
172
|
+
className: t10,
|
|
173
|
+
...t11,
|
|
174
|
+
children: t12
|
|
161
175
|
});
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
} else
|
|
167
|
-
return
|
|
176
|
+
$[45] = t10;
|
|
177
|
+
$[46] = t11;
|
|
178
|
+
$[47] = t12;
|
|
179
|
+
$[48] = t13;
|
|
180
|
+
} else t13 = $[48];
|
|
181
|
+
return t13;
|
|
168
182
|
};
|
|
169
183
|
function _temp(next) {
|
|
170
184
|
return next ?? [];
|
package/es/color-picker/alpha.js
CHANGED
package/es/color-picker/hue.js
CHANGED
package/es/color-picker/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.1
|
|
2
|
+
* react-kui v3.2.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import Popup from "../popup/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { resolveTheme, useFormAppearance } from "../config/use-config-appearance.js";
|
|
11
11
|
import { useValue } from "../utils/use-value.js";
|
|
12
12
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
13
13
|
import Alpha from "./alpha.js";
|
|
@@ -21,10 +21,10 @@ import { isValidElement, useCallback, useRef, useState } from "react";
|
|
|
21
21
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
22
22
|
import Color from "color";
|
|
23
23
|
//#region components/color-picker/index.tsx
|
|
24
|
-
function ColorPicker({ value, open: openProp, disabled = false, readOnly = false, disabledAlpha = false, showText = false, placement = "bottom-left", trigger = "click", size: sizeProp, theme: themeProp, shape: shapeProp, mode: modeProp, presets, onChange, onUpdateMode, onOpenChange, className, children, panelOnly = false, ...rest }) {
|
|
25
|
-
const inheritedAppearance =
|
|
24
|
+
function ColorPicker({ value, open: openProp, disabled = false, readOnly = false, disabledAlpha = false, showText = false, placement = "bottom-left", destroyOnClose = true, trigger = "click", size: sizeProp, theme: themeProp, shape: shapeProp, mode: modeProp, presets, onChange, onUpdateMode, onOpenChange, className, children, panelOnly = false, ...rest }) {
|
|
25
|
+
const inheritedAppearance = useFormAppearance();
|
|
26
26
|
const size = sizeProp ?? inheritedAppearance.size;
|
|
27
|
-
const theme = themeProp ?? inheritedAppearance.theme
|
|
27
|
+
const theme = resolveTheme(themeProp ?? inheritedAppearance.theme, "fill");
|
|
28
28
|
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
29
29
|
const [innerColor, setInnerColor] = useValue(value, (next) => next ?? "#000000ff");
|
|
30
30
|
const [innerMode, setInnerMode] = useState(modeProp ?? "hex");
|
|
@@ -114,7 +114,7 @@ function ColorPicker({ value, open: openProp, disabled = false, readOnly = false
|
|
|
114
114
|
"k-color-picker-readonly": readOnly,
|
|
115
115
|
"k-color-picker-sm": size === "small",
|
|
116
116
|
"k-color-picker-lg": size === "large",
|
|
117
|
-
[`k-color-picker-${theme}`]:
|
|
117
|
+
[`k-color-picker-${theme}`]: true,
|
|
118
118
|
[`k-color-picker-${shape}`]: shape
|
|
119
119
|
}, className),
|
|
120
120
|
...hoverProps,
|
|
@@ -254,7 +254,7 @@ function ColorPicker({ value, open: openProp, disabled = false, readOnly = false
|
|
|
254
254
|
prefixCls: "k-color-picker-dropdown",
|
|
255
255
|
transitionName: "k-color-picker",
|
|
256
256
|
transitionDuration: 200,
|
|
257
|
-
destroyOnClose
|
|
257
|
+
destroyOnClose,
|
|
258
258
|
outsideEvent: "mousedown",
|
|
259
259
|
onOpenChange: setVisible,
|
|
260
260
|
overlay: dropdownContent
|