@mpfrontend/primitives 0.1.0 → 1.1.0
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/dist/index.d.ts +0 -11
- package/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +12 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
export type ButtonState = 'default' | 'disabled' | 'loading' | 'restricted';
|
|
2
2
|
export type FieldState = 'default' | 'disabled' | 'readonly' | 'error';
|
|
3
|
-
export declare function buttonState(input: Readonly<{
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
loading?: boolean;
|
|
6
|
-
restricted?: boolean;
|
|
7
|
-
}>): ButtonState;
|
|
8
|
-
export declare function fieldState(input: Readonly<{
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
readOnly?: boolean;
|
|
11
|
-
invalid?: boolean;
|
|
12
|
-
}>): FieldState;
|
|
13
|
-
export declare function isControlUnavailable(state: ButtonState): boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
if (input.restricted)
|
|
3
|
-
return 'restricted';
|
|
4
|
-
if (input.loading)
|
|
5
|
-
return 'loading';
|
|
6
|
-
if (input.disabled)
|
|
7
|
-
return 'disabled';
|
|
8
|
-
return 'default';
|
|
9
|
-
}
|
|
10
|
-
export function fieldState(input) {
|
|
11
|
-
if (input.disabled)
|
|
12
|
-
return 'disabled';
|
|
13
|
-
if (input.readOnly)
|
|
14
|
-
return 'readonly';
|
|
15
|
-
if (input.invalid)
|
|
16
|
-
return 'error';
|
|
17
|
-
return 'default';
|
|
18
|
-
}
|
|
19
|
-
export function isControlUnavailable(state) {
|
|
20
|
-
return state !== 'default';
|
|
21
|
-
}
|
|
1
|
+
export {};
|
|
22
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ButtonState, FieldState } from './index.js';
|
|
2
|
+
export declare function buttonState(input: Readonly<{
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
restricted?: boolean;
|
|
6
|
+
}>): ButtonState;
|
|
7
|
+
export declare function fieldState(input: Readonly<{
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
}>): FieldState;
|
|
12
|
+
export declare function isControlUnavailable(state: ButtonState): boolean;
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function buttonState(input) {
|
|
2
|
+
if (input.restricted)
|
|
3
|
+
return 'restricted';
|
|
4
|
+
if (input.loading)
|
|
5
|
+
return 'loading';
|
|
6
|
+
if (input.disabled)
|
|
7
|
+
return 'disabled';
|
|
8
|
+
return 'default';
|
|
9
|
+
}
|
|
10
|
+
export function fieldState(input) {
|
|
11
|
+
if (input.disabled)
|
|
12
|
+
return 'disabled';
|
|
13
|
+
if (input.readOnly)
|
|
14
|
+
return 'readonly';
|
|
15
|
+
if (input.invalid)
|
|
16
|
+
return 'error';
|
|
17
|
+
return 'default';
|
|
18
|
+
}
|
|
19
|
+
export function isControlUnavailable(state) {
|
|
20
|
+
return state !== 'default';
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,WAAW,CAAC,KAA8E;IACxG,IAAI,KAAK,CAAC,UAAU;QAAE,OAAO,YAAY,CAAC;IAC1C,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IACpC,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,UAAU,CAAC;IACtC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAA4E;IACrG,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,UAAU,CAAC;IACtC,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,UAAU,CAAC;IACtC,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAkB;IACrD,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpfrontend/primitives",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./internal": {
|
|
19
|
+
"types": "./dist/internal.d.ts",
|
|
20
|
+
"import": "./dist/internal.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"files": [
|