amotify 0.2.26 → 0.2.28
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/demo/esbuild/app.tsx +23 -9
- package/demo/esbuild/public/index.css +1 -1
- package/demo/esbuild/public/index.js +96 -94
- package/dist/@declares/index.d.ts +2 -2
- package/dist/@declares/property.d.ts +4 -3
- package/dist/@styles/componentClasses/index.css +1 -1
- package/dist/@styles/componentClasses/index.d.ts +1 -2
- package/dist/@styles/componentClasses/index.js +1 -1
- package/dist/@styles/index.css +1 -1
- package/dist/@styles/index.js +1 -1
- package/dist/@styles/init.css +1 -1
- package/dist/@styles/style.css +1 -1
- package/dist/@styles/style.js +1 -1
- package/dist/@styles/var.css +1 -1
- package/dist/@utils/GenerateClassName.d.ts +4 -4
- package/dist/@utils/GenerateClassName.js +1 -1
- package/dist/@utils/LaunchReactApp.d.ts +1 -2
- package/dist/@utils/LaunchReactApp.js +1 -1
- package/dist/@utils/collectForm.js +1 -1
- package/dist/@utils/useRouterEffect.js +1 -1
- package/dist/atoms/Box.d.ts +8 -6
- package/dist/atoms/Box.js +1 -1
- package/dist/atoms/FAI.d.ts +3 -5
- package/dist/atoms/FAI.js +1 -1
- package/dist/atoms/Img.d.ts +3 -3
- package/dist/atoms/Img.js +1 -1
- package/dist/atoms/Logo.d.ts +3 -3
- package/dist/atoms/Logo.js +2 -2
- package/dist/atoms/Placeholder.d.ts +1 -1
- package/dist/atoms/Placeholder.js +1 -1
- package/dist/atoms/index.d.ts +40 -4
- package/dist/atoms/index.js +1 -1
- package/dist/fn/Button.d.ts +3 -3
- package/dist/fn/Button.js +1 -1
- package/dist/fn/Cropper.d.ts +1 -1
- package/dist/fn/Cropper.js +1 -1
- package/dist/fn/Effect/Fade.d.ts +3 -3
- package/dist/fn/Effect/Fade.js +1 -1
- package/dist/fn/Effect/Pudding.js +1 -1
- package/dist/fn/Effect/Ripple.js +2 -2
- package/dist/fn/Input/Autocomplete.d.ts +86 -0
- package/dist/fn/Input/Autocomplete.js +1 -0
- package/dist/fn/Input/Checker.d.ts +3 -3
- package/dist/fn/Input/Checker.js +1 -1
- package/dist/fn/Input/Contenteditable.js +1 -1
- package/dist/fn/Input/DigitCharacters.d.ts +2 -2
- package/dist/fn/Input/DigitCharacters.js +1 -1
- package/dist/fn/Input/Filer.d.ts +2 -2
- package/dist/fn/Input/Filer.js +1 -1
- package/dist/fn/Input/Hidden.js +1 -1
- package/dist/fn/Input/Label.d.ts +8 -0
- package/dist/fn/Input/Label.js +1 -0
- package/dist/fn/Input/List.d.ts +34 -22
- package/dist/fn/Input/List.js +1 -1
- package/dist/fn/Input/Parts.d.ts +18 -15
- package/dist/fn/Input/Parts.js +1 -1
- package/dist/fn/Input/Plain.d.ts +2 -2
- package/dist/fn/Input/Plain.js +1 -1
- package/dist/fn/Input/Search.d.ts +2 -2
- package/dist/fn/Input/Search.js +1 -1
- package/dist/fn/Input/Segmented.d.ts +17 -13
- package/dist/fn/Input/Segmented.js +1 -1
- package/dist/fn/Input/Select.d.ts +29 -9
- package/dist/fn/Input/Select.js +1 -1
- package/dist/fn/Input/Slider.js +1 -1
- package/dist/fn/Input/Switch.js +1 -1
- package/dist/fn/Input/TextField.d.ts +70 -0
- package/dist/fn/Input/TextField.js +3 -0
- package/dist/fn/Input/Time/Picker.js +1 -1
- package/dist/fn/Input/Time/index.d.ts +14 -0
- package/dist/fn/Input/Time/index.js +1 -1
- package/dist/fn/Input/core.d.ts +16 -18
- package/dist/fn/Input/core.js +1 -1
- package/dist/fn/Input/index.d.ts +36 -64
- package/dist/fn/Input/index.js +1 -1
- package/dist/fn/Loader/corner.js +1 -1
- package/dist/fn/Loader/index.d.ts +2 -2
- package/dist/fn/Loader/index.js +1 -1
- package/dist/fn/Loader/mini.js +1 -1
- package/dist/fn/PageNotFound.js +1 -1
- package/dist/fn/Plate.d.ts +2 -2
- package/dist/fn/Plate.js +1 -1
- package/dist/fn/RootViewController.d.ts +6 -7
- package/dist/fn/RootViewController.js +1 -1
- package/dist/fn/Sheet.d.ts +9 -9
- package/dist/fn/Sheet.js +1 -1
- package/dist/fn/Snackbar.d.ts +2 -2
- package/dist/fn/Snackbar.js +1 -1
- package/dist/fn/SwipeView.d.ts +2 -2
- package/dist/fn/SwipeView.js +1 -1
- package/dist/fn/TabBar.d.ts +2 -2
- package/dist/fn/TabBar.js +1 -1
- package/dist/fn/Table/Data.d.ts +3 -3
- package/dist/fn/Table/Data.js +1 -1
- package/dist/fn/Table/Drag.js +1 -1
- package/dist/fn/Table/Normal.js +1 -1
- package/dist/fn/Table/Parts.d.ts +7 -7
- package/dist/fn/Table/Parts.js +1 -1
- package/dist/fn/Table/cellStyling.d.ts +3 -3
- package/dist/fn/Table/cellStyling.js +1 -1
- package/dist/fn/Table/index.d.ts +5 -5
- package/dist/fn/Table/index.js +1 -1
- package/dist/fn/Tooltips.d.ts +4 -6
- package/dist/fn/Tooltips.js +1 -1
- package/dist/index.d.ts +28 -20
- package/dist/mols/Accordion.d.ts +2 -2
- package/dist/mols/Accordion.js +1 -1
- package/dist/mols/LinkifyText.d.ts +1 -1
- package/dist/mols/LinkifyText.js +1 -1
- package/dist/mols/List.d.ts +30 -7
- package/dist/mols/List.js +1 -1
- package/dist/mols/Row.d.ts +3 -3
- package/dist/mols/Row.js +1 -1
- package/dist/mols/Text.d.ts +18 -14
- package/dist/mols/Text.js +1 -1
- package/dist/mols/index.d.ts +0 -1
- package/dist/mols/index.js +1 -1
- package/dist/temps/designBook.js +20 -20
- package/package.json +2 -2
- package/dist/atoms/Flex.d.ts +0 -11
- package/dist/atoms/Flex.js +0 -1
- package/dist/atoms/Grid.d.ts +0 -4
- package/dist/atoms/Grid.js +0 -1
- package/dist/atoms/P.d.ts +0 -9
- package/dist/atoms/P.js +0 -1
- package/dist/atoms/Span.d.ts +0 -9
- package/dist/atoms/Span.js +0 -1
- package/dist/fn/Input/AutoHeightText.d.ts +0 -6
- package/dist/fn/Input/AutoHeightText.js +0 -1
- package/dist/fn/Input/Chips/Selector.d.ts +0 -44
- package/dist/fn/Input/Chips/Selector.js +0 -1
- package/dist/fn/Input/Chips/index.d.ts +0 -60
- package/dist/fn/Input/Chips/index.js +0 -1
- package/dist/fn/Input/RichSelect.d.ts +0 -33
- package/dist/fn/Input/RichSelect.js +0 -1
- package/dist/fn/Input/Text.d.ts +0 -51
- package/dist/fn/Input/Text.js +0 -1
- package/dist/fn/Input/TextArea.d.ts +0 -19
- package/dist/fn/Input/TextArea.js +0 -1
- package/dist/mols/Column.d.ts +0 -7
- package/dist/mols/Column.js +0 -1
package/dist/fn/Input/Parts.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import Span from '../../atoms
|
|
2
|
+
import { StyleTags, ReactElement } from '../../@declares';
|
|
3
|
+
import { Span } from '../../atoms';
|
|
4
4
|
import { InputTypes } from '.';
|
|
5
|
-
declare namespace Parts {
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
type Input = TagProperty.States & {
|
|
5
|
+
export declare namespace Parts {
|
|
6
|
+
type RequiredSign = React.FC<Span.Input>;
|
|
7
|
+
type RequiredShortSign = React.FC<Span.Input>;
|
|
8
|
+
type OmitSign = React.FC<Span.Input>;
|
|
9
|
+
type LeftIndicator = React.FC<Input>;
|
|
10
|
+
type RightIndicator = React.FC<Input>;
|
|
11
|
+
type LeftIcon = React.FC<Input>;
|
|
12
|
+
type RightIcon = React.FC<Input>;
|
|
13
|
+
type Input = StyleTags.States & {
|
|
16
14
|
tone?: InputTypes.BoxTone;
|
|
17
15
|
className?: string;
|
|
18
16
|
children: ReactElement;
|
|
19
17
|
};
|
|
20
18
|
}
|
|
21
|
-
declare const
|
|
22
|
-
export
|
|
19
|
+
export declare const RequiredSign: React.FC<Span.Input>;
|
|
20
|
+
export declare const RequiredShortSign: React.FC<Span.Input>;
|
|
21
|
+
export declare const OmitSign: React.FC<Span.Input>;
|
|
22
|
+
export declare const LeftIndicator: React.FC<Parts.Input>;
|
|
23
|
+
export declare const RightIndicator: React.FC<Parts.Input>;
|
|
24
|
+
export declare const RightIcon: React.FC<Parts.Input>;
|
|
25
|
+
export declare const LeftIcon: React.FC<Parts.Input>;
|
package/dist/fn/Input/Parts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,c as n,d as
|
|
1
|
+
import{b as t,c as n,d as c}from"../../chunk-C5N2D3ZX.js";import{jsx as a}from"react/jsx-runtime";import{Box as d,Span as u}from"../../atoms";import{DefaultStyles as p}from"./core";const l=e=>a(u,t({children:"\u5FC5\u9808",fontColor:"white",fontSize:"0.xs",padding:["1/4","1/3"],backgroundColor:"nega",borderRadius:"3.tone.tertiary"},e)),h=e=>a(u,t({children:"*",fontColor:"nega",padding:["1/4","1/3"],borderRadius:"3.tone.tertiary"},e)),x=e=>a(u,t({children:"\u7701\u7565\u53EF",fontColor:"white",fontSize:"0.xs",padding:["1/4","1/3"],borderRadius:"3.tone.tertiary",backgroundColor:"layer.6"},e)),y=e=>{let r=e,{tone:i}=r,o=c(r,["tone"]);return a(d,t(n(t({},p.Indicator(i)),{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3"}),o))},m=e=>{let r=e,{tone:i}=r,o=c(r,["tone"]);return a(d,t(n(t({},p.Indicator(i)),{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3"}),o))},F=e=>{let r=e,{tone:i="border"}=r,o=c(r,["tone"]);return a(d,n(t(n(t({},p.IndicatorIcon),{position:"absolute",right:"3/4"}),o),{freeCSS:t(t({},p.IndicatorIcon.freeCSS),o.freeCSS)}))},b=e=>{let r=e,{tone:i="border"}=r,o=c(r,["tone"]);return a(d,n(t(n(t({},p.IndicatorIcon),{left:"3/4"}),o),{freeCSS:t(t({},p.IndicatorIcon.freeCSS),o.freeCSS)}))};export{b as LeftIcon,y as LeftIndicator,x as OmitSign,h as RequiredShortSign,l as RequiredSign,F as RightIcon,m as RightIndicator};
|
package/dist/fn/Input/Plain.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { StyleTags } from '../../@declares';
|
|
3
3
|
declare namespace _Plain {
|
|
4
|
-
type Input =
|
|
4
|
+
type Input = StyleTags.States & React.InputHTMLAttributes<HTMLInputElement>;
|
|
5
5
|
}
|
|
6
6
|
declare const _Plain: (p: _Plain.Input) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export { _Plain, _Plain as default };
|
package/dist/fn/Input/Plain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t}from"../../chunk-C5N2D3ZX.js";import{jsx as n}from"react/jsx-runtime";import{
|
|
1
|
+
import{b as t}from"../../chunk-C5N2D3ZX.js";import{jsx as n}from"react/jsx-runtime";import{Box as p}from"../../atoms";const a=e=>n(p,t({htmlTag:"input"},e));export{a as _Plain,a as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Autocomplete } from './Autocomplete';
|
|
2
2
|
declare namespace Search {
|
|
3
|
-
type Input =
|
|
3
|
+
type Input = Autocomplete.Input;
|
|
4
4
|
}
|
|
5
5
|
declare const Search: (p: Search.Input) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export { Search, Search as default };
|
package/dist/fn/Input/Search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as t}from"../../chunk-C5N2D3ZX.js";import{Fragment as l,jsx as e}from"react/jsx-runtime";import{FAI as p}from"../../atoms";import{Autocomplete as c}from"./Autocomplete";import{RightIcon as m}from".";const o=r=>e(c,t({multiSelect:!1,SelectedComponent:({value:u,label:n})=>e(l,{children:n}),rightIcon:e(m,{children:e(p.AngleDown,{})})},r));export{o as Search,o as default};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import List from './List';
|
|
2
|
+
import { List } from './List';
|
|
3
3
|
declare namespace Segmented {
|
|
4
|
-
type Tones = '
|
|
4
|
+
type Tones = 'plain' | 'cloud' | 'cloud.theme' | 'cloud.mono' | 'border' | 'border.vivid' | 'bottomline';
|
|
5
5
|
type CoreInput = Segmented.Input & {
|
|
6
|
-
|
|
6
|
+
__sys_segmented_type: Segmented.Tones;
|
|
7
7
|
};
|
|
8
8
|
type ListInput = List.Options[];
|
|
9
9
|
type Input = List.Input;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
namespace Methods {
|
|
11
|
+
type Component = {
|
|
12
|
+
(p: Input): JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
type FNs = {
|
|
15
|
+
Cloud: (p: Input) => JSX.Element;
|
|
16
|
+
CloudTheme: (p: Input) => JSX.Element;
|
|
17
|
+
CloudMono: (p: Input) => JSX.Element;
|
|
18
|
+
Border: (p: Input) => JSX.Element;
|
|
19
|
+
BorderVivid: (p: Input) => JSX.Element;
|
|
20
|
+
Bottomline: (p: Input) => JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type Methods = Methods.Component & Methods.FNs;
|
|
20
24
|
}
|
|
21
25
|
declare const Segmented: Segmented.Methods;
|
|
22
26
|
export { Segmented, Segmented as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as e,c as n,d as S}from"../../chunk-C5N2D3ZX.js";import{jsx as r}from"react/jsx-runtime";import V from"@mingoo/jsmin";import{useState as a}from"react";import{Radio as E}from"./List";import{InputSegmentedClasses as p}from"../../@styles/componentClasses";const R=t=>{let c=t,{__sys_segmented_type:o,tone:B,value:d,options:y,onUpdateValue:h,onUpdateValidValue:u,enableFormSubmit:M,checkValidationAtFirst:J,cellStyles:g,cellClassName:_,cellCheckedClassName:f,cellCheckedStyles:b,freeCSS:k,wrapStyles:L}=c,I=S(c,["__sys_segmented_type","tone","value","options","onUpdateValue","onUpdateValidValue","enableFormSubmit","checkValidationAtFirst","cellStyles","cellClassName","cellCheckedClassName","cellCheckedStyles","freeCSS","wrapStyles"]),[v]=a(V.uuid.gen()),[i,x]=a(d),[w,m]=a(i);return i!=d&&(x(d),m(d)),r(E,n(e({options:y,value:w,componentID:v,icon:!1,flexWrap:!1,borderRadius:"2.tone.secondary",position:"relative"},I),{freeCSS:e({whiteSpace:"nowrap"},k),cellStyles:e({flexCenter:!0,ssEffectsOnActive:"push"},g),cellCheckedStyles:e({},b),cellClassName:[_,p("Label"),p("Tone_"+o.replace(/\./ig,""))].join(" "),cellCheckedClassName:[f,p("Checked")].join(" "),tone:"custom",onUpdateValue:h,onUpdateValidValue:C=>{u&&u(C),o=="bottomline"&&m(C.value[0])}}))},s=t=>{let{__sys_segmented_type:o}=t;return o=o||"plain",o=="plain"&&(t=n(e({padding:"1/3",gap:"1/3",ssCardBox:!0,isRounded:!0},t),{cellStyles:e({isRounded:!0,padding:["1/2","3/4"],borderRadius:"inherit",position:"relative"},t.cellStyles),cellCheckedStyles:e({backgroundColor:"theme",boxShadow:"1.normal",fontColor:"white"},t.cellCheckedStyles)})),r(R,e({__sys_segmented_type:"plain"},t))},l=s;l.Cloud=t=>{let o=n(e({__sys_segmented_type:"cloud",padding:"1/3",gap:"1/3",backgroundColor:"cloud"},t),{cellStyles:e({padding:"3/4",borderRadius:"inherit",position:"relative"},t.cellStyles),cellCheckedStyles:e({boxShadow:"1.normal",backgroundColor:"theme",fontColor:"white"},t.cellCheckedStyles)});return r(s,e({},o))},l.CloudTheme=t=>{let o=e({backgroundColor:"theme.opa.few",fontColor:"theme",__sys_segmented_type:"cloud.theme"},t);return r(l.Cloud,e({},o))},l.CloudMono=t=>{let o=n(e({fontColor:"3.blur",__sys_segmented_type:"cloud.mono"},t),{cellCheckedStyles:e({backgroundColor:"layer.1",fontColor:"1.clear"},t.cellCheckedStyles)});return r(l.Cloud,e({},o))},l.Border=t=>{let o=n(e({backgroundColor:"layer.1",border:"2.normal",overflow:"hidden",gap:0,fontColor:"3.blur",ssLastChildLossBorder:"right",boxShadow:"0.min",__sys_segmented_type:"border"},t),{cellStyles:e({padding:["1/4","2/3"],borderRadius:0,borderRight:"2.normal"},t.cellStyles),cellCheckedStyles:e({backgroundColor:"theme.opa.few",fontColor:"theme"},t.cellCheckedStyles)});return r(s,e({},o))},l.BorderVivid=t=>{let o=n(e({border:!0,borderColor:"theme",__sys_segmented_type:"border.vivid"},t),{cellStyles:e({borderRight:!0,borderColor:"theme"},t.cellStyles),cellCheckedStyles:e({backgroundColor:"theme",fontColor:"white"},t.cellCheckedStyles)});return r(l.Border,e({},o))},l.Bottomline=t=>{let o=n(e({__sys_segmented_type:"bottomline",gap:0,fontColor:"3.blur"},t),{cellStyles:e({ssEffectsOnActive:"ripple.theme",borderRadius:0,padding:1},t.cellStyles),cellCheckedStyles:e({fontColor:"theme"},t.cellCheckedStyles)});return r(s,e({},o))};export{l as Segmented,l as default};
|
|
@@ -1,28 +1,48 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { StyleTags, ReactElement } from '../../@declares';
|
|
3
3
|
import { KeyValueDict } from '@mingoo/jsmin';
|
|
4
4
|
import { InputTypes } from '.';
|
|
5
5
|
declare namespace Select {
|
|
6
|
-
type Input = InputTypes.CoreInput & React.DOMAttributes<
|
|
6
|
+
type Input = InputTypes.CoreInput<Value | Value[]> & React.DOMAttributes<HTMLInputElement> & {
|
|
7
|
+
label?: ReactElement;
|
|
7
8
|
tone?: InputTypes.BoxTone;
|
|
8
9
|
tabIndex?: number;
|
|
9
10
|
id?: string;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
value?: Value;
|
|
12
|
-
options:
|
|
13
|
-
placeholder?: string;
|
|
13
|
+
options: Option[];
|
|
14
14
|
leftIndicator?: ReactElement | false;
|
|
15
15
|
rightIndicator?: ReactElement | false;
|
|
16
16
|
leftIcon?: ReactElement | false;
|
|
17
17
|
rightIcon?: ReactElement | false;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
emptySelect?: boolean;
|
|
19
|
+
SelectedCellStyles?: StyleTags.PropsNFreeCSS;
|
|
20
|
+
SelectorCellStyles?: StyleTags.PropsNFreeCSS;
|
|
21
|
+
SelectorStyles?: StyleTags.PropsNFreeCSS;
|
|
22
|
+
gravityPoint?: number;
|
|
20
23
|
};
|
|
21
24
|
type Value = string | number | boolean | KeyValueDict | void | null;
|
|
22
|
-
type
|
|
25
|
+
type Option = {
|
|
26
|
+
type?: 'button';
|
|
23
27
|
value: Value;
|
|
24
|
-
label:
|
|
25
|
-
|
|
28
|
+
label: ReactElement;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'label';
|
|
31
|
+
value?: Value;
|
|
32
|
+
label: ReactElement;
|
|
33
|
+
};
|
|
34
|
+
type WrapperStates = {
|
|
35
|
+
rootStates: Input & {
|
|
36
|
+
value: Value[];
|
|
37
|
+
};
|
|
38
|
+
val_focus: boolean;
|
|
39
|
+
set_focus: React.Dispatch<React.SetStateAction<boolean>>;
|
|
40
|
+
val_status: InputTypes.Status.Plain<Value>;
|
|
41
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status.Plain>>;
|
|
42
|
+
val_validate: InputTypes.Validation.Result;
|
|
43
|
+
set_validate: React.Dispatch<React.SetStateAction<InputTypes.Validation.Result>>;
|
|
44
|
+
val_optionFocused: Value;
|
|
45
|
+
set_optionFocused: React.Dispatch<React.SetStateAction<Value>>;
|
|
26
46
|
};
|
|
27
47
|
}
|
|
28
48
|
declare const Select: React.FC<Select.Input>;
|
package/dist/fn/Input/Select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as l,c as d,d as U}from"../../chunk-C5N2D3ZX.js";import{Fragment as pe,jsx as o,jsxs as B}from"react/jsx-runtime";import{useState as R}from"react";import v from"@mingoo/jsmin";import{GenerateHTMLProps as X,ExtractStyles as Y}from"../../@utils";import{Box as _,Span as Z,FAI as j,Column as ee}from"../../atoms";import{Text as te,Row as ae}from"../../mols";import le from"../Button";import{OptionalInputWrapper as oe,BoxWrapper as ne,CoreEffects as q,DefaultStyles as se}from"./core";import{InputLabel as ie}from"./Label";import{RightIcon as ue}from".";function re(e){let{value:t,states:n}=e,{required:s,options:u}=n,S=[];return s&&t==="null"&&S.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!S.filter(({type:m})=>m=="invalid").length,notice:S}}const ce={FilterSelectableOptions:(e,t)=>{let n=e.rootStates.options;return t||(n=n.filter(s=>s.type!="label")),n}},F={Shallow:e=>{let{rootStates:t,val_status:n}=e,s=Y(t);return o(_,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:o(te.Description,d(l({className:t.className},s),{position:"absolute",width:1,freeCSS:d(l({},s.freeCSS),{color:"orange"}),children:o(_,{"data-input-value-shallow":n.componentID,children:"A"})}))})},Button:e=>{let{rootStates:t,val_optionFocused:n,set_optionFocused:s,val_validate:u,set_validate:S,val_focus:m,set_focus:r,val_status:i,set_status:b}=e,O=t,{tone:x,required:V,form:g,className:y,enableFormSubmit:T,emptySelect:D,checkValidationAtFirst:w,onValidate:M,onUpdateValue:A,onUpdateValidValue:de,value:Se="",options:J,leftIndicator:fe,rightIndicator:ve,leftIcon:ye,rightIcon:me,componentID:Ie,status_id:be,wrapStyles:ge,SelectedCellStyles:$,SelectorCellStyles:_e,SelectorStyles:Ve,gravityPoint:he}=O,a=U(O,["tone","required","form","className","enableFormSubmit","emptySelect","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentID","status_id","wrapStyles","SelectedCellStyles","SelectorCellStyles","SelectorStyles","gravityPoint"]),k=[];return i.dataValue!=="null"&&v.scope(()=>{let p=J.find(I=>I.value==i.dataValue);p&&k.push(o(_,d(l({},$),{children:p.label}),String(p.value)))}),o(pe,{children:B("div",d(l({tabIndex:0},a),{"data-disabled":t.disabled,"data-name":t.name,"data-form":g,"data-show-validation":q.isShowValidation(u,i,!!w),"data-validation":u.ok,"data-component-id":i.componentID,"data-input-origin":i.componentID,"data-value":i.dataValue,"data-input-type":"select",className:y,onFocus:p=>{a!=null&&a.onFocus&&(a==null||a.onFocus(p)),!t.disabled&&r(!0)},onBlur:p=>{a!=null&&a.onBlur&&(a==null||a.onBlur(p)),!t.disabled&&r(!1)},onKeyDown:p=>{let{key:I,metaKey:G,ctrlKey:Q}=p,W=G||Q;if(a!=null&&a.onKeyDown&&(a==null||a.onKeyDown(p)),!t.disabled){if(v.scope(()=>{if(!["ArrowDown","ArrowUp"].includes(I))return;p.preventDefault();let C=I=="ArrowDown"?1:-1,c=ce.FilterSelectableOptions(e),P=c.length-1,f=null;v.scope(()=>{var K,L,N,z;if(C==1){if(f=((K=c[0])==null?void 0:K.value)||null,e.val_optionFocused==null)return;if(W){f=c[P].value||f||null;return}let h=c.findIndex(E=>E.value==e.val_optionFocused);if(h==-1)return;f=((L=c[h+1])==null?void 0:L.value)||f||null}else{if(f=c[P].value||null,e.val_optionFocused==null)return;if(W){f=((N=c[0])==null?void 0:N.value)||f||null;return}let h=c.findIndex(E=>E.value==e.val_optionFocused);if(h==-1)return;f=((z=c[h-1])==null?void 0:z.value)||f||null}}),e.set_optionFocused(f)}),I=="Escape")r(!1);else if(I==" "){if(!m)return r(!0)}else if(I=="Enter"){if(!m)return r(!0);if(!n)return;p.preventDefault();let C=e.rootStates.options.find(c=>c.value==e.val_optionFocused);if(!C)return;b(c=>d(l({},c),{dataValue:C.value,eventType:"update",eventID:v.uuid.gen()})),r(!1)}}},children:[B(ae.Left,{flexWrap:!0,gap:"1/3",children:[o(Z,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),k]}),o(F.Selector,l({},e))]}))})},Selector:e=>{var b;let{rootStates:t,val_optionFocused:n,set_optionFocused:s,val_focus:u,set_focus:S,val_status:m,set_status:r}=e,i=[];return t.options.forEach((x,V)=>{let{type:g,value:y,label:T}=x,D=n==y,w=m.dataValue===y;if(g=="button"){i.push(o(le.Button.Sub.S,d(l({tabIndex:u?0:-1,color:"cloud",backgroundColor:"trans",borderRadius:0,fontSize:"inherit",fontColor:"2.normal",textAlign:"left",padding:["1/2",2]},t.SelectorCellStyles),{isActive:w||D,isActiveStyles:D?{backgroundColor:"cloud"}:{backgroundColor:"theme.opa.few",fontColor:"theme"},onClick:M=>{r(A=>d(l({},A),{dataValue:y,eventType:"update",eventID:v.uuid.gen()})),S(!1)},children:o(_,{paddingLeft:D?"1/2":0,transition:"short",children:T})}),String(y)));return}i.push(o(_,{children:T},v.uuid.gen()))}),o(_,d(l({position:"absolute",height:u?"auto":0,top:"100%",left:0,right:0,ssCardBox:!0,marginTop:"1/4",overflow:"auto",transition:"long",borderRadius:"2.tone.secondary",padding:["1/2",0]},t.SelectorStyles),{freeCSS:d(l({zIndex:100,transform:u?"scale(1)":"scale(0.9)",opacity:u?1:0,pointerEvents:u?"all":"none"},(b=t.SelectorStyles)==null?void 0:b.freeCSS),{maxHeight:"90vh"}),children:o(ee,{gap:0,children:i})}))},Core:e=>{let{onUpdateValue:t,onUpdateValidValue:n,value:s}=e,u={componentID:e.componentID||"",dataValue:s,eventType:"init",eventID:v.uuid.gen()},[S,m]=R(!1),[r,i]=R(u),[b,x]=R(e.value||null),[V,g]=R({ok:!1,notice:[]}),y={rootStates:e,val_optionFocused:b,set_optionFocused:x,val_focus:S,set_focus:m,val_status:r,set_status:i,val_validate:V,set_validate:g};return q.CommonEffects({type:"select",states:e,val_status:r,set_status:i,val_validate:V,set_validate:g,onUpdateValue:t,onUpdateValidValue:n,DefaultValidation:re,ExtraOverrideStates:{dataValue:s,formatValue:s}}),B(ne,{val_status:r,set_status:i,val_validate:V,states:e,children:[o(ie,{componentID:e.componentID,fontSize:e.fontSize,required:e.required,label:e.label,isActive:S||r.dataValue!=="null"}),o(F.Shallow,l({},y)),o(F.Button,l({},y))]})}},H=e=>{e=d(l({emptySelect:!0},e),{freeCSS:l({cursor:"pointer"},e.freeCSS)}),e.value=v.JsonTo(e.value||null),e.emptySelect&&(e.options=[{value:null,label:"\u9078\u629E\u3092\u89E3\u9664"},...e.options]),e.options.forEach((n,s)=>{let{type:u,value:S}=n;e.options[s]=d(l({},n),{type:u||"button",value:v.JsonTo(S)})}),v.is.nullish(e.rightIcon)&&(e.rightIcon=o(ue,{children:o(j.AngleDown,{})})),e.rightIcon&&(e=l({paddingRight:3},e)),e.leftIcon&&(e=l({paddingLeft:3},e));let t=X(se.Boxish(e));return o(oe,{componentID:e.componentID,children:F.Core,states:t})};export{H as Select,H as default};
|
package/dist/fn/Input/Slider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as I,c as T,d as A}from"../../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as M}from"react/jsx-runtime";import{useState as F,useEffect as
|
|
1
|
+
import{b as I,c as T,d as A}from"../../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as M}from"react/jsx-runtime";import{useState as F,useEffect as G}from"react";import c from"@mingoo/jsmin";import{$$fromRoot as L,useStore as R,GenerateHTMLProps as X}from"../../@utils";import{Box as x,Flex as z,Column as j}from"../../atoms";import J from"../Button";import{OptionalInputWrapper as Q,BoxWrapper as Y,CoreEffects as N}from"./core";import Z from"./Hidden";import{InputSliderClasses as S}from"../../@styles/componentClasses";function ee(e){let{value:t,states:o}=e,{required:n}=o,s=[];return n&&!t&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!s.filter(({type:i})=>i=="invalid").length,notice:s}}const H=e=>{let{value:t,val_status:o}=e,{min:n,max:s,step:i}=o;t=Math.max(t,n),t=Math.min(t,s);let a=t/s*s;return a=Math.round(a/i),{stepValue:a*i,stepIndex:a,positionLeft:a*i/s*100+"%"}},K={IndicatorLabels:e=>{let{componentID:t,min:o,max:n,step:s,customLegends:i}=e,r=[],a=Math.round(o/s),p=Math.round(n/s),v=p-a+1;for(var u=a;u<=p;u++){let l=u*s;l=Math.max(l,o),l=Math.min(l,n);let f=l/n*100+"%";r.push(d(x,{className:S("Label"),id:"Legend-"+t+"-"+u,display:u==a||u==p?"flex":"none",position:"absolute",top:0,unitHeight:1,unitWidth:1.5,transition:"middle",fontColor:"1.clear",verticalAlign:"center",horizontalAlign:"center",freeCSS:{left:f,whiteSpace:"nowrap",textAlign:"center"},children:i?i(l):l.rank()},l))}return G(()=>{const l=()=>{let f=L("#Labels-"+t),{width:b}=f.position(),C=Math.round(b/50)-1,y=Math.round(v/C);for(let m=a+1;m<p;m++)L("#Legend-"+t+"-"+m).css({display:m%y==0?"flex":"none"})};return c(window).addEvent({eventID:"SliderResizeCallback-"+t,eventType:"resize",callback:()=>{l()}}),l(),()=>{c(window).removeEvent("SliderResizeCallback-"+t)}},[]),d(z,{className:S("Labels"),verticalAlign:"center",horizontalAlign:"between",fontSize:"0.xs",position:"relative",unitHeight:1,id:"Labels-"+t,children:d(x,{position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:r})})},Rail:e=>{let{val_status:t,set_status:o,DotData:n,form:s,enableFormSubmit:i}=e,{componentID:r}=t;return M(z,{className:S("Rail"),position:"relative",paddingLeft:"1/2",unitHeight:1.5,verticalAlign:"center",freeCSS:{minWidth:"10rem",zIndex:1,cursor:"pointer"},onMouseDown:a=>{e.rootStates.disabled||(a.stopPropagation(),g.Effects.Start(a,{val_status:t,set_status:o,DotData:n}))},onTouchStart:a=>{e.rootStates.disabled||(a.stopPropagation(),g.Effects.Start(a,{val_status:t,set_status:o,DotData:n}))},children:[d(x,{className:S("Bar"),backgroundColor:"layer.4",position:"relative",isRounded:!0,transition:"middle",flexSizing:"none",unitHeight:"2/3",width:1,id:r+"_Bar",children:d(x,{className:S("BarColor"),position:"relative",height:1,width:0,left:0,transition:"long",borderRadius:"inherit",backgroundColor:e.color,opacity:"middle",overflow:"hidden",freeCSS:{width:n.positionLeft},id:r+"_BarColor"})}),d(x,{className:S("BallWrap"),position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:d(J.Button.Plain,{className:S("Ball"),position:"absolute",backgroundColor:e.color,top:0,left:0,ssSphere:1.5,freeCSS:{zIndex:2,left:n.positionLeft},"data-form-name":s,id:r+"_Ball",onKeyDown:a=>{g.KeyDownEvent({event:a,val_status:t,set_status:o,DotData:n}),i&&N.SubmitForm(a)}})})]})}},g={Effects:{Start:(e,t)=>{c(document).addEvent({eventID:"SliderMouseMove",eventType:"mousemove",callback:o=>{g.Effects.Move(o,t)},options:{passive:!1}}).addEvent({eventID:"SliderTouchMove",eventType:"touchmove",callback:o=>{g.Effects.Move(o,t)},options:{passive:!1}}).addEvent({eventID:"SliderMouseUp",eventType:"mouseup",callback:()=>{g.Effects.End()}}).addEvent({eventID:"SliderTouchEnd",eventType:"touchend",callback:()=>{g.Effects.End()}})},Move:(e,t)=>{let o=c.getCursor(e).x,{val_status:n,set_status:s}=t,{componentID:i,min:r,max:a}=n,p=L("#"+i+"_Ball"),v=L("#"+i+"_Bar"),u=L("#"+i+"_BarColor"),{width:l,left:f}=v.position(),b=(o-f)/l;b=Math.max(b,0),b=Math.min(b,1);let C=b*a,y=H({value:C,val_status:n}),m=y.positionLeft,D=y.stepValue;p.css({left:m}),u.css({width:m});let{prevValue:V}=R.get(i);return D!=V&&(R.update({[i]:{prevValue:D}}),s(B=>T(I({},B),{dataValue:D,eventType:"update",eventID:c.uuid.gen()}))),e.preventDefault(),e.stopPropagation(),!1},End:()=>{c(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},KeyDownEvent:e=>{let{event:t,val_status:o,set_status:n}=e,{min:s,max:i,step:r}=o,{key:a,metaKey:p,ctrlKey:v}=t,u=v||p,l=o.dataValue;a.match(/Arrow/)&&(t.preventDefault(),a.match(/Left|Up/)?u?l=s:l-=r:a.match(/Right|Down/)&&(u?l=i:l+=r),l=Math.max(Math.min(l,i),s),R.update({[o.componentID]:{prevValue:l}}),n(f=>T(I({},f),{dataValue:l,eventType:"update",eventID:c.uuid.gen()})))}},te=e=>{let k=e,{color:t="theme",required:o,form:n="",legends:{enable:s=!0,custom:i,showAlways:r=!1}={},min:a,max:p,step:v,enableFormSubmit:u,checkValidationAtFirst:l,onChange:f,onKeyDown:b,onValidate:C,onUpdateValue:y,onUpdateValidValue:m,value:D="",className:V,freeCSS:B,wrapStyles:ae}=k,P=A(k,["color","required","form","legends","min","max","step","enableFormSubmit","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","className","freeCSS","wrapStyles"]),U={componentID:e.componentID||"",dataValue:D,min:a,max:p,step:v,eventType:"init",eventID:c.uuid.gen()},[h,w]=F(U),[_,$]=F({ok:!1,notice:[]});N.CommonEffects({type:"slider",states:e,val_status:h,set_status:w,val_validate:_,set_validate:$,onUpdateValue:y,onUpdateValidValue:m,DefaultValidation:ee,ExtraOverrideStates:{dataValue:D},ExtraStoreStates:{prevValue:h.dataValue,setValueByForeign:O=>{w(q=>T(I({},q),{dataValue:O,eventType:"update",eventID:c.uuid.gen()}))}}});let E=H({value:h.dataValue,val_status:h});return M(Y,{val_status:h,set_status:w,val_validate:_,states:e,children:[d(Z,I({value:E.stepValue,form:n,"data-value":E.stepValue,"data-validation":_.ok,"data-input-type":"slider"},P)),M(j,{gap:"1/2",flexSizing:"auto",className:[S("Wrap"),V,S("ShowLegendsAlways_"+r)].join(" "),children:[d(K.Rail,{rootStates:e,color:t,val_status:h,set_status:w,DotData:E,form:n,enableFormSubmit:u}),!!s&&d(K.IndicatorLabels,{componentID:h.componentID,min:a,max:p,step:v,customLegends:i})]})]})},W=e=>(e=I({},e),d(Q,{componentID:e.componentID,children:te,states:X(e)}));export{W as Slider,W as default};
|
package/dist/fn/Input/Switch.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l,c as
|
|
1
|
+
import{b as l,c as h,d as V}from"../../chunk-C5N2D3ZX.js";import{jsx as e,jsxs as R}from"react/jsx-runtime";import{useState as g}from"react";import k from"@mingoo/jsmin";import d from"../../atoms/Box";import{Row as L}from"../../mols";import O from"../Button";import{OptionalInputWrapper as q,BoxWrapper as H,CoreEffects as x}from"./core";import{InputSwitchClasses as c}from"../../@styles/componentClasses";function P(t){let{value:I,states:a}=t,{required:y}=a,n=[];return y&&!I&&n.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!n.filter(({type:r})=>r=="invalid").length,notice:n}}const U=t=>{let S=t,{componentID:I,color:a="posi",required:y,form:n,id:r,enableFormSubmit:T,checkValidationAtFirst:W,onChange:b,onKeyDown:C,onValidate:A,onUpdateValue:B,onUpdateValidValue:_,value:m="",icon:v="",appearance:s="material"}=S,E=V(S,["componentID","color","required","form","id","enableFormSubmit","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","icon","appearance"]),F={componentID:t.componentID||"",dataValue:m,eventType:"init",eventID:k.uuid.gen()},[o,f]=g(F),[p,w]=g({ok:!1,notice:[]}),u=!!o.dataValue;return x.CommonEffects({type:"switch",states:t,val_status:o,set_status:f,val_validate:p,set_validate:w,DefaultValidation:P,onUpdateValue:B,onUpdateValidValue:_,ExtraOverrideStates:{dataValue:m,formatValue:m}}),R(H,{val_status:o,set_status:f,val_validate:p,states:t,children:[e("input",l({type:"checkbox","data-form":n,"data-input-type":"switch","data-validation":p.ok,"data-component-id":o.componentID,"data-value":o.dataValue,checked:o.dataValue,className:c("Input"),id:r,onKeyDown:i=>{C&&C(i),T&&x.SubmitForm(i)},onChange:i=>{p.ok&&w({ok:!1,notice:[]}),f(N=>h(l({},N),{dataValue:i.target.checked,eventType:"update",eventID:k.uuid.gen()})),b&&b(i)}},E)),e(O.Label.Plain,{tabIndex:-1,htmlFor:r,padding:"1/3",transition:"middle",borderRadius:"1.tone.primary",className:c("Label"),children:e(d,h(l({},s=="applely"?{padding:"1/4",isRounded:!0,backgroundColor:u?a:"layer.5"}:{}),{children:R(L.Center,{unitHeight:2.5,position:"relative",freeCSS:{width:12*4.5},children:[s=="material"&&e(d,{position:"absolute",backgroundColor:u?a:"layer.5",isRounded:!0,unitHeight:1,transition:"middle",width:1,opacity:"middle",className:c("Bar")}),e(d,{position:"absolute",top:0,left:0,backgroundColor:s=="material"&&u?a:"white",transition:"middle",ssSphere:2.5,boxShadow:"1.remark",className:c("Dot"),children:v&&e(d,{transition:"middle",ssSquare:2,flexCenter:!0,fontColor:s=="applely"&&u?a:"white",children:v})})]})}))})]})},D=t=>(t=l({},t),t.color=t.color||"theme",e(q,{componentID:t.componentID,children:U,states:t}));export{D as Switch,D as default};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReactElement } from '../../@declares';
|
|
3
|
+
import { InputTypes } from '.';
|
|
4
|
+
declare namespace TextField {
|
|
5
|
+
type Restrict = 'text' | 'katakana' | 'hankaku.katakana' | 'number' | 'number.zeroStart' | 'digitNumber' | 'tel' | 'email' | 'url' | 'fileName' | 'password' | 'postal' | 'creditCard' | 'concealed';
|
|
6
|
+
type Input<T = HTMLInputElement> = InputTypes.CoreInput & React.DOMAttributes<T> & {
|
|
7
|
+
label?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
tone?: InputTypes.BoxTone;
|
|
10
|
+
tabIndex?: number;
|
|
11
|
+
id?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
restrict?: Restrict;
|
|
14
|
+
minRows?: number;
|
|
15
|
+
maxRows?: number;
|
|
16
|
+
multiline?: boolean;
|
|
17
|
+
autoHeight?: boolean;
|
|
18
|
+
min?: number | null;
|
|
19
|
+
max?: number | null;
|
|
20
|
+
maxLength?: number | null;
|
|
21
|
+
autoComplete?: 'off' | 'none' | string;
|
|
22
|
+
autoCapitalize?: 'off' | 'none' | string;
|
|
23
|
+
clearButton?: boolean;
|
|
24
|
+
value?: string | number;
|
|
25
|
+
leftIndicator?: ReactElement | false;
|
|
26
|
+
rightIndicator?: ReactElement | false;
|
|
27
|
+
leftIcon?: ReactElement | false;
|
|
28
|
+
rightIcon?: ReactElement | false;
|
|
29
|
+
};
|
|
30
|
+
type WrapperStates = {
|
|
31
|
+
rootStates: Input;
|
|
32
|
+
val_focus: boolean;
|
|
33
|
+
set_focus: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
|
+
val_isComposing: boolean;
|
|
35
|
+
set_isComposing: React.Dispatch<React.SetStateAction<boolean>>;
|
|
36
|
+
val_status: InputTypes.Status.Text;
|
|
37
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status.Text>>;
|
|
38
|
+
val_validate: InputTypes.Validation.Result;
|
|
39
|
+
set_validate: React.Dispatch<React.SetStateAction<InputTypes.Validation.Result>>;
|
|
40
|
+
};
|
|
41
|
+
namespace Methods {
|
|
42
|
+
type Component = {
|
|
43
|
+
(p: Input): JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
type FNs = {
|
|
46
|
+
Validate(value: any, restrict: Restrict): {
|
|
47
|
+
ok: boolean;
|
|
48
|
+
body: ReactElement;
|
|
49
|
+
};
|
|
50
|
+
Katakana: React.FC<Input>;
|
|
51
|
+
HankakuKatakana: React.FC<Input>;
|
|
52
|
+
Number: React.FC<Input>;
|
|
53
|
+
DigitNumber: React.FC<Input>;
|
|
54
|
+
Tel: React.FC<Input>;
|
|
55
|
+
CreditCard: React.FC<Input>;
|
|
56
|
+
Email: React.FC<Input>;
|
|
57
|
+
Url: React.FC<Input>;
|
|
58
|
+
Postal: React.FC<Input>;
|
|
59
|
+
Password: React.FC<Input>;
|
|
60
|
+
Concealed: React.FC<Input>;
|
|
61
|
+
Money: {
|
|
62
|
+
JPY: React.FC<Input>;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
type Methods = Methods.Component & Methods.FNs;
|
|
67
|
+
}
|
|
68
|
+
export declare const TextInput: React.FC<TextField.Input>;
|
|
69
|
+
declare const TextField: TextField.Methods;
|
|
70
|
+
export { TextField, TextField as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{b as o,c as s,d as Y,e as ne}from"../../chunk-C5N2D3ZX.js";import{Fragment as ue,jsx as l,jsxs as U}from"react/jsx-runtime";import{useState as A,useEffect as G}from"react";import g from"@mingoo/jsmin";import{$$fromRoot as ve,useStore as Se,ExtractStyles as Ce,GenerateHTMLProps as le}from"../../@utils";import{Box as _,FAI as oe}from"../../atoms";import{Text as X}from"../../mols";import re from"../Button";import P from"../Tooltips";import{faEye as se}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as Re,BoxWrapper as Te,CoreEffects as L,DefaultStyles as ye}from"./core";import{InputLabel as Ve}from"./Label";import{LeftIndicator as ke,RightIndicator as j}from".";const De={number:{reg:/^-?[0-9\.]+$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},katakana:{reg:/^[ァ-ヶー ヲ-゚ ]*$/g,exist:!0,reason:"\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},"hankaku.katakana":{reg:/^[ヲ-゚ ]*$/g,exist:!0,reason:"\u534A\u89D2\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},digitNumber:{reg:/^-?[0-9\.]+$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},fileName:{reg:/[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist:!1,reason:"\u7A7A\u767D\u307E\u305F\u306F\u4E00\u90E8\u306E\u7279\u6B8A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},creditCard:{reg:/^\d{14,16}$/g,exist:!0,reason:"14~16\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},email:{reg:/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist:!0,reason:U(ue,{children:[l(_,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),l(_,{children:"\u6700\u5F8C\u306E\u6587\u5B57\u306B.(\u30C9\u30C3\u30C8)\u3092\u5165\u308C\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"})]})},password:{reg:/^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist:!0,reason:"8\u6587\u5B57\u4EE5\u4E0A\u3001\u534A\u89D2\u82F1\u6570\u5927\u5C0F\u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},tel:{reg:/.*$/g,exist:!0,reason:U(ue,{children:[l(_,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),l(_,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),l(_,{children:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"})]})},url:{reg:/^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist:!0,reason:"URL\u5F62\u5F0F : http(s)://\u25EF\u25EF\u25EF\u25EF"},postal:{reg:/^\d{7}$/g,exist:!0,reason:"7\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},T={setSelection:e=>{let{id:a,restrict:r,val_status:t}=e,n=ve("#"+a)[0];if(n&&t.prevValue&&t.formatValue){let{formatValue:u,prevValue:c,caretFrom:i,caretTo:d}=t;if(r=="creditCard")u.length>=c.length&&i%5==0&&(i++,d++),n.setSelectionRange(i,d);else if(r=="postal")u.length==5&&c.length==3&&(i++,d++),n.setSelectionRange(i,d);else if(r=="digitNumber"){let h=u.length-c.length;h==2&&(i++,d++),h==-2&&(i--,d--),n.setSelectionRange(i,d)}}},Validation:{Default:e=>{let{value:a,states:r}=e,{restrict:t="text",maxLength:n,multiline:u,required:c}=r,i=[];if(u||(n=n||255),g.is.exist(n)&&a.length>=Number(n)&&i.push({type:"invalid",label:n+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),a){let d=T.Validation.Text(a,t);d.ok||i.push({type:"invalid",label:d.body})}else c&&i.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!i.filter(({type:d})=>d=="invalid").length,notice:i}},Text:(e,a)=>{let r={ok:!0,body:""};return(()=>{let t=De[a];if(!t)return;let n=t.reason;if(t){let u=!!(+!!e.match(t.reg)^+!t.exist);r={ok:u,body:u?"":n}}})(),r},DataLeveling:e=>{let{restrict:a,value:r=""}=e,t=String(r),n=!1;if(["tel","number","digitNumber","test","postal","creditCard"].includes(a)&&(t=t.zen2hanNumber()),a=="katakana"&&(t=t.replace(/[^ァ-ヶー ヲ-゚ ]/ig,"")),a=="hankaku.katakana"&&(t=t.replace(/[^ヲ-゚ ]/ig,"")),["postal","creditCard"].includes(a)&&(t=t.removeLetters()),["number","number.zeroStart","digitNumber"].includes(a)){let c=t[0]=="0";if(t){if(t!="-")if(t=="0-")t="-";else{t[0]=="-"&&(n=!0),t=t.replace(/[^0-9\.]/ig,"");let i=Number(t);i===0&&(n=!1),n&&(i=-1*i),g.is.exist(e.min)&&(i=Math.max(i,Number(e.min))),g.is.exist(e.max)&&(i=Math.min(i,Number(e.max))),t=String(Math.abs(i))}c&&t!="0"&&a=="number.zeroStart"&&(t="0"+t)}}let u=t;if(a=="digitNumber"){if(t&&t!="-"){let c=[];for(let i=t.length-1;i>=0;i--){c.unshift(t[i]);let d=t.length-1-i+1;i!=0&&d%3==0&&c.unshift(",")}u=c.join("")}}else a=="postal"?t.length>=4&&(u=t.clip(0,3)+"-"+t.clip(3)):a=="creditCard"&&(u=t.replace(/.{4}(?=.)/g,"$& "));return["number","digitNumber"].includes(a)&&n&&(t="-"+t,u="-"+u),{formatValue:u,dataValue:t}}}},Q={Shallow:e=>{let{rootStates:a,val_status:r}=e,t=r.dataValue||"";G(()=>{g.scope(()=>ne(void 0,null,function*(){if(!a.multiline)return;let h=g('[data-input-origin="'+r.componentID+'"]'),y=g('[data-input-shallow="'+r.componentID+'"]'),B=g('[data-input-min-height-value-shallow="'+r.componentID+'"]'),w=g('[data-input-max-height-value-shallow="'+r.componentID+'"]');if(!h[0]||!y[0]||!B[0]||!w[0])return;let m=y.position(),V=B.position(),k=w.position(),I=0;a.autoHeight&&(I=m.height),I=Math.max(I,V.height),I=Math.min(I,k.height),h[0].style.height=I+"px"}))},[t]);let n=t||a.label||a.placeholder||"";(!!t.match(/\n$/)||!t)&&(n+="T");let c="",i="";if(a.multiline){let h=a.minRows||1,y=a.maxRows||100;c=`
|
|
2
|
+
T`.repeat(h-1),i=`
|
|
3
|
+
T`.repeat(y-1)}let d=Ce(a);return U(_,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[l(X.Description,s(o({className:a.className},d),{position:"absolute",width:1,freeCSS:s(o({},d.freeCSS),{color:"orange"}),"data-input-shallow":r.componentID,children:l(_,{"data-input-value-shallow":r.componentID,children:n})})),l(X.Description,s(o({className:a.className},d),{position:"absolute",left:0,freeCSS:s(o({},d.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":r.componentID,children:c})),l(X.Description,s(o({className:a.className},d),{position:"absolute",right:0,freeCSS:s(o({},d.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":r.componentID,children:i}))]})},InputBox:e=>{let{rootStates:a,val_validate:r,set_validate:t,val_status:n,set_status:u,val_focus:c,set_focus:i,val_isComposing:d,set_isComposing:h}=e;if(a.multiline)return null;let ae=a,{componentID:y,tone:B,required:w,restrict:m="text",form:V,autoComplete:k="off",autoCapitalize:I="off",minRows:N,maxRows:de,multiline:ee,autoHeight:K,enableFormSubmit:z,clearButton:me=!1,checkValidationAtFirst:te,onChange:O,onKeyDown:W,onValidate:pe,onUpdateValue:ce,onUpdateValidValue:fe,value:ge="",leftIndicator:xe,rightIndicator:b,leftIcon:he,rightIcon:Z,maxLength:C,min:E,max:H,label:Ne,wrapStyles:Fe}=ae,p=Y(ae,["componentID","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","wrapStyles"]),be=m=="password"||m=="concealed"?"password":"text",Ie=["number","digitNumber","creditCard"].includes(m)?"numeric":m=="email"?"email":"text";return l("input",s(o({type:be,inputMode:Ie,"data-disabled":a.disabled,"data-form":V,"data-input-type":"text","data-show-validation":L.isShowValidation(r,n,!!te),"data-validation":r.ok,"data-value":n.dataValue,"data-component-id":n.componentID,"data-input-origin":n.componentID,value:n.formatValue,autoComplete:k,autoCapitalize:I,onKeyDown:f=>{let{key:v,target:D}=f;{let R=D,{selectionStart:F,selectionEnd:M}=R,$=Number(F),ie=Number(M),q=n.formatValue[Number($)],J=n.formatValue[Number($)-1];v=="Delete"&&(m=="creditCard"&&q==" "||m=="postal"&&q=="-"||m=="digitNumber"&&q==",")&&(R.setSelectionRange($+1,ie+1),f.preventDefault()),v=="Backspace"&&(m=="creditCard"&&J==" "||m=="postal"&&J=="-"||m=="digitNumber"&&J==",")&&(R.setSelectionRange($-1,ie-1),f.preventDefault()),v=="Enter"||v=="Tab"}if(["number","digitNumber","creditCard"].includes(m)&&v=="Clear"&&u(R=>s(o({},R),{dataValue:"",formatValue:"",eventType:"update",eventID:g.uuid.gen()})),["number","digitNumber"].includes(m)&&["ArrowUp","ArrowDown"].includes(v)){let R=+(v=="ArrowUp")*2-1,F=String(Number(n.dataValue)+R);r.ok&&t({ok:!1,notice:[]}),u(M=>s(o(o({},M),T.Validation.DataLeveling({min:E,max:H,restrict:m,value:F})),{eventType:"update",eventID:g.uuid.gen()})),f.preventDefault()}W&&W(f),z&&L.SubmitForm(f)},onChange:f=>{let{value:v,selectionStart:D,selectionEnd:R}=f.target,F=T.Validation.DataLeveling({min:E,max:H,restrict:m,value:v});d&&(F.formatValue=v),F.formatValue!=n.formatValue&&(r.ok&&t({ok:!1,notice:[]}),u(M=>s(o(o({},M),F),{prevValue:n.formatValue,eventType:"update",eventID:g.uuid.gen(),caretFrom:Number(D),caretTo:Number(R)})),O&&O(f))}},le(p)),{onFocus:f=>{p!=null&&p.onFocus&&(p==null||p.onFocus(f)),i(!0)},onBlur:f=>{p!=null&&p.onBlur&&(p==null||p.onBlur(f)),i(!1)},onCompositionStart:f=>{p!=null&&p.onCompositionStart&&(p==null||p.onCompositionStart(f)),h(!0)},onCompositionEnd:f=>{if(p!=null&&p.onCompositionEnd&&(p==null||p.onCompositionEnd(f)),m=="text")return;let v=T.Validation.DataLeveling({min:E,max:H,restrict:m,value:n.formatValue});u(D=>s(o(o({},D),v),{prevValue:D.formatValue,eventType:"update",eventID:g.uuid.gen(),caretFrom:Number(D.formatValue.length+1),caretTo:Number(D.formatValue.length+1)})),h(!1)}}))},TextAreaBox:e=>{let{rootStates:a,val_focus:r,set_focus:t,val_validate:n,set_validate:u,val_status:c,set_status:i,isShallow:d}=e,Z=a,{componentID:h,tone:y,required:B,form:w,minRows:m,maxRows:V,multiline:k,autoHeight:I,enableFormSubmit:N,maxLength:de,checkValidationAtFirst:ee,onChange:K,onKeyDown:z,onValidate:me,onUpdateValue:te,onUpdateValidValue:O,value:W="",leftIndicator:pe,rightIndicator:ce,leftIcon:fe,rightIcon:ge,wrapStyles:xe}=Z,b=Y(Z,["componentID","tone","required","form","minRows","maxRows","multiline","autoHeight","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","wrapStyles"]);return!a.multiline?null:l("textarea",s(o({"data-form":w,"data-input-type":"textarea","data-show-validation":L.isShowValidation(n,c,!!ee),"data-validation":n.ok,"data-value":c.dataValue,"data-input-origin":c.componentID,"data-component-id":c.componentID,value:c.dataValue},le(b)),{onFocus:C=>{b!=null&&b.onFocus&&(b==null||b.onFocus(C)),t(!0)},onBlur:C=>{b!=null&&b.onBlur&&(b==null||b.onBlur(C)),t(!1)},onKeyDown:C=>{z&&z(C),N&&L.SubmitForm(C)},onChange:C=>{let{value:E}=C.target;n.ok&&u({ok:!1,notice:[]}),i(H=>s(o({},H),{dataValue:E,eventType:"update",eventID:g.uuid.gen()})),K&&K(C)}}))}},we=e=>{let{componentID:a,restrict:r="text",onUpdateValue:t,onUpdateValidValue:n,value:u="",min:c,max:i}=e,d=s(o({componentID:a},T.Validation.DataLeveling({min:c,max:i,restrict:r,value:u})),{prevValue:"",eventType:"init",eventID:g.uuid.gen(),caretFrom:null,caretTo:null}),[h,y]=A(!1),[B,w]=A(!1),[m,V]=A(d),[k,I]=A({ok:!1,notice:[]}),N={rootStates:e,val_focus:h,set_focus:y,val_isComposing:B,set_isComposing:w,val_status:m,set_status:V,val_validate:k,set_validate:I};return L.CommonEffects({type:"textfield",states:e,val_status:m,set_status:V,val_validate:k,set_validate:I,onUpdateValue:t,onUpdateValidValue:n,DefaultValidation:T.Validation.Default,ExtraOverrideStates:o({},T.Validation.DataLeveling({min:c,max:i,restrict:r,value:u}))}),G(()=>{T.setSelection({id:e.id,restrict:r,val_status:m})},[m]),U(Te,{val_status:m,set_status:V,val_validate:k,states:N.rootStates,children:[l(Ve,{componentID:e.componentID,fontSize:e.fontSize,required:e.required,label:e.label,isActive:h||!!m.dataValue}),l(Q.Shallow,o({},N)),l(Q.InputBox,o({},N)),l(Q.TextAreaBox,o({},N))]})},S=e=>{e=o({autoHeight:!0,restrict:"text",fontSize:"2.normal"},e),e.rightIcon&&(e=o({paddingRight:3},e)),e.leftIcon&&(e=o({paddingLeft:3},e)),e.multiline?(e.minRows=e.minRows||5,e.maxRows=e.maxRows||20):(e.minRows=1,e.maxRows=1);let a=ye.Boxish(e);return l(Re,{componentID:e.componentID,children:we,states:a})},x=S;x.Validate=T.Validation.Text,x.Katakana=e=>l(S,s(o({},e),{restrict:"katakana",multiline:!1,autoHeight:!1})),x.HankakuKatakana=e=>l(S,s(o({},e),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),x.CreditCard=e=>l(S,s(o({},e),{restrict:"creditCard",multiline:!1,autoHeight:!1})),x.Tel=e=>l(S,s(o({},e),{restrict:"tel",placeholder:"xxx-xxxx-xxxx",multiline:!1,autoHeight:!1})),x.Number=e=>l(S,s(o({},e),{restrict:"number",multiline:!1,autoHeight:!1})),x.DigitNumber=e=>l(S,s(o({},e),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),x.Email=e=>l(S,s(o({},e),{restrict:"email",multiline:!1,autoHeight:!1})),x.Url=e=>l(S,s(o({},e),{restrict:"url",multiline:!1,autoHeight:!1})),x.Postal=e=>{let[a]=A(g.uuid.gen());return G(()=>()=>{Se.delete(a)},[]),l(S,s(o({label:"\u90F5\u4FBF\u756A\u53F7"},e),{restrict:"postal",multiline:!1,autoHeight:!1,leftIndicator:l(ke,{children:"\u3012"})}))},x.Password=e=>l(S,s(o({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIndicator:l(j,{padding:0,children:l(re.Button.Normal.R,{padding:[0,1],fontColor:"theme",borderRadius:"inherit",backgroundColor:"inherit",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:a=>{P.open({parent:a.currentTarget,gravityPoint:24,padding:[1,0],content:l(P.Body,{children:"\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8868\u793A"})})},tabIndex:-1,onClick:a=>{g(a.target).parent().parent().find("input").callback(r=>{let t=r[0];t.type=t.type==="password"?"text":"password"})},children:l(oe,{icon:se})})})},e),{restrict:"password",multiline:!1,autoHeight:!1})),x.Concealed=e=>l(S,s(o({label:"\u79D8\u5BC6\u9375",rightIndicator:l(j,{padding:0,children:l(re.Button.Normal.R,{padding:[0,1],fontColor:"theme",borderRadius:"inherit",backgroundColor:"inherit",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:a=>{P.open({parent:a.currentTarget,gravityPoint:24,padding:[1,0],content:l(P.Body,{children:"\u5024\u3092\u8868\u793A"})})},tabIndex:-1,onClick:a=>{g(a.target).parent().parent().parent().find("input").callback(r=>{let t=r[0];t.type=t.type==="password"?"text":"password"})},children:l(oe,{icon:se})})})},e),{restrict:"concealed",multiline:!1,autoHeight:!1})),x.Money={JPY:e=>l(x.DigitNumber,s(o({label:"\u91D1\u984D",rightIndicator:l(j,{children:"\u5186"})},e),{multiline:!1,autoHeight:!1}))};export{x as TextField,we as TextInput,x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as f,c as x}from"../../../chunk-C5N2D3ZX.js";import{Fragment as H,jsx as r,jsxs as y}from"react/jsx-runtime";import{createElement as G}from"react";import{useState as I,useEffect as W,useRef as j}from"react";import c from"@mingoo/jsmin";import C from"../../../atoms/Box";import N from"../../../atoms/FAI";import D from"../../../atoms/Flex";import w from"../../../atoms/Grid";import M from"../../../mols/Row";import T from"../../../mols/Column";import Y from"../../../mols/Text";import v from"../../Button";import O from"../../Tooltips";import R from"../Select";import{List as z}from"../List";import{InputTimeClasses as g}from"../../../@styles/componentClasses";let A=i=>{var t,a;let e=[],d=Number((t=i==null?void 0:i.min)!=null?t:1900),o=Number((a=i==null?void 0:i.max)!=null?a:c.Time().addYear(10).year);for(let m=d;m<=o;m++)e.unshift({value:m,label:[m,...c.transformer.wareki(m).value].join(" - ")});return e};const F=i=>{let{restrict:e,era:d="year",defaultValue:o=""}=i;i=f({},i),i.tipsID=i.tipsID||c.uuid.gen();const t=j(!1);let[a,m]=I((()=>{var s,p;if(e=="clock"){let l=String(o).split(/[^\d]/);l[0]||(l=[0,0]);let u=Number(l[0]),h=Number(l[1]);return{modifiedType:"init",hour:u,minutes:h}}else if(e=="date"){let[l,u,h]=(s=String(o))==null?void 0:s.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",year:Number(l),month:Number(u),date:Number(h)}}else if(e!="week"){if(e=="month"){let[l,u]=String(o).split(/\D/);return(c.is.nullish(l)||c.is.nullish(u))&&([l,u]=c.Time().toFormat("%Y-%M").split("-")),{modifiedType:"init",year:Number(l),month:Number(u)}}else if(e=="year"){let[l]=String(o).split(/\D/);return c.is.nullish(l)&&([l]=c.Time().toFormat("%Y").split("-")),{modifiedType:"init",year:Number(l)}}else if(e=="dateWareki"){let[l,u,h]=(p=String(o))==null?void 0:p.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",era:d||"year",year:Number(l),month:Number(u),date:Number(h)}}}return{}})());W(()=>{if(t.current){if(a.modifiedType=="update"){let s="",p=d||"year";if(e=="clock"){let{hour:l,minutes:u}=a;s=[l.zeroEmbed(2),u.zeroEmbed(2)].join("/")}else if(e=="date"){let{year:l,month:u,date:h}=a;s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}else if(e!="week"){if(e=="month"){let{year:l,month:u}=a;s=[l,u.zeroEmbed(2)].join("/")}else if(e=="year"){let{year:l}=a;s=String(l)}else if(e=="dateWareki"){let{year:l,month:u,date:h,era:S}=a;p=S,s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}}i.onValueUpdate(s,p)}}else t.current=!0},[a]);let n=x(f({},i),{val_value:a,set_value:m});return r(C,{backgroundColor:"layer.1",borderRadius:"2.tone.secondary",boxShadow:"1.remark",border:!0,overflow:"hidden",children:r(C,{overflow:"auto",className:g(e.toCapital()+"Base"),children:e=="clock"?r(k.Clock.index,f({},n)):e=="date"?r(k.Date.index,f({},n)):e=="week"?"":e=="month"?r(k.Month.index,f({},n)):e=="year"?r(k.Year.index,f({},n)):e=="dates"||e=="months"?"":e=="dateWareki"?r(k.DateWareki.index,f({},n)):r(H,{})})})},k={Clock:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=i,[n,s]=I(a.hour>12?2:1),[p,l]=I(Number(localStorage.getItem("timePickerUnit")||5));W(()=>{localStorage.setItem("timePickerUnit",String(p))},[p]);let{hour:u,minutes:h}=a;return y(T,{padding:1,children:[y(D,{flexType:"row",flexWrap:!1,gap:1,className:g("Body"),children:[y(T,{className:g("DesignSide"),flexSizing:0,children:[r(C,{className:g("ClockUiBase"),padding:[1,"2/3"],flexCenter:!0,children:y(C,{className:g("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[r(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("hour")].join(" "),freeCSS:{transform:`rotate(${u*30+h/2}deg)`}}),r(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("minute")].join(" "),freeCSS:{transform:`rotate(${h*6}deg)`}})]})}),r(z.Radio,{tone:"plain",icon:!0,value:[n],options:[{value:1,label:"AM"},{value:2,label:"PM"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{let B=a.hour%12+(S==2?12:0);s(S),m({modifiedType:"update",hour:B,minutes:a.minutes})}}),r(C,{borderTop:!0,margin:[0,1]}),r(z.Radio,{tone:"plain",icon:!0,value:[p],options:[{value:1,label:"/ 1\u5206"},{value:2,label:"/ 2\u5206"},{value:5,label:"/ 5\u5206"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{l(S)}})]}),y(T,{children:[y(C,{flexCenter:!0,isSemiBoldFont:!0,fontSize:"3.paragraph",children:[a.hour.zeroEmbed(2)," : ",a.minutes.zeroEmbed(2)]}),y(D,{flexWrap:!1,borderRadius:"1.tone.primary",boxShadow:"0.remark.inset",flexChilds:"even",padding:["1/3",0],freeCSS:{minWidth:12*12},children:[r(T,{gap:0,overflow:"auto",padding:"2/3",borderRight:!0,freeCSS:{maxHeight:12*22},children:k.Clock.Hours({onClick:S=>{let V=S+(n==2?12:0);m({modifiedType:"update",hour:V,minutes:a.minutes})},min:e,max:d,ampm:n})}),r(T,{gap:0,overflow:"auto",padding:"2/3",freeCSS:{maxHeight:12*22},children:k.Clock.Minutes({onClick:S=>{m({modifiedType:"update",hour:a.hour,minutes:S})},min:e,max:d,unit:p})})]})]})]}),r(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Hours:i=>{let e=[];for(let d=0;d<12;d++){let o=i.ampm==2?d+12:d,t=!1;{let a=Number(String(o*100).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>a&&(t=!0),i.max){let m=Number(String(i.max).replace(/\D/ig,""));a>m&&(t=!0)}}e.push(r(v.Button.Normal.R,{isLocked:t,borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{i.onClick(d)},children:o.zeroEmbed(2)},d))}return e},Minutes:i=>{let e=[];for(let d=0;d<60/i.unit;d++){let o=d*i.unit;e.push(r(v.Button.Normal.R,{borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{i.onClick(o)},children:o.zeroEmbed(2)},o))}return e}},Date:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=i,{year:n,month:s,date:p}=a;return y(T,{padding:1,children:[y(D,{flexWrap:!0,verticalAlign:"center",horizontalAlign:"between",children:[y(D,{verticalAlign:"bottom",horizontalAlign:"left",gap:"2/3",flexWrap:!1,children:[r(R,{override:"force",enableUnSelected:!1,value:n,options:A(),border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:Number(l),month:s,date:p})}}),r(R,{override:"force",enableUnSelected:!1,value:s,options:(()=>{let l=[];for(let u=1;u<=12;u++)l.push({value:u,label:String(u),displayLabel:String(u)+"\u6708"});return l})(),placeholder:"",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:n,month:Number(l),date:p})}})]}),r(k.Variables.ShiftButtons,{callback:l=>{let u=s+l,h=n;l==-1?(u<=0&&h--,u=u||12):s==12&&h++,m({modifiedType:"update",year:h,month:u,date:a.date})}})]}),r(C,{borderTop:!0}),r(C,{children:k.Date.MonthCalendar({min:e,max:d,year:a.year,month:a.month,current:[a.year,a.month,a.date],callback:l=>{let[u,h,S]=l;m({modifiedType:"update",year:u,month:h,date:S})}})}),r(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},MonthCalendar:i=>{let{min:e,max:d,year:o,month:t,current:a,callback:m}=i,n=c.Time(),s=c.Time([o,t.zeroEmbed(2),"01"].join("/")),p=s.getLastDayOfTheMonth(),l=c.Time(s).addMonth(-1).getLastDayOfTheMonth().date,u=[],h=[],S=[],V=[],B={padding:0,unitWidth:3,unitHeight:3,flexCenter:!0,borderRadius:"3.tone.tertiary"};for(var b=0;b<7;b++)u.push(r(C,x(f({className:[g("CalendarDay"),g("Legend")].join(" ")},B),{children:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][b]}),b));for(var b=0;b<s.weekday;b++)h.unshift(G(C,x(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},B),{key:b}),l-b));for(var b=1;b<=p.date;b++){let U=b,L=o==n.year&&t==n.month&&b==n.date,P=!1;{let _=Number(String([o,t.zeroEmbed(2),b.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>_&&(P=!0),i.max){let E=Number(String(i.max).replace(/\D/ig,""));_>E&&(P=!0)}}S.push(r(v.Button.Clear.R,x(f({className:[g("CalendarDay"),g("isToday_"+L)].join(" ")},B),{fontColor:"1.clear",padding:0,flexCenter:!0,borderRadius:"sphere",ssEffectsOnActive:"shrink",onClick:()=>{m([o,t,U])},tabIndex:-1,isLocked:P,children:b}),U))}for(var b=1;b<7-p.weekday;b++)V.push(r(C,x(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},B),{children:b}),b));return y(w,{gridCols:7,gap:"1/3",children:[u,h,S,V]})}},Month:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=i,{year:n,month:s}=a;return y(T,{padding:1,children:[y(M.Separate,{gap:0,children:[r(M.Center,{verticalAlign:"bottom",gap:"2/3",children:r(R,{enableUnSelected:!1,value:n,options:A(),override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},onUpdateValidValue:({value:p})=>{m({modifiedType:"update",year:Number(p),month:s})}})}),r(k.Variables.ShiftButtons,{callback:p=>{let l=Math.min(Math.max(n+p,1900),2100);m({modifiedType:"update",year:l,month:s})}})]}),r(C,{borderTop:!0}),k.Month.Months({min:e,max:d,year:a.year,callback:p=>{let[l,u]=p;m({modifiedType:"update",year:l,month:u})}}),r(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Months:i=>{let{year:e,callback:d}=i,o=c.Time(),t=[];for(let a=1;a<=12;a++){let m=e==o.year&&a==o.month,n=!1;{let p=Number(String([e,a.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>p&&(n=!0),i.max){let l=Number(String(i.max).replace(/\D/ig,""));p>l&&(n=!0)}}let s=[g("Cell"),m?g("isThisMonth"):""].join(" ");t.push(y(v.Button.Clear.R,{className:s,isLocked:n,fontColor:"2.normal",padding:["1/3",1],ssEffectsOnActive:"shrink",onClick:()=>{d([e,a])},children:[a," \u6708"]},e+"-"+a))}return r(w,{gridCols:4,gap:"2/3",children:t})}},Year:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=i,{year:n}=a;return y(T,{padding:1,children:[r(R,{enableUnSelected:!1,value:n||c.Time().year,override:"force",options:A({min:e,max:d}),onUpdateValidValue:({value:s})=>{m({modifiedType:"update",year:Number(s)})}}),r(k.Variables.Footer,{tipsID:t,onValueUpdate:o,onSubmit:()=>{m({modifiedType:"update",year:Number(n||c.Time().year)})}})]})}},DateWareki:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:a,set_value:m}=i,{era:n,year:s,month:p,date:l}=a,u={val_value:a,set_value:m};return y(C,{children:[y(M.Left,{borderBottom:!0,gap:0,verticalAlign:"unset",children:[r(k.DateWareki.EraSelect,f({},u)),r(C,{borderRight:!0}),r(k.DateWareki.Calendar,f({},u))]}),r(C,{padding:1,children:r(k.Variables.Footer,{tipsID:t,onValueUpdate:o})})]})},EraSelect:i=>{let{val_value:e,set_value:d}=i,o={padding:["1/2",1.5],fontColor:"3.blur"},t={backgroundColor:"cloud",fontColor:"2.normal",isSemiBoldFont:!0};return y(T,{padding:1,gap:0,children:[r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="year",onClick:()=>{let a=c.Time();d({modifiedType:"update",era:"year",year:a.year,month:a.month,date:a.date})},children:"\u897F\u66A6"})),r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="reiwa",onClick:()=>{let a=c.Time();d({modifiedType:"update",era:"reiwa",year:a.year,month:a.month,date:a.date})},children:"\u4EE4\u548C"})),r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="heisei",onClick:()=>{d({modifiedType:"update",era:"heisei",year:2019,month:1,date:1})},children:"\u5E73\u6210"})),r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="shouwa",onClick:()=>{d({modifiedType:"update",era:"shouwa",year:1989,month:1,date:1})},children:"\u662D\u548C"})),r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="taisho",onClick:()=>{d({modifiedType:"update",era:"taisho",year:1926,month:1,date:1})},children:"\u5927\u6B63"})),r(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="meiji",onClick:()=>{d({modifiedType:"update",era:"meiji",year:1912,month:1,date:1})},children:"\u660E\u6CBB"}))]})},Calendar:i=>{let{val_value:e,set_value:d}=i,o=[];if(e.era=="year")for(let t=1900;t<2100;t++)o.unshift({value:t,label:t+"\u5E74"});else if(e.era=="reiwa"){let t=c.Time().year-2018;for(let a=1;a<=t+10;a++)o.unshift({value:2019+a-1,label:"\u4EE4\u548C"+(a==1?"\u5143":a)+"\u5E74"})}else if(e.era=="heisei")for(let t=1;t<=31;t++)o.unshift({value:1989+t-1,label:"\u5E73\u6210"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="shouwa")for(let t=1;t<=64;t++)o.unshift({value:1926+t-1,label:"\u662D\u548C"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="taisho")for(let t=1;t<=15;t++)o.unshift({value:1912+t-1,label:"\u5927\u6B63"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="meiji")for(let t=1;t<=45;t++)o.unshift({value:1868+t-1,label:"\u660E\u6CBB"+(t==1?"\u5143":t)+"\u5E74"});return y(T,{padding:1,children:[y(M.Separate,{children:[r(R,{tone:"cloud",enableUnSelected:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},options:o,value:e.year,onUpdateValidValue:({value:t})=>{d(a=>x(f({},a),{modifiedType:"update",year:Number(t)}))}}),y(M.Center,{gap:"1/3",children:[r(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month-1;d({modifiedType:"update",era:e.era,year:t==0?e.year-1:e.year,month:t==0?12:t,date:1})},children:r(N.ChevronLeft,{})}),r(R,{tone:"cloud",enableUnSelected:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIconStyles:{right:"1/3"},options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:e.month,onUpdateValidValue:({value:t})=>{d({modifiedType:"update",era:e.era,year:e.year,month:Number(t),date:1})}}),r(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month+1;d({modifiedType:"update",era:e.era,year:t==13?e.year+1:e.year,month:t==13?1:t,date:1})},children:r(N.ChevronRight,{})})]})]}),r(k.DateWareki.MonthCell,f({},i))]},e.era)},MonthCell:i=>{let{val_value:e,set_value:d}=i,o=c.Time([e.year.zeroEmbed(4),e.month.zeroEmbed(2),e.date.zeroEmbed(2)].join("/"));if(!o.validate)return;let t=o.getFirstDayOfTheMonth().weekday,a=o.getLastDayOfTheMonth(),m=[];for(let n=0;n<7;n++)m.push(r(Y.Supplement,{flexCenter:!0,fontColor:n==0?"googleRed":n==6?"googleBlue":"3.blur",children:c.transformer.weekday.shortJP(n)},"legend-"+n));for(let n=0;n<t;n++){let s=c.Time(o).getFirstDayOfTheMonth().addDate(n-t);m.push(r(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSphere:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"lastMonth-"+n))}for(let n=1;n<=a.date;n++){let s=c.Time(o).setDate(n);m.push(r(v.Button.Border.R,{ssSphere:3,onClick:()=>{d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"currentMonth-"+n))}for(let n=0;n<7-a.weekday-1;n++){let s=c.Time(o).addMonth(1).setDate(1).addDate(n);m.push(r(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSquare:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"nextMonth-"+n))}return r(w,{gridCols:7,gap:"1/4",children:m})}},Variables:{Footer:i=>y(D,{flexWrap:!1,gap:1,flexChilds:"even",freeCSS:{whiteSpace:"nowrap"},children:[y(v.Button.Border.R,{onClick:()=>{i.onValueUpdate("")},tabIndex:-1,flexSizing:"none",padding:["2/3",1],children:[r(N.Times,{})," \u524A\u9664"]}),r(v.Button.Prime.R,{flexSizing:"auto",padding:["2/3",1],onClick:()=>{i.onSubmit&&i.onSubmit(),O.close(i.tipsID)},tabIndex:-1,children:"\u6C7A\u5B9A"})]}),ShiftButtons:i=>y(D,{gap:"1/3",flexWrap:!1,children:[r(v.Button.Clear.R,x(f({className:g("LeftButton"),tabIndex:-1,right:0},k.Variables.ShiftButtonStyles),{onClick:()=>{i.callback(-1)},children:r(N.ChevronLeft,{})})),r(v.Button.Clear.R,x(f({className:g("RightButton"),tabIndex:-1,left:0},k.Variables.ShiftButtonStyles),{onClick:()=>{i.callback(1)},children:r(N.ChevronRight,{})}))]}),ShiftButtonStyles:{flexCenter:!0,padding:0,unitWidth:3,unitHeight:3,borderRadius:"sphere",position:"relative"}}};export{F as Picker,F as default};
|
|
1
|
+
import{b as f,c as x}from"../../../chunk-C5N2D3ZX.js";import{Fragment as G,jsx as a,jsxs as y}from"react/jsx-runtime";import{createElement as $}from"react";import{useState as P,useEffect as F,useRef as Y}from"react";import c from"@mingoo/jsmin";import{Box as C,Flex as R,Grid as A,FAI as T,Column as D}from"../../../atoms";import{Row as M,Text as O}from"../../../mols";import v from"../../Button";import H from"../../Tooltips";import V from"../Select";import{Radio as U}from"../List";import{RightIcon as I}from"..";import{InputTimeClasses as g}from"../../../@styles/componentClasses";let _=i=>{var t,r;let e=[],d=Number((t=i==null?void 0:i.min)!=null?t:1900),o=Number((r=i==null?void 0:i.max)!=null?r:c.Time().addYear(10).year);for(let m=d;m<=o;m++)e.unshift({value:m,label:[m,...c.transformer.wareki(m).value].join(" - ")});return e};const L=i=>{let{restrict:e,era:d="year",defaultValue:o=""}=i;i=f({},i),i.tipsID=i.tipsID||c.uuid.gen();const t=Y(!1);let[r,m]=P((()=>{var s,p;if(e=="clock"){let l=String(o).split(/[^\d]/);l[0]||(l=[0,0]);let u=Number(l[0]),h=Number(l[1]);return{modifiedType:"init",hour:u,minutes:h}}else if(e=="date"){let[l,u,h]=(s=String(o))==null?void 0:s.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",year:Number(l),month:Number(u),date:Number(h)}}else if(e!="week"){if(e=="month"){let[l,u]=String(o).split(/\D/);return(c.is.nullish(l)||c.is.nullish(u))&&([l,u]=c.Time().toFormat("%Y-%M").split("-")),{modifiedType:"init",year:Number(l),month:Number(u)}}else if(e=="year"){let[l]=String(o).split(/\D/);return c.is.nullish(l)&&([l]=c.Time().toFormat("%Y").split("-")),{modifiedType:"init",year:Number(l)}}else if(e=="dateWareki"){let[l,u,h]=(p=String(o))==null?void 0:p.split(/\D/);return(c.is.nullish(l)||c.is.nullish(u)||c.is.nullish(h))&&([l,u,h]=c.Time().toFormat("%Y-%M-%D").split("-")),{modifiedType:"init",era:d||"year",year:Number(l),month:Number(u),date:Number(h)}}}return{}})());F(()=>{if(t.current){if(r.modifiedType=="update"){let s="",p=d||"year";if(e=="clock"){let{hour:l,minutes:u}=r;s=[l.zeroEmbed(2),u.zeroEmbed(2)].join("/")}else if(e=="date"){let{year:l,month:u,date:h}=r;s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}else if(e!="week"){if(e=="month"){let{year:l,month:u}=r;s=[l,u.zeroEmbed(2)].join("/")}else if(e=="year"){let{year:l}=r;s=String(l)}else if(e=="dateWareki"){let{year:l,month:u,date:h,era:S}=r;p=S,s=[l,u.zeroEmbed(2),h.zeroEmbed(2)].join("/")}}i.onValueUpdate(s,p)}}else t.current=!0},[r]);let n=x(f({},i),{val_value:r,set_value:m});return a(C,{backgroundColor:"layer.1",borderRadius:"2.tone.secondary",boxShadow:"1.remark",border:!0,overflow:"hidden",children:a(C,{overflow:"auto",className:g(e.toCapital()+"Base"),children:e=="clock"?a(k.Clock.index,f({},n)):e=="date"?a(k.Date.index,f({},n)):e=="week"?"":e=="month"?a(k.Month.index,f({},n)):e=="year"?a(k.Year.index,f({},n)):e=="dates"||e=="months"?"":e=="dateWareki"?a(k.DateWareki.index,f({},n)):a(G,{})})})},k={Clock:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:r,set_value:m}=i,[n,s]=P(r.hour>12?2:1),[p,l]=P(Number(localStorage.getItem("timePickerUnit")||5));F(()=>{localStorage.setItem("timePickerUnit",String(p))},[p]);let{hour:u,minutes:h}=r;return y(D,{padding:1,children:[y(R,{flexType:"row",flexWrap:!1,gap:1,className:g("Body"),children:[y(D,{className:g("DesignSide"),flexSizing:0,children:[a(C,{className:g("ClockUiBase"),padding:[1,"2/3"],flexCenter:!0,children:y(C,{className:g("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[a(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("hour")].join(" "),freeCSS:{transform:`rotate(${u*30+h/2}deg)`}}),a(C,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[g("Needle"),g("minute")].join(" "),freeCSS:{transform:`rotate(${h*6}deg)`}})]})}),a(U,{icon:!0,value:[n],options:[{value:1,label:"AM"},{value:2,label:"PM"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{let B=r.hour%12+(S==2?12:0);s(S),m({modifiedType:"update",hour:B,minutes:r.minutes})}}),a(C,{borderTop:!0,margin:[0,1]}),a(U,{icon:!0,value:[p],options:[{value:1,label:"/ 1\u5206"},{value:2,label:"/ 2\u5206"},{value:5,label:"/ 5\u5206"}],flexType:"col",gap:0,cellStyles:{padding:"1/2",horizontalAlign:"between",gap:"1/3"},tabIndex:-1,onUpdateValidValue:({value:S})=>{l(S)}})]}),y(D,{children:[y(C,{flexCenter:!0,isSemiBoldFont:!0,fontSize:"3.paragraph",children:[r.hour.zeroEmbed(2)," : ",r.minutes.zeroEmbed(2)]}),y(R,{flexWrap:!1,borderRadius:"1.tone.primary",boxShadow:"0.remark.inset",flexChilds:"even",padding:["1/3",0],freeCSS:{minWidth:12*12},children:[a(D,{gap:0,overflow:"auto",padding:"2/3",borderRight:!0,freeCSS:{maxHeight:12*22},children:k.Clock.Hours({onClick:S=>{let N=S+(n==2?12:0);m({modifiedType:"update",hour:N,minutes:r.minutes})},min:e,max:d,ampm:n})}),a(D,{gap:0,overflow:"auto",padding:"2/3",freeCSS:{maxHeight:12*22},children:k.Clock.Minutes({onClick:S=>{m({modifiedType:"update",hour:r.hour,minutes:S})},min:e,max:d,unit:p})})]})]})]}),a(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Hours:i=>{let e=[];for(let d=0;d<12;d++){let o=i.ampm==2?d+12:d,t=!1;{let r=Number(String(o*100).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>r&&(t=!0),i.max){let m=Number(String(i.max).replace(/\D/ig,""));r>m&&(t=!0)}}e.push(a(v.Button.Normal.R,{isLocked:t,borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{i.onClick(d)},children:o.zeroEmbed(2)},d))}return e},Minutes:i=>{let e=[];for(let d=0;d<60/i.unit;d++){let o=d*i.unit;e.push(a(v.Button.Normal.R,{borderBottom:!0,borderRadius:0,padding:["1/2",1],freeCSS:{whiteSpace:"nowrap"},tabIndex:-1,onClick:()=>{i.onClick(o)},children:o.zeroEmbed(2)},o))}return e}},Date:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:r,set_value:m}=i,{year:n,month:s,date:p}=r;return y(D,{padding:1,children:[y(R,{flexWrap:!0,verticalAlign:"center",horizontalAlign:"between",children:[y(R,{verticalAlign:"bottom",horizontalAlign:"left",gap:"2/3",flexWrap:!1,children:[a(V,{override:"force",emptySelect:!1,value:n,options:_(),border:"1.thin",padding:["1/3","2/3"],paddingRight:2,onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:Number(l),month:s,date:p})},rightIcon:a(I,{right:"1/3",children:a(T.AngleDown,{})})}),a(V,{override:"force",emptySelect:!1,value:s,options:(()=>{let l=[];for(let u=1;u<=12;u++)l.push({value:u,label:String(u),displayLabel:String(u)+"\u6708"});return l})(),border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIcon:a(I,{right:"1/3",children:a(T.AngleDown,{})}),onUpdateValidValue:({value:l})=>{m({modifiedType:"update",year:n,month:Number(l),date:p})}})]}),a(k.Variables.ShiftButtons,{callback:l=>{let u=s+l,h=n;l==-1?(u<=0&&h--,u=u||12):s==12&&h++,m({modifiedType:"update",year:h,month:u,date:r.date})}})]}),a(C,{borderTop:!0}),a(C,{children:k.Date.MonthCalendar({min:e,max:d,year:r.year,month:r.month,current:[r.year,r.month,r.date],callback:l=>{let[u,h,S]=l;m({modifiedType:"update",year:u,month:h,date:S})}})}),a(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},MonthCalendar:i=>{let{min:e,max:d,year:o,month:t,current:r,callback:m}=i,n=c.Time(),s=c.Time([o,t.zeroEmbed(2),"01"].join("/")),p=s.getLastDayOfTheMonth(),l=c.Time(s).addMonth(-1).getLastDayOfTheMonth().date,u=[],h=[],S=[],N=[],B={padding:0,unitWidth:3,unitHeight:3,flexCenter:!0,borderRadius:"3.tone.tertiary"};for(var b=0;b<7;b++)u.push(a(C,x(f({className:[g("CalendarDay"),g("Legend")].join(" ")},B),{children:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"][b]}),b));for(var b=0;b<s.weekday;b++)h.unshift($(C,x(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},B),{key:b}),l-b));for(var b=1;b<=p.date;b++){let E=b,j=o==n.year&&t==n.month&&b==n.date,w=!1;{let W=Number(String([o,t.zeroEmbed(2),b.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>W&&(w=!0),i.max){let z=Number(String(i.max).replace(/\D/ig,""));W>z&&(w=!0)}}S.push(a(v.Button.Clear.R,x(f({className:[g("CalendarDay"),g("isToday_"+j)].join(" ")},B),{fontColor:"1.clear",padding:0,flexCenter:!0,isRounded:!0,ssEffectsOnActive:"shrink",onClick:()=>{m([o,t,E])},tabIndex:-1,isLocked:w,children:b}),E))}for(var b=1;b<7-p.weekday;b++)N.push(a(C,x(f({className:[g("CalendarDay"),g("Dummy")].join(" "),fontColor:"4.thin"},B),{children:b}),b));return y(A,{gridCols:7,gap:"1/3",children:[u,h,S,N]})}},Month:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:r,set_value:m}=i,{year:n,month:s}=r;return y(D,{padding:1,children:[y(M.Separate,{gap:0,children:[a(M.Center,{verticalAlign:"bottom",gap:"2/3",children:a(V,{emptySelect:!1,value:n,options:_(),override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIcon:a(I,{right:"1/3",children:a(T.AngleDown,{})}),onUpdateValidValue:({value:p})=>{m({modifiedType:"update",year:Number(p),month:s})}})}),a(k.Variables.ShiftButtons,{callback:p=>{let l=Math.min(Math.max(n+p,1900),2100);m({modifiedType:"update",year:l,month:s})}})]}),a(C,{borderTop:!0}),k.Month.Months({min:e,max:d,year:r.year,callback:p=>{let[l,u]=p;m({modifiedType:"update",year:l,month:u})}}),a(k.Variables.Footer,{tipsID:t,onValueUpdate:o})]})},Months:i=>{let{year:e,callback:d}=i,o=c.Time(),t=[];for(let r=1;r<=12;r++){let m=e==o.year&&r==o.month,n=!1;{let p=Number(String([e,r.zeroEmbed(2)].join("/")).replace(/\D/ig,""));if(i.min&&Number(String(i.min).replace(/\D/ig,""))>p&&(n=!0),i.max){let l=Number(String(i.max).replace(/\D/ig,""));p>l&&(n=!0)}}let s=[g("Cell"),m?g("isThisMonth"):""].join(" ");t.push(y(v.Button.Clear.R,{className:s,isLocked:n,fontColor:"2.normal",padding:["1/3",1],ssEffectsOnActive:"shrink",onClick:()=>{d([e,r])},children:[r," \u6708"]},e+"-"+r))}return a(A,{gridCols:4,gap:"2/3",children:t})}},Year:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:r,set_value:m}=i,{year:n}=r;return y(D,{padding:1,children:[a(V,{emptySelect:!1,value:n||c.Time().year,override:"force",options:_({min:e,max:d}),onUpdateValidValue:({value:s})=>{m({modifiedType:"update",year:Number(s)})}}),a(k.Variables.Footer,{tipsID:t,onValueUpdate:o,onSubmit:()=>{m({modifiedType:"update",year:Number(n||c.Time().year)})}})]})}},DateWareki:{index:i=>{let{min:e,max:d,onValueUpdate:o,tipsID:t,val_value:r,set_value:m}=i,{era:n,year:s,month:p,date:l}=r,u={val_value:r,set_value:m};return y(C,{children:[y(M.Left,{borderBottom:!0,gap:0,verticalAlign:"unset",children:[a(k.DateWareki.EraSelect,f({},u)),a(C,{borderRight:!0}),a(k.DateWareki.Calendar,f({},u))]}),a(C,{padding:1,children:a(k.Variables.Footer,{tipsID:t,onValueUpdate:o})})]})},EraSelect:i=>{let{val_value:e,set_value:d}=i,o={padding:["1/2",1.5],fontColor:"3.blur"},t={backgroundColor:"cloud",fontColor:"2.normal",isSemiBoldFont:!0};return y(D,{padding:1,gap:0,children:[a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="year",onClick:()=>{let r=c.Time();d({modifiedType:"update",era:"year",year:r.year,month:r.month,date:r.date})},children:"\u897F\u66A6"})),a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="reiwa",onClick:()=>{let r=c.Time();d({modifiedType:"update",era:"reiwa",year:r.year,month:r.month,date:r.date})},children:"\u4EE4\u548C"})),a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="heisei",onClick:()=>{d({modifiedType:"update",era:"heisei",year:2019,month:1,date:1})},children:"\u5E73\u6210"})),a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="shouwa",onClick:()=>{d({modifiedType:"update",era:"shouwa",year:1989,month:1,date:1})},children:"\u662D\u548C"})),a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="taisho",onClick:()=>{d({modifiedType:"update",era:"taisho",year:1926,month:1,date:1})},children:"\u5927\u6B63"})),a(v.Button.Clear.R,x(f({color:"cloud"},o),{isActiveStyles:t,isActive:e.era=="meiji",onClick:()=>{d({modifiedType:"update",era:"meiji",year:1912,month:1,date:1})},children:"\u660E\u6CBB"}))]})},Calendar:i=>{let{val_value:e,set_value:d}=i,o=[];if(e.era=="year")for(let t=1900;t<2100;t++)o.unshift({value:t,label:t+"\u5E74"});else if(e.era=="reiwa"){let t=c.Time().year-2018;for(let r=1;r<=t+10;r++)o.unshift({value:2019+r-1,label:"\u4EE4\u548C"+(r==1?"\u5143":r)+"\u5E74"})}else if(e.era=="heisei")for(let t=1;t<=31;t++)o.unshift({value:1989+t-1,label:"\u5E73\u6210"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="shouwa")for(let t=1;t<=64;t++)o.unshift({value:1926+t-1,label:"\u662D\u548C"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="taisho")for(let t=1;t<=15;t++)o.unshift({value:1912+t-1,label:"\u5927\u6B63"+(t==1?"\u5143":t)+"\u5E74"});else if(e.era=="meiji")for(let t=1;t<=45;t++)o.unshift({value:1868+t-1,label:"\u660E\u6CBB"+(t==1?"\u5143":t)+"\u5E74"});return y(D,{padding:1,children:[y(M.Separate,{children:[a(V,{tone:"cloud",emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIcon:a(I,{right:"1/3",children:a(T.AngleDown,{})}),options:o,value:e.year,onUpdateValidValue:({value:t})=>{d(r=>x(f({},r),{modifiedType:"update",year:Number(t)}))}}),y(M.Center,{gap:"1/3",children:[a(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month-1;d({modifiedType:"update",era:e.era,year:t==0?e.year-1:e.year,month:t==0?12:t,date:1})},children:a(T.ChevronLeft,{})}),a(V,{tone:"cloud",emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,rightIcon:a(I,{right:"1/3",children:a(T.AngleDown,{})}),options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:e.month,onUpdateValidValue:({value:t})=>{d({modifiedType:"update",era:e.era,year:e.year,month:Number(t),date:1})}}),a(v.Button.Clear.S,{ssSphere:2,onClick:()=>{let t=e.month+1;d({modifiedType:"update",era:e.era,year:t==13?e.year+1:e.year,month:t==13?1:t,date:1})},children:a(T.ChevronRight,{})})]})]}),a(k.DateWareki.MonthCell,f({},i))]},e.era)},MonthCell:i=>{let{val_value:e,set_value:d}=i,o=c.Time([e.year.zeroEmbed(4),e.month.zeroEmbed(2),e.date.zeroEmbed(2)].join("/"));if(!o.validate)return;let t=o.getFirstDayOfTheMonth().weekday,r=o.getLastDayOfTheMonth(),m=[];for(let n=0;n<7;n++)m.push(a(O.Supplement,{flexCenter:!0,fontColor:n==0?"googleRed":n==6?"googleBlue":"3.blur",children:c.transformer.weekday.shortJP(n)},"legend-"+n));for(let n=0;n<t;n++){let s=c.Time(o).getFirstDayOfTheMonth().addDate(n-t);m.push(a(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSphere:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"lastMonth-"+n))}for(let n=1;n<=r.date;n++){let s=c.Time(o).setDate(n);m.push(a(v.Button.Border.R,{ssSphere:3,onClick:()=>{d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"currentMonth-"+n))}for(let n=0;n<7-r.weekday-1;n++){let s=c.Time(o).addMonth(1).setDate(1).addDate(n);m.push(a(v.Button.Sub.R,{color:"cloud",border:"1.thin",ssSquare:3,opacity:"middle",onClick:p=>{p.preventDefault(),p.stopPropagation(),d({modifiedType:"update",era:e.era,year:s.year,month:s.month,date:s.date})},children:s.date},"nextMonth-"+n))}return a(A,{gridCols:7,gap:"1/4",children:m})}},Variables:{Footer:i=>y(R,{flexWrap:!1,gap:1,flexChilds:"even",freeCSS:{whiteSpace:"nowrap"},children:[y(v.Button.Border.R,{onClick:()=>{i.onValueUpdate("")},tabIndex:-1,flexSizing:"none",padding:["2/3",1],children:[a(T.Times,{})," \u524A\u9664"]}),a(v.Button.Prime.R,{flexSizing:"auto",padding:["2/3",1],onClick:()=>{i.onSubmit&&i.onSubmit(),H.close(i.tipsID)},tabIndex:-1,children:"\u6C7A\u5B9A"})]}),ShiftButtons:i=>y(R,{gap:"1/3",flexWrap:!1,children:[a(v.Button.Clear.R,x(f({className:g("LeftButton"),tabIndex:-1,right:0},k.Variables.ShiftButtonStyles),{onClick:()=>{i.callback(-1)},children:a(T.ChevronLeft,{})})),a(v.Button.Clear.R,x(f({className:g("RightButton"),tabIndex:-1,left:0},k.Variables.ShiftButtonStyles),{onClick:()=>{i.callback(1)},children:a(T.ChevronRight,{})}))]}),ShiftButtonStyles:{flexCenter:!0,padding:0,unitWidth:3,unitHeight:3,borderRadius:"sphere",position:"relative"}}};export{L as Picker,L as default};
|
|
@@ -49,6 +49,7 @@ declare namespace Time {
|
|
|
49
49
|
type Era = TimeTypes.Era;
|
|
50
50
|
type Restrict = TimeTypes.Restrict;
|
|
51
51
|
type Input = InputTypes.CoreInput & React.DOMAttributes<HTMLInputElement> & {
|
|
52
|
+
label?: ReactElement;
|
|
52
53
|
tone?: InputTypes.BoxTone;
|
|
53
54
|
tabIndex?: number;
|
|
54
55
|
id?: string;
|
|
@@ -58,6 +59,8 @@ declare namespace Time {
|
|
|
58
59
|
max?: string;
|
|
59
60
|
leftIndicator?: ReactElement | false;
|
|
60
61
|
rightIndicator?: ReactElement | false;
|
|
62
|
+
leftIcon?: ReactElement | false;
|
|
63
|
+
rightIcon?: ReactElement | false;
|
|
61
64
|
};
|
|
62
65
|
type Origin = Input & {
|
|
63
66
|
restrict: Restrict;
|
|
@@ -71,6 +74,17 @@ declare namespace Time {
|
|
|
71
74
|
value?: [string, string];
|
|
72
75
|
};
|
|
73
76
|
type Range = TimeTypes.Range;
|
|
77
|
+
type WrapperStates = {
|
|
78
|
+
rootStates: Time.Origin;
|
|
79
|
+
val_status: InputTypes.Status.Time;
|
|
80
|
+
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status.Time>>;
|
|
81
|
+
val_validate: InputTypes.Validation.Result;
|
|
82
|
+
set_validate: React.Dispatch<React.SetStateAction<InputTypes.Validation.Result>>;
|
|
83
|
+
val_era: Time.Era;
|
|
84
|
+
set_era: React.Dispatch<React.SetStateAction<Time.Era>>;
|
|
85
|
+
val_focus: TimeTypes.Focus;
|
|
86
|
+
set_focus: React.Dispatch<React.SetStateAction<TimeTypes.Focus>>;
|
|
87
|
+
};
|
|
74
88
|
}
|
|
75
89
|
declare const Time: Time.Methods & {
|
|
76
90
|
Origin: (props: Time.Origin) => JSX.Element;
|