@kubed/components 0.0.69 → 0.0.72
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/CHANGELOG.md +23 -0
- package/cjs/Checkbox/Checkbox.js +8 -8
- package/cjs/Checkbox/Checkbox.js.map +1 -1
- package/cjs/Checkbox/CheckboxGroup.js +1 -1
- package/cjs/Checkbox/CheckboxGroup.js.map +1 -1
- package/cjs/ConfigProvider/locales/en.js +1 -1
- package/cjs/ConfigProvider/locales/en.js.map +1 -1
- package/cjs/ConfigProvider/locales/es.js +1 -1
- package/cjs/ConfigProvider/locales/es.js.map +1 -1
- package/cjs/ConfigProvider/locales/zh-tw.js +1 -1
- package/cjs/ConfigProvider/locales/zh-tw.js.map +1 -1
- package/cjs/ConfigProvider/locales/zh.js +1 -1
- package/cjs/ConfigProvider/locales/zh.js.map +1 -1
- package/cjs/FilterInput/FilterInput.js +1 -1
- package/cjs/FilterInput/FilterInput.js.map +1 -1
- package/cjs/Input/Input.styles.js +1 -0
- package/cjs/Input/Input.styles.js.map +1 -1
- package/cjs/Modal/Modal.js +1 -1
- package/cjs/Modal/Modal.js.map +1 -1
- package/cjs/Radio/RadioGroup.js +1 -1
- package/cjs/Radio/RadioGroup.js.map +1 -1
- package/cjs/SliderConfirm/SliderConfirm.js +4 -0
- package/cjs/SliderConfirm/SliderConfirm.js.map +1 -0
- package/cjs/SliderConfirm/SliderConfirm.styles.js +47 -0
- package/cjs/SliderConfirm/SliderConfirm.styles.js.map +1 -0
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/esm/Checkbox/Checkbox.js +7 -7
- package/esm/Checkbox/Checkbox.js.map +1 -1
- package/esm/Checkbox/CheckboxGroup.js +1 -1
- package/esm/Checkbox/CheckboxGroup.js.map +1 -1
- package/esm/ConfigProvider/locales/en.js +1 -1
- package/esm/ConfigProvider/locales/en.js.map +1 -1
- package/esm/ConfigProvider/locales/es.js +1 -1
- package/esm/ConfigProvider/locales/es.js.map +1 -1
- package/esm/ConfigProvider/locales/zh-tw.js +1 -1
- package/esm/ConfigProvider/locales/zh-tw.js.map +1 -1
- package/esm/ConfigProvider/locales/zh.js +1 -1
- package/esm/ConfigProvider/locales/zh.js.map +1 -1
- package/esm/FilterInput/FilterInput.js +1 -1
- package/esm/FilterInput/FilterInput.js.map +1 -1
- package/esm/Input/Input.styles.js +5 -4
- package/esm/Input/Input.styles.js.map +1 -1
- package/esm/Modal/Modal.js +1 -1
- package/esm/Modal/Modal.js.map +1 -1
- package/esm/Radio/RadioGroup.js +1 -1
- package/esm/Radio/RadioGroup.js.map +1 -1
- package/esm/SliderConfirm/SliderConfirm.js +4 -0
- package/esm/SliderConfirm/SliderConfirm.js.map +1 -0
- package/esm/SliderConfirm/SliderConfirm.styles.js +47 -0
- package/esm/SliderConfirm/SliderConfirm.styles.js.map +1 -0
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/lib/src/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/src/ConfigProvider/LocaleProvider/types.d.ts +3 -0
- package/lib/src/ConfigProvider/LocaleProvider/types.d.ts.map +1 -1
- package/lib/src/ConfigProvider/locales/en.d.ts.map +1 -1
- package/lib/src/ConfigProvider/locales/es.d.ts.map +1 -1
- package/lib/src/ConfigProvider/locales/zh-tw.d.ts.map +1 -1
- package/lib/src/ConfigProvider/locales/zh.d.ts.map +1 -1
- package/lib/src/FilterInput/FilterInput.d.ts.map +1 -1
- package/lib/src/Input/Input.styles.d.ts.map +1 -1
- package/lib/src/Modal/Modal.d.ts.map +1 -1
- package/lib/src/Pagination/Pagination.d.ts +14 -0
- package/lib/src/Pagination/Pagination.d.ts.map +1 -0
- package/lib/src/Radio/RadioGroup.d.ts.map +1 -1
- package/lib/src/SliderConfirm/SliderConfirm.d.ts +9 -0
- package/lib/src/SliderConfirm/SliderConfirm.d.ts.map +1 -0
- package/lib/src/SliderConfirm/SliderConfirm.styles.d.ts +11 -0
- package/lib/src/SliderConfirm/SliderConfirm.styles.d.ts.map +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("./ConfigProvider/index.js"),Button=require("./Button/Button.js"),Group=require("./Group/Group.js"),Container=require("./Container/Container.js"),Center=require("./Center/Center.js"),Row=require("./Grid/Row.js"),Navs=require("./Navs/Navs.js"),Snippet=require("./Snippet/Snippet.js"),Tabs=require("./Tabs/Tabs.js"),Text=require("./Text/Text.js"),Tooltip=require("./Tooltip/Tooltip.js"),Popover=require("./Popover/Popover.js"),Divider=require("./Divider/Divider.js"),Menu=require("./Menu/Menu.js"),StatusDot=require("./StatusDot/StatusDot.js"),Tag=require("./Tag/Tag.js"),Badge=require("./Badge/Badge.js"),Alert=require("./Alert/Alert.js"),Card=require("./Card/Card.js"),Descriptions=require("./Descriptions/Descriptions.js"),Entity=require("./Entity/Entity.js"),Dropdown=require("./Dropdown/Dropdown.js"),LoadingOverlay=require("./LoadingOverlay/LoadingOverlay.js"),Input=require("./Input/Input.js"),InputPassword=require("./InputPassword/InputPassword.js"),FilterInput=require("./FilterInput/FilterInput.js"),Textarea=require("./Textarea/Textarea.js"),Empty=require("./Empty/Empty.js"),Form=require("./Form/Form.js"),Select=require("./Select/Select.js"),Checkbox=require("./Checkbox/Checkbox.js"),Radio=require("./Radio/Radio.js"),Switch=require("./Switch/Switch.js"),InputNumber=require("./InputNumber/InputNumber.js"),DatePicker=require("./DatePicker/DatePicker.js"),Banner=require("./Banner/Banner.js"),Notify=require("./Notify/Notify.js"),AutoComplete=require("./AutoComplete/AutoComplete.js"),ActionConfirm=require("./ActionConfirm/ActionConfirm.js"),Progress=require("./Progress/Progress.js"),color=require("./utils/color.js"),Steps=require("./Steps/Steps.js"),TypeSelect=require("./TypeSelect/TypeSelect.js"),ShowMore=require("./ShowMore/ShowMore.js"),Dropzone=require("./Dropzone/Dropzone.js"),Skeleton=require("./Skeleton/Skeleton.js"),Loading=require("./Loading/Loading.js"),TimePicker=require("./TimePicker/TimePicker.js"),Drawer=require("./Drawer/Drawer.js"),Collapse=require("./Collapse/Collapse.js"),forwardRef=require("./utils/forwardRef.js"),toArray=require("./utils/toArray.js"),useForm=require("./Form/hooks/useForm.js"),CssBaseline=require("./theme/CssBaseline.js"),ThemeContext=require("./theme/ThemeContext.js"),utils=require("./theme/utils.js"),Col=require("./Grid/Col.js"),Tab=require("./Tabs/Tab/Tab.js"),MenuItem=require("./Menu/MenuItem/MenuItem.js"),MenuLabel=require("./Menu/MenuLabel/MenuLabel.js"),BadgeAnchor=require("./Badge/BadgeAnchor.js"),Description=require("./Descriptions/Description.js"),Field=require("./Entity/Field.js"),FieldForm=require("rc-field-form"),FormItem=require("./Form/FormItem/FormItem.js"),Modal=require("./Modal/Modal.js"),ModalContext=require("./Modal/ModalProvider/ModalContext.js"),CheckboxGroup=require("./Checkbox/CheckboxGroup.js"),RadioGroup=require("./Radio/RadioGroup.js"),BannerTip=require("./Banner/BannerTip.js"),toast=require("react-hot-toast"),Slider=require("./Slider/Slider/Slider.js"),RangeSlider=require("./Slider/RangeSlider/RangeSlider.js"),Step=require("./Steps/Step/Step.js"),StepCompleted=require("./Steps/StepCompleted/StepCompleted.js"),TabStep=require("./Steps/TabStep/TabStep.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var toast__default=_interopDefaultLegacy(toast);exports.KubedConfigProvider=index.KubedConfigProvider,exports.Button=Button.Button,exports.Group=Group.Group,exports.Container=Container.Container,exports.sizes=Container.sizes,exports.Center=Center.Center,exports.Row=Row.Row,exports.Navs=Navs.Navs,exports.Snippet=Snippet.Snippet,exports.Tabs=Tabs.Tabs,exports.Text=Text.Text,exports.Tooltip=Tooltip.Tooltip,exports.Popover=Popover.Popover,exports.Divider=Divider.Divider,exports.Menu=Menu.Menu,exports.StatusDot=StatusDot.StatusDot,exports.Tag=Tag.Tag,exports.Badge=Badge.Badge,exports.Alert=Alert.Alert,exports.Card=Card.Card,exports.Descriptions=Descriptions.Descriptions,exports.Entity=Entity.Entity,exports.Dropdown=Dropdown.Dropdown,exports.LoadingOverlay=LoadingOverlay.LoadingOverlay,exports.Input=Input.Input,exports.fixControlledValue=Input.fixControlledValue,exports.InputPassword=InputPassword.InputPassword,exports.FilterInput=FilterInput.FilterInput,exports.Textarea=Textarea.Textarea,exports.Empty=Empty.Empty,exports.Form=Form.Form,exports.Select=Select.Select,exports.Checkbox=Checkbox.Checkbox,exports.Radio=Radio.Radio,exports.Switch=Switch.Switch,exports.InputNumber=InputNumber.InputNumber,exports.DatePicker=DatePicker.DatePicker,exports.Banner=Banner.Banner,exports.Notify=Notify.Notify,exports.AutoComplete=AutoComplete.AutoComplete,exports.ActionConfirm=ActionConfirm.ActionConfirm,exports.Progress=Progress.Progress,exports.addColorAlpha=color.addColorAlpha,exports.colorToRgbValues=color.colorToRgbValues,exports.Steps=Steps.Steps,exports.TypeSelect=TypeSelect.TypeSelect,exports.ShowMore=ShowMore.ShowMore,exports.Dropzone=Dropzone.Dropzone,exports._Dropzone=Dropzone._Dropzone,exports.Skeleton=Skeleton.Skeleton,exports.Loading=Loading.Loading,exports.TimePicker=TimePicker.default,exports.Drawer=Drawer.default,exports.Collapse=Collapse.default,exports.forwardRef=forwardRef.default,exports.toArray=toArray.default,exports.useForm=useForm.default,exports.CssBaseline=CssBaseline.default,exports.useTheme=ThemeContext.useTheme,exports.themeUtils=utils.default,exports.Col=Col.Col,exports.Tab=Tab.Tab,exports.MenuItem=MenuItem.MenuItem,exports.MenuLabel=MenuLabel.MenuLabel,exports.BadgeAnchor=BadgeAnchor.BadgeAnchor,exports.Description=Description.Description,exports.Field=Field.Field,exports.FormList=FieldForm.List,exports.useWatch=FieldForm.useWatch,exports.FormItem=FormItem.FormItem,exports.Modal=Modal.Modal,exports.useModal=ModalContext.useModal,exports.CheckboxGroup=CheckboxGroup.CheckboxGroup,exports.RadioGroup=RadioGroup.RadioGroup,exports.BannerTip=BannerTip.BannerTip,exports.notify=toast__default,exports.Slider=Slider.Slider,exports.RangeSlider=RangeSlider.RangeSlider,exports.Step=Step.Step,exports.StepCompleted=StepCompleted.StepCompleted,exports.TabStep=TabStep.TabStep;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index=require("./ConfigProvider/index.js"),Button=require("./Button/Button.js"),Group=require("./Group/Group.js"),Container=require("./Container/Container.js"),Center=require("./Center/Center.js"),Row=require("./Grid/Row.js"),Navs=require("./Navs/Navs.js"),Snippet=require("./Snippet/Snippet.js"),Tabs=require("./Tabs/Tabs.js"),Text=require("./Text/Text.js"),Tooltip=require("./Tooltip/Tooltip.js"),Popover=require("./Popover/Popover.js"),Divider=require("./Divider/Divider.js"),Menu=require("./Menu/Menu.js"),StatusDot=require("./StatusDot/StatusDot.js"),Tag=require("./Tag/Tag.js"),Badge=require("./Badge/Badge.js"),Alert=require("./Alert/Alert.js"),Card=require("./Card/Card.js"),Descriptions=require("./Descriptions/Descriptions.js"),Entity=require("./Entity/Entity.js"),Dropdown=require("./Dropdown/Dropdown.js"),LoadingOverlay=require("./LoadingOverlay/LoadingOverlay.js"),Input=require("./Input/Input.js"),InputPassword=require("./InputPassword/InputPassword.js"),FilterInput=require("./FilterInput/FilterInput.js"),Textarea=require("./Textarea/Textarea.js"),Empty=require("./Empty/Empty.js"),Form=require("./Form/Form.js"),Select=require("./Select/Select.js"),Checkbox=require("./Checkbox/Checkbox.js"),Radio=require("./Radio/Radio.js"),Switch=require("./Switch/Switch.js"),InputNumber=require("./InputNumber/InputNumber.js"),DatePicker=require("./DatePicker/DatePicker.js"),Banner=require("./Banner/Banner.js"),Notify=require("./Notify/Notify.js"),AutoComplete=require("./AutoComplete/AutoComplete.js"),ActionConfirm=require("./ActionConfirm/ActionConfirm.js"),Progress=require("./Progress/Progress.js"),color=require("./utils/color.js"),Steps=require("./Steps/Steps.js"),TypeSelect=require("./TypeSelect/TypeSelect.js"),ShowMore=require("./ShowMore/ShowMore.js"),Dropzone=require("./Dropzone/Dropzone.js"),Skeleton=require("./Skeleton/Skeleton.js"),SliderConfirm=require("./SliderConfirm/SliderConfirm.js"),Loading=require("./Loading/Loading.js"),TimePicker=require("./TimePicker/TimePicker.js"),Drawer=require("./Drawer/Drawer.js"),Collapse=require("./Collapse/Collapse.js"),forwardRef=require("./utils/forwardRef.js"),toArray=require("./utils/toArray.js"),useForm=require("./Form/hooks/useForm.js"),CssBaseline=require("./theme/CssBaseline.js"),ThemeContext=require("./theme/ThemeContext.js"),utils=require("./theme/utils.js"),Col=require("./Grid/Col.js"),Tab=require("./Tabs/Tab/Tab.js"),MenuItem=require("./Menu/MenuItem/MenuItem.js"),MenuLabel=require("./Menu/MenuLabel/MenuLabel.js"),BadgeAnchor=require("./Badge/BadgeAnchor.js"),Description=require("./Descriptions/Description.js"),Field=require("./Entity/Field.js"),FieldForm=require("rc-field-form"),FormItem=require("./Form/FormItem/FormItem.js"),Modal=require("./Modal/Modal.js"),ModalContext=require("./Modal/ModalProvider/ModalContext.js"),CheckboxGroup=require("./Checkbox/CheckboxGroup.js"),RadioGroup=require("./Radio/RadioGroup.js"),BannerTip=require("./Banner/BannerTip.js"),toast=require("react-hot-toast"),Slider=require("./Slider/Slider/Slider.js"),RangeSlider=require("./Slider/RangeSlider/RangeSlider.js"),Step=require("./Steps/Step/Step.js"),StepCompleted=require("./Steps/StepCompleted/StepCompleted.js"),TabStep=require("./Steps/TabStep/TabStep.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e.default:e}var toast__default=_interopDefaultLegacy(toast);exports.KubedConfigProvider=index.KubedConfigProvider,exports.Button=Button.Button,exports.Group=Group.Group,exports.Container=Container.Container,exports.sizes=Container.sizes,exports.Center=Center.Center,exports.Row=Row.Row,exports.Navs=Navs.Navs,exports.Snippet=Snippet.Snippet,exports.Tabs=Tabs.Tabs,exports.Text=Text.Text,exports.Tooltip=Tooltip.Tooltip,exports.Popover=Popover.Popover,exports.Divider=Divider.Divider,exports.Menu=Menu.Menu,exports.StatusDot=StatusDot.StatusDot,exports.Tag=Tag.Tag,exports.Badge=Badge.Badge,exports.Alert=Alert.Alert,exports.Card=Card.Card,exports.Descriptions=Descriptions.Descriptions,exports.Entity=Entity.Entity,exports.Dropdown=Dropdown.Dropdown,exports.LoadingOverlay=LoadingOverlay.LoadingOverlay,exports.Input=Input.Input,exports.fixControlledValue=Input.fixControlledValue,exports.InputPassword=InputPassword.InputPassword,exports.FilterInput=FilterInput.FilterInput,exports.Textarea=Textarea.Textarea,exports.Empty=Empty.Empty,exports.Form=Form.Form,exports.Select=Select.Select,exports.Checkbox=Checkbox.Checkbox,exports.Radio=Radio.Radio,exports.Switch=Switch.Switch,exports.InputNumber=InputNumber.InputNumber,exports.DatePicker=DatePicker.DatePicker,exports.Banner=Banner.Banner,exports.Notify=Notify.Notify,exports.AutoComplete=AutoComplete.AutoComplete,exports.ActionConfirm=ActionConfirm.ActionConfirm,exports.Progress=Progress.Progress,exports.addColorAlpha=color.addColorAlpha,exports.colorToRgbValues=color.colorToRgbValues,exports.Steps=Steps.Steps,exports.TypeSelect=TypeSelect.TypeSelect,exports.ShowMore=ShowMore.ShowMore,exports.Dropzone=Dropzone.Dropzone,exports._Dropzone=Dropzone._Dropzone,exports.Skeleton=Skeleton.Skeleton,exports.SliderConfirm=SliderConfirm.SliderConfirm,exports.Loading=Loading.Loading,exports.TimePicker=TimePicker.default,exports.Drawer=Drawer.default,exports.Collapse=Collapse.default,exports.forwardRef=forwardRef.default,exports.toArray=toArray.default,exports.useForm=useForm.default,exports.CssBaseline=CssBaseline.default,exports.useTheme=ThemeContext.useTheme,exports.themeUtils=utils.default,exports.Col=Col.Col,exports.Tab=Tab.Tab,exports.MenuItem=MenuItem.MenuItem,exports.MenuLabel=MenuLabel.MenuLabel,exports.BadgeAnchor=BadgeAnchor.BadgeAnchor,exports.Description=Description.Description,exports.Field=Field.Field,exports.FormList=FieldForm.List,exports.useWatch=FieldForm.useWatch,exports.FormItem=FormItem.FormItem,exports.Modal=Modal.Modal,exports.useModal=ModalContext.useModal,exports.CheckboxGroup=CheckboxGroup.CheckboxGroup,exports.RadioGroup=RadioGroup.RadioGroup,exports.BannerTip=BannerTip.BannerTip,exports.notify=toast__default,exports.Slider=Slider.Slider,exports.RangeSlider=RangeSlider.RangeSlider,exports.Step=Step.Step,exports.StepCompleted=StepCompleted.StepCompleted,exports.TabStep=TabStep.TabStep;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/esm/Checkbox/Checkbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import d,{useEffect as A}from"react";import b,{css as v}from"styled-components";import{isUndefined as R}from"lodash";import{useId as S,useUncontrolled as I}from"@kubed/hooks";import N from"../utils/forwardRef.js";import{useCheckbox as V}from"./CheckboxContext.js";var z=Object.defineProperty,s=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,w=(e,o,t)=>o in e?z(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,U=(e,o)=>{for(var t in o||(o={}))C.call(o,t)&&w(e,t,o[t]);if(s)for(var t of s(o))_.call(o,t)&&w(e,t,o[t]);return e},W=(e,o)=>{var t={};for(var r in e)C.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&s)for(var r of s(e))o.indexOf(r)<0&&_.call(e,r)&&(t[r]=e[r]);return t};const D=b("div")`
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ import c,{useEffect as j}from"react";import p,{css as y}from"styled-components";
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
${({disabled:e})=>e?"opacity: 0.5;":null};
|
|
12
|
-
`,
|
|
12
|
+
`,F=(e,o,t)=>e?v`
|
|
13
13
|
border-color: transparent;
|
|
14
14
|
background-color: ${t.palette.colors.green[2]} !important;
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ import c,{useEffect as j}from"react";import p,{css as y}from"styled-components";
|
|
|
29
29
|
content: '';
|
|
30
30
|
will-change: transform;
|
|
31
31
|
}
|
|
32
|
-
`:o?
|
|
32
|
+
`:o?v`
|
|
33
33
|
border-color: transparent;
|
|
34
34
|
background-color: ${t.palette.colors.green[2]} !important;
|
|
35
35
|
|
|
@@ -45,7 +45,7 @@ import c,{useEffect as j}from"react";import p,{css as y}from"styled-components";
|
|
|
45
45
|
content: '';
|
|
46
46
|
will-change: transform;
|
|
47
47
|
}
|
|
48
|
-
`:null,
|
|
48
|
+
`:null,G=b("div")`
|
|
49
49
|
position: relative;
|
|
50
50
|
display: inline-block;
|
|
51
51
|
width: 16px;
|
|
@@ -56,7 +56,7 @@ import c,{useEffect as j}from"react";import p,{css as y}from"styled-components";
|
|
|
56
56
|
background-color: ${({theme:e})=>e.palette.background};
|
|
57
57
|
transition: border 0.2s ease;
|
|
58
58
|
|
|
59
|
-
${({checked:e,indeterminate:o,theme:t})=>
|
|
59
|
+
${({checked:e,indeterminate:o,theme:t})=>F(e,o,t)};
|
|
60
60
|
|
|
61
61
|
input {
|
|
62
62
|
outline: 0;
|
|
@@ -68,10 +68,10 @@ import c,{useEffect as j}from"react";import p,{css as y}from"styled-components";
|
|
|
68
68
|
opacity: 0;
|
|
69
69
|
cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
|
|
70
70
|
}
|
|
71
|
-
`,
|
|
71
|
+
`,L=b("label")`
|
|
72
72
|
user-select: none;
|
|
73
73
|
cursor: ${({disabled:e})=>e?"not-allowed":"pointer"};
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
line-height: 1.67;
|
|
76
|
-
`,O=N((e,o)=>{var t=e,{id:r,checked:
|
|
76
|
+
`,O=N((e,o)=>{var t=e,{id:r,checked:f,defaultChecked:$,indeterminate:h,onChange:i,disabled:u,label:m}=t,p=W(t,["id","checked","defaultChecked","indeterminate","onChange","disabled","label"]);const k=S(r),[x,g]=I({value:f,defaultValue:$,finalValue:!1,rule:n=>!R(n),onChange:()=>{}}),{updateState:y,inGroup:c,disabledAll:P,values:a}=V(),l=c&&P||u;if(c&&f&&console.warn('Remove props "checked" when [Checkbox] component is in the group.'),c){const n=Array.isArray(a)?a.join(","):a;A(()=>{const j=Array.isArray(a)&&a.includes(p.value);g(j)},[n])}const E=n=>{l||(c&&y?(y(p.value,n.target.checked),i&&i(n)):(g(n.target.checked),i&&i(n)))};return d.createElement(D,{disabled:l},d.createElement(G,{className:"kubed-checkbox-control",checked:x,indeterminate:h,disabled:l},d.createElement("input",U({id:k,ref:o,type:"checkbox",checked:h||x,onChange:E,disabled:l},p))),m&&d.createElement(L,{htmlFor:k,disabled:l},m))});O.displayName="@kubed/components/Checkbox";export{O as Checkbox};
|
|
77
77
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport styled, { css } from 'styled-components';\nimport { isUndefined } from 'lodash';\nimport { useId, useUncontrolled } from '@kubed/hooks';\nimport { DefaultProps, KubedTheme } from '../theme';\nimport forwardRef from '../utils/forwardRef';\nimport { useCheckbox } from './CheckboxContext';\nimport { CheckboxGroup } from './CheckboxGroup';\n\nexport { CheckboxGroup };\n\ninterface WrapProps {\n disabled: boolean;\n}\nconst CheckboxWrap = styled('div')<WrapProps>`\n display: inline-flex;\n align-items: center;\n\n &:hover {\n .kubed-checkbox-control {\n background-color: ${({ theme, disabled }) => (disabled ? '' : theme.palette.accents_1)};\n }\n }\n\n ${({ disabled }) => (disabled ? `opacity: 0.5;` : null)};\n`;\n\nconst getStateStyles = (checked, indeterminate, theme) => {\n if (checked) {\n return css`\n border-color: transparent;\n background-color: ${theme.palette.colors.green[2]} !important;\n\n &:before {\n position: absolute;\n top: 1.2px;\n left: 5px;\n display: block;\n width: 3.2px;\n height: 8.2px;\n border-width: 0 2px 2px 0;\n border-style: solid;\n border-color: #fff;\n transform: rotate(45deg);\n backface-visibility: hidden;\n box-sizing: content-box;\n content: '';\n will-change: transform;\n }\n `;\n }\n\n if (indeterminate) {\n return css`\n border-color: transparent;\n background-color: ${theme.palette.colors.green[2]} !important;\n\n &:before {\n position: absolute;\n top: 6px;\n left: 2px;\n display: block;\n width: 8px;\n height: 0;\n border: 1px solid #fff;\n box-sizing: content-box;\n content: '';\n will-change: transform;\n }\n `;\n }\n\n return null;\n};\n\ninterface ControlProps {\n state?: string;\n theme?: KubedTheme;\n disabled?: boolean;\n indeterminate?: boolean;\n checked?: boolean;\n}\n\nconst CheckboxControl = styled('div')<ControlProps>`\n position: relative;\n display: inline-block;\n width: 16px;\n height: 16px;\n border: 1px solid ${({ theme }) => theme.palette.border};\n border-radius: 2px;\n outline: none;\n background-color: ${({ theme }) => theme.palette.background};\n transition: border 0.2s ease;\n\n ${({ checked, indeterminate, theme }) => getStateStyles(checked, indeterminate, theme)};\n\n input {\n outline: 0;\n appearance: none;\n display: inline-block;\n width: 16px;\n height: 16px;\n margin: 0;\n opacity: 0;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};\n }\n`;\n\nconst LabelWrap = styled('label')<ControlProps>`\n user-select: none;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};\n padding: 0 8px;\n line-height: 1.67;\n`;\n\nexport interface CheckboxProps extends DefaultProps {\n /** Checkbox label */\n label?: React.ReactNode;\n\n /** Checkbox value */\n value?: string;\n\n /** Indeterminate state of checkbox, overwrites checked */\n indeterminate?: boolean;\n\n /** Id is used to bind input and label, if not passed unique id will be generated for each input */\n id?: string;\n\n /** Whether the Checkbox is checked */\n checked?: boolean;\n\n defaultChecked?: boolean;\n\n disabled?: boolean;\n}\n\nexport const Checkbox = forwardRef<CheckboxProps, 'input'>(\n (\n { id, checked, defaultChecked, indeterminate, onChange, disabled, label, ...restProps },\n ref\n ) => {\n const uuid = useId(id);\n const [_checked, setChecked] = useUncontrolled({\n value: checked,\n defaultValue: defaultChecked,\n finalValue: false,\n rule: (val) => !isUndefined(val),\n onChange: () => {},\n });\n const { updateState, inGroup, disabledAll, values } = useCheckbox();\n const isDisabled = inGroup ? disabledAll || disabled : disabled;\n\n if (inGroup && checked) {\n // eslint-disable-next-line no-console\n console.warn('Remove props \"checked\" when [Checkbox] component is in the group.');\n }\n\n if (inGroup) {\n useEffect(() => {\n const isChecked = values.includes(restProps.value);\n setChecked(isChecked);\n }, [values.join(',')]);\n }\n\n const onCheckboxChange = (e) => {\n if (isDisabled) return;\n\n if (inGroup && updateState) {\n updateState(restProps.value, e.target.checked);\n onChange && onChange(e);\n } else {\n setChecked(e.target.checked);\n onChange && onChange(e);\n }\n };\n\n return (\n <CheckboxWrap disabled={isDisabled}>\n <CheckboxControl\n className=\"kubed-checkbox-control\"\n checked={_checked}\n indeterminate={indeterminate}\n disabled={isDisabled}\n >\n <input\n id={uuid}\n ref={ref}\n type=\"checkbox\"\n checked={indeterminate || _checked}\n onChange={onCheckboxChange}\n disabled={isDisabled}\n {...restProps}\n />\n </CheckboxControl>\n {label && (\n <LabelWrap htmlFor={uuid} disabled={isDisabled}>\n {label}\n </LabelWrap>\n )}\n </CheckboxWrap>\n );\n }\n);\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EAAE;AAChC,MAAM,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC9B,KAAK,MAAM;AACX,MAAM,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACnC,MAAM,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,YAAY,EAAE;AAC3D,IAAI,QAAQ,EAAE,UAAU;AACxB,GAAG,kBAAkBA,cAAK,CAAC,aAAa,CAAC,eAAe,EAAE;AAC1D,IAAI,SAAS,EAAE,wBAAwB;AACvC,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,aAAa;AACjB,IAAI,QAAQ,EAAE,UAAU;AACxB,GAAG,kBAAkBA,cAAK,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC;AACjE,IAAI,EAAE,EAAE,IAAI;AACZ,IAAI,GAAG;AACP,IAAI,IAAI,EAAE,UAAU;AACpB,IAAI,OAAO,EAAE,aAAa,IAAI,QAAQ;AACtC,IAAI,QAAQ,EAAE,gBAAgB;AAC9B,IAAI,QAAQ,EAAE,UAAU;AACxB,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,oBAAoBA,cAAK,CAAC,aAAa,CAAC,SAAS,EAAE;AAC3E,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,QAAQ,EAAE,UAAU;AACxB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACb,CAAC,EAAE;AACH,QAAQ,CAAC,WAAW,GAAG,4BAA4B;;;;"}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../src/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport styled, { css } from 'styled-components';\nimport { isUndefined } from 'lodash';\nimport { useId, useUncontrolled } from '@kubed/hooks';\nimport { DefaultProps, KubedTheme } from '../theme';\nimport forwardRef from '../utils/forwardRef';\nimport { useCheckbox } from './CheckboxContext';\nimport { CheckboxGroup } from './CheckboxGroup';\n\nexport { CheckboxGroup };\n\ninterface WrapProps {\n disabled: boolean;\n}\nconst CheckboxWrap = styled('div')<WrapProps>`\n display: inline-flex;\n align-items: center;\n\n &:hover {\n .kubed-checkbox-control {\n background-color: ${({ theme, disabled }) => (disabled ? '' : theme.palette.accents_1)};\n }\n }\n\n ${({ disabled }) => (disabled ? `opacity: 0.5;` : null)};\n`;\n\nconst getStateStyles = (checked, indeterminate, theme) => {\n if (checked) {\n return css`\n border-color: transparent;\n background-color: ${theme.palette.colors.green[2]} !important;\n\n &:before {\n position: absolute;\n top: 1.2px;\n left: 5px;\n display: block;\n width: 3.2px;\n height: 8.2px;\n border-width: 0 2px 2px 0;\n border-style: solid;\n border-color: #fff;\n transform: rotate(45deg);\n backface-visibility: hidden;\n box-sizing: content-box;\n content: '';\n will-change: transform;\n }\n `;\n }\n\n if (indeterminate) {\n return css`\n border-color: transparent;\n background-color: ${theme.palette.colors.green[2]} !important;\n\n &:before {\n position: absolute;\n top: 6px;\n left: 2px;\n display: block;\n width: 8px;\n height: 0;\n border: 1px solid #fff;\n box-sizing: content-box;\n content: '';\n will-change: transform;\n }\n `;\n }\n\n return null;\n};\n\ninterface ControlProps {\n state?: string;\n theme?: KubedTheme;\n disabled?: boolean;\n indeterminate?: boolean;\n checked?: boolean;\n}\n\nconst CheckboxControl = styled('div')<ControlProps>`\n position: relative;\n display: inline-block;\n width: 16px;\n height: 16px;\n border: 1px solid ${({ theme }) => theme.palette.border};\n border-radius: 2px;\n outline: none;\n background-color: ${({ theme }) => theme.palette.background};\n transition: border 0.2s ease;\n\n ${({ checked, indeterminate, theme }) => getStateStyles(checked, indeterminate, theme)};\n\n input {\n outline: 0;\n appearance: none;\n display: inline-block;\n width: 16px;\n height: 16px;\n margin: 0;\n opacity: 0;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};\n }\n`;\n\nconst LabelWrap = styled('label')<ControlProps>`\n user-select: none;\n cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};\n padding: 0 8px;\n line-height: 1.67;\n`;\n\nexport interface CheckboxProps extends DefaultProps {\n /** Checkbox label */\n label?: React.ReactNode;\n\n /** Checkbox value */\n value?: string;\n\n /** Indeterminate state of checkbox, overwrites checked */\n indeterminate?: boolean;\n\n /** Id is used to bind input and label, if not passed unique id will be generated for each input */\n id?: string;\n\n /** Whether the Checkbox is checked */\n checked?: boolean;\n\n defaultChecked?: boolean;\n\n disabled?: boolean;\n}\n\nexport const Checkbox = forwardRef<CheckboxProps, 'input'>(\n (\n { id, checked, defaultChecked, indeterminate, onChange, disabled, label, ...restProps },\n ref\n ) => {\n const uuid = useId(id);\n const [_checked, setChecked] = useUncontrolled({\n value: checked,\n defaultValue: defaultChecked,\n finalValue: false,\n rule: (val) => !isUndefined(val),\n onChange: () => {},\n });\n const { updateState, inGroup, disabledAll, values } = useCheckbox();\n const isDisabled = inGroup ? disabledAll || disabled : disabled;\n\n if (inGroup && checked) {\n // eslint-disable-next-line no-console\n console.warn('Remove props \"checked\" when [Checkbox] component is in the group.');\n }\n\n if (inGroup) {\n const deps = Array.isArray(values) ? values.join(',') : values;\n useEffect(() => {\n const isChecked = Array.isArray(values) && values.includes(restProps.value);\n setChecked(isChecked);\n }, [deps]);\n }\n\n const onCheckboxChange = (e) => {\n if (isDisabled) return;\n\n if (inGroup && updateState) {\n updateState(restProps.value, e.target.checked);\n onChange && onChange(e);\n } else {\n setChecked(e.target.checked);\n onChange && onChange(e);\n }\n };\n\n return (\n <CheckboxWrap disabled={isDisabled}>\n <CheckboxControl\n className=\"kubed-checkbox-control\"\n checked={_checked}\n indeterminate={indeterminate}\n disabled={isDisabled}\n >\n <input\n id={uuid}\n ref={ref}\n type=\"checkbox\"\n checked={indeterminate || _checked}\n onChange={onCheckboxChange}\n disabled={isDisabled}\n {...restProps}\n />\n </CheckboxControl>\n {label && (\n <LabelWrap htmlFor={uuid} disabled={isDisabled}>\n {label}\n </LabelWrap>\n )}\n </CheckboxWrap>\n );\n }\n);\n\nCheckbox.displayName = '@kubed/components/Checkbox';\n"],"names":["React"],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,C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;AAC3E,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,QAAQ,EAAE,UAAU;AACxB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACb,CAAC,EAAE;AACH,QAAQ,CAAC,WAAW,GAAG,4BAA4B;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a,{useMemo as b,useEffect as C}from"react";import{useUncontrolled as G}from"@kubed/hooks";import{isUndefined as h}from"lodash";import{Group as j}from"../Group/Group.js";import{CheckboxContext as V}from"./CheckboxContext.js";const p=({onChange:c,disabled:t,value:r,defaultValue:i,children:n,unstyled:m})=>{const[e,s]=G({value:r,defaultValue:i,finalValue:[],rule:o=>!h(o),onChange:c}),l=(o,k)=>{const u=Array.isArray(e)?e.filter(A=>A!==o):[],y=k?[...u,o]:u;s(y)},d=Array.isArray(e)?e.join(","):e,f=b(()=>({updateState:l,disabledAll:t,inGroup:!0,values:e}),[t,d]),x=Array.isArray(r)?r.join(","):r;return C(()=>{s(r)},[x]),a.createElement(V.Provider,{value:f},m?n:a.createElement(j,null,n))};p.displayName="@kubed/components/CheckboxGroup";export{p as CheckboxGroup};
|
|
2
2
|
//# sourceMappingURL=CheckboxGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.js","sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from 'react';\nimport { useUncontrolled } from '@kubed/hooks';\nimport { isUndefined } from 'lodash';\nimport { Group } from '../Group/Group';\nimport { CheckboxContext } from './CheckboxContext';\n\ninterface Props {\n value?: string[];\n defaultValue?: string[];\n disabled?: boolean;\n onChange?: (values: string[]) => void;\n unstyled?: boolean;\n}\n\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;\nexport type CheckboxGroupProps = Props & NativeAttrs;\n\nexport const CheckboxGroup: React.FC<React.PropsWithChildren<CheckboxGroupProps>> = ({\n onChange,\n disabled,\n value,\n defaultValue,\n children,\n unstyled,\n}: CheckboxGroupProps) => {\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n rule: (val) => !isUndefined(val),\n onChange,\n });\n\n const updateState = (val, checked) => {\n
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.js","sources":["../../src/Checkbox/CheckboxGroup.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from 'react';\nimport { useUncontrolled } from '@kubed/hooks';\nimport { isUndefined } from 'lodash';\nimport { Group } from '../Group/Group';\nimport { CheckboxContext } from './CheckboxContext';\n\ninterface Props {\n value?: string[];\n defaultValue?: string[];\n disabled?: boolean;\n onChange?: (values: string[]) => void;\n unstyled?: boolean;\n}\n\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;\nexport type CheckboxGroupProps = Props & NativeAttrs;\n\nexport const CheckboxGroup: React.FC<React.PropsWithChildren<CheckboxGroupProps>> = ({\n onChange,\n disabled,\n value,\n defaultValue,\n children,\n unstyled,\n}: CheckboxGroupProps) => {\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: [],\n rule: (val) => !isUndefined(val),\n onChange,\n });\n\n const updateState = (val, checked) => {\n const removed = Array.isArray(_value) ? _value.filter((v) => v !== val) : [];\n const next = checked ? [...removed, val] : removed;\n setValue(next);\n };\n\n const providerValueDeps = Array.isArray(_value) ? _value.join(',') : _value;\n\n const providerValue = useMemo(() => {\n return {\n updateState,\n disabledAll: disabled,\n inGroup: true,\n values: _value,\n };\n }, [disabled, providerValueDeps]);\n\n const deps = Array.isArray(value) ? value.join(',') : value;\n useEffect(() => {\n setValue(value);\n }, [deps]);\n\n return (\n <CheckboxContext.Provider value={providerValue}>\n {unstyled ? children : <Group>{children}</Group>}\n </CheckboxContext.Provider>\n );\n};\n\nCheckboxGroup.displayName = '@kubed/components/CheckboxGroup';\n"],"names":["React"],"mappings":";;;;;;AAKY,MAAC,aAAa,GAAG,CAAC;AAC9B,EAAE,QAAQ;AACV,EA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AC9D,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpB,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACb,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,eAAe,CAAC,QAAQ,EAAE;AACvE,IAAI,KAAK,EAAE,aAAa;AACxB,GAAG,EAAE,QAAQ,GAAG,QAAQ,mBAAmBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvF,EAAE;AACF,aAAa,CAAC,WAAW,GAAG,iCAAiC;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"../../DatePicker/locales/en.js";const e={Empty:{noData:"No Data"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Pagination:{totalItems:"Total:"},DatePicker:a};var t=e;export{t as default};
|
|
2
2
|
//# sourceMappingURL=en.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.js","sources":["../../../src/ConfigProvider/locales/en.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/en';\n\nconst localeValues: ILocale = {\n Empty: { noData: 'No Data' },\n Modal: {\n okText: 'OK',\n cancelText: 'Cancel',\n justOkText: 'OK',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;AAC9B,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,UAAU,EAAE,QAAQ;AACxB,IAAI,UAAU,EAAE,IAAI;AACpB,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
1
|
+
{"version":3,"file":"en.js","sources":["../../../src/ConfigProvider/locales/en.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/en';\n\nconst localeValues: ILocale = {\n Empty: { noData: 'No Data' },\n Modal: {\n okText: 'OK',\n cancelText: 'Cancel',\n justOkText: 'OK',\n },\n Pagination: {\n totalItems: 'Total:',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;AAC9B,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,UAAU,EAAE,QAAQ;AACxB,IAAI,UAAU,EAAE,IAAI;AACpB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,UAAU,EAAE,QAAQ;AACxB,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"../../DatePicker/locales/es.js";const e={Empty:{noData:"No hay datos"},Modal:{okText:"Aceptar",cancelText:"Cancelar",justOkText:"Aceptar"},Pagination:{totalItems:"Total:"},DatePicker:a};var t=e;export{t as default};
|
|
2
2
|
//# sourceMappingURL=es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.js","sources":["../../../src/ConfigProvider/locales/es.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/es';\n\nconst localeValues: ILocale = {\n Empty: { noData: 'No hay datos' },\n Modal: {\n okText: 'Aceptar',\n cancelText: 'Cancelar',\n justOkText: 'Aceptar',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;AACnC,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,UAAU,EAAE,UAAU;AAC1B,IAAI,UAAU,EAAE,SAAS;AACzB,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
1
|
+
{"version":3,"file":"es.js","sources":["../../../src/ConfigProvider/locales/es.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/es';\n\nconst localeValues: ILocale = {\n Empty: { noData: 'No hay datos' },\n Modal: {\n okText: 'Aceptar',\n cancelText: 'Cancelar',\n justOkText: 'Aceptar',\n },\n Pagination: {\n totalItems: 'Total:',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;AACnC,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,UAAU,EAAE,UAAU;AAC1B,IAAI,UAAU,EAAE,SAAS;AACzB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,UAAU,EAAE,QAAQ;AACxB,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"../../DatePicker/locales/zh-tw.js";const a={Empty:{noData:"\u7121\u6B64\u8CC7\u6599"},Modal:{okText:"\u78BA\u5B9A",cancelText:"\u53D6\u6D88",justOkText:"\u77E5\u9053\u4E86"},Pagination:{totalItems:"\u7E3D\u6578:"},DatePicker:t};var e=a;export{e as default};
|
|
2
2
|
//# sourceMappingURL=zh-tw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-tw.js","sources":["../../../src/ConfigProvider/locales/zh-tw.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/zh-tw';\n\nconst localeValues: ILocale = {\n Empty: { noData: '無此資料' },\n Modal: {\n okText: '確定',\n cancelText: '取消',\n justOkText: '知道了',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,UAAU,EAAE,cAAc;AAC9B,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
1
|
+
{"version":3,"file":"zh-tw.js","sources":["../../../src/ConfigProvider/locales/zh-tw.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/zh-tw';\n\nconst localeValues: ILocale = {\n Empty: { noData: '無此資料' },\n Modal: {\n okText: '確定',\n cancelText: '取消',\n justOkText: '知道了',\n },\n Pagination: {\n totalItems: '總數:',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,UAAU,EAAE,cAAc;AAC9B,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,UAAU,EAAE,eAAe;AAC/B,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"../../DatePicker/locales/zh.js";const e={Empty:{noData:"\u6682\u65E0\u6570\u636E"},Modal:{okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",justOkText:"\u77E5\u9053\u4E86"},Pagination:{totalItems:"\u603B\u6570:"},DatePicker:a};var t=e;export{t as default};
|
|
2
2
|
//# sourceMappingURL=zh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh.js","sources":["../../../src/ConfigProvider/locales/zh.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/zh';\n\nconst localeValues: ILocale = {\n Empty: {\n noData: '暂无数据',\n },\n Modal: {\n okText: '确定',\n cancelText: '取消',\n justOkText: '知道了',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,0BAA0B;AACtC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,UAAU,EAAE,cAAc;AAC9B,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
1
|
+
{"version":3,"file":"zh.js","sources":["../../../src/ConfigProvider/locales/zh.ts"],"sourcesContent":["import { ILocale } from '../LocaleProvider/types';\nimport PickerLocale from '../../DatePicker/locales/zh';\n\nconst localeValues: ILocale = {\n Empty: {\n noData: '暂无数据',\n },\n Modal: {\n okText: '确定',\n cancelText: '取消',\n justOkText: '知道了',\n },\n Pagination: {\n totalItems: '总数:',\n },\n DatePicker: PickerLocale,\n};\n\nexport default localeValues;\n"],"names":[],"mappings":";;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,0BAA0B;AACtC,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,UAAU,EAAE,cAAc;AAC9B,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,UAAU,EAAE,eAAe;AAC/B,GAAG;AACH,EAAE,UAAU,EAAE,YAAY;AAC1B,CAAC,CAAC;AACF,SAAe,YAAY;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import s,{useState as f,useRef as G,useEffect as
|
|
1
|
+
import s,{useState as f,useRef as G,useEffect as w}from"react";import H from"classnames";import{isEmpty as p,find as C,omit as J,trim as Q}from"lodash";import{Magnifier as X,Close as M}from"@kubed/icons";import{useClickOutside as Y}from"@kubed/hooks";import Z from"../utils/forwardRef.js";import{Tag as ee}from"../Tag/Tag.js";import"../Menu/Menu.js";import{Dropdown as te}from"../Dropdown/Dropdown.js";import{Wrapper as ne,InputWrapper as le,StyledMenu as E}from"./FilterInput.styles.js";import{MenuItem as O}from"../Menu/MenuItem/MenuItem.js";var oe=Object.defineProperty,ae=Object.defineProperties,se=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,j=(t,n,l)=>n in t?oe(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l,I=(t,n)=>{for(var l in n||(n={}))re.call(n,l)&&j(t,l,n[l]);if(P)for(var l of P(n))ie.call(n,l)&&j(t,l,n[l]);return t},N=(t,n)=>ae(t,se(n));const ce=(t,n)=>typeof n!="object"?[]:Object.keys(n).map(l=>{const r=C(t,{key:l})||{},i=r.options?C(r.options,{key:n[l]})||{}:{};return{filter:l,filterLabel:"label"in r?r.label:"",value:n[l],valueLabel:"label"in i?i.label:n[l]}}),ue=Z((t,n)=>{const l=t.simpleMode?t.initialKeyword:"",[r,i]=f(l),[D,m]=f(!1),[c,d]=f(null),[g,T]=f([]),[V,h]=f(!1),y=Y(()=>{m(!1)}),b=G();w(()=>{if(!t.simpleMode){const e=ce(t.suggestions,t.filters);T(e),d(null),m(!1),i("")}},[t.filters]),w(()=>{t.simpleMode&&i(t.initialKeyword)},[t.initialKeyword]);const S=e=>{e.nativeEvent.stopImmediatePropagation();const{onChange:o=()=>{},simpleMode:a}=t;i(""),d(null),o(a?"":{})},F=e=>{const{onChange:o,filters:a}=t;o(J(a,e.filter))},R=()=>t.simpleMode?null:g.map(e=>s.createElement(ee,{className:"filter-tag",key:e.filter,append:s.createElement(M,{className:"icon-close-tag",variant:"light",onClick:()=>F(e)})},s.createElement("span",null,e.filterLabel,":",e.valueLabel))),v=()=>{h(!0),m(!0)},L=()=>{h(!1)},x=e=>{const{onInputChange:o=()=>{},simpleMode:a}=t,{value:u}=e.target;i(u),a?o(u):p(u)&&d(null)},B=e=>{if(e.keyCode===13&&!p(r)){const{onChange:o=()=>{},filters:a,suggestions:u,simpleMode:z}=t;if(z)o(r);else{const _=c||u[0];o(N(I({},a),{[_.key]:Q(r.replace(`${_.label}:`,""))}))}}},U=e=>{d(e),i(`${e.label}:`),!e.options&&!e.customDropdown&&(b.current.focus(),m(!1))},W=e=>{const{onChange:o=()=>{},filters:a}=t;o(N(I({},a),{[c.key]:e.key})),m(!1)},$=()=>s.createElement(E,{ref:y,className:"suggestion-menu"},c.options.map(e=>s.createElement(O,{key:e.key,onClick:()=>{W(e)},className:"menu-item"},e.label))),A=()=>{const{suggestions:e=[]}=t,o=e.filter(a=>!g.some(u=>u.filter===a.key));return o.length<1?null:s.createElement(E,{ref:y,className:"suggestion-menu"},o.map(a=>s.createElement(O,{key:a.key,onClick:()=>U(a),className:"menu-item"},a.customLabel||a.label)))},K=()=>{if(t.simpleMode)return null;let e;return c&&c.customDropdown?e=c.customDropdown:c&&c.options?e=$():e=A(),e},q=()=>{const e=s.createElement("input",{ref:b,className:"filter-input",type:"text",placeholder:t.placeholder,onChange:x,onKeyUp:B,value:r||"",onFocus:v,onBlur:L,onClick:v}),o=K();return o?s.createElement(te,{content:o,visible:D,hideOnClick:!1,appendTo:()=>document.body,placement:"bottom-start",animation:null},e):e},k=!p(r)||!p(g);return s.createElement(ne,{className:H(t.className,{"has-value":k,"is-focused":V}),ref:n},s.createElement(X,{className:"icon-search"}),s.createElement(le,null,R(),q()),k&&s.createElement(M,{className:"icon-clear",name:"close",onClick:S}))});export{ue as FilterInput};
|
|
2
2
|
//# sourceMappingURL=FilterInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterInput.js","sources":["../../src/FilterInput/FilterInput.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport cx from 'classnames';\nimport { find, isEmpty, trim, omit } from 'lodash';\nimport { Magnifier, Close } from '@kubed/icons';\nimport { useClickOutside } from '@kubed/hooks';\nimport forwardRef from '../utils/forwardRef';\nimport { Tag } from '../Tag/Tag';\nimport { MenuItem } from '../Menu/Menu';\nimport { Dropdown } from '../Dropdown/Dropdown';\n\nimport { Wrapper, InputWrapper, StyledMenu } from './FilterInput.styles';\nimport { DefaultProps } from '../theme';\n\nconst getTags = (suggestions, filters) => {\n if (typeof filters !== 'object') return [];\n\n return Object.keys(filters).map((filterKey) => {\n const curFilter = find(suggestions, { key: filterKey }) || {};\n const curValue = curFilter.options\n ? find(curFilter.options, { key: filters[filterKey] }) || {}\n : {};\n\n return {\n filter: filterKey,\n filterLabel: 'label' in curFilter ? curFilter.label : '',\n value: filters[filterKey],\n valueLabel: 'label' in curValue ? curValue.label : filters[filterKey],\n };\n });\n};\n\ntype Option = {\n label: string;\n key: string;\n};\n\ntype Filter = Record<string, any>;\n\ntype Suggestion = {\n label: string;\n key: string;\n options?: Option[];\n};\n\nexport interface FilterInputProps extends DefaultProps {\n suggestions?: any[];\n placeholder?: string;\n filters?: Filter;\n // filter?: () => void;\n onChange?: (params?: any) => void;\n onClear?: () => void;\n onInputChange?: (params?: any) => void;\n isMultiKeyword?: boolean;\n // defaultKeywordLabel?: string;\n // renderMenuItem?: () => void;\n initialKeyword?: string;\n simpleMode?: boolean;\n}\n\nexport const FilterInput = forwardRef<FilterInputProps, null>((props, ref) => {\n const initialValue = props.simpleMode ? props.initialKeyword : '';\n const [value, setValue] = useState<string>(initialValue);\n const [optionVisible, setOptionVisible] = useState(false);\n const [activeSuggestion, setActiveSuggestion] = useState<Suggestion>(null);\n const [tags, setTags] = useState([]);\n const [isFocused, setIsFocused] = useState(false);\n const optionRef = useClickOutside(() => {\n setOptionVisible(false);\n });\n const inputRef = useRef<HTMLInputElement>();\n\n useEffect(() => {\n if (!props.simpleMode) {\n const newTags = getTags(props.suggestions, props.filters);\n setTags(newTags);\n setActiveSuggestion(null);\n setOptionVisible(false);\n setValue('');\n }\n }, [props.filters]);\n\n useEffect(() => {\n if (props.simpleMode) {\n setValue(props.initialKeyword);\n }\n }, [props.initialKeyword]);\n\n const handleClear = (e) => {\n e.nativeEvent.stopImmediatePropagation();\n const { onChange = () => {}, simpleMode } = props;\n setValue('');\n setActiveSuggestion(null);\n const returnValue = simpleMode ? '' : {};\n onChange(returnValue);\n };\n\n const handleTagDelete = (tag) => {\n const { onChange, filters } = props;\n onChange(omit(filters, tag.filter));\n };\n\n const renderTags = () => {\n if (props.simpleMode) return null;\n return tags.map((tag) => (\n <Tag\n className=\"filter-tag\"\n key={tag.filter}\n append={\n <Close className=\"icon-close-tag\" variant=\"light\" onClick={() => handleTagDelete(tag)} />\n }\n >\n <span>\n {tag.filterLabel}:{tag.valueLabel}\n </span>\n </Tag>\n ));\n };\n\n const handleFocus = () => {\n setIsFocused(true);\n setOptionVisible(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n };\n\n const handleChange = (e) => {\n const { onInputChange = () => {}, simpleMode } = props;\n const { value: _value } = e.target;\n setValue(_value);\n if (simpleMode) {\n onInputChange(_value);\n } else if (isEmpty(_value)) {\n setActiveSuggestion(null);\n }\n };\n\n const handleKeyUp = (e) => {\n if (e.keyCode === 13 && !isEmpty(value)) {\n const { onChange = () => {}, filters, suggestions, simpleMode } = props;\n if (simpleMode) {\n onChange(value);\n } else {\n const sg = activeSuggestion || suggestions[0];\n onChange({\n ...filters,\n [sg.key]: trim(value.replace(`${sg.label}:`, '')),\n });\n }\n }\n };\n\n const handleMenuClick = (suggestion: Suggestion) => {\n setActiveSuggestion(suggestion);\n setValue(`${suggestion.label}:`);\n if (!suggestion.options) {\n inputRef.current.focus();\n setOptionVisible(false);\n }\n };\n\n const handleSuggestionMenuClick = (option: Option) => {\n const { onChange = () => {}, filters } = props;\n onChange({\n ...filters,\n [activeSuggestion.key]: option.key,\n });\n setOptionVisible(false);\n };\n\n const renderSuggestionOptions = () => {\n return (\n <StyledMenu ref={optionRef} className=\"suggestion-menu\">\n {activeSuggestion.options.map((option) => (\n <MenuItem\n key={option.key}\n onClick={() => {\n handleSuggestionMenuClick(option);\n }}\n className=\"menu-item\"\n >\n {option.label}\n </MenuItem>\n ))}\n </StyledMenu>\n );\n };\n\n const renderMenu = () => {\n const { suggestions = [] } = props;\n const sgs = suggestions.filter((sg) => !tags.some((tag) => tag.filter === sg.key));\n\n if (sgs.length < 1) {\n return null;\n }\n\n return (\n <StyledMenu ref={optionRef} className=\"suggestion-menu\">\n {sgs.map((sg) => (\n <MenuItem key={sg.key} onClick={() => handleMenuClick(sg)} className=\"menu-item\">\n {sg.label}\n </MenuItem>\n ))}\n </StyledMenu>\n );\n };\n\n const getDropdownContent = () => {\n if (props.simpleMode) return null;\n\n let content;\n if (activeSuggestion && activeSuggestion.options) {\n content = renderSuggestionOptions();\n } else {\n content = renderMenu();\n }\n return content;\n };\n\n const renderInput = () => {\n const input = (\n <input\n ref={inputRef}\n className=\"filter-input\"\n type=\"text\"\n placeholder={props.placeholder}\n onChange={handleChange}\n onKeyUp={handleKeyUp}\n value={value || ''}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onClick={handleFocus}\n />\n );\n\n const content = getDropdownContent();\n if (content) {\n return (\n <Dropdown\n content={content}\n visible={optionVisible}\n hideOnClick={false}\n appendTo={() => document.body}\n placement=\"bottom-start\"\n animation={null}\n >\n {input}\n </Dropdown>\n );\n }\n\n return input;\n };\n\n const hasValue = !isEmpty(value) || !isEmpty(tags);\n\n return (\n <Wrapper\n className={cx(props.className, { 'has-value': hasValue, 'is-focused': isFocused })}\n ref={ref}\n >\n <Magnifier className=\"icon-search\" />\n <InputWrapper>\n {renderTags()}\n {renderInput()}\n </InputWrapper>\n {hasValue && <Close className=\"icon-clear\" name=\"close\" onClick={handleClear} />}\n </Wrapper>\n );\n});\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,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CAAC;AACJ,EAAE,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACrD,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,OAAO,EAAE;AACtD,IAAI,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AACtF,IAAI,GAAG;AACP,GAAG,kBAAkBA,cAAK,CAAC,aAAa,CAAC,SAAS,EAAE;AACpD,IAAI,SAAS,EAAE,aAAa;AAC5B,GAAG,CAAC,kBAAkBA,cAAK,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,oBAAoBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACnJ,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,WAAW;AACxB,GAAG,CAAC,CAAC,CAAC;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"FilterInput.js","sources":["../../src/FilterInput/FilterInput.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, ReactNode } from 'react';\nimport cx from 'classnames';\nimport { find, isEmpty, trim, omit } from 'lodash';\nimport { Magnifier, Close } from '@kubed/icons';\nimport { useClickOutside } from '@kubed/hooks';\nimport forwardRef from '../utils/forwardRef';\nimport { Tag } from '../Tag/Tag';\nimport { MenuItem } from '../Menu/Menu';\nimport { Dropdown } from '../Dropdown/Dropdown';\n\nimport { Wrapper, InputWrapper, StyledMenu } from './FilterInput.styles';\nimport { DefaultProps } from '../theme';\n\nconst getTags = (suggestions, filters) => {\n if (typeof filters !== 'object') return [];\n\n return Object.keys(filters).map((filterKey) => {\n const curFilter = find(suggestions, { key: filterKey }) || {};\n const curValue = curFilter.options\n ? find(curFilter.options, { key: filters[filterKey] }) || {}\n : {};\n\n return {\n filter: filterKey,\n filterLabel: 'label' in curFilter ? curFilter.label : '',\n value: filters[filterKey],\n valueLabel: 'label' in curValue ? curValue.label : filters[filterKey],\n };\n });\n};\n\ntype Option = {\n label: string;\n key: string;\n};\n\ntype Filter = Record<string, any>;\n\ntype Suggestion = {\n key: string;\n label: string;\n options?: Option[];\n customLabel?: ReactNode;\n customDropdown?: ReactNode;\n};\n\nexport interface FilterInputProps extends DefaultProps {\n suggestions?: any[];\n placeholder?: string;\n filters?: Filter;\n // filter?: () => void;\n onChange?: (params?: any) => void;\n onClear?: () => void;\n onInputChange?: (params?: any) => void;\n isMultiKeyword?: boolean;\n // defaultKeywordLabel?: string;\n // renderMenuItem?: () => void;\n initialKeyword?: string;\n simpleMode?: boolean;\n}\n\nexport const FilterInput = forwardRef<FilterInputProps, null>((props, ref) => {\n const initialValue = props.simpleMode ? props.initialKeyword : '';\n const [value, setValue] = useState<string>(initialValue);\n const [optionVisible, setOptionVisible] = useState(false);\n const [activeSuggestion, setActiveSuggestion] = useState<Suggestion>(null);\n const [tags, setTags] = useState([]);\n const [isFocused, setIsFocused] = useState(false);\n const optionRef = useClickOutside(() => {\n setOptionVisible(false);\n });\n const inputRef = useRef<HTMLInputElement>();\n\n useEffect(() => {\n if (!props.simpleMode) {\n const newTags = getTags(props.suggestions, props.filters);\n setTags(newTags);\n setActiveSuggestion(null);\n setOptionVisible(false);\n setValue('');\n }\n }, [props.filters]);\n\n useEffect(() => {\n if (props.simpleMode) {\n setValue(props.initialKeyword);\n }\n }, [props.initialKeyword]);\n\n const handleClear = (e) => {\n e.nativeEvent.stopImmediatePropagation();\n const { onChange = () => {}, simpleMode } = props;\n setValue('');\n setActiveSuggestion(null);\n const returnValue = simpleMode ? '' : {};\n onChange(returnValue);\n };\n\n const handleTagDelete = (tag) => {\n const { onChange, filters } = props;\n onChange(omit(filters, tag.filter));\n };\n\n const renderTags = () => {\n if (props.simpleMode) return null;\n return tags.map((tag) => (\n <Tag\n className=\"filter-tag\"\n key={tag.filter}\n append={\n <Close className=\"icon-close-tag\" variant=\"light\" onClick={() => handleTagDelete(tag)} />\n }\n >\n <span>\n {tag.filterLabel}:{tag.valueLabel}\n </span>\n </Tag>\n ));\n };\n\n const handleFocus = () => {\n setIsFocused(true);\n setOptionVisible(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n };\n\n const handleChange = (e) => {\n const { onInputChange = () => {}, simpleMode } = props;\n const { value: _value } = e.target;\n setValue(_value);\n if (simpleMode) {\n onInputChange(_value);\n } else if (isEmpty(_value)) {\n setActiveSuggestion(null);\n }\n };\n\n const handleKeyUp = (e) => {\n if (e.keyCode === 13 && !isEmpty(value)) {\n const { onChange = () => {}, filters, suggestions, simpleMode } = props;\n if (simpleMode) {\n onChange(value);\n } else {\n const sg = activeSuggestion || suggestions[0];\n onChange({\n ...filters,\n [sg.key]: trim(value.replace(`${sg.label}:`, '')),\n });\n }\n }\n };\n\n const handleMenuClick = (suggestion: Suggestion) => {\n setActiveSuggestion(suggestion);\n setValue(`${suggestion.label}:`);\n if (!suggestion.options && !suggestion.customDropdown) {\n inputRef.current.focus();\n setOptionVisible(false);\n }\n };\n\n const handleSuggestionMenuClick = (option: Option) => {\n const { onChange = () => {}, filters } = props;\n onChange({\n ...filters,\n [activeSuggestion.key]: option.key,\n });\n setOptionVisible(false);\n };\n\n const renderSuggestionOptions = () => {\n return (\n <StyledMenu ref={optionRef} className=\"suggestion-menu\">\n {activeSuggestion.options.map((option) => (\n <MenuItem\n key={option.key}\n onClick={() => {\n handleSuggestionMenuClick(option);\n }}\n className=\"menu-item\"\n >\n {option.label}\n </MenuItem>\n ))}\n </StyledMenu>\n );\n };\n\n const renderMenu = () => {\n const { suggestions = [] } = props;\n const sgs = suggestions.filter((sg) => !tags.some((tag) => tag.filter === sg.key));\n\n if (sgs.length < 1) {\n return null;\n }\n\n return (\n <StyledMenu ref={optionRef} className=\"suggestion-menu\">\n {sgs.map((sg) => (\n <MenuItem key={sg.key} onClick={() => handleMenuClick(sg)} className=\"menu-item\">\n {sg.customLabel || sg.label}\n </MenuItem>\n ))}\n </StyledMenu>\n );\n };\n\n const getDropdownContent = () => {\n if (props.simpleMode) return null;\n\n let content;\n if (activeSuggestion && activeSuggestion.customDropdown) {\n content = activeSuggestion.customDropdown;\n } else if (activeSuggestion && activeSuggestion.options) {\n content = renderSuggestionOptions();\n } else {\n content = renderMenu();\n }\n return content;\n };\n\n const renderInput = () => {\n const input = (\n <input\n ref={inputRef}\n className=\"filter-input\"\n type=\"text\"\n placeholder={props.placeholder}\n onChange={handleChange}\n onKeyUp={handleKeyUp}\n value={value || ''}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onClick={handleFocus}\n />\n );\n\n const content = getDropdownContent();\n if (content) {\n return (\n <Dropdown\n content={content}\n visible={optionVisible}\n hideOnClick={false}\n appendTo={() => document.body}\n placement=\"bottom-start\"\n animation={null}\n >\n {input}\n </Dropdown>\n );\n }\n\n return input;\n };\n\n const hasValue = !isEmpty(value) || !isEmpty(tags);\n\n return (\n <Wrapper\n className={cx(props.className, { 'has-value': hasValue, 'is-focused': isFocused })}\n ref={ref}\n >\n <Magnifier className=\"icon-search\" />\n <InputWrapper>\n {renderTags()}\n {renderInput()}\n </InputWrapper>\n {hasValue && <Close className=\"icon-clear\" name=\"close\" onClick={handleClear} />}\n </Wrapper>\n );\n});\n"],"names":["React"],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI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EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,oBAAoBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACnJ,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,WAAW;AACxB,GAAG,CAAC,CAAC,CAAC;AACN,CAAC;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import r from"styled-components";import{addColorAlpha as t}from"../utils/color.js";const a=r("div")`
|
|
2
|
+
background-color: ${({theme:e})=>e.palette.background};
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
width: ${({width:e})=>e?`${e}px`:"100%"};
|
|
4
5
|
border-radius: 3px;
|
|
@@ -45,11 +46,11 @@ import r from"styled-components";import{addColorAlpha as t}from"../utils/color.j
|
|
|
45
46
|
-webkit-box-shadow: 0 0 0 1000px #fff inset;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
`,
|
|
49
|
+
`,d=r("div")`
|
|
49
50
|
margin-right: 8px;
|
|
50
51
|
display: flex;
|
|
51
52
|
align-items: center;
|
|
52
|
-
`,
|
|
53
|
+
`,i=r("div")`
|
|
53
54
|
margin-left: 8px;
|
|
54
55
|
display: flex;
|
|
55
56
|
align-items: center;
|
|
@@ -70,7 +71,7 @@ import r from"styled-components";import{addColorAlpha as t}from"../utils/color.j
|
|
|
70
71
|
border-bottom-right-radius: 0;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
`,
|
|
74
|
+
`,l=r("div")`
|
|
74
75
|
background-color: ${({theme:e})=>e.palette.accents_1};
|
|
75
76
|
border: 1px solid ${({theme:e})=>e.palette.accents_4};
|
|
76
77
|
display: inline-flex;
|
|
@@ -89,5 +90,5 @@ import r from"styled-components";import{addColorAlpha as t}from"../utils/color.j
|
|
|
89
90
|
border-top-right-radius: 3px;
|
|
90
91
|
border-bottom-right-radius: 3px;
|
|
91
92
|
}
|
|
92
|
-
`;export{
|
|
93
|
+
`;export{l as AddonWrapper,n as InputGroup,a as InputWrapper,d as PrefixWrapper,i as SuffixWrapper};
|
|
93
94
|
//# sourceMappingURL=Input.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.styles.js","sources":["../../src/Input/Input.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { addColorAlpha } from '../utils/color';\nimport { KubedSizes } from '../theme';\n\ninterface InputProps {\n focused?: boolean;\n disabled?: boolean;\n width?: number;\n size?: KubedSizes;\n}\n\nexport const InputWrapper = styled('div')<InputProps>`\n display: inline-flex;\n width: ${({ width }) => (width ? `${width}px` : '100%')};\n border-radius: 3px;\n padding: 0 12px;\n border: 1px solid ${({ theme }) => theme.palette.accents_4};\n outline: none;\n transition: all 0.3s ease-in-out;\n\n &:hover {\n border-color: ${({ theme }) => theme.palette.accents_5};\n }\n\n &.input-focus {\n border-color: ${({ theme }) => theme.palette.colors.green[2]};\n box-shadow: 0 4px 8px 0 ${({ theme }) => addColorAlpha(theme.palette.colors.green[2], 0.2)};\n }\n\n &.input-disabled {\n cursor: not-allowed;\n background-color: ${({ theme }) => theme.palette.accents_1};\n border-color: ${({ theme }) => theme.palette.accents_4};\n }\n\n input {\n width: 100%;\n font-weight: 600;\n outline: none;\n border-radius: 3px;\n height: ${({ size, theme }) => theme.layout.inputSizes[size]};\n padding: 6px 0;\n border: none;\n line-height: 1.67;\n color: ${({ theme }) => theme.palette.accents_7};\n transition: all 0.3s ease-in-out;\n background-color: transparent;\n\n &[disabled] {\n cursor: not-allowed;\n background-color: ${({ theme }) => theme.palette.accents_1};\n }\n\n &:-webkit-autofill {\n background-color: #fff;\n -webkit-box-shadow: 0 0 0 1000px #fff inset;\n }\n }\n`;\n\nexport const PrefixWrapper = styled('div')`\n margin-right: 8px;\n display: flex;\n align-items: center;\n`;\n\nexport const SuffixWrapper = styled('div')`\n margin-left: 8px;\n display: flex;\n align-items: center;\n`;\n\nexport const InputGroup = styled('div')<InputProps>`\n display: flex;\n width: ${({ width }) => (width ? `${width}px` : '100%')};\n\n &.has-addon-before {\n .input-wrapper {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n }\n\n &.has-addon-after {\n .input-wrapper {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n }\n`;\n\nexport const AddonWrapper = styled('div')`\n background-color: ${({ theme }) => theme.palette.accents_1};\n border: 1px solid ${({ theme }) => theme.palette.accents_4};\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0 8px;\n\n &.addon-before {\n border-right-width: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n }\n\n &.addon-after {\n border-left-width: 0;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n }\n`;\n"],"names":[],"mappings":";;;AAEY,MAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1C;AACA,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;AACxD;AACA;AACA,oBAAoB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC7D;AACA;AACA;AACA;AACA,kBAAkB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC3D;AACA;AACA;AACA,kBAAkB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjE,4BAA4B,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/F;AACA;AACA;AACA;AACA,sBAAsB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC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;;"}
|
|
1
|
+
{"version":3,"file":"Input.styles.js","sources":["../../src/Input/Input.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { addColorAlpha } from '../utils/color';\nimport { KubedSizes } from '../theme';\n\ninterface InputProps {\n focused?: boolean;\n disabled?: boolean;\n width?: number;\n size?: KubedSizes;\n}\n\nexport const InputWrapper = styled('div')<InputProps>`\n background-color: ${({ theme }) => theme.palette.background};\n display: inline-flex;\n width: ${({ width }) => (width ? `${width}px` : '100%')};\n border-radius: 3px;\n padding: 0 12px;\n border: 1px solid ${({ theme }) => theme.palette.accents_4};\n outline: none;\n transition: all 0.3s ease-in-out;\n\n &:hover {\n border-color: ${({ theme }) => theme.palette.accents_5};\n }\n\n &.input-focus {\n border-color: ${({ theme }) => theme.palette.colors.green[2]};\n box-shadow: 0 4px 8px 0 ${({ theme }) => addColorAlpha(theme.palette.colors.green[2], 0.2)};\n }\n\n &.input-disabled {\n cursor: not-allowed;\n background-color: ${({ theme }) => theme.palette.accents_1};\n border-color: ${({ theme }) => theme.palette.accents_4};\n }\n\n input {\n width: 100%;\n font-weight: 600;\n outline: none;\n border-radius: 3px;\n height: ${({ size, theme }) => theme.layout.inputSizes[size]};\n padding: 6px 0;\n border: none;\n line-height: 1.67;\n color: ${({ theme }) => theme.palette.accents_7};\n transition: all 0.3s ease-in-out;\n background-color: transparent;\n\n &[disabled] {\n cursor: not-allowed;\n background-color: ${({ theme }) => theme.palette.accents_1};\n }\n\n &:-webkit-autofill {\n background-color: #fff;\n -webkit-box-shadow: 0 0 0 1000px #fff inset;\n }\n }\n`;\n\nexport const PrefixWrapper = styled('div')`\n margin-right: 8px;\n display: flex;\n align-items: center;\n`;\n\nexport const SuffixWrapper = styled('div')`\n margin-left: 8px;\n display: flex;\n align-items: center;\n`;\n\nexport const InputGroup = styled('div')<InputProps>`\n display: flex;\n width: ${({ width }) => (width ? `${width}px` : '100%')};\n\n &.has-addon-before {\n .input-wrapper {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n }\n\n &.has-addon-after {\n .input-wrapper {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n }\n`;\n\nexport const AddonWrapper = styled('div')`\n background-color: ${({ theme }) => theme.palette.accents_1};\n border: 1px solid ${({ theme }) => theme.palette.accents_4};\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 0 8px;\n\n &.addon-before {\n border-right-width: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n }\n\n &.addon-after {\n border-left-width: 0;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n }\n`;\n"],"names":[],"mappings":";;;AAEY,MAAC,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1C,oBAAoB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;AAC9D;AACA,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;AACxD;AACA;AACA,oBAAoB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC7D;AACA;AACA;AACA;AACA,kBAAkB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC3D;AACA;AACA;AACA,kBAAkB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjE,4BAA4B,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/F;AACA;AACA;AACA;AACA,sBAAsB,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,OAAO,CAAC,S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"}
|
package/esm/Modal/Modal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import a,{useState as g,useEffect as H,useImperativeHandle as V}from"react";import z from"classnames";import{isNull as C}from"lodash";import{Close as W}from"@kubed/icons";import{StyledDialog as q,HeaderWrapper as G}from"./Modal.styles.js";import{Button as O}from"../Button/Button.js";import{useLocales as J}from"../ConfigProvider/LocaleProvider/LocaleContext.js";import{getTransitionName as b}from"../utils/motion.js";import{Field as P}from"../Entity/Field.js";import K from"../utils/forwardRef.js";var Q=Object.defineProperty,U=Object.defineProperties,X=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,
|
|
1
|
+
import a,{useState as g,useEffect as H,useImperativeHandle as V}from"react";import z from"classnames";import{isNull as C}from"lodash";import{Close as W}from"@kubed/icons";import{StyledDialog as q,HeaderWrapper as G}from"./Modal.styles.js";import{Button as O}from"../Button/Button.js";import{useLocales as J}from"../ConfigProvider/LocaleProvider/LocaleContext.js";import{getTransitionName as b}from"../utils/motion.js";import{Field as P}from"../Entity/Field.js";import K from"../utils/forwardRef.js";var Q=Object.defineProperty,U=Object.defineProperties,X=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,E=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u=(e,t)=>{for(var r in t||(t={}))w.call(t,r)&&E(e,r,t[r]);if(d)for(var r of d(t))y.call(t,r)&&E(e,r,t[r]);return e},Y=(e,t)=>U(e,X(t)),Z=(e,t)=>{var r={};for(var n in e)w.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&d)for(var n of d(e))t.indexOf(n)<0&&y.call(e,n)&&(r[n]=e[n]);return r};const k=K((e,t)=>{const{locales:r}=J(),{Modal:n}=r,p=e,{visible:m,centered:x=!0,getContainer:$,closeIcon:j,focusTriggerAfterClose:N=!0,width:h=600,wrapClassName:I,confirmLoading:T,destroyOnClose:L=!0}=p,B=Z(p,["visible","centered","getContainer","closeIcon","focusTriggerAfterClose","width","wrapClassName","confirmLoading","destroyOnClose"]),[F,v]=g(m),[M,_]=g(T),f=o=>{const{onCancel:l}=e;l==null||l(o)},R=async o=>{const{onOk:l,onAsyncOk:s}=e;if(s){_(!0);const i=await s();_(!1),i&&f(o)}else l==null||l(o)},S=()=>{const{header:o,title:l,description:s,titleIcon:i,headerExtra:c}=e;return o||C(o)?o:c?a.createElement(G,null,a.createElement(P,{value:l,label:s,avatar:i}),c):a.createElement(P,{value:l,label:s,avatar:i})};H(()=>{v(m)},[m]),V(t,()=>({close:o=>(v(!1),o&&o())}));const A=()=>{const{footer:o,okText:l,cancelText:s,cancelButtonProps:i,okButtonProps:c}=e;return o||C(o)?o:a.createElement(a.Fragment,null,a.createElement(O,u({onClick:f,radius:"xl"},i),s||n.cancelText),a.createElement(O,u({loading:M,onClick:R,radius:"xl",shadow:!0,color:"secondary"},c),l||n.okText))},D=a.createElement(a.Fragment,null,j||a.createElement(W,{size:24}));return a.createElement(q,Y(u({},B),{prefixCls:"kubed-modal",wrapClassName:z(I,{"kubed-modal-centered":x}),focusTriggerAfterClose:N,visible:F,width:h,closeIcon:D,destroyOnClose:L,onClose:f,title:S(),footer:A(),transitionName:b("kubed","zoom",e.transitionName),maskTransitionName:b("kubed","fade",e.maskTransitionName)}))});k.displayName="@kubed/components/Modal";export{k as Modal};
|
|
2
2
|
//# sourceMappingURL=Modal.js.map
|
package/esm/Modal/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import React, { RefObject, useEffect, useImperativeHandle, useState } from 'react';\nimport cx from 'classnames';\nimport { isNull } from 'lodash';\nimport { Close } from '@kubed/icons';\n\nimport { StyledDialog, HeaderWrapper } from './Modal.styles';\nimport { ButtonProps, Button } from '../Button/Button';\nimport { useLocales } from '../ConfigProvider/LocaleProvider/LocaleContext';\nimport { getTransitionName } from '../utils/motion';\nimport { Field } from '../Entity/Field';\nimport forwardRef from '../utils/forwardRef';\n\ntype getContainerFunc = () => HTMLElement;\n\nexport interface ModalProps {\n /** Mounts modal if true */\n visible?: boolean;\n\n /** Whether to apply loading visual effect for OK button or not */\n confirmLoading?: boolean;\n\n /** Modal title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Modal description */\n description?: React.ReactNode;\n\n /** Modal Icon */\n titleIcon?: React.ReactNode;\n\n /** Show or hide close button, modal still can be closed with escape key and by clicking outside */\n closable?: boolean;\n\n /** Specify a function that will be called when a user clicks the OK button */\n onOk?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /** Specify a function that will be called when a user clicks mask, close button on top right or Cancel button */\n onCancel?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /** Specify a function that will be called when modal is closed completely */\n afterClose?: () => void;\n\n /** Centered Modal */\n centered?: boolean;\n\n /** Width of the modal dialog */\n width?: string | number;\n\n /** Custom header content */\n header?: React.ReactNode;\n\n /** Custom header extra content */\n headerExtra?: React.ReactNode;\n\n /** Custom footer content */\n footer?: React.ReactNode;\n\n /** 确认按钮文字 */\n okText?: React.ReactNode;\n\n /** 取消按钮文字 */\n cancelText?: React.ReactNode;\n\n /** Whether to close the modal dialog when the mask (area outside the modal) is clicked */\n maskClosable?: boolean;\n\n /** Force render Modal */\n forceRender?: boolean;\n\n /** Props of the ok button */\n okButtonProps?: ButtonProps;\n\n /** Props of the cancel button */\n cancelButtonProps?: ButtonProps;\n\n /** Whether to unmount child components on onClose */\n destroyOnClose?: boolean;\n style?: React.CSSProperties;\n wrapClassName?: string;\n maskTransitionName?: string;\n transitionName?: string;\n className?: string;\n getContainer?: string | HTMLElement | getContainerFunc | false;\n\n /** Modal z-index property */\n zIndex?: number;\n bodyStyle?: React.CSSProperties;\n\n /** Style for modal's mask element */\n maskStyle?: React.CSSProperties;\n\n /** Whether show mask or not */\n mask?: boolean;\n\n /** Whether support press esc to close */\n keyboard?: boolean;\n wrapProps?: any;\n closeIcon?: React.ReactNode;\n modalRender?: (node: React.ReactNode) => React.ReactNode;\n focusTriggerAfterClose?: boolean;\n}\n\ninterface ModalRef {\n close?: () => void;\n}\n\nexport type ModalType = 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm' | 'open';\n\nexport interface ModalFuncProps extends Omit<ModalProps, 'forceRender' | 'destroyOnClose'> {\n content?: React.ReactNode;\n icon?: React.ReactNode;\n type?: ModalType;\n autoFocusButton?: null | 'ok' | 'cancel';\n okCancel?: boolean;\n id?: string;\n ref?: RefObject<ModalRef>;\n onAsyncOk?: () => Promise<any>;\n}\n\nexport const Modal = forwardRef<ModalProps, any>((props, ref) => {\n const { locales } = useLocales();\n const { Modal: modalLocales } = locales;\n\n const {\n visible,\n centered = true,\n getContainer,\n closeIcon,\n focusTriggerAfterClose = true,\n width = 600,\n wrapClassName,\n confirmLoading,\n destroyOnClose = true,\n ...restProps\n } = props;\n const [internalVisible, setInternalVisible] = useState(visible);\n const [_confirmLoading, setConfirmLoading] = useState(confirmLoading);\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n const { onCancel } = props;\n onCancel?.(e);\n };\n\n const handleOk = (e: React.MouseEvent<HTMLButtonElement>) => {\n const { onOk, onAsyncOk } = props;\n if (onAsyncOk) {\n setConfirmLoading(true);\n onAsyncOk().finally(() => {\n setConfirmLoading(false);\n });\n } else {\n onOk?.(e);\n }\n };\n\n const renderHeader = () => {\n const { header, title, description, titleIcon, headerExtra } = props;\n if (header || isNull(header)) return header;\n\n if (headerExtra) {\n return (\n <HeaderWrapper>\n <Field value={title} label={description} avatar={titleIcon} />\n {headerExtra}\n </HeaderWrapper>\n );\n }\n\n return <Field value={title} label={description} avatar={titleIcon} />;\n };\n\n useEffect(() => {\n setInternalVisible(visible);\n }, [visible]);\n\n useImperativeHandle(ref, () => ({\n // only use for imperative mode\n close: (callback) => {\n setInternalVisible(false);\n return callback && callback();\n },\n }));\n\n const renderFooter = () => {\n const { footer, okText, cancelText, cancelButtonProps, okButtonProps } = props;\n if (footer || isNull(footer)) return footer;\n\n return (\n <>\n <Button onClick={handleCancel} radius=\"xl\" {...cancelButtonProps}>\n {cancelText || modalLocales.cancelText}\n </Button>\n <Button\n loading={_confirmLoading}\n onClick={handleOk}\n radius=\"xl\"\n shadow\n color=\"secondary\"\n {...okButtonProps}\n >\n {okText || modalLocales.okText}\n </Button>\n </>\n );\n };\n\n const renderCloseIcon = <>{closeIcon || <Close size={24} />}</>;\n\n return (\n <StyledDialog\n {...restProps}\n prefixCls=\"kubed-modal\"\n wrapClassName={cx(wrapClassName, { 'kubed-modal-centered': centered })}\n focusTriggerAfterClose={focusTriggerAfterClose}\n visible={internalVisible}\n width={width}\n closeIcon={renderCloseIcon}\n destroyOnClose={destroyOnClose}\n onClose={handleCancel}\n title={renderHeader()}\n footer={renderFooter()}\n transitionName={getTransitionName('kubed', 'zoom', props.transitionName)}\n maskTransitionName={getTransitionName('kubed', 'fade', props.maskTransitionName)}\n />\n );\n});\n\nModal.displayName = '@kubed/components/Modal';\n"],"names":["React"],"mappings":";;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IA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CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,oBAAoBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5I,IAAI,IAAI,EAAE,EAAE;AACZ,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE;AACxG,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,aAAa,EAAE,EAAE,CAAC,aAAa,EAAE,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC;AAC1E,IAAI,sBAAsB;AAC1B,IAAI,OAAO,EAAE,eAAe;AAC5B,IAAI,KAAK;AACT,IAAI,SAAS,EAAE,eAAe;AAC9B,IAAI,cAAc;AAClB,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,KAAK,EAAE,YAAY,EAAE;AACzB,IAAI,MAAM,EAAE,YAAY,EAAE;AAC1B,IAAI,cAAc,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAC5E,IAAI,kBAAkB,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC;AACpF,GAAG,CAAC,CAAC,CAAC;AACN,CAAC,EAAE;AACH,KAAK,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../../src/Modal/Modal.tsx"],"sourcesContent":["import React, { RefObject, useEffect, useImperativeHandle, useState } from 'react';\nimport cx from 'classnames';\nimport { isNull } from 'lodash';\nimport { Close } from '@kubed/icons';\n\nimport { StyledDialog, HeaderWrapper } from './Modal.styles';\nimport { ButtonProps, Button } from '../Button/Button';\nimport { useLocales } from '../ConfigProvider/LocaleProvider/LocaleContext';\nimport { getTransitionName } from '../utils/motion';\nimport { Field } from '../Entity/Field';\nimport forwardRef from '../utils/forwardRef';\n\ntype getContainerFunc = () => HTMLElement;\n\nexport interface ModalProps {\n /** Mounts modal if true */\n visible?: boolean;\n\n /** Whether to apply loading visual effect for OK button or not */\n confirmLoading?: boolean;\n\n /** Modal title, displayed in header before close button */\n title?: React.ReactNode;\n\n /** Modal description */\n description?: React.ReactNode;\n\n /** Modal Icon */\n titleIcon?: React.ReactNode;\n\n /** Show or hide close button, modal still can be closed with escape key and by clicking outside */\n closable?: boolean;\n\n /** Specify a function that will be called when a user clicks the OK button */\n onOk?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /** Specify a function that will be called when a user clicks mask, close button on top right or Cancel button */\n onCancel?: (e: React.MouseEvent<HTMLElement>) => void;\n\n /** Specify a function that will be called when modal is closed completely */\n afterClose?: () => void;\n\n /** Centered Modal */\n centered?: boolean;\n\n /** Width of the modal dialog */\n width?: string | number;\n\n /** Custom header content */\n header?: React.ReactNode;\n\n /** Custom header extra content */\n headerExtra?: React.ReactNode;\n\n /** Custom footer content */\n footer?: React.ReactNode;\n\n /** 确认按钮文字 */\n okText?: React.ReactNode;\n\n /** 取消按钮文字 */\n cancelText?: React.ReactNode;\n\n /** Whether to close the modal dialog when the mask (area outside the modal) is clicked */\n maskClosable?: boolean;\n\n /** Force render Modal */\n forceRender?: boolean;\n\n /** Props of the ok button */\n okButtonProps?: ButtonProps;\n\n /** Props of the cancel button */\n cancelButtonProps?: ButtonProps;\n\n /** Whether to unmount child components on onClose */\n destroyOnClose?: boolean;\n style?: React.CSSProperties;\n wrapClassName?: string;\n maskTransitionName?: string;\n transitionName?: string;\n className?: string;\n getContainer?: string | HTMLElement | getContainerFunc | false;\n\n /** Modal z-index property */\n zIndex?: number;\n bodyStyle?: React.CSSProperties;\n\n /** Style for modal's mask element */\n maskStyle?: React.CSSProperties;\n\n /** Whether show mask or not */\n mask?: boolean;\n\n /** Whether support press esc to close */\n keyboard?: boolean;\n wrapProps?: any;\n closeIcon?: React.ReactNode;\n modalRender?: (node: React.ReactNode) => React.ReactNode;\n focusTriggerAfterClose?: boolean;\n}\n\ninterface ModalRef {\n close?: () => void;\n}\n\nexport type ModalType = 'info' | 'success' | 'error' | 'warn' | 'warning' | 'confirm' | 'open';\n\nexport interface ModalFuncProps extends Omit<ModalProps, 'forceRender' | 'destroyOnClose'> {\n content?: React.ReactNode;\n icon?: React.ReactNode;\n type?: ModalType;\n autoFocusButton?: null | 'ok' | 'cancel';\n okCancel?: boolean;\n id?: string;\n ref?: RefObject<ModalRef>;\n onAsyncOk?: () => Promise<any>;\n}\n\nexport const Modal = forwardRef<ModalProps, any>((props, ref) => {\n const { locales } = useLocales();\n const { Modal: modalLocales } = locales;\n\n const {\n visible,\n centered = true,\n getContainer,\n closeIcon,\n focusTriggerAfterClose = true,\n width = 600,\n wrapClassName,\n confirmLoading,\n destroyOnClose = true,\n ...restProps\n } = props;\n const [internalVisible, setInternalVisible] = useState(visible);\n const [_confirmLoading, setConfirmLoading] = useState(confirmLoading);\n\n const handleCancel = (e: React.MouseEvent<HTMLButtonElement>) => {\n const { onCancel } = props;\n onCancel?.(e);\n };\n\n const handleOk = async (e: React.MouseEvent<HTMLButtonElement>) => {\n const { onOk, onAsyncOk } = props;\n if (onAsyncOk) {\n setConfirmLoading(true);\n const ret = await onAsyncOk();\n setConfirmLoading(false);\n if (ret) {\n handleCancel(e);\n }\n } else {\n onOk?.(e);\n }\n };\n\n const renderHeader = () => {\n const { header, title, description, titleIcon, headerExtra } = props;\n if (header || isNull(header)) return header;\n\n if (headerExtra) {\n return (\n <HeaderWrapper>\n <Field value={title} label={description} avatar={titleIcon} />\n {headerExtra}\n </HeaderWrapper>\n );\n }\n\n return <Field value={title} label={description} avatar={titleIcon} />;\n };\n\n useEffect(() => {\n setInternalVisible(visible);\n }, [visible]);\n\n useImperativeHandle(ref, () => ({\n // only use for imperative mode\n close: (callback) => {\n setInternalVisible(false);\n return callback && callback();\n },\n }));\n\n const renderFooter = () => {\n const { footer, okText, cancelText, cancelButtonProps, okButtonProps } = props;\n if (footer || isNull(footer)) return footer;\n\n return (\n <>\n <Button onClick={handleCancel} radius=\"xl\" {...cancelButtonProps}>\n {cancelText || modalLocales.cancelText}\n </Button>\n <Button\n loading={_confirmLoading}\n onClick={handleOk}\n radius=\"xl\"\n shadow\n color=\"secondary\"\n {...okButtonProps}\n >\n {okText || modalLocales.okText}\n </Button>\n </>\n );\n };\n\n const renderCloseIcon = <>{closeIcon || <Close size={24} />}</>;\n\n return (\n <StyledDialog\n {...restProps}\n prefixCls=\"kubed-modal\"\n wrapClassName={cx(wrapClassName, { 'kubed-modal-centered': centered })}\n focusTriggerAfterClose={focusTriggerAfterClose}\n visible={internalVisible}\n width={width}\n closeIcon={renderCloseIcon}\n destroyOnClose={destroyOnClose}\n onClose={handleCancel}\n title={renderHeader()}\n footer={renderFooter()}\n transitionName={getTransitionName('kubed', 'zoom', props.transitionName)}\n maskTransitionName={getTransitionName('kubed', 'fade', props.maskTransitionName)}\n />\n );\n});\n\nModal.displayName = '@kubed/components/Modal';\n"],"names":["React"],"mappings":";;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IA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IAAI,EAAE,SAAS,oBAAoBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AAC5I,IAAI,IAAI,EAAE,EAAE;AACZ,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE;AACxG,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,aAAa,EAAE,EAAE,CAAC,aAAa,EAAE,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC;AAC1E,IAAI,sBAAsB;AAC1B,IAAI,OAAO,EAAE,eAAe;AAC5B,IAAI,KAAK;AACT,IAAI,SAAS,EAAE,eAAe;AAC9B,IAAI,cAAc;AAClB,IAAI,OAAO,EAAE,YAAY;AACzB,IAAI,KAAK,EAAE,YAAY,EAAE;AACzB,IAAI,MAAM,EAAE,YAAY,EAAE;AAC1B,IAAI,cAAc,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC;AAC5E,IAAI,kBAAkB,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC;AACpF,GAAG,CAAC,CAAC,CAAC;AACN,CAAC,EAAE;AACH,KAAK,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
package/esm/Radio/RadioGroup.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n,{useMemo as c,useEffect as f}from"react";import{useUncontrolled as G}from"@kubed/hooks";import{isUndefined as a}from"lodash";import{Group as R}from"../Group/Group.js";import{RadioContext as k}from"./RadioContext.js";const i=({onChange:l,disabled:r,value:e,defaultValue:p,children:d})=>{const[t,u]=G({value:e,defaultValue:p,finalValue:"",rule:o=>!a(o),onChange:l}),m=o=>{u(o)},s=c(()=>({updateState:m,disabledAll:r,inGroup:!0,value:t}),[r,t]);return f(()=>{a(e)||u(e)},[e]),n.createElement(k.Provider,{value:s},n.createElement(R,null,d))};i.displayName="@kubed/components/RadioGroup";export{i as RadioGroup};
|
|
2
2
|
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../../src/Radio/RadioGroup.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from 'react';\nimport { useUncontrolled } from '@kubed/hooks';\nimport { isUndefined } from 'lodash';\nimport { Group } from '../Group/Group';\nimport { RadioContext } from './RadioContext';\n\ninterface Props {\n value?: string | number;\n defaultValue?: string;\n disabled?: boolean;\n onChange?: (value) => void;\n}\n\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;\nexport type RadioGroupProps = Props & NativeAttrs;\n\nexport const RadioGroup: React.FC<React.PropsWithChildren<RadioGroupProps>> = ({\n onChange,\n disabled,\n value,\n defaultValue,\n children,\n}: RadioGroupProps) => {\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n rule: (val) => !isUndefined(val),\n onChange,\n });\n\n const updateState = (val) => {\n
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../../src/Radio/RadioGroup.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from 'react';\nimport { useUncontrolled } from '@kubed/hooks';\nimport { isUndefined } from 'lodash';\nimport { Group } from '../Group/Group';\nimport { RadioContext } from './RadioContext';\n\ninterface Props {\n value?: string | number;\n defaultValue?: string;\n disabled?: boolean;\n onChange?: (value) => void;\n}\n\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof Props>;\nexport type RadioGroupProps = Props & NativeAttrs;\n\nexport const RadioGroup: React.FC<React.PropsWithChildren<RadioGroupProps>> = ({\n onChange,\n disabled,\n value,\n defaultValue,\n children,\n}: RadioGroupProps) => {\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n rule: (val) => !isUndefined(val),\n onChange,\n });\n\n const updateState = (val) => {\n setValue(val);\n };\n\n const providerValue = useMemo(() => {\n return {\n updateState,\n disabledAll: disabled,\n inGroup: true,\n value: _value,\n };\n }, [disabled, _value]);\n\n useEffect(() => {\n if (isUndefined(value)) return;\n setValue(value);\n }, [value]);\n\n return (\n <RadioContext.Provider value={providerValue}>\n <Group>{children}</Group>\n </RadioContext.Provider>\n );\n};\n\nRadioGroup.displayName = '@kubed/components/RadioGroup';\n"],"names":["React"],"mappings":";;;;;;AAKY,MAAC,UAAU,GAAG,CAAC;AAC3B,EAAE,QAAQ;AACV,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,YAAY;AACd,EAAE,QAAQ;AACV,CAAC,KAAK;AACN,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,eAAe,CAAC;AAC7C,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,UAAU,EAAE,EAAE;AAClB,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;AACpC,IAAI,QAAQ;AACZ,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,WAAW,GAAG,CAAC,GAAG,KAAK;AAC/B,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;AAClB,GAAG,CAAC;AACJ,EAAE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM;AACtC,IAAI,OAAO;AACX,MAAM,WAAW;AACjB,MAAM,WAAW,EAAE,QAAQ;AAC3B,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,KAAK,EAAE,MAAM;AACnB,KAAK,CAAC;AACN,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC;AAC1B,MAAM,OAAO;AACb,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpB,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,EAAE,uBAAuBA,cAAK,CAAC,aAAa,CAAC,YAAY,CAAC,QAAQ,EAAE;AACpE,IAAI,KAAK,EAAE,aAAa;AACxB,GAAG,kBAAkBA,cAAK,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AACjE,EAAE;AACF,UAAU,CAAC,WAAW,GAAG,8BAA8B;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import r,{useState as y,useEffect as E}from"react";import{useMove as R}from"@kubed/hooks";import S from"../utils/forwardRef.js";import{SliderConfirmRoot as b,Track as x,DragHandlerWrapper as N,DragBackGround as $,Tip as h,DragHandler as v}from"./SliderConfirm.styles.js";const o=S(({tip:c,dragIcon:s,onConfirm:l=()=>{},className:n},i)=>{const[e,m]=y(0),{ref:f,active:t}=R(({x:k})=>m(k));E(()=>{e===1&&l()},[e]);const d=t?`calc(${e*100}% - 24px)`:"-24px",a=t?"0s":"0.3s",p=t?`calc(${(1-e)*100}% - 28px)`:"calc(100% - 28px)",u=t?e:0,g=t?{color:`rgb(${121+(255-121)*e},
|
|
2
|
+
${135+(255-135)*e},
|
|
3
|
+
${156+(255-156)*e})`}:{color:"#79879c"};return r.createElement(b,{ref:i,className:n},r.createElement(x,{className:"slider-track"}),r.createElement(N,{ref:f},r.createElement($,{style:{right:p,transitionDuration:a,opacity:u},className:"drag-background"}),r.createElement(h,{style:g,className:"slider-tip"},c),r.createElement(v,{style:{left:d,transitionDuration:a},className:"drag-handler"},s)))});o.displayName="@kubed/components/SliderConfirm";export{o as SliderConfirm};
|
|
4
|
+
//# sourceMappingURL=SliderConfirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliderConfirm.js","sources":["../../src/SliderConfirm/SliderConfirm.tsx"],"sourcesContent":["import React, { useState, useEffect, CSSProperties } from 'react';\nimport { useMove } from '@kubed/hooks';\nimport { DefaultProps } from '../theme';\nimport forwardRef from '../utils/forwardRef';\n\nimport {\n SliderConfirmRoot,\n Track,\n DragHandlerWrapper,\n DragBackGround,\n DragHandler,\n Tip,\n} from './SliderConfirm.styles';\n\nexport interface SliderConfirmProps extends DefaultProps {\n tip?: string | React.ReactNode;\n dragIcon?: React.ReactNode;\n onConfirm?: () => void;\n}\n\nexport const SliderConfirm = forwardRef<SliderConfirmProps, null>(\n ({ tip, dragIcon, onConfirm = () => {}, className }, ref) => {\n const [value, setValue] = useState(0);\n const { ref: moveRef, active } = useMove(({ x }) => setValue(x));\n\n useEffect(() => {\n if (value === 1) {\n onConfirm();\n }\n }, [value]);\n\n const left = active ? `calc(${value * 100}% - 24px)` : '-24px';\n const transitionDuration = active ? '0s' : '0.3s';\n const bgRight = active ? `calc(${(1 - value) * 100}% - 28px)` : 'calc(100% - 28px)';\n const opacity = active ? value : 0;\n const tipStyle: CSSProperties = active\n ? {\n color: `rgb(${121 + (255 - 121) * value},\n ${135 + (255 - 135) * value},\n ${156 + (255 - 156) * value})`,\n }\n : {\n color: '#79879c',\n };\n\n return (\n <SliderConfirmRoot ref={ref} className={className}>\n <Track className=\"slider-track\" />\n <DragHandlerWrapper ref={moveRef}>\n <DragBackGround\n style={{ right: bgRight, transitionDuration, opacity }}\n className=\"drag-background\"\n />\n <Tip style={tipStyle} className=\"slider-tip\">\n {tip}\n </Tip>\n <DragHandler style={{ left, transitionDuration }} className=\"drag-handler\">\n {dragIcon}\n </DragHandler>\n </DragHandlerWrapper>\n </SliderConfirmRoot>\n );\n }\n);\n\nSliderConfirm.displayName = '@kubed/components/SliderConfirm';\n"],"names":["React"],"mappings":";;;;;AAWY,MAAC,aAAa,GAAG,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,GAAG,MAAM;AAC5E,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK;AACxB,EAAE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AACxC,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAA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