amotify 0.2.233 → 0.2.235
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/server.ts +2 -2
- package/demo/next/next-env.d.ts +1 -0
- package/demo/next/next.config.ts +1 -1
- package/demo/next/package.json +9 -10
- package/dist/@declares/property.d.ts +1 -0
- package/dist/@utils/LaunchReactApp.d.ts +5 -3
- package/dist/atoms/Box.d.ts +2 -2
- package/dist/atoms/Box.js +1 -1
- package/dist/atoms/Logo.d.ts +14 -14
- package/dist/atoms/Logo.js +3 -3
- package/dist/fn/Button.d.ts +37 -3
- package/dist/fn/Button.js +1 -1
- package/dist/fn/Effect/index.d.ts +2 -2
- package/dist/fn/Input/Autocomplete.d.ts +3 -3
- package/dist/fn/Input/Autocomplete.js +1 -1
- package/dist/fn/Input/CollectForm.d.ts +1 -1
- package/dist/fn/Input/CollectForm.js +1 -1
- package/dist/fn/Input/Filer.js +1 -1
- package/dist/fn/Input/List.d.ts +12 -12
- package/dist/fn/Input/List.js +1 -1
- package/dist/fn/Input/Search.d.ts +1 -1
- package/dist/fn/Input/Search.js +1 -1
- package/dist/fn/Input/Segmented.d.ts +7 -7
- package/dist/fn/Input/Segmented.js +1 -1
- package/dist/fn/Input/Select.d.ts +1 -1
- package/dist/fn/Input/TextField.d.ts +1 -1
- package/dist/fn/Input/Time/index.d.ts +9 -9
- package/dist/fn/Input/Time/index.js +1 -1
- package/dist/fn/Input/core.js +1 -1
- package/dist/fn/Input/index.d.ts +1 -1
- package/dist/fn/Loader/index.d.ts +1 -1
- package/dist/fn/Loader/index.js +1 -1
- package/dist/fn/Sheet.d.ts +3 -3
- package/dist/fn/Sheet.js +1 -1
- package/dist/fn/Snackbar.d.ts +3 -3
- package/dist/fn/Snackbar.js +1 -1
- package/dist/fn/Table/Data.d.ts +1 -1
- package/dist/fn/Table/Wrapper.d.ts +1 -1
- package/dist/fn/Table/Wrapper.js +1 -1
- package/dist/fn/Tooltips.d.ts +1 -1
- package/dist/index.d.ts +24 -24
- package/dist/mols/List.d.ts +6 -6
- package/dist/mols/List.js +1 -1
- package/dist/mols/Literal.d.ts +1 -1
- package/dist/mols/Literal.js +1 -1
- package/package.json +6 -7
- package/demo/next/nodemon.json +0 -7
- package/demo/next/src/app/(hooks)/useClientEffect.tsx +0 -83
- package/demo/next/src/app/(router)/designbook/page.tsx +0 -2891
- package/demo/next/src/app/(router)/page.tsx +0 -206
- package/demo/next/src/app/apis/test/route.ts +0 -9
- package/demo/next/src/app/layout.tsx +0 -26
- package/demo/next/src/server/app.ts +0 -42
- package/demo/next/src/server/fin.ts +0 -11
- package/demo/next/src/server/index.ts +0 -4
package/demo/esbuild/server.ts
CHANGED
|
@@ -14,8 +14,8 @@ expressServer
|
|
|
14
14
|
.get( "*",( req,res ) => {
|
|
15
15
|
res.render( 'layout.ejs' )
|
|
16
16
|
} )
|
|
17
|
-
expressServer.listen(
|
|
18
|
-
let port =
|
|
17
|
+
expressServer.listen( 8100,() => {
|
|
18
|
+
let port = 8100
|
|
19
19
|
let localIP = Server.getLocalIP( os )
|
|
20
20
|
|
|
21
21
|
let local_ip = `http://${ localIP }:${ port }`,
|
package/demo/next/next-env.d.ts
CHANGED
package/demo/next/next.config.ts
CHANGED
package/demo/next/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "demo.app",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"start": "run-p clean dev
|
|
6
|
+
"start": "run-p clean dev:next",
|
|
7
7
|
"clean": "rimraf .next serverDist",
|
|
8
|
-
"dev:next": "NODE_OPTIONS=\"--max-old-space-size=8192\" NEXT_TURBOPACK_TRACING=1 next dev --turbopack"
|
|
9
|
-
"dev:server": "nodemon"
|
|
8
|
+
"dev:next": "NODE_OPTIONS=\"--max-old-space-size=8192\" NEXT_TURBOPACK_TRACING=1 next dev --turbopack -p 8000"
|
|
10
9
|
},
|
|
11
10
|
"dependencies": {
|
|
12
11
|
"cross-env": "^7.0.3",
|
|
13
12
|
"dotenv": "^16.4.5",
|
|
14
13
|
"express": "^4.19.2",
|
|
15
14
|
"jmini": "^0.0.102",
|
|
16
|
-
"next": "^
|
|
15
|
+
"next": "^16.1.1",
|
|
17
16
|
"node-cron": "^4.1.1",
|
|
18
17
|
"nodemon": "^3.1.4",
|
|
19
18
|
"npm-run-all": "^4.1.5",
|
|
20
19
|
"os": "^0.1.2",
|
|
21
|
-
"react": "^
|
|
22
|
-
"react-dom": "^
|
|
20
|
+
"react": "^19.2.3",
|
|
21
|
+
"react-dom": "^19.2.3",
|
|
23
22
|
"rimraf": "^6.0.1",
|
|
24
23
|
"sass": "^1.77.8",
|
|
25
24
|
"ts-loader": "^9.5.1",
|
|
@@ -29,10 +28,10 @@
|
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/express": "^4.17.21",
|
|
31
30
|
"@types/node": "^20",
|
|
32
|
-
"@types/react": "^
|
|
33
|
-
"
|
|
31
|
+
"@types/react": "^19.2.3",
|
|
32
|
+
"react-dom": "^19.2.3",
|
|
34
33
|
"eslint": "^8",
|
|
35
34
|
"eslint-config-next": "14.2.5",
|
|
36
35
|
"typescript": "^5"
|
|
37
36
|
}
|
|
38
|
-
}
|
|
37
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactElement } from '../@declares';
|
|
3
3
|
declare global {
|
|
4
|
-
namespace
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
namespace React {
|
|
5
|
+
namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'amotify-app': React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
8
|
+
}
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
}
|
package/dist/atoms/Box.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ declare namespace Box {
|
|
|
7
7
|
} & StyleTags.BasicElement & Omit<React.ComponentPropsWithRef<HTMLComponent>, 'htmlTag'> & React.HTMLAttributes<any>;
|
|
8
8
|
type DefaultInput = Input<'div'>;
|
|
9
9
|
type Component = {
|
|
10
|
-
<T extends React.ElementType = 'div'>(p: Input<T>): JSX.Element;
|
|
10
|
+
<T extends React.ElementType = 'div'>(p: Input<T>): React.JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
declare const Box: <T extends
|
|
13
|
+
declare const Box: <T extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "div">(p: Box.Input<T>) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
14
|
export { Box, Box as default };
|
package/dist/atoms/Box.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as p,d as
|
|
1
|
+
import{b as o,c as p,d as a}from"../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import{GenerateHTMLProps as s}from"../@utils";const m=e=>{let{ref:l}=e,n=s(e),{htmlTag:T}=n,r=a(n,["htmlTag"]);const t=T||"div";return t?c(t,p(o({},r),{ref:l})):null};export{m as Box,m as default};
|
package/dist/atoms/Logo.d.ts
CHANGED
|
@@ -11,21 +11,21 @@ declare namespace Logo {
|
|
|
11
11
|
color?: 'normal' | 'white';
|
|
12
12
|
};
|
|
13
13
|
type Methods = {
|
|
14
|
-
Icon: (p: ComponentInput) => JSX.Element;
|
|
15
|
-
Title: (p: ComponentInput) => JSX.Element;
|
|
14
|
+
Icon: (p: ComponentInput) => React.JSX.Element;
|
|
15
|
+
Title: (p: ComponentInput) => React.JSX.Element;
|
|
16
16
|
Brands: {
|
|
17
|
-
MingooIcon: (p: DefaultLogoInput) => JSX.Element;
|
|
18
|
-
MingooTitle: (p: DefaultLogoInput) => JSX.Element;
|
|
19
|
-
MingooLogoH: (p: DefaultLogoInput) => JSX.Element;
|
|
20
|
-
MingooLogoV: (p: DefaultLogoInput) => JSX.Element;
|
|
21
|
-
ComunIcon: (p: DefaultLogoInput) => JSX.Element;
|
|
22
|
-
ComunTitle: (p: DefaultLogoInput) => JSX.Element;
|
|
23
|
-
ComunLogoH: (p: DefaultLogoInput) => JSX.Element;
|
|
24
|
-
ComunLogoV: (p: DefaultLogoInput) => JSX.Element;
|
|
25
|
-
Google: (p: DefaultLogoInput) => JSX.Element;
|
|
26
|
-
Facebook: (p: DefaultLogoInput) => JSX.Element;
|
|
27
|
-
Twitter: (p: DefaultLogoInput) => JSX.Element;
|
|
28
|
-
LINE: (p: DefaultLogoInput) => JSX.Element;
|
|
17
|
+
MingooIcon: (p: DefaultLogoInput) => React.JSX.Element;
|
|
18
|
+
MingooTitle: (p: DefaultLogoInput) => React.JSX.Element;
|
|
19
|
+
MingooLogoH: (p: DefaultLogoInput) => React.JSX.Element;
|
|
20
|
+
MingooLogoV: (p: DefaultLogoInput) => React.JSX.Element;
|
|
21
|
+
ComunIcon: (p: DefaultLogoInput) => React.JSX.Element;
|
|
22
|
+
ComunTitle: (p: DefaultLogoInput) => React.JSX.Element;
|
|
23
|
+
ComunLogoH: (p: DefaultLogoInput) => React.JSX.Element;
|
|
24
|
+
ComunLogoV: (p: DefaultLogoInput) => React.JSX.Element;
|
|
25
|
+
Google: (p: DefaultLogoInput) => React.JSX.Element;
|
|
26
|
+
Facebook: (p: DefaultLogoInput) => React.JSX.Element;
|
|
27
|
+
Twitter: (p: DefaultLogoInput) => React.JSX.Element;
|
|
28
|
+
LINE: (p: DefaultLogoInput) => React.JSX.Element;
|
|
29
29
|
};
|
|
30
30
|
Images: {
|
|
31
31
|
mingooIcon: string;
|
package/dist/atoms/Logo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as l,c
|
|
1
|
+
import{b as l,c,d as p}from"../chunk-C5N2D3ZX.js";import{Fragment as A,jsx as e,jsxs as I}from"react/jsx-runtime";import T from"jmini";import{Flex as L,Img as C}from".";import{LogoClasses as a}from"../@styles/componentClasses";const h={ComunIcon:()=>e("svg",{viewBox:"0,0,1200,1200",className:a("ComunIcon"),children:I("g",{children:[e("path",{d:`
|
|
2
2
|
M
|
|
3
3
|
100,600
|
|
4
4
|
A 500,500 0 0,0 600,1100
|
|
@@ -40,7 +40,7 @@ import{b as l,c as g,d as p}from"../chunk-C5N2D3ZX.js";import{Fragment as A,jsx
|
|
|
40
40
|
L600,600
|
|
41
41
|
L600,300
|
|
42
42
|
Z
|
|
43
|
-
`,className:[
|
|
43
|
+
`,className:[a("P"),a("P_"+t)].join(" "),style:{fill:"#c56ff0"}}),e("path",{d:`
|
|
44
44
|
M
|
|
45
45
|
600,300
|
|
46
46
|
A 45,45 0 0,1 600,390
|
|
@@ -48,4 +48,4 @@ import{b as l,c as g,d as p}from"../chunk-C5N2D3ZX.js";import{Fragment as A,jsx
|
|
|
48
48
|
L600,600
|
|
49
49
|
L600,300
|
|
50
50
|
Z
|
|
51
|
-
`,className:[
|
|
51
|
+
`,className:[a("P"),a("P_"+t)].join(" "),style:{fill:"#ea6093"}})]});return I("svg",{viewBox:"0,0,1200,1200",className:a("MingooIcon"),children:[o(0),o(1),o(2),o(3),o(4),o(5),o(6),o(7),o(8)]})}},u={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.MingooIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"mingoo"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(u.Icon,{size:t,color:g}),e(u.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(u.Icon,{margin:"auto",size:t,color:g}),e(u.Title,{size:t,color:g})]}))}},m={Icon:o=>e(r.Icon,c(l({},o),{children:e(h.ComunIcon,{})})),Title:o=>e(r.Title,c(l({className:a("ComunTitle"),height:"auto"},o),{freeCSS:l({letterSpacing:"3px"},o.freeCSS),children:"comun"})),LogoH:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({gap:"1/2",flexCenter:!0},i),{children:[e(m.Icon,{size:t,color:g}),e(m.Title,{size:t,color:g})]}))},LogoV:o=>{let n=o,{size:t,color:g}=n,i=p(n,["size","color"]);return I(L,c(l({flexType:"col",gap:"1/2"},i),{children:[e(m.Icon,{margin:"auto",size:t,color:g}),e(m.Title,{size:t,color:g})]}))}};let s="https://cdn.amotify.com/";const r={Icon:o=>{let f=o,{size:t="R",color:g="normal",className:i="",children:n}=f,S=p(f,["size","color","className","children"]);return e(L,c(l({className:[i,a("Icon"),a("Size_"+t)].join(" "),verticalAlign:"center"},S),{children:T.is.function(n)?e(n,{}):n}))},Title:o=>{let f=o,{size:t="R",color:g="normal",className:i="",children:n}=f,S=p(f,["size","color","className","children"]);return e(L,c(l({className:[i,a("Title"),a("Size_"+t)].join(" "),verticalAlign:"center",fontColor:g=="white"?"white":"logo"},S),{children:T.is.function(n)?e(n,{}):n}))},Brands:{MingooIcon:u.Icon,MingooTitle:u.Title,MingooLogoH:u.LogoH,MingooLogoV:u.LogoV,ComunIcon:m.Icon,ComunTitle:m.Title,ComunLogoH:m.LogoH,ComunLogoV:m.LogoV,Google:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Google_Icon.svg",alt:""})})),Facebook:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/FaceBook_Icon.svg",alt:""})})),Twitter:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Twitter_Icon.svg",alt:""})})),LINE:o=>e(r.Icon,c(l({},o),{children:e(C,{src:s+"@env/@logos/brands/Line_Icon.svg",alt:""})}))},Images:{mingooIcon:s+"@env/@logos/mingoo/icon.png",mingooIconClear:s+"@env/@logos/mingoo/iconClear.png",comunIcon:s+"@env/@logos/comun/icon.png",comunIconClear:s+"@env/@logos/comun/iconClear.png",defaultIcon:o=>s+"@env/@icon/"+(o||"image")+".png"}};export{r as Logo,r as default};
|
package/dist/fn/Button.d.ts
CHANGED
|
@@ -34,7 +34,41 @@ declare namespace ButtonTypes {
|
|
|
34
34
|
type SizeMethods<I> = SizeMethods.Component<I> & SizeMethods.FNs<I>;
|
|
35
35
|
}
|
|
36
36
|
declare namespace Button {
|
|
37
|
+
namespace OnFormSubmit {
|
|
38
|
+
type Input = [
|
|
39
|
+
string,
|
|
40
|
+
Callback<any>
|
|
41
|
+
] | [
|
|
42
|
+
string,
|
|
43
|
+
Callback<any>,
|
|
44
|
+
Options
|
|
45
|
+
];
|
|
46
|
+
type Callback<T = KeyValueDict> = {
|
|
47
|
+
(args: CallbackParams<T>): void;
|
|
48
|
+
};
|
|
49
|
+
type CallbackParams<T = KeyValueDict> = {
|
|
50
|
+
body: T;
|
|
51
|
+
isValid: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* ⚠️ Warning: Be careful when using this function to avoid deadlocks.
|
|
54
|
+
* after serialLock function is called, the form submission will be locked until release function is called.
|
|
55
|
+
* */
|
|
56
|
+
serialLock(): {
|
|
57
|
+
release(): void;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type Options = {
|
|
61
|
+
validOnly?: boolean;
|
|
62
|
+
submitableKey?: ButtonTypes.delegateClickEventProps | ButtonTypes.delegateClickEventProps[];
|
|
63
|
+
/**
|
|
64
|
+
* releaseOnFinish
|
|
65
|
+
* [default] true
|
|
66
|
+
* */
|
|
67
|
+
releaseOnFinish?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
37
70
|
type Input<C = ButtonTypes.Colors> = ButtonTypes.Input<C> & {
|
|
71
|
+
onFormSubmit?: OnFormSubmit.Input;
|
|
38
72
|
submitOption?: {
|
|
39
73
|
formName: string;
|
|
40
74
|
acceptInvalidForm?: boolean;
|
|
@@ -43,7 +77,7 @@ declare namespace Button {
|
|
|
43
77
|
};
|
|
44
78
|
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
45
79
|
namespace Methods {
|
|
46
|
-
type Component = (p: Input) => JSX.Element;
|
|
80
|
+
type Component = (p: Input) => React.JSX.Element;
|
|
47
81
|
type FNs = {
|
|
48
82
|
Plain: ButtonTypes.SizeMethods<Input<''>>;
|
|
49
83
|
Link: ButtonTypes.SizeMethods<Input<''>>;
|
|
@@ -63,7 +97,7 @@ declare namespace Label {
|
|
|
63
97
|
htmlFor?: string;
|
|
64
98
|
} & React.LabelHTMLAttributes<HTMLLabelElement>;
|
|
65
99
|
namespace Methods {
|
|
66
|
-
type Component = (p: Input) => JSX.Element;
|
|
100
|
+
type Component = (p: Input) => React.JSX.Element;
|
|
67
101
|
type FNs = {
|
|
68
102
|
Plain: ButtonTypes.SizeMethods<Input<''>>;
|
|
69
103
|
Link: ButtonTypes.SizeMethods<Input<''>>;
|
|
@@ -87,7 +121,7 @@ declare namespace Anchor {
|
|
|
87
121
|
shiftQueryParams?: boolean;
|
|
88
122
|
} & React.ButtonHTMLAttributes<HTMLAnchorElement>;
|
|
89
123
|
namespace Methods {
|
|
90
|
-
type Component = (p: Input) => JSX.Element;
|
|
124
|
+
type Component = (p: Input) => React.JSX.Element;
|
|
91
125
|
type FNs = {
|
|
92
126
|
Plain: ButtonTypes.SizeMethods<Input<''>>;
|
|
93
127
|
Link: ButtonTypes.SizeMethods<Input<''>>;
|
package/dist/fn/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s,c as i,d as
|
|
1
|
+
import{b as s,c as i,d as I,e as F}from"../chunk-C5N2D3ZX.js";import{jsx as u}from"react/jsx-runtime";import M,{useStore as A,UUID as V}from"jmini";import{pageRouter as R,ReadStyleSet as D}from"../@utils";import{Input as O}from".";import{Box as N}from"../atoms";import{ButtonClasses as C}from"../@styles/componentClasses";const w={Size:(a,t,o,n)=>{let e={fontSize:"inherit"};return o=o||"R",t=="plain"?{}:(t=="link"?o=="xsmall"?e.fontSize="0.xs":o=="small"?e.fontSize="1.mini":o=="regular"||o=="large"&&(e.fontSize="3.paragraph"):e=s({borderRadius:"2.tone.secondary",transition:"middle",position:"relative",textAlign:"center"},e),o=="xsmall"?e=i(s({},e),{padding:["1/3","2/3"],fontSize:"0.xs",borderRadius:"3.tone.tertiary"}):o=="small"?e=i(s({},e),{padding:["1/2","3/4"],fontSize:"1.mini",borderRadius:"3.tone.tertiary"}):o=="regular"?e.padding=["3/4",1]:o=="large"&&(e.padding=[1,2],e.fontSize="3.paragraph",e.isSemiBoldFont=!0),e)},Tone:(a,t,o,n)=>{let e={display:"inlineBlock",fontWeight:"inherit",fontColor:"inherit",border:"unset"};return t=="plain"||(t=="link"?(e.fontColor="theme",e.textAlign="left",e.backgroundColor="trans"):t=="normal"?e=i(s({},e),{backgroundColor:"trans"}):t=="border"?e=i(s({},e),{backgroundColor:"layer.1",border:"2.normal",borderStyle:"solid",boxShadow:"0.min"}):t=="prime"?(e=i(s({},e),{isSemiBoldFont:!0,fontColor:"white",backgroundColor:n,boxShadow:"0.normal",ssEffectsOnActive:["shrink","push","ripple.white"]}),n=="white"&&(e=i(s({},e),{fontColor:"theme",ssEffectsOnActive:["shrink","push","ripple.cloud"]}))):t=="sub"?e=i(s({},e),{fontColor:n,ssEffectsOnActive:["shrink","ripple.cloud"]}):t=="clear"?e=i(s({},e),{fontColor:n,backgroundColor:"trans",ssEffectsOnActive:["shrink","ripple.cloud"]}):t=="fillToBorder"?e=i(s({},e),{boxShadow:"0.normal",border:"2.normal",borderWidth:2,borderColor:n,fontColor:n,backgroundColor:n}):t=="borderToFill"&&(e=i(s({},e),{fontColor:n,boxShadow:"0.normal",border:"2.normal",borderWidth:2,borderColor:n,backgroundColor:n})),n=="cloud"&&(e.fontColor="2.normal"),t!="link"&&(e=s({position:"relative",ssEffectsOnActive:["shrink","push"]},e))),e}},K=a=>{var e;let t=D(s({isLocked:!1,isActive:!1,isActiveStyles:{},isActiveClassName:"",tabIndex:0,className:"",color:"theme",tone:"border","aria-label":V()},a)),o=t.seed;{let{isLocked:m=!1,isActive:h=!1,isActiveStyles:B={},isActiveClassName:g="",tone:r="border",size:l="regular",color:p="theme",className:d=""}=t;t=s(s(s({},w.Size(a.seed,r,l,p)),w.Tone(a.seed,r,l,p)),t),t.className=[d,C("Wrap"),C("isNeutral_"+!h),C("isLocked_"+m),C("Tone_"+r),C("Color_"+p),C("Tone_"+r+"_Color_"+p)].join(" "),h&&(t=s(s({className:[t.className,g].join(" ")},t),B))}if(o=="button"){let n=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,submitOption:r,onFormSubmit:l,onClick:p}=n,d=I(n,["isLocked","isActive","isActiveClassName","isActiveStyles","submitOption","onFormSubmit","onClick"]);return l!=null&&l[1]&&(d=i(s({},d),{"data-form-submit-button":l[0],"data-sdfike":M.flatArray(((e=l[2])==null?void 0:e.submitableKey)||"auxEnter").join(",")})),r&&(r=s({acceptInvalidForm:!1,submitDelegationKey:"auxEnter"},r),d=i(s({},d),{"data-form-submit-button":r.formName,"data-sdfike":M.flatArray(r.submitDelegationKey).join(",")})),u(N,i(s({htmlTag:"button",fontHeight:"inherit"},d),{onClick:k=>{m||(p&&p(k),M.scope(()=>F(void 0,null,function*(){if(!(l!=null&&l[1]))return;l[2]=s({validOnly:!0,submitableKey:"auxEnter",releaseOnFinish:!0},l==null?void 0:l[2]);let[c,T,f]=l,S="prevent-form-submit-"+c,b=A.get(S),x=()=>A.delete(S);const z=()=>(A.set({[S]:!0}),{release:x});if(b)return f.validOnly?void 0:T({body:{},isValid:!1,serialLock:z});z();let v=yield O.CollectForm(c);x(),!(!v.isValid&&f.validOnly)&&(yield T({body:v.data,isValid:v.isValid,serialLock:z}),f.releaseOnFinish&&x())})),M.scope(()=>F(void 0,null,function*(){if(!r)return;let c=yield O.CollectForm(r.formName);!c.isValid&&!r.acceptInvalidForm||r.callback(c.data,c.isValid)})))}}))}else if(o=="label"){let P=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,onClick:r}=P,l=I(P,["isLocked","isActive","isActiveClassName","isActiveStyles","onClick"]);return u(N,i(s({htmlTag:"label"},l),{onClick:p=>{m||r&&r(p)}}))}else if(o=="anchor"){let E=t,{isLocked:m,isActive:h,isActiveClassName:B,isActiveStyles:g,onClick:r,href:l="",newTab:p,sync:d,shiftQueryParams:k}=E,c=I(E,["isLocked","isActive","isActiveClassName","isActiveStyles","onClick","href","newTab","sync","shiftQueryParams"]);return u(N,i(s({htmlTag:"button"},c),{onClick:T=>{if(m)return;if(r)return r(T);let f=T.ctrlKey||T.metaKey,S=p||!!f,b=l;if(k&&(b+=location.search),d){R.pushSync(b);return}R.push(b,!!S)}}))}return null},y=function(a,t){const o=e=>u(K,s({seed:a,tone:t,size:"regular"},e)),n=o;return n.Plain=e=>u(o,s({size:"plain",tone:t},e)),n.XS=e=>u(o,s({size:"xsmall",tone:t},e)),n.S=e=>u(o,s({size:"small",tone:t},e)),n.R=e=>u(o,s({size:"regular",tone:t},e)),n.L=e=>u(o,s({size:"large",tone:t},e)),n},L=function(a){const o=n=>u(K,s({seed:a,tone:"prime",size:"regular"},n));return o.Plain=y(a,"plain"),o.Link=y(a,"link"),o.Normal=y(a,"normal"),o.Border=y(a,"border"),o.Prime=y(a,"prime"),o.Sub=y(a,"sub"),o.Clear=y(a,"clear"),o.FillToBorder=y(a,"fillToBorder"),o.BorderToFill=y(a,"borderToFill"),o},H=L("button"),W=L("label"),_=L("anchor");export{_ as Anchor,H as Button,W as Label};
|
|
@@ -5,7 +5,7 @@ import Pudding from './Pudding';
|
|
|
5
5
|
declare const Effect: {
|
|
6
6
|
Ripple: Ripple.Methods;
|
|
7
7
|
Pudding: Pudding.Methods;
|
|
8
|
-
FadeIn:
|
|
9
|
-
FadeUp:
|
|
8
|
+
FadeIn: React.FC<FadeIn.Input>;
|
|
9
|
+
FadeUp: React.FC<FadeUp.Input>;
|
|
10
10
|
};
|
|
11
11
|
export { Effect, Effect as default };
|
|
@@ -24,10 +24,10 @@ declare namespace Autocomplete {
|
|
|
24
24
|
DynamicOptionsOnSearch?: DynamicOptionsOnSearch<T>;
|
|
25
25
|
DynamicOptionsOnSearchDelay?: number;
|
|
26
26
|
SelectedComponent?: {
|
|
27
|
-
(p: SelectedComponentProps<T>): JSX.Element;
|
|
27
|
+
(p: SelectedComponentProps<T>): React.JSX.Element;
|
|
28
28
|
};
|
|
29
29
|
SelectorComponent?: {
|
|
30
|
-
(p: SelectorComponentProps<T>): JSX.Element;
|
|
30
|
+
(p: SelectorComponentProps<T>): React.JSX.Element;
|
|
31
31
|
};
|
|
32
32
|
SelectorStyles?: StyleTags.PropsNFreeCSS;
|
|
33
33
|
SelectorPosition?: 1 | 2 | 3 | 4;
|
|
@@ -90,7 +90,7 @@ declare namespace Autocomplete {
|
|
|
90
90
|
set_validate: React.Dispatch<React.SetStateAction<InputTypes.Validation.Result>>;
|
|
91
91
|
};
|
|
92
92
|
type Component = {
|
|
93
|
-
<T = Value>(p: Input<Value<T>>): JSX.Element;
|
|
93
|
+
<T = Value>(p: Input<Value<T>>): React.JSX.Element;
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
declare const Autocomplete: Autocomplete.Component;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m,c as g,d as ee,e as te}from"../../chunk-C5N2D3ZX.js";import{Fragment as X,jsx as l,jsxs as V}from"react/jsx-runtime";import{useState as b,useEffect as F,useRef as ue}from"react";import p,{UUID as D}from"jmini";import{ExtractStyles as ce}from"../../@utils";import{Box as E,Span as pe,FAI as H,Column as oe}from"../../atoms";import{Literal as q,Row as P}from"../../mols";import{Button as ae}from"../Button";import{Loader as de}from"../Loader";import{Sheet as Se}from"../Sheet";import{OptionalInputWrapper as fe,BoxWrapper as me,CoreEffects as M,DefaultBoxishStyles as ve}from"./core";import{InputAutocompleteClasses as W}from"../../@styles/componentClasses";import{InputLabel as ye}from"./Label";import{RightIcon as le}from".";function _e(e){let{value:t,states:s}=e,{required:d,options:o,min:a,max:n}=s;a=a||0,n=n||65535;let S=[],u=t.filter(c=>c!==null).length;return d&&(u||S.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),u<a&&S.push({type:"invalid",label:a+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),u>n&&S.push({type:"invalid",label:n+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!S.filter(({type:c})=>c=="invalid").length,notice:S}}const z={InitOptions:e=>{let t=[];return e.forEach(s=>{if(!s)return;let{type:d,label:o,value:a,searchValue:n}=s,S=n||p.is.string(o)&&o||""||p.is.string(a)&&a||p.Stringify(a||"")||"";p.is.nullish(o)&&(o=String(a)),t.push(g(m({id:D()},s),{searchValue:S,type:d||"selector",label:o,value:a}))}),t},FilterSelectableOptions:(e,t,s)=>{let d=e;return s||(d=e.filter(o=>(o==null?void 0:o.type)!="label")),p.scope(()=>{if(!t)return;let o=t.toLower().replace(/ /g,"");d=d.filter(a=>(a.searchValue||"").toLower().replace(/ /g,"").includes(o))}),d}},L={Shallow:e=>{let{rootStates:t,val_status:s}=e,d=ce(t);return l(E,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:l(q.Description,g(m({className:t.className},d),{position:"absolute",width:1,freeCSS:g(m({},d.freeCSS),{color:"orange"}),"data-id":"shallow_"+s.componentId,children:l(E,{"data-input-value-shallow":s.componentId,children:"A"})}))})},Button:e=>{let{rootStates:t,val_keyword:s,set_keyword:d,val_optionFocused:o,set_optionFocused:a,val_preventOpenSelector:n,set_preventOpenSelector:S,val_openSelector:u,set_openSelector:c,val_status:i,set_status:f,val_activeInput:v,set_activeInput:y,val_validate:C,set_validate:O}=e,Y=t,{tone:h,required:A,form:I,className:w,multiSelect:T,enableFormSubmit:K,checkValidationAtFirst:N,onValidate:$,onValidateDelay:Q,onUpdateValue:U,onUpdateValidValue:J,onUserAction:j,value:G="",options:R,leftIndicator:B,rightIndicator:k,leftIcon:ge,rightIcon:he,componentId:Ie,status_id:be,wrapStyles:Ce,emptySelect:De,SearchInput:Oe,SearchInputPlaceholder:we,SelectedComponent:Te,SelectorComponent:Re,SelectorStyles:ke,SelectorPosition:xe,DynamicOptionsOnSearch:Ve,DynamicOptionsOnSearchDelay:Ae}=Y,r=ee(Y,["tone","required","form","className","multiSelect","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","SearchInput","SearchInputPlaceholder","SelectedComponent","SelectorComponent","SelectorStyles","SelectorPosition","DynamicOptionsOnSearch","DynamicOptionsOnSearchDelay"]);return F(()=>{var x;if(t.disabled||!u||p.is.exist(o))return;let _=z.FilterSelectableOptions(e.val_options,s,!1);a(((x=_[0])==null?void 0:x.id)||"")},[s]),F(()=>{if(i.eventType!="init"&&i.eventType!="override"){if(t.max==i.dataValue.length){c(!1),S(!0),d("");return}p("#SearchInput_"+t.componentId).focus()}},[i.dataValue]),F(()=>{if(i.eventType=="override")return;let _="autocomplete-click-"+t.componentId;if(!u){p(document).removeEvent([_]);return}p('[data-input-origin="'+t.componentId+'"]')&&(p("#SearchInput_"+t.componentId).focus(),p(document).addEvent({eventID:_,eventType:"mousedown",callback:ie=>{let Z=p(ie.target),re=!!p(Z).parent("."+W("Core")).length,se=!!p(Z).parent("."+W("Selector")).length;re||se||(c(!1),y(!1))},options:{passive:!1}}))},[u]),V(X,{children:[l(E,g(m({tabIndex:0},r),{"data-disabled":t.disabled,"data-show-validation":M.isShowValidation(C,i,!!N),"data-component-id":i.componentId,"data-input-origin":i.componentId,"data-focus":!!u||!!v,className:[w,W("Core")].join(" "),onFocus:_=>{if(r!=null&&r.onFocus&&(r==null||r.onFocus(_)),!t.disabled){if(n)return S(!1);c(!0),y(!0),_.preventDefault()}},onBlur:_=>{r!=null&&r.onBlur&&(r==null||r.onBlur(_))},onCompositionStart:_=>{r!=null&&r.onCompositionStart&&(r==null||r.onCompositionStart(_))},onCompositionEnd:_=>{r!=null&&r.onCompositionEnd&&(r==null||r.onCompositionEnd(_))},onClick:_=>{r!=null&&r.onClick&&(r==null||r.onClick(_)),!t.disabled&&(c(!0),y(!0))},onKeyDown:_=>{let{key:x}=_;K&&M.SubmitForm(_,I),!u&&(x==" "||x=="ArrowDown"||x=="ArrowUp"||x=="Enter")&&(c(!0),y(!0))},children:V(P.Left,{gap:0,children:[l(pe,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),V(P.Left,{flexWrap:!0,flexSizing:0,gap:"1/3",freeCSS:{letterSpacing:".5px"},children:[l(L.Selected,m({},e)),l(L.SearchInput,m({},e))]})]})})),u&&l(L.Selector,m({},e))]})},SearchInput:e=>{let{rootStates:t,val_status:s,set_status:d}=e;return t.disabled||!e.val_openSelector&&!e.val_activeInput?null:l(E,{htmlTag:"input",id:"SearchInput_"+t.componentId,placeholder:t.SearchInputPlaceholder||"\u691C\u7D22...",opacity:e.val_openSelector?"max":"middle",transition:"middle",flexSizing:0,fontSize:"inherit",border:"unset",backgroundColor:"trans",value:e.val_keyword,freeCSS:{outline:"none"},onFocus:o=>{d(a=>g(m({},a),{eventID:D(),isFocusing:!0}))},onBlur:o=>{e.set_activeInput(!1),d(a=>g(m({},a),{eventID:D(),isFocusing:!1}))},onCompositionStart:o=>{d(a=>g(m({},a),{eventID:D(),isComposing:!0}))},onCompositionEnd:o=>{d(a=>g(m({},a),{eventID:D(),isComposing:!1}))},onKeyDown:o=>{let{key:a,metaKey:n,ctrlKey:S}=o,u=n||S;a=="Tab"?(e.set_openSelector(!1),e.set_activeInput(!1),e.set_preventOpenSelector(!1)):a==" "?p.scope(()=>{e.val_openSelector||e.val_keyword||(o.preventDefault(),e.set_openSelector(!0))}):a=="Backspace"?p.scope(()=>{if(e.val_keyword)return;let c=[...e.val_status.dataValue];c.pop(),e.set_status(i=>g(m({},i),{dataValue:c,eventType:"update",eventID:D()}))}):a=="Enter"&&p.scope(()=>{if(s.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!e.val_openSelector)return e.set_openSelector(!0);if(!e.val_optionFocused)return;let c=e.val_options.find(f=>(f==null?void 0:f.id)==e.val_optionFocused);if(!c)return;let{value:i}=c;e.set_status(f=>{let v=[...f.dataValue];return p.scope(()=>{if(i===null)return v=[];f.dataValue.includes(i)?v=v.filter(C=>C!==i):t.multiSelect?v.push(i):v=[i]}),g(m({},f),{dataValue:v,eventType:"update",eventID:D()})}),e.set_optionsModified(!0),e.set_keyword("")}),p.scope(()=>{if(!["ArrowDown","ArrowUp"].includes(a))return;if(o.preventDefault(),!e.val_openSelector)return e.set_openSelector(!0);let c=a=="ArrowDown"?1:-1,i=z.FilterSelectableOptions(e.val_options),f=i.length-1,v=null;p.scope(()=>{var C,O,h,A,I,w;let y=i.findIndex(T=>(T==null?void 0:T.id)==e.val_optionFocused);if(y==-1&&(y=0),c==1){if(v=(C=i[0])==null?void 0:C.id,u){v=(O=i[f])==null?void 0:O.id;return}if(y==-1||y==f)return;v=(h=i[y+1])==null?void 0:h.id}else{if(v=(A=i[f])==null?void 0:A.id,u){v=(I=i[0])==null?void 0:I.id;return}if(y==-1||y==0)return;v=(w=i[y-1])==null?void 0:w.id}}),e.set_optionFocused(v)}),t.enableFormSubmit&&M.SubmitForm(o,e.rootStates.form)},onChange:o=>{let n=o.target.value;e.set_openSelector(!0),e.set_keyword(n)}},"searchInput")},Selector:e=>{var S;let[t,s]=b("idle"),[d,o]=b("idle");F(()=>{if(!e.rootStates.DynamicOptionsOnSearch||!e.val_openSelector)return;if(e.val_optionsModified)return e.set_optionsModified(!1);if(e.val_status.isComposing)return;if(t=="idle")return s("ok");o("fetch");let u="autocomplete-search-"+e.rootStates.componentId;e.set_optionFocused(""),p.interval.once(()=>te(void 0,null,function*(){var f;let c=yield e.rootStates.DynamicOptionsOnSearch(e.val_keyword);o("idle");let i=z.InitOptions(c||[]);e.set_options(i),e.set_optionFocused(((f=i[0])==null?void 0:f.id)||"")}),e.rootStates.DynamicOptionsOnSearchDelay||500,u)},[e.val_keyword,e.val_status.isComposing]),F(()=>{let u=p(`[data-selector-id="${e.val_status.componentId}"]`)[0];if(!u)return;let c=p(`[data-autocomplete-input-value="${e.val_optionFocused}"]`)[0];c&&(u.scrollTop=c.offsetTop-24)},[e.val_optionFocused]);let a=z.FilterSelectableOptions(e.val_options,e.rootStates.DynamicOptionsOnSearch?"":e.val_keyword,!0),n={};switch(e.rootStates.SelectorPosition){case 1:n.bottom="100%",n.left=0,n.paddingBottom="1/3";break;case 2:n.bottom="100%",n.right=0,n.paddingBottom="1/3";break;case 3:n.top="100%",n.left=0,n.paddingTop="1/3";break;case 4:n.top="100%",n.right=0,n.paddingTop="1/3";break;default:break}return l(E,g(m({position:"absolute"},n),{freeCSS:m({minWidth:"75%",zIndex:1e3},n.freeCSS),children:l(Se.Body,g(m({className:W("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,boxShadow:"1.normal",overflow:"auto","data-selector-id":e.val_status.componentId},e.rootStates.SelectorStyles),{freeCSS:m({maxHeight:12*24},(S=e.rootStates.SelectorStyles)==null?void 0:S.freeCSS),children:V(oe,{gap:"1/12",padding:[1,0],children:[d=="fetch"&&l(P.Center,{padding:"1/2",children:l(de.Theme.R,{showInitial:!0})}),d!="fetch"&&V(X,{children:[!a.length&&l(q.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),a.map((u,c)=>{if(!u)return null;let{type:i,value:f}=u,v=e.val_optionFocused==u.id,y=e.val_status.dataValue.includes(f),C=e.rootStates.SelectorComponent;return l(oe,{"data-autocomplete-input-value":u.id,children:l(C,{option:u,isFocused:v,isSelected:y,addCallback:()=>{e.set_status(O=>{let h=[...O.dataValue];return p.scope(()=>{if(f===null)return h=[];O.dataValue.includes(f)?h=h.filter(I=>I!==f):e.rootStates.multiSelect?h.push(f):h=[f]}),g(m({},O),{dataValue:h,eventType:"update",eventID:D()})})}})},u.id)})]})]})}))}))},Selected:e=>{let{rootStates:t,val_status:s,set_status:d,val_optionsDict:o}=e,a=[];return s.dataValue.forEach(n=>{let S=o[p.Stringify(n)];if(!S)return;let u=t.SelectedComponent,c=S.label;(S==null?void 0:S.value)===null&&(c=""),a.push(l(E,{className:W("SelectedCell"),children:l(u,{value:S==null?void 0:S.value,label:c,removeCallback:i=>{if(i.stopPropagation(),i.preventDefault(),t.disabled)return;let f=[...s.dataValue];f=f.filter(v=>v!==n),d(v=>g(m({},v),{dataValue:f,eventType:"update",eventID:D()}))}})},p.Stringify(S==null?void 0:S.value)||D()))}),l(X,{children:a})},Core:e=>{var J,j,G;let{value:t}=e,[s,d]=b(!1),[o,a]=b(!1),[n,S]=b(!1),[u,c]=b(!1),[i,f]=b(""),[v,y]=b(e.options),[C,O]=b(((J=e.options.find(R=>{var B;return(R==null?void 0:R.value)===((B=e.value)==null?void 0:B[0])}))==null?void 0:J.id)||((j=e.options[0])==null?void 0:j.id)||""),[h,A]=b({}),[I,w]=b(M.DefaultStatus(e.componentId,t)),[T,K]=b({ok:!1,notice:[]}),N=ue(!1);F(()=>{o||(N.current?y(e.options):N.current=!0)},[p.Stringify((G=e.options)==null?void 0:G.map(R=>R.value))]),F(()=>{if(!v.length)return;let R=[...v],B=m({},h);R.forEach(k=>{(k==null?void 0:k.type)!="label"&&(B[p.Stringify(k==null?void 0:k.value)]=k)}),A(B)},[v]);let $={rootStates:e,val_options:v,set_options:y,val_optionFocused:C,set_optionFocused:O,val_optionsDict:h,set_optionsDict:A,val_optionsModified:o,set_optionsModified:a,val_preventOpenSelector:s,set_preventOpenSelector:d,val_openSelector:n,set_openSelector:S,val_activeInput:u,set_activeInput:c,val_keyword:i,set_keyword:f,val_status:I,set_status:w,val_validate:T,set_validate:K},Q=!!e.multiSelect;M.CommonEffects({type:Q?"autocomplete.multi":"autocomplete.single",states:e,val_status:I,set_status:w,val_validate:T,set_validate:K,SystemValidation:_e});let U=I.dataValue.length&&I.dataValue[0]!==null;return U=U||n||u,V(me,{val_status:I,set_status:w,val_validate:T,states:e,children:[l(ye,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:U}),l(L.Shallow,m({},$)),l(L.Button,m({},$))]})}},ne=e=>{let t=m({},e);return t=g(m({value:[],min:0,max:65535,multiSelect:!0,SearchInput:!0,emptySelect:!0,SelectorComponent:({option:s,isSelected:d,isFocused:o,addCallback:a})=>s?(s==null?void 0:s.type)=="label"?l(X,{children:s.label}):l(ae.Sub.S,{color:"cloud",backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["1/2",1.5],isActive:o,isActiveStyles:{backgroundColor:"cloud"},onClick:a,children:V(P.Left,{gap:"1/2",children:[d&&l(H.Check,{fontColor:"theme"}),l(q.Supplement,{transition:"short",children:s.label})]})}):null,SelectedComponent:({value:s,label:d,removeCallback:o})=>V(P.Left,{ssCardBox:"cloud",borderRadius:"2.tone.secondary",fontSize:"1.mini",padding:"1/2",gap:0,children:[l(E,{padding:[0,"1/4"],children:d}),l(ae.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,isRounded:!0,padding:"1/4",onClick:o,freeCSS:{lineHeight:1,aspectRatio:"1/1"},children:l(H.X,{})})]}),SelectorPosition:3},t),{freeCSS:m({cursor:"pointer"},t.freeCSS)}),t.multiSelect||(t.min=0,t.max=1),t.options=t.options||[],t.emptySelect&&(t.options=[{value:null,label:l(q.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...t.options]),t.value=p.flatArray(t.value),t.options=z.InitOptions(t.options),p.is.nullish(t.rightIcon)&&(t.rightIcon=l(le,{children:l(H.Search,{})}),t.disabled&&(t.rightIcon=l(le,{fontColor:"5.translucent",children:l(H.Ban,{})}))),t.rightIcon&&(t=m({paddingRight:3},t)),t.leftIcon&&(t=m({paddingLeft:3},t)),l(fe,{componentId:t.componentId,children:L.Core,states:ve(t)})};export{ne as Autocomplete,ne as default};
|
|
1
|
+
import{b as m,c as g,d as ee,e as te}from"../../chunk-C5N2D3ZX.js";import{Fragment as X,jsx as l,jsxs as V}from"react/jsx-runtime";import{useState as b,useEffect as F,useRef as ue}from"react";import p,{UUID as D}from"jmini";import{ExtractStyles as ce}from"../../@utils";import{Box as E,Span as pe,FAI as H,Column as oe}from"../../atoms";import{Literal as q,Row as P}from"../../mols";import{Button as ae}from"../Button";import{Loader as de}from"../Loader";import{Sheet as Se}from"../Sheet";import{OptionalInputWrapper as fe,BoxWrapper as me,CoreEffects as M,DefaultBoxishStyles as ve}from"./core";import{InputAutocompleteClasses as W}from"../../@styles/componentClasses";import{InputLabel as ye}from"./Label";import{RightIcon as le}from".";function _e(e){let{value:t,states:s}=e,{required:d,options:o,min:a,max:n}=s;a=a||0,n=n||65535;let S=[],u=t.filter(c=>c!==null).length;return d&&(u||S.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),u<a&&S.push({type:"invalid",label:a+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),u>n&&S.push({type:"invalid",label:n+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!S.filter(({type:c})=>c=="invalid").length,notice:S}}const z={InitOptions:e=>{let t=[];return e.forEach(s=>{if(!s)return;let{type:d,label:o,value:a,searchValue:n}=s,S=n||p.is.string(o)&&o||""||p.is.string(a)&&a||p.Stringify(a||"")||"";p.is.nullish(o)&&(o=String(a)),t.push(g(m({id:D()},s),{searchValue:S,type:d||"selector",label:o,value:a}))}),t},FilterSelectableOptions:(e,t,s)=>{let d=e;return s||(d=e.filter(o=>(o==null?void 0:o.type)!="label")),p.scope(()=>{if(!t)return;let o=t.toLower().replace(/ /g,"");d=d.filter(a=>(a.searchValue||"").toLower().replace(/ /g,"").includes(o))}),d}},L={Shallow:e=>{let{rootStates:t,val_status:s}=e,d=ce(t);return l(E,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:l(q.Description,g(m({className:t.className},d),{position:"absolute",width:1,freeCSS:g(m({},d.freeCSS),{color:"orange"}),"data-id":"shallow_"+s.componentId,children:l(E,{"data-input-value-shallow":s.componentId,children:"A"})}))})},Button:e=>{let{rootStates:t,val_keyword:s,set_keyword:d,val_optionFocused:o,set_optionFocused:a,val_preventOpenSelector:n,set_preventOpenSelector:S,val_openSelector:u,set_openSelector:c,val_status:i,set_status:f,val_activeInput:v,set_activeInput:y,val_validate:C,set_validate:O}=e,Y=t,{tone:h,required:A,form:I,className:w,multiSelect:R,enableFormSubmit:K,checkValidationAtFirst:N,onValidate:$,onValidateDelay:Q,onUpdateValue:U,onUpdateValidValue:J,onUserAction:j,value:G="",options:T,leftIndicator:B,rightIndicator:k,leftIcon:ge,rightIcon:he,componentId:Ie,status_id:be,wrapStyles:Ce,emptySelect:De,SearchInput:Oe,SearchInputPlaceholder:we,SelectedComponent:Re,SelectorComponent:Te,SelectorStyles:ke,SelectorPosition:xe,DynamicOptionsOnSearch:Ve,DynamicOptionsOnSearchDelay:Ae}=Y,r=ee(Y,["tone","required","form","className","multiSelect","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","emptySelect","SearchInput","SearchInputPlaceholder","SelectedComponent","SelectorComponent","SelectorStyles","SelectorPosition","DynamicOptionsOnSearch","DynamicOptionsOnSearchDelay"]);return F(()=>{var x;if(t.disabled||!u||p.is.exist(o))return;let _=z.FilterSelectableOptions(e.val_options,s,!1);a(((x=_[0])==null?void 0:x.id)||"")},[s]),F(()=>{if(i.eventType!="init"&&i.eventType!="override"){if(t.max==i.dataValue.length){c(!1),S(!0),d("");return}p("#SearchInput_"+t.componentId).focus()}},[i.dataValue]),F(()=>{if(i.eventType=="override")return;let _="autocomplete-click-"+t.componentId;if(!u){p(document).removeEvent([_]);return}p('[data-input-origin="'+t.componentId+'"]')&&(p("#SearchInput_"+t.componentId).focus(),p(document).addEvent({eventID:_,eventType:"mousedown",callback:ie=>{let Z=p(ie.target),re=!!p(Z).parent("."+W("Core")).length,se=!!p(Z).parent("."+W("Selector")).length;re||se||(c(!1),y(!1))},options:{passive:!1}}))},[u]),V(X,{children:[l(E,g(m({tabIndex:0},r),{"data-disabled":t.disabled,"data-show-validation":M.isShowValidation(C,i,!!N),"data-component-id":i.componentId,"data-input-origin":i.componentId,"data-focus":!!u||!!v,className:[w,W("Core")].join(" "),onFocus:_=>{if(r!=null&&r.onFocus&&(r==null||r.onFocus(_)),!t.disabled){if(n)return S(!1);c(!0),y(!0),_.preventDefault()}},onBlur:_=>{r!=null&&r.onBlur&&(r==null||r.onBlur(_))},onCompositionStart:_=>{r!=null&&r.onCompositionStart&&(r==null||r.onCompositionStart(_))},onCompositionEnd:_=>{r!=null&&r.onCompositionEnd&&(r==null||r.onCompositionEnd(_))},onClick:_=>{r!=null&&r.onClick&&(r==null||r.onClick(_)),!t.disabled&&(c(!0),y(!0))},onKeyDown:_=>{let{key:x}=_;K&&M.SubmitForm(_,I),!u&&(x==" "||x=="ArrowDown"||x=="ArrowUp"||x=="Enter")&&(c(!0),y(!0))},children:V(P.Left,{gap:0,children:[l(pe,{width:0,overflow:"hidden",opacity:"trans",children:"A"}),V(P.Left,{flexWrap:!0,flexSizing:0,gap:"1/3",freeCSS:{letterSpacing:".5px"},children:[l(L.Selected,m({},e)),l(L.SearchInput,m({},e))]})]})})),u&&l(L.Selector,m({},e))]})},SearchInput:e=>{let{rootStates:t,val_status:s,set_status:d}=e;return t.disabled||!e.val_openSelector&&!e.val_activeInput?null:l(E,{htmlTag:"input",id:"SearchInput_"+t.componentId,placeholder:t.SearchInputPlaceholder||"\u691C\u7D22...",opacity:e.val_openSelector?"max":"middle",transition:"middle",flexSizing:0,fontSize:"inherit",border:"unset",backgroundColor:"trans",value:e.val_keyword,freeCSS:{outline:"none"},onFocus:o=>{d(a=>g(m({},a),{eventID:D(),isFocusing:!0}))},onBlur:o=>{e.set_activeInput(!1),d(a=>g(m({},a),{eventID:D(),isFocusing:!1}))},onCompositionStart:o=>{d(a=>g(m({},a),{eventID:D(),isComposing:!0}))},onCompositionEnd:o=>{d(a=>g(m({},a),{eventID:D(),isComposing:!1}))},onKeyDown:o=>{let{key:a,metaKey:n,ctrlKey:S}=o,u=n||S;a=="Tab"?(e.set_openSelector(!1),e.set_activeInput(!1),e.set_preventOpenSelector(!1)):a==" "?p.scope(()=>{e.val_openSelector||e.val_keyword||(o.preventDefault(),e.set_openSelector(!0))}):a=="Backspace"?p.scope(()=>{if(e.val_keyword)return;let c=[...e.val_status.dataValue];c.pop(),e.set_status(i=>g(m({},i),{dataValue:c,eventType:"update",eventID:D()}))}):a=="Enter"&&p.scope(()=>{if(s.isComposing||(o==null?void 0:o.keyCode)===229)return;if(!e.val_openSelector)return e.set_openSelector(!0);if(!e.val_optionFocused)return;let c=e.val_options.find(f=>(f==null?void 0:f.id)==e.val_optionFocused);if(!c)return;let{value:i}=c;e.set_status(f=>{let v=[...f.dataValue];return p.scope(()=>{if(i===null)return v=[];f.dataValue.includes(i)?v=v.filter(C=>C!==i):t.multiSelect?v.push(i):v=[i]}),g(m({},f),{dataValue:v,eventType:"update",eventID:D()})}),e.set_optionsModified(!0),e.set_keyword("")}),p.scope(()=>{if(!["ArrowDown","ArrowUp"].includes(a))return;if(o.preventDefault(),!e.val_openSelector)return e.set_openSelector(!0);let c=a=="ArrowDown"?1:-1,i=z.FilterSelectableOptions(e.val_options),f=i.length-1,v=null;p.scope(()=>{var C,O,h,A,I,w;let y=i.findIndex(R=>(R==null?void 0:R.id)==e.val_optionFocused);if(y==-1&&(y=0),c==1){if(v=(C=i[0])==null?void 0:C.id,u){v=(O=i[f])==null?void 0:O.id;return}if(y==-1||y==f)return;v=(h=i[y+1])==null?void 0:h.id}else{if(v=(A=i[f])==null?void 0:A.id,u){v=(I=i[0])==null?void 0:I.id;return}if(y==-1||y==0)return;v=(w=i[y-1])==null?void 0:w.id}}),e.set_optionFocused(v)}),t.enableFormSubmit&&M.SubmitForm(o,e.rootStates.form)},onChange:o=>{let n=o.target.value;e.set_openSelector(!0),e.set_keyword(n)}},"searchInput")},Selector:e=>{var S;let[t,s]=b("idle"),[d,o]=b("idle");F(()=>{if(!e.rootStates.DynamicOptionsOnSearch||!e.val_openSelector)return;if(e.val_optionsModified)return e.set_optionsModified(!1);if(e.val_status.isComposing)return;if(t=="idle")return s("ok");o("fetch");let u="autocomplete-search-"+e.rootStates.componentId;e.set_optionFocused(""),p.interval.once(()=>te(void 0,null,function*(){var f;let c=yield e.rootStates.DynamicOptionsOnSearch(e.val_keyword);o("idle");let i=z.InitOptions(c||[]);e.set_options(i),e.set_optionFocused(((f=i[0])==null?void 0:f.id)||"")}),e.rootStates.DynamicOptionsOnSearchDelay||500,u)},[e.val_keyword,e.val_status.isComposing]),F(()=>{let u=p(`[data-selector-id="${e.val_status.componentId}"]`)[0];if(!u)return;let c=p(`[data-autocomplete-input-value="${e.val_optionFocused}"]`)[0];c&&(u.scrollTop=c.offsetTop-24)},[e.val_optionFocused]);let a=z.FilterSelectableOptions(e.val_options,e.rootStates.DynamicOptionsOnSearch?"":e.val_keyword,!0),n={};switch(e.rootStates.SelectorPosition){case 1:n.bottom="100%",n.left=0,n.paddingBottom="1/3";break;case 2:n.bottom="100%",n.right=0,n.paddingBottom="1/3";break;case 3:n.top="100%",n.left=0,n.paddingTop="1/3";break;case 4:n.top="100%",n.right=0,n.paddingTop="1/3";break;default:break}return l(E,g(m({position:"absolute"},n),{freeCSS:m({minWidth:"75%",zIndex:1e3},n.freeCSS),children:l(Se.Body,g(m({className:W("Selector"),borderRadius:"2.tone.secondary",ssCardBox:!0,boxShadow:"1.normal",overflow:"auto","data-selector-id":e.val_status.componentId},e.rootStates.SelectorStyles),{freeCSS:m({maxHeight:12*24},(S=e.rootStates.SelectorStyles)==null?void 0:S.freeCSS),children:V(oe,{gap:"1/12",padding:[1,0],children:[d=="fetch"&&l(P.Center,{padding:"1/2",children:l(de.Theme.R,{showInitial:!0})}),d!="fetch"&&V(X,{children:[!a.length&&l(q.Supplement,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"}),a.map((u,c)=>{if(!u)return null;let{type:i,value:f}=u,v=e.val_optionFocused==u.id,y=e.val_status.dataValue.includes(f),C=e.rootStates.SelectorComponent;return l(oe,{"data-autocomplete-input-value":u.id,children:l(C,{option:u,isFocused:v,isSelected:y,addCallback:()=>{e.set_status(O=>{let h=[...O.dataValue];return p.scope(()=>{if(f===null)return h=[];O.dataValue.includes(f)?h=h.filter(I=>I!==f):e.rootStates.multiSelect?h.push(f):h=[f]}),g(m({},O),{dataValue:h,eventType:"update",eventID:D()})})}})},u.id)})]})]})}))}))},Selected:e=>{let{rootStates:t,val_status:s,set_status:d,val_optionsDict:o}=e,a=[];return s.dataValue.forEach(n=>{let S=o[p.Stringify(n)];if(!S)return;let u=t.SelectedComponent,c=S.label;(S==null?void 0:S.value)===null&&(c=""),a.push(l(E,{className:W("SelectedCell"),children:l(u,{value:S==null?void 0:S.value,label:c,removeCallback:i=>{if(i.stopPropagation(),i.preventDefault(),t.disabled)return;let f=[...s.dataValue];f=f.filter(v=>v!==n),d(v=>g(m({},v),{dataValue:f,eventType:"update",eventID:D()}))}})},p.Stringify(S==null?void 0:S.value)||D()))}),l(X,{children:a})},Core:e=>{var J,j,G;let{value:t}=e,[s,d]=b(!1),[o,a]=b(!1),[n,S]=b(!1),[u,c]=b(!1),[i,f]=b(""),[v,y]=b(e.options),[C,O]=b(((J=e.options.find(T=>{var B;return(T==null?void 0:T.value)===((B=e.value)==null?void 0:B[0])}))==null?void 0:J.id)||((j=e.options[0])==null?void 0:j.id)||""),[h,A]=b({}),[I,w]=b(M.DefaultStatus(e.componentId,t)),[R,K]=b({ok:!1,notice:[]}),N=ue(!1);F(()=>{o||(N.current?y(e.options):N.current=!0)},[p.Stringify((G=e.options)==null?void 0:G.map(T=>T.value))]),F(()=>{if(!v.length)return;let T=[...v],B=m({},h);T.forEach(k=>{(k==null?void 0:k.type)!="label"&&(B[p.Stringify(k==null?void 0:k.value)]=k)}),A(B)},[v]);let $={rootStates:e,val_options:v,set_options:y,val_optionFocused:C,set_optionFocused:O,val_optionsDict:h,set_optionsDict:A,val_optionsModified:o,set_optionsModified:a,val_preventOpenSelector:s,set_preventOpenSelector:d,val_openSelector:n,set_openSelector:S,val_activeInput:u,set_activeInput:c,val_keyword:i,set_keyword:f,val_status:I,set_status:w,val_validate:R,set_validate:K},Q=!!e.multiSelect;M.CommonEffects({type:Q?"autocomplete.multi":"autocomplete.single",states:e,val_status:I,set_status:w,val_validate:R,set_validate:K,SystemValidation:_e});let U=I.dataValue.length&&I.dataValue[0]!==null;return U=U||n||u,V(me,{val_status:I,set_status:w,val_validate:R,states:e,children:[l(ye,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:U}),l(L.Shallow,m({},$)),l(L.Button,m({},$))]})}},ne=e=>{let t=m({},e);return t=g(m({value:[],min:0,max:65535,multiSelect:!0,SearchInput:!0,emptySelect:!0,SelectorComponent:({option:s,isSelected:d,isFocused:o,addCallback:a})=>s?(s==null?void 0:s.type)=="label"?l(X,{children:s.label}):l(ae.Sub.S,{color:"cloud",backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["1/2",1.5],isActive:o,isActiveStyles:{backgroundColor:"cloud"},onClick:a,children:V(P.Left,{gap:"1/2",children:[d&&l(H.Check,{fontColor:"theme"}),l(q.Supplement,{transition:"short",children:s.label})]})}):null,SelectedComponent:({value:s,label:d,removeCallback:o})=>V(P.Left,{ssCardBox:"cloud",borderRadius:"2.tone.secondary",fontSize:"1.mini",padding:"1/2",gap:0,children:[l(E,{padding:[0,"1/4"],children:d}),l(ae.Clear,{flexSizing:"none",color:"nega",fontColor:"4.thin",tabIndex:-1,isRounded:!0,padding:"1/4",onClick:o,freeCSS:{lineHeight:1,aspectRatio:"1/1"},children:l(H.X,{})})]}),SelectorPosition:3},t),{freeCSS:m({cursor:"pointer"},t.freeCSS)}),t.multiSelect||(t.min=0,t.max=1),t.options=t.options||[],t.emptySelect&&(t.options=[{value:null,label:l(q.Supplement,{fontColor:"4.thin",children:"\u9078\u629E\u3092\u89E3\u9664"})},...t.options]),t.value=p.flatArray(t.value),t.options=z.InitOptions(t.options),p.is.nullish(t.rightIcon)&&(t.rightIcon=l(le,{children:l(H.Search,{})}),t.disabled&&(t.rightIcon=l(le,{fontColor:"5.translucent",children:l(H.Ban,{})}))),t.rightIcon&&(t=m({paddingRight:3},t)),t.leftIcon&&(t=m({paddingLeft:3},t)),l(fe,{componentId:t.componentId,children:L.Core,states:ve(t)})};export{ne as Autocomplete,ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as
|
|
1
|
+
import{e as i}from"../../chunk-C5N2D3ZX.js";import c,{useStore as t}from"jmini";const p=o=>i(void 0,null,function*(){let l={},r="form-process-"+o;if(t.get(r))return console.log("[CollectForm] already processing..."),{isValid:!1,data:{}};t.set({[r]:!0});let s=1;return yield c.pending(()=>{},200),yield c.scope(()=>i(void 0,null,function*(){let m=t.get(["form-data",o].join("-"));if(m){for(let[n,a]of Object.entries(m)){if(!a)continue;let e=t.get(a.componentId);e&&e.Refresh&&(yield e.Refresh())}{let n=t.get(["form-data",o].join("-"));if(!n)return;for(let[a,e]of Object.entries(n))e&&(s&=Number(e.validation),l[a]=e.value)}}})),t.set({[r]:!1}),{isValid:!!s,data:l}});export{p as CollectForm,p as default};
|
package/dist/fn/Input/Filer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as r,c as f,d as ee,e as j}from"../../chunk-C5N2D3ZX.js";import{Fragment as ie,jsx as a,jsxs as m}from"react/jsx-runtime";import{useState as H,useEffect as te}from"react";import q,{UUID as v,useStore as le}from"jmini";import{$$fromRoot as
|
|
1
|
+
import{b as r,c as f,d as ee,e as j}from"../../chunk-C5N2D3ZX.js";import{Fragment as ie,jsx as a,jsxs as m}from"react/jsx-runtime";import{useState as H,useEffect as te}from"react";import q,{UUID as v,useStore as le}from"jmini";import{$$fromRoot as D,ExtractStyles as pe}from"../../@utils";import{Box as S,FAI as R,Flex as P,Column as ae}from"../../atoms";import{Row as ue}from"../../mols";import{Button as L}from"../Button";import K from"../Snackbar";import{OptionalInputWrapper as me,BoxWrapper as de,CoreEffects as ne,DefaultBoxishStyles as ce}from"./core";import fe from"./TextField";import{InputFilerClasses as y}from"../../@styles/componentClasses";import{faCloudArrowUp as ge}from"@fortawesome/free-solid-svg-icons/faCloudArrowUp";function Se(e){let{value:t,states:o}=e,{required:d}=o,l=[];return d&&!t.length&&l.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!l.filter(({type:p})=>p=="invalid").length,notice:l}}const oe={List:e=>{let{rootStates:t,val_status:o,set_status:d}=e;if(t.useSystemOnly)return null;let l=t.limit-(o.dataValue||[]).length,p=(o.dataValue||[]).map((n,u)=>a(oe.ListCell,f(r({},e),{index:u,val_file:n}),n.name));return l>0&&p.push(a(S,f(r({htmlTag:"label"},t.cellStyles),{className:[t.cellClassName,y("AddButton")].join(" "),"data-component-id":o.componentId,htmlFor:t.id,tabIndex:t.tabIndex,onKeyDown:n=>{let{key:u}=n;t.tabIndex!=-1&&[" ","Enter"].includes(u)&&D("#"+t.id).click()},children:m(ue.Center,{padding:["1/3",0],children:[a(S,{isRounded:!0,className:y("AddIcon"),children:a(R,{icon:ge,className:y("Icon"),fontColor:"theme",fontSize:"4.thirdTitle",backgroundColor:"theme.opa.low",ssSphere:3,padding:"1/2"})}),m(S,{children:[m(S,{fontColor:"theme",fontSize:"2.normal",isSemiBoldFont:!0,children:["\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E(",l,")"]}),a(S,{fontColor:"4.thin",fontSize:"0.xs",isSemiBoldFont:!0,children:"\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7"})]})]})}),"AddButton")),a(ae,f(r({flexSizing:"auto"},pe(t)),{className:t.className,children:p}))},ListCell:e=>{let{index:t,rootStates:o,val_file:d,val_status:l,set_status:p}=e,{name:n,size:u,type:i}=d,[c,b]=H(!1),x=v(),X=u.rank(),[Z,W]=n.replace(/\s/g,"_").replace(/(.*)\.(.*)$/,"$1 $2").split(" "),s="\u30D5\u30A1\u30A4\u30EB";return i.match(/image/)?s=i.replace(/image\//,""):i.match(/pdf/)?s="PDF":i.match(/csv/)?s="CSV":i.match(/spreadsheet/)?s="SpreadSheet":i.match(/presentation/)?s="PowerPoint":i.match(/word/)?s="Word":i.match(/zip/)?s="Zip":i.match(/powerpoint/)?s="PowerPoint":i.match(/html/)?s="HTML":i.match(/js/)?s="JavaScript":i.match(/css/)?s="CSS":i.match(/text\/plain/)&&(s="\u30C6\u30AD\u30B9\u30C8"),te(()=>{c&&setTimeout(()=>{D("#"+x).focus()},100)},[c]),m(P,f(r({verticalAlign:"center",flexWrap:!1,gap:1,className:o.cellClassName},o.cellStyles),{children:[a(R.File,{fontSize:"4.thirdTitle",fontColor:"4.thin"}),m(S,{flexSizing:0,children:[a(S,{children:a(P,{verticalAlign:"center",gap:"2/3",flexWrap:!1,className:y("FileName"),children:c?a(ie,{children:m(ae,{flexSizing:0,gap:"1/2",children:[m(P,{gap:"2/3",verticalAlign:"center",children:[a(fe,{tone:"border",wrapStyles:{flexSizing:"auto"},restrict:"fileName",name:"name",required:!0,id:x,form:"form-"+x,enableFormSubmit:!0,value:Z,onKeyDown:F=>{let{key:w}=F;w=="Escape"&&b(!1)}}),m(S,{children:[". ",W]})]}),m(P,{gap:"2/3",horizontalAlign:"right",flexWrap:!1,children:[a(L.Sub.S,{padding:["2/3",1],onClick:()=>{b(!1)},children:"\u9589\u3058\u308B"}),a(L.Prime.S,{padding:["2/3",1],onFormSubmit:["form-"+x,F=>j(void 0,null,function*(){let{name:w}=F.body,T=[...l.dataValue],A=T[t],G=A.id;if(!A)return;let k=yield A.convert();k=String(k);let M=yield k.toBlob(d.type);if(!M)return;let $=new File([M],w+"."+W,{type:A.type});$.id=G,T[t]=$,p(O=>f(r({},O),{dataValue:T,eventType:"update",eventID:v()})),b(!1)})],children:"\u6C7A\u5B9A"})]})]})}):m(ie,{children:[n,!!o.isNameEditable&&a(L.Clear,{ssSphere:2.5,flexSizing:"none",fontColor:"4.thin",padding:"1/3",ssEffectsOnActive:"expand",color:"cloud",onClick:()=>{b(!0)},children:a(R.Pen,{})})]})})}),!c&&m(S,{fontSize:"1.mini",fontColor:"4.thin",flexSizing:0,children:[s,"\u30D5\u30A1\u30A4\u30EB / ",X,"B"]})]}),a(L.Sub,{color:"cloud",fontColor:"4.thin",ssSphere:3,onClick:()=>{let F=[...l.dataValue];F[t]&&(F.splice(t,1),p(T=>f(r({},T),{dataValue:F,eventType:"update",eventID:v()})))},children:a(R.X,{})})]}))}},ye=e=>{let Y=e,{tone:t,required:o,form:d,isNameEditable:l,useSystemOnly:p,accept:n="*",limit:u=1,checkValidationAtFirst:i,onChange:c,onValidate:b,onValidateDelay:x,onUpdateValue:X,onUpdateValidValue:Z,onUserAction:W,value:s=[],className:F,cellStyles:w,cellClassName:T,componentId:A,status_id:G,enableFormSubmit:k,freeCSS:M,wrapStyles:$}=Y,O=ee(Y,["tone","required","form","isNameEditable","useSystemOnly","accept","limit","checkValidationAtFirst","onChange","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","className","cellStyles","cellClassName","componentId","status_id","enableFormSubmit","freeCSS","wrapStyles"]),[B,N]=H(ne.DefaultStatus(e.componentId||"",s)),[Q,se]=H({ok:!1,notice:[]}),re={rootStates:e,val_status:B,set_status:N};te(()=>{le.set({["AddFiles-"+B.componentId]:I=>{N(_=>{let C=_.dataValue,V=[];for(var g=0;g<(I==null?void 0:I.length);g++){let h=I[g],{type:E,name:z}=h;if(g+1+C.length>u){K.add({componentId:z,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u9078\u629E\u4E0A\u9650\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${z}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}if(n&&n=="image"&&!E.match(/image/)){K.add({componentId:z,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u7570\u306A\u308B\u305F\u3081\u3001${z} \u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3002`,backgroundColor:"nega"});continue}V.push(h)}return f(r({},_),{dataValue:[...C,...V],eventType:"update",eventID:v()})})}})},[]),ne.CommonEffects({type:"file",states:e,val_status:B,set_status:N,val_validate:Q,set_validate:se,SystemValidation:Se});let U="";return n&&(n=="image"?U="image/png,image/jpeg":U=n),m(de,{val_status:B,set_status:N,val_validate:Q,states:e,children:[a(S,f(r({htmlTag:"input",type:"file",className:y("Input"),"data-component-id":B.componentId,accept:U,multiple:u!=1,onChange:I=>j(void 0,null,function*(){c&&c(I);let _=I.target,C=_.files,V=[];for(var g=0;g<(C==null?void 0:C.length);g++){if(!C[g])continue;let h=C[g].clone(),E=h.name;if(h.id=v(),g+1+B.dataValue.length>u){K.add({componentId:E,secondsToClose:12e3,children:`\u30D5\u30A1\u30A4\u30EB\u767B\u9332\u6570\u3092\u8D85\u3048\u305F\u305F\u3081\u3001${E}}\u306F\u8FFD\u52A0\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002`,backgroundColor:"nega"});continue}V.push(h)}N(h=>f(r({},h),{dataValue:[...h.dataValue,...V],eventType:"update",eventID:v()})),_.value=""})},O),{opacity:"low",tabIndex:-1,value:""})),a(oe.List,r({},re))]})},J=e=>(e=f(r({limit:1,isNameEditable:!0,useSystemOnly:!1,tone:"border",value:[]},e),{override:"force",cellStyles:r(r({},ce({tone:e.tone||"border"})),e.cellStyles)}),a(me,{componentId:e.componentId,children:ye,states:e}));J.fn={openDialog:e=>{let{multiple:t,accept:o}=e,d=v();const l=document.createElement("input");l.type="file",l.multiple=!!t,l.value="",l.id=d,o&&(o=="image"?l.accept="image/png,image/jpeg,image/jpg,image/webp":l.accept=o),q("body").append(l),l.onchange=p=>{var i;let n=((i=p==null?void 0:p.target)==null?void 0:i.files)||[];if(!(n!=null&&n.length))return;let u=[];for(let c=0;c<n.length;c++){let x=n[c].clone();u.push(x)}e.onChange(u),q("#"+d).remove()},l.click()}},typeof window!="undefined"&&window.document&&q(document).addEvent({eventType:"dragover",callback:e=>{e.preventDefault(),D("."+y("AddButton")).addClass(y("Draggable"))},options:{passive:!1}}).addEvent({eventType:"drop",callback:e=>{e.preventDefault(),D("."+y("AddButton")).removeClass(y("Draggable"));let t=e.dataTransfer.files;if(t.length){let o=e.target;if(D(o).hasClass(y("AddButton"))){let{componentId:d}=o.dataset,l=le.get("AddFiles-"+d);l&&l(t)}}},options:{passive:!1}});export{J as Filer,J as default};
|
package/dist/fn/Input/List.d.ts
CHANGED
|
@@ -59,14 +59,14 @@ declare namespace Radio {
|
|
|
59
59
|
type Input<T = List.Value> = List.Input<T>;
|
|
60
60
|
namespace Methods {
|
|
61
61
|
type Component = {
|
|
62
|
-
<T = List.Value>(p: List.Input<List.Value<T>>): JSX.Element;
|
|
62
|
+
<T = List.Value>(p: List.Input<List.Value<T>>): React.JSX.Element;
|
|
63
63
|
};
|
|
64
64
|
type FNs = {
|
|
65
|
-
Normal: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
66
|
-
Border: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
67
|
-
Cloud: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
68
|
-
Simple: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
69
|
-
Vivid: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
65
|
+
Normal: <T = List.Value>(p: List.Input<List.Value<T>>) => React.JSX.Element;
|
|
66
|
+
Border: <T = List.Value>(p: List.Input<List.Value<T>>) => React.JSX.Element;
|
|
67
|
+
Cloud: <T = List.Value>(p: List.Input<List.Value<T>>) => React.JSX.Element;
|
|
68
|
+
Simple: <T = List.Value>(p: List.Input<List.Value<T>>) => React.JSX.Element;
|
|
69
|
+
Vivid: <T = List.Value>(p: List.Input<List.Value<T>>) => React.JSX.Element;
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
type Methods = Methods.Component & Methods.FNs;
|
|
@@ -75,14 +75,14 @@ declare namespace Checkbox {
|
|
|
75
75
|
type Input<T = List.Value, O = T[]> = List.Input<T, O>;
|
|
76
76
|
namespace Methods {
|
|
77
77
|
type Component = {
|
|
78
|
-
<T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>): JSX.Element;
|
|
78
|
+
<T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>): React.JSX.Element;
|
|
79
79
|
};
|
|
80
80
|
type FNs = {
|
|
81
|
-
Normal: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
82
|
-
Border: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
83
|
-
Cloud: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
84
|
-
Simple: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
85
|
-
Vivid: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
81
|
+
Normal: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => React.JSX.Element;
|
|
82
|
+
Border: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => React.JSX.Element;
|
|
83
|
+
Cloud: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => React.JSX.Element;
|
|
84
|
+
Simple: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => React.JSX.Element;
|
|
85
|
+
Vivid: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => React.JSX.Element;
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
type Methods = Methods.Component & Methods.FNs;
|
package/dist/fn/Input/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as m,d as B}from"../../chunk-C5N2D3ZX.js";import{jsx as
|
|
1
|
+
import{b as o,c as m,d as B}from"../../chunk-C5N2D3ZX.js";import{jsx as i}from"react/jsx-runtime";import C,{UUID as w}from"jmini";import{useState as ae}from"react";import{$$fromRoot as ne,GenerateHTMLProps as se}from"../../@utils";import{Box as T,Flex as re,FAI as ce,Span as ue}from"../../atoms";import{Button as de}from"../Button";import{OptionalInputWrapper as me,BoxWrapper as pe,CoreEffects as M}from"./core";import{InputListClasses as b}from"../../@styles/componentClasses";function Ce(t){let{value:l,states:a}=t,{type:e,required:s,min:n,max:p}=a;n=n||0,p=p||65535;let c=[],y=l.length;return s&&(y||e=="radio"&&c.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),y<n&&c.push({type:"invalid",label:n+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),y>p&&c.push({type:"invalid",label:p+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!c.filter(({type:V})=>V=="invalid").length,notice:c}}const h={InitOptions:t=>{let l=[];return t.forEach(a=>{if(!a)return;let{label:e,value:s}=a;C.is.nullish(e)&&(e=String(s)),l.push(m(o({},a),{label:e,value:s}))}),l},OptionalListWrapper:t=>{let{value:l,options:a=[]}=t,e=C.is.exist(l)?C.flatArray(l):[],s=[];return e.forEach(n=>{a.findIndex(c=>C.is.equal(c.value,n))!=-1&&s.push(n)}),i(h.Core,m(o({},t),{value:s,options:a}))},Core:t=>{let S=t,{type:l,tone:a,required:e,componentId:s="",form:n,override:p,icon:c,iconType:y,iconSize:V,iconPosition:P,iconColor:v,CustomIcon:X,enableFormSubmit:A,checkValidationAtFirst:$,onValidate:U,onValidateDelay:R,onUpdateValue:W,onUpdateValidValue:H,onUserAction:q,value:f,options:K,className:j,cellStyles:G,cellClassName:Q,cellCheckedStyles:Y,cellCheckedClassName:Z,min:D,max:u,hideInput:N,freeCSS:x,wrapStyles:ee}=S,L=B(S,["type","tone","required","componentId","form","override","icon","iconType","iconSize","iconPosition","iconColor","CustomIcon","enableFormSubmit","checkValidationAtFirst","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","className","cellStyles","cellClassName","cellCheckedStyles","cellCheckedClassName","min","max","hideInput","freeCSS","wrapStyles"]),[k,O]=ae(M.DefaultStatus(s,f)),[_,E]=ae({ok:!1,notice:[]});return M.CommonEffects({type:"list."+l,states:t,val_status:k,set_status:O,val_validate:_,set_validate:E,SystemValidation:Ce}),i(pe,{val_status:k,set_status:O,val_validate:_,states:t,children:i(h.List,{rootStates:t,val_status:k,set_status:O})})},List:t=>{let{rootStates:l,val_status:a,set_status:e}=t,{componentId:s,type:n,tone:p,icon:c,iconSize:y,iconColor:V,isChecker:P,options:v,name:X,form:A,tabIndex:$,hideInput:U,disabled:R,className:W,cellStyles:H,cellClassName:q="",cellCheckedStyles:f,cellCheckedClassName:K="",enableFormSubmit:j}=l,{dataValue:G}=a,Q=l.CustomIcon,Y=v.map((Z,D)=>{let le=Z,{value:u,label:N,disabled:x,className:ee="",checkedStyles:L,checkedClassName:k="",freeCSS:O}=le,_=B(le,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS"]),E=w(),S=G.findIndex(r=>r===u||C.is.equal(r,u))!=-1,I=o(o({},H),_),z=[b("Label"),q,ee];S&&(I=m(o(o(o({},I),f),L),{freeCSS:o(o(o({},I==null?void 0:I.freeCSS),f==null?void 0:f.freeCSS),L==null?void 0:L.freeCSS)}),z=[...z,K,k]);const te=()=>{if(R||x)return;let r=[];if(n=="radio")r=[u];else if(n=="checkbox"||P)if(!S)r=[...a.dataValue,u];else{let d=[...a.dataValue];d.splice(a.dataValue.findIndex(F=>F==u),1),r=d}e(d=>m(o({},d),{dataValue:r,eventType:"update",eventID:w()}))};let oe=[i(ue,{position:"relative",freeCSS:{zIndex:2},flexSizing:0,children:C.is.string(N)?i(T,{children:N}):N},"content")];return c&&oe[l.iconPosition=="right"?"push":"unshift"](i(Q,{isChecked:S,iconSize:y,iconColor:V,toggle:te},"icon")),[i(T,{htmlTag:"input",type:n=="radio"?"radio":"checkbox",className:b("Input"),name:"RadioCheckbox-"+X,"data-list-index":s+"-"+D,id:E,value:String(u),disabled:R||x,checked:S,onFocus:r=>{x||n=="radio"&&(a.dataValue.length||e(d=>m(o({},d),{dataValue:[u],eventType:"update",eventID:w()})))},onChange:()=>{te()},onKeyDown:r=>{let{key:d,shiftKey:F}=r;if((n=="checkbox"||t.rootStates.isChecker)&&d!="Tab"){if(d.match(/Arrow/)){r.preventDefault();let ie=["ArrowLeft","ArrowUp"].includes(d)?-1:1,g=D+ie;g<0?g=v.length-1:g>=v.length&&(g=0),ne(`input[data-list-index="${s}-${g}"]`).focus()}}j&&M.SubmitForm(r,A)},tabIndex:$},"List-"+C.Stringify(u)),i(T,m(o({htmlTag:"label","data-disabled":R||x,htmlFor:E,className:z.join(" "),tabIndex:-1,display:"flex",verticalAlign:"center",flexWrap:!1},I),{children:oe}),"ListTrigger-"+C.Stringify(u))]});return i(re,{flexSizing:"auto",style:l.style,freeCSS:o({},l.freeCSS),className:[W,b("CellBase"),b("HideInput_"+U),b("IconIndicator_"+!!c),b("Tone_"+p)].join(" "),children:Y})},_Icon:t=>{let l=1.5;return t.iconSize=="small"?l=1.2:t.iconSize=="large"&&(l=2),i(de.Normal,{ssPushable:!0,color:"cloud",tabIndex:-1,ssEffectsOnActive:"ripple.cloud",ssSphere:2,freeCSS:{transform:`scale(${l})`},onClick:a=>{a.preventDefault(),a.stopPropagation(),t.toggle()},children:t.children})},RadioIcon:t=>i(h._Icon,m(o({type:"radio"},t),{children:i(T,{flexCenter:!0,isRounded:!0,border:t.isChecked?"0.trans":"3.thick",borderColor:t.isChecked?t.iconColor:"3.thick",position:"relative",transition:"middle",freeCSS:{width:"50%",height:"50%"},children:i(T,{position:"absolute",transition:"middle",isRounded:!0,backgroundColor:t.iconColor,opacity:t.isChecked?"max":"trans",freeCSS:{width:"60%",height:"60%",transform:t.isChecked?"scale(1)":"scale(.4)"}})})})),CheckboxIcon:t=>i(h._Icon,m(o({type:"checkbox"},t),{children:i(T,{flexCenter:!0,boxShadow:t.isChecked?"0.remark":"none",border:t.isChecked?"0.trans":"3.thick",backgroundColor:t.isChecked?t.iconColor:"trans",position:"relative",transition:"middle",fontColor:"white",freeCSS:{borderRadius:"25%",padding:"4%",width:"50%",height:"50%"},children:i(ce.Check,{transition:"middle",opacity:t.isChecked?"max":"trans",freeCSS:{zIndex:8,width:"100%",height:"100%",transform:t.isChecked?"scale(1)":"scale(.5)"}})})}))},J=t=>{t=t||"checkbox";const l=e=>(e=m(o({gap:1,icon:!0,iconSize:"regular",iconType:t=="radio"?"radio":"checkbox",iconPosition:"left",iconColor:"theme"},e),{type:t,cellStyles:o({gap:"1/6",position:"relative",borderRadius:"2.tone.secondary",transition:"middle"},e.cellStyles)}),e.CustomIcon||(e.iconType=="radio"?e.CustomIcon=h.RadioIcon:e.iconType=="checkbox"&&(e.CustomIcon=h.CheckboxIcon)),e.iconSize=="small"?e.cellStyles.gap=0:e.iconSize=="large"&&(e.cellStyles.gap="1/2"),e.tone=="normal"?(e.cellStyles=o({padding:["1/4",1],border:"1.thin",backgroundColor:"layer.1"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme",boxShadow:"1.normal"},e.cellCheckedStyles)):e.tone=="border"?(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.1",padding:["1/2",1,"1/2","1/2"]},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):e.tone=="cloud"&&(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.2",padding:["1/2",1,"1/2","1/2"]},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud",fontColor:"theme"},e.cellCheckedStyles)),e=se(e),e.options=h.InitOptions(e.options),i(me,{componentId:e.componentId,children:h.OptionalListWrapper,states:e})),a=l;return a.Normal=e=>i(l,o({type:t,tone:"normal",icon:!1},e)),a.Border=e=>i(l,o({type:t,tone:"border"},e)),a.Cloud=e=>i(l,o({type:t,tone:"cloud"},e)),a.Vivid=e=>i(l,o({type:t,tone:"normal",icon:!1,cellCheckedStyles:{backgroundColor:"theme",fontColor:"white"}},e)),a.Simple=e=>i(l,o({type:t,tone:"plain",icon:!1,cellCheckedStyles:{fontColor:"theme"}},e)),a},he=J("radio"),Se=J("checkbox"),ye=J();export{Se as Checkbox,ye as List,he as Radio};
|
|
@@ -3,7 +3,7 @@ import { Autocomplete } from './Autocomplete';
|
|
|
3
3
|
declare namespace Search {
|
|
4
4
|
type Input<T = Autocomplete.Value> = Autocomplete.Input<T>;
|
|
5
5
|
type Component = {
|
|
6
|
-
<T = Autocomplete.Value>(p: Input<Autocomplete.Value<T>>): JSX.Element;
|
|
6
|
+
<T = Autocomplete.Value>(p: Input<Autocomplete.Value<T>>): React.JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
declare const Search: Search.Component;
|
package/dist/fn/Input/Search.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t}from"../../chunk-C5N2D3ZX.js";import{Fragment as
|
|
1
|
+
import{b as t}from"../../chunk-C5N2D3ZX.js";import{Fragment as r,jsx as e}from"react/jsx-runtime";import{FAI as l}from"../../atoms";import{Autocomplete as m}from"./Autocomplete";import{RightIcon as c}from".";const o=p=>e(m,t({multiSelect:!1,SelectedComponent:({value:u,label:n})=>e(r,{children:n}),rightIcon:e(c,{children:e(l.AngleDown,{})})},p));export{o as Search,o as default};
|