powell-react 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/index.d.mts +564 -0
- package/dist/index.mjs +932 -0
- package/dist/index.mjs.map +1 -0
- package/dist/powell/styles/global.scss +1460 -0
- package/dist/powell/themes/arya-blue.css +1 -0
- package/dist/powell/themes/arya-green.css +1 -0
- package/dist/powell/themes/arya-orange.css +1 -0
- package/dist/powell/themes/arya-purple.css +1 -0
- package/dist/powell/themes/bootstrap4-dark-blue.css +1 -0
- package/dist/powell/themes/bootstrap4-dark-purple.css +1 -0
- package/dist/powell/themes/bootstrap4-light-blue.css +1 -0
- package/dist/powell/themes/bootstrap4-light-purple.css +1 -0
- package/dist/powell/themes/fluent-light.css +1 -0
- package/dist/powell/themes/lara-dark-amber.css +1 -0
- package/dist/powell/themes/lara-dark-blue.css +1 -0
- package/dist/powell/themes/lara-dark-cyan.css +1 -0
- package/dist/powell/themes/lara-dark-green.css +1 -0
- package/dist/powell/themes/lara-dark-indigo.css +1 -0
- package/dist/powell/themes/lara-dark-pink.css +1 -0
- package/dist/powell/themes/lara-dark-purple.css +1 -0
- package/dist/powell/themes/lara-dark-teal.css +1 -0
- package/dist/powell/themes/lara-light-amber.css +1 -0
- package/dist/powell/themes/lara-light-blue.css +1 -0
- package/dist/powell/themes/lara-light-cyan.css +1 -0
- package/dist/powell/themes/lara-light-green.css +1 -0
- package/dist/powell/themes/lara-light-indigo.css +1 -0
- package/dist/powell/themes/lara-light-pink.css +1 -0
- package/dist/powell/themes/lara-light-purple.css +1 -0
- package/dist/powell/themes/lara-light-teal.css +1 -0
- package/dist/powell/themes/luna-amber.css +1 -0
- package/dist/powell/themes/luna-blue.css +1 -0
- package/dist/powell/themes/luna-green.css +1 -0
- package/dist/powell/themes/luna-pink.css +1 -0
- package/dist/powell/themes/md-dark-deeppurple.css +1 -0
- package/dist/powell/themes/md-dark-indigo.css +1 -0
- package/dist/powell/themes/md-light-deeppurple.css +1 -0
- package/dist/powell/themes/md-light-indigo.css +1 -0
- package/dist/powell/themes/mdc-dark-deeppurple.css +1 -0
- package/dist/powell/themes/mdc-dark-indigo.css +1 -0
- package/dist/powell/themes/mdc-light-deeppurple.css +1 -0
- package/dist/powell/themes/mdc-light-indigo.css +1 -0
- package/dist/powell/themes/mira.css +1 -0
- package/dist/powell/themes/nano.css +1 -0
- package/dist/powell/themes/nova-accent.css +1 -0
- package/dist/powell/themes/nova-alt.css +1 -0
- package/dist/powell/themes/nova.css +1 -0
- package/dist/powell/themes/rhea.css +1 -0
- package/dist/powell/themes/saga-blue.css +1 -0
- package/dist/powell/themes/saga-green.css +1 -0
- package/dist/powell/themes/saga-orange.css +1 -0
- package/dist/powell/themes/saga-purple.css +1 -0
- package/dist/powell/themes/soho-dark.css +1 -0
- package/dist/powell/themes/soho-light.css +1 -0
- package/dist/powell/themes/tailwind-light.css +1 -0
- package/dist/powell/themes/vela-blue.css +1 -0
- package/dist/powell/themes/vela-green.css +1 -0
- package/dist/powell/themes/vela-orange.css +1 -0
- package/dist/powell/themes/vela-purple.css +1 -0
- package/dist/powell/themes/viva-dark.css +1 -0
- package/dist/powell/themes/viva-light.css +1 -0
- package/package.json +48 -63
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/types/src/components/Button/Button.d.ts +0 -6
- package/dist/cjs/types/src/components/Button/index.d.ts +0 -1
- package/dist/cjs/types/src/components/index.d.ts +0 -1
- package/dist/cjs/types/src/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/api/PowellProvider.d.ts +0 -5
- package/dist/cjs/types/src/powell/api/configService.d.ts +0 -2
- package/dist/cjs/types/src/powell/api/forms.d.ts +0 -73
- package/dist/cjs/types/src/powell/api/index.d.ts +0 -5
- package/dist/cjs/types/src/powell/api/powellDefaults.d.ts +0 -2
- package/dist/cjs/types/src/powell/api/primereact.d.ts +0 -968
- package/dist/cjs/types/src/powell/components/AutoComplete/AutoComplete.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/AutoComplete/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Button/Button.d.ts +0 -22
- package/dist/cjs/types/src/powell/components/Button/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/CascadeSelect/CascadeSelect.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/CascadeSelect/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Checkbox/Checkbox.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/Checkbox/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Chips/Chips.d.ts +0 -23
- package/dist/cjs/types/src/powell/components/Chips/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/ColorPicker/ColorPicker.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/ColorPicker/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Dropdown/Dropdown.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/Dropdown/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Editor/Editor.d.ts +0 -23
- package/dist/cjs/types/src/powell/components/Editor/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/FormContainer/FormContainer.d.ts +0 -7
- package/dist/cjs/types/src/powell/components/FormContainer/FormContext.d.ts +0 -4
- package/dist/cjs/types/src/powell/components/FormContainer/index.d.ts +0 -2
- package/dist/cjs/types/src/powell/components/InputMask/InputMask.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/InputMask/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputNumber/InputNumber.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/InputNumber/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputOtp/InputOtp.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/InputOtp/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputPassword/InputPassword.d.ts +0 -23
- package/dist/cjs/types/src/powell/components/InputPassword/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputSwitch/InputSwitch.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/InputSwitch/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputText/InputText.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/InputText/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/InputTextarea/InputTextarea.d.ts +0 -23
- package/dist/cjs/types/src/powell/components/InputTextarea/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Knob/Knob.d.ts +0 -20
- package/dist/cjs/types/src/powell/components/Knob/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/ListBox/ListBox.d.ts +0 -20
- package/dist/cjs/types/src/powell/components/ListBox/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Mention/Mention.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/Mention/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/MultiSelect/MultiSelect.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/MultiSelect/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +0 -20
- package/dist/cjs/types/src/powell/components/MultiStateCheckbox/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/RadioGroup/RadioGroup.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/RadioGroup/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Rating/Rating.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/Rating/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/SelectButton/SelectButton.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/SelectButton/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/Slider/Slider.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/Slider/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/ToggleButton/ToggleButton.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/ToggleButton/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/TreeSelect/TreeSelect.d.ts +0 -24
- package/dist/cjs/types/src/powell/components/TreeSelect/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/components/TriStateCheckbox/TriStateCheckbox.d.ts +0 -21
- package/dist/cjs/types/src/powell/components/TriStateCheckbox/index.d.ts +0 -1
- package/dist/cjs/types/src/powell/hooks/index.d.ts +0 -3
- package/dist/cjs/types/src/powell/hooks/useApplyConfig.d.ts +0 -17
- package/dist/cjs/types/src/powell/hooks/useFormContext.d.ts +0 -2
- package/dist/cjs/types/src/powell/hooks/usePowellConfig.d.ts +0 -2
- package/dist/cjs/types/src/powell/index.d.ts +0 -28
- package/dist/cjs/types/src/powell/models/common.d.ts +0 -7
- package/dist/cjs/types/src/powell/models/config.d.ts +0 -13
- package/dist/cjs/types/src/powell/models/forms.d.ts +0 -28
- package/dist/cjs/types/src/powell/models/index.d.ts +0 -3
- package/dist/cjs/types/src/powell/utils/globalState.d.ts +0 -19
- package/dist/cjs/types/src/powell/utils/index.d.ts +0 -2
- package/dist/cjs/types/src/powell/utils/utilsService.d.ts +0 -8
- package/dist/cjs/types/vite.config.d.ts +0 -2
- package/dist/esm/index.js +0 -1
- package/dist/esm/types/src/components/Button/Button.d.ts +0 -6
- package/dist/esm/types/src/components/Button/index.d.ts +0 -1
- package/dist/esm/types/src/components/index.d.ts +0 -1
- package/dist/esm/types/src/index.d.ts +0 -1
- package/dist/esm/types/src/powell/api/PowellProvider.d.ts +0 -5
- package/dist/esm/types/src/powell/api/configService.d.ts +0 -2
- package/dist/esm/types/src/powell/api/forms.d.ts +0 -73
- package/dist/esm/types/src/powell/api/index.d.ts +0 -5
- package/dist/esm/types/src/powell/api/powellDefaults.d.ts +0 -2
- package/dist/esm/types/src/powell/api/primereact.d.ts +0 -968
- package/dist/esm/types/src/powell/components/AutoComplete/AutoComplete.d.ts +0 -24
- package/dist/esm/types/src/powell/components/AutoComplete/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Button/Button.d.ts +0 -22
- package/dist/esm/types/src/powell/components/Button/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/CascadeSelect/CascadeSelect.d.ts +0 -24
- package/dist/esm/types/src/powell/components/CascadeSelect/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Checkbox/Checkbox.d.ts +0 -21
- package/dist/esm/types/src/powell/components/Checkbox/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Chips/Chips.d.ts +0 -23
- package/dist/esm/types/src/powell/components/Chips/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/ColorPicker/ColorPicker.d.ts +0 -24
- package/dist/esm/types/src/powell/components/ColorPicker/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Dropdown/Dropdown.d.ts +0 -24
- package/dist/esm/types/src/powell/components/Dropdown/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Editor/Editor.d.ts +0 -23
- package/dist/esm/types/src/powell/components/Editor/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/FormContainer/FormContainer.d.ts +0 -7
- package/dist/esm/types/src/powell/components/FormContainer/FormContext.d.ts +0 -4
- package/dist/esm/types/src/powell/components/FormContainer/index.d.ts +0 -2
- package/dist/esm/types/src/powell/components/InputMask/InputMask.d.ts +0 -24
- package/dist/esm/types/src/powell/components/InputMask/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputNumber/InputNumber.d.ts +0 -24
- package/dist/esm/types/src/powell/components/InputNumber/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputOtp/InputOtp.d.ts +0 -21
- package/dist/esm/types/src/powell/components/InputOtp/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputPassword/InputPassword.d.ts +0 -23
- package/dist/esm/types/src/powell/components/InputPassword/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputSwitch/InputSwitch.d.ts +0 -21
- package/dist/esm/types/src/powell/components/InputSwitch/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputText/InputText.d.ts +0 -24
- package/dist/esm/types/src/powell/components/InputText/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/InputTextarea/InputTextarea.d.ts +0 -23
- package/dist/esm/types/src/powell/components/InputTextarea/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Knob/Knob.d.ts +0 -20
- package/dist/esm/types/src/powell/components/Knob/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/ListBox/ListBox.d.ts +0 -20
- package/dist/esm/types/src/powell/components/ListBox/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Mention/Mention.d.ts +0 -24
- package/dist/esm/types/src/powell/components/Mention/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/MultiSelect/MultiSelect.d.ts +0 -24
- package/dist/esm/types/src/powell/components/MultiSelect/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +0 -20
- package/dist/esm/types/src/powell/components/MultiStateCheckbox/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/RadioGroup/RadioGroup.d.ts +0 -24
- package/dist/esm/types/src/powell/components/RadioGroup/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Rating/Rating.d.ts +0 -21
- package/dist/esm/types/src/powell/components/Rating/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/SelectButton/SelectButton.d.ts +0 -21
- package/dist/esm/types/src/powell/components/SelectButton/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/Slider/Slider.d.ts +0 -21
- package/dist/esm/types/src/powell/components/Slider/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/ToggleButton/ToggleButton.d.ts +0 -21
- package/dist/esm/types/src/powell/components/ToggleButton/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/TreeSelect/TreeSelect.d.ts +0 -24
- package/dist/esm/types/src/powell/components/TreeSelect/index.d.ts +0 -1
- package/dist/esm/types/src/powell/components/TriStateCheckbox/TriStateCheckbox.d.ts +0 -21
- package/dist/esm/types/src/powell/components/TriStateCheckbox/index.d.ts +0 -1
- package/dist/esm/types/src/powell/hooks/index.d.ts +0 -3
- package/dist/esm/types/src/powell/hooks/useApplyConfig.d.ts +0 -17
- package/dist/esm/types/src/powell/hooks/useFormContext.d.ts +0 -2
- package/dist/esm/types/src/powell/hooks/usePowellConfig.d.ts +0 -2
- package/dist/esm/types/src/powell/index.d.ts +0 -28
- package/dist/esm/types/src/powell/models/common.d.ts +0 -7
- package/dist/esm/types/src/powell/models/config.d.ts +0 -13
- package/dist/esm/types/src/powell/models/forms.d.ts +0 -28
- package/dist/esm/types/src/powell/models/index.d.ts +0 -3
- package/dist/esm/types/src/powell/utils/globalState.d.ts +0 -19
- package/dist/esm/types/src/powell/utils/index.d.ts +0 -2
- package/dist/esm/types/src/powell/utils/utilsService.d.ts +0 -8
- package/dist/esm/types/vite.config.d.ts +0 -2
package/dist/index.mjs
ADDED
@@ -0,0 +1,932 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4
|
+
|
5
|
+
// src/powell/components/Button/Button.tsx
|
6
|
+
import { useRef as useRef4, useState as useState2 } from "react";
|
7
|
+
|
8
|
+
// src/powell/utils/globalState.ts
|
9
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
10
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" || typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
11
|
+
var equ = (a, b) => a === b;
|
12
|
+
var FR = {};
|
13
|
+
function useComparator(v, c = equ) {
|
14
|
+
const f = useRef(FR);
|
15
|
+
let nv = f.current;
|
16
|
+
useIsomorphicLayoutEffect(() => {
|
17
|
+
f.current = nv;
|
18
|
+
});
|
19
|
+
if (f.current === FR || !c(v, f.current)) {
|
20
|
+
nv = v;
|
21
|
+
}
|
22
|
+
return nv;
|
23
|
+
}
|
24
|
+
function globalState(initialValue, options) {
|
25
|
+
let sb = [];
|
26
|
+
let v = initialValue;
|
27
|
+
function set(newValue, callback) {
|
28
|
+
const pv = v;
|
29
|
+
v = newValue instanceof Function ? newValue(v) : newValue;
|
30
|
+
setTimeout(() => {
|
31
|
+
sb.forEach((c) => c(v, pv));
|
32
|
+
callback?.(v, pv);
|
33
|
+
options?.onSet?.(v, pv);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
function subscribe(subscriber) {
|
37
|
+
sb.push(subscriber);
|
38
|
+
return () => {
|
39
|
+
sb = sb.filter((f) => f !== subscriber);
|
40
|
+
};
|
41
|
+
}
|
42
|
+
function useSubscription(subscriber) {
|
43
|
+
useIsomorphicLayoutEffect(() => subscribe(subscriber), [subscriber]);
|
44
|
+
}
|
45
|
+
function use() {
|
46
|
+
const [l, s] = useState(v);
|
47
|
+
useSubscription(s);
|
48
|
+
return [l, set];
|
49
|
+
}
|
50
|
+
function useSelector(selector, comparator = equ) {
|
51
|
+
const [rv] = use();
|
52
|
+
return useComparator(selector(rv), comparator);
|
53
|
+
}
|
54
|
+
return {
|
55
|
+
use,
|
56
|
+
useSelector,
|
57
|
+
useValue: () => use()[0],
|
58
|
+
get: () => v,
|
59
|
+
set,
|
60
|
+
reset: () => set(initialValue),
|
61
|
+
subscribe
|
62
|
+
};
|
63
|
+
}
|
64
|
+
|
65
|
+
// src/powell/api/configService.ts
|
66
|
+
var configService = globalState({});
|
67
|
+
|
68
|
+
// src/powell/api/forms.ts
|
69
|
+
import {
|
70
|
+
connect,
|
71
|
+
ErrorMessage,
|
72
|
+
FastField,
|
73
|
+
Field,
|
74
|
+
FieldArray,
|
75
|
+
Form,
|
76
|
+
Formik,
|
77
|
+
FormikConsumer,
|
78
|
+
FormikContext,
|
79
|
+
FormikProvider,
|
80
|
+
getActiveElement,
|
81
|
+
getIn,
|
82
|
+
insert,
|
83
|
+
isEmptyArray,
|
84
|
+
isEmptyChildren,
|
85
|
+
isFunction,
|
86
|
+
isInputEvent,
|
87
|
+
isInteger,
|
88
|
+
isNaN,
|
89
|
+
isObject,
|
90
|
+
isPromise,
|
91
|
+
isString,
|
92
|
+
move,
|
93
|
+
prepareDataForValidation,
|
94
|
+
replace,
|
95
|
+
setIn,
|
96
|
+
setNestedObjectValues,
|
97
|
+
swap,
|
98
|
+
useField,
|
99
|
+
useFormik,
|
100
|
+
useFormikContext,
|
101
|
+
validateYupSchema,
|
102
|
+
withFormik,
|
103
|
+
yupToFormErrors
|
104
|
+
} from "formik";
|
105
|
+
import * as Yup from "yup";
|
106
|
+
|
107
|
+
// src/powell/api/powellDefaults.ts
|
108
|
+
var powellDefaults = {
|
109
|
+
theme: "lara-light-cyan",
|
110
|
+
rtl: false,
|
111
|
+
showRequiredStar: true,
|
112
|
+
ripple: true,
|
113
|
+
inputSize: "medium",
|
114
|
+
inputStyle: "outlined",
|
115
|
+
labelPosition: "top",
|
116
|
+
fixLabelPosition: "side",
|
117
|
+
injectDirectionToRoot: false
|
118
|
+
};
|
119
|
+
|
120
|
+
// src/powell/components/Toast/Toast.tsx
|
121
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
122
|
+
|
123
|
+
// src/powell/api/overlayEmitter.ts
|
124
|
+
var OverlayEmitter = class {
|
125
|
+
constructor() {
|
126
|
+
__publicField(this, "listeners", {});
|
127
|
+
}
|
128
|
+
on(event, listener) {
|
129
|
+
if (!this.listeners[event]) {
|
130
|
+
this.listeners[event] = [];
|
131
|
+
}
|
132
|
+
this.listeners[event].push(listener);
|
133
|
+
}
|
134
|
+
emit(event, data) {
|
135
|
+
if (this.listeners[event]) {
|
136
|
+
this.listeners[event].forEach((listener) => listener(data));
|
137
|
+
}
|
138
|
+
}
|
139
|
+
off(event, listener) {
|
140
|
+
if (!this.listeners[event]) return;
|
141
|
+
this.listeners[event] = this.listeners[event].filter((l) => l !== listener);
|
142
|
+
}
|
143
|
+
};
|
144
|
+
var overlayEmitter = new OverlayEmitter();
|
145
|
+
|
146
|
+
// src/powell/components/Toast/Toast.tsx
|
147
|
+
import { jsx } from "react/jsx-runtime";
|
148
|
+
var Toast2 = (prop) => {
|
149
|
+
const toast = useRef2(null);
|
150
|
+
const isRendered = useRef2(false);
|
151
|
+
useEffect2(() => {
|
152
|
+
if (isRendered.current) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
isRendered.current = true;
|
156
|
+
overlayEmitter.on("toast", (options) => {
|
157
|
+
toast.current?.show(options);
|
158
|
+
});
|
159
|
+
}, []);
|
160
|
+
return /* @__PURE__ */ jsx(Toast, { ...prop, ref: toast });
|
161
|
+
};
|
162
|
+
|
163
|
+
// src/powell/hooks/usePowellConfig.ts
|
164
|
+
import { useContext } from "react";
|
165
|
+
var usePowellConfig = () => {
|
166
|
+
const [powellConfig, setPowellConfig] = configService.use();
|
167
|
+
const {
|
168
|
+
setPt,
|
169
|
+
setFilterMatchModeOptions,
|
170
|
+
setLocale,
|
171
|
+
setNonce,
|
172
|
+
setHideOverlaysOnDocumentScrolling,
|
173
|
+
setRipple,
|
174
|
+
setCssTransition,
|
175
|
+
setStyleContainer,
|
176
|
+
setInputStyle,
|
177
|
+
setNullSortOrder,
|
178
|
+
setZIndex,
|
179
|
+
setAutoZIndex,
|
180
|
+
setAppendTo,
|
181
|
+
changeTheme,
|
182
|
+
...restPrimeConfig
|
183
|
+
} = useContext(PrimeReactContext);
|
184
|
+
const configAction = {
|
185
|
+
pt: setPt,
|
186
|
+
filterMatchModeOptions: setFilterMatchModeOptions,
|
187
|
+
locale: setLocale,
|
188
|
+
nonce: setNonce,
|
189
|
+
hideOverlaysOnDocumentScrolling: setHideOverlaysOnDocumentScrolling,
|
190
|
+
ripple: setRipple,
|
191
|
+
cssTransition: setCssTransition,
|
192
|
+
styleContainer: setStyleContainer,
|
193
|
+
inputStyle: setInputStyle,
|
194
|
+
nullSortOrder: setNullSortOrder,
|
195
|
+
zIndex: setZIndex,
|
196
|
+
autoZIndex: setAutoZIndex,
|
197
|
+
appendTo: setAppendTo,
|
198
|
+
theme: (v) => changeTheme?.(powellConfig.theme, v.theme, "powell-theme-link")
|
199
|
+
};
|
200
|
+
const updateConfig = (c) => {
|
201
|
+
for (const key in c) {
|
202
|
+
if (key in configAction) {
|
203
|
+
configAction[key]?.(c);
|
204
|
+
}
|
205
|
+
applyConfigToDom({ ...c, injectDirectionToRoot: powellConfig.injectDirectionToRoot });
|
206
|
+
setPowellConfig((prev) => ({ ...prev, ...c }));
|
207
|
+
}
|
208
|
+
};
|
209
|
+
return [{ ...powellConfig, ...restPrimeConfig }, updateConfig];
|
210
|
+
};
|
211
|
+
var applyConfigToDom = (config) => {
|
212
|
+
handleBodyClasses(config);
|
213
|
+
if ("rtl" in config && config.injectDirectionToRoot) {
|
214
|
+
document.documentElement.setAttribute("dir", config.rtl ? "rtl" : "ltr");
|
215
|
+
} else {
|
216
|
+
document.documentElement.removeAttribute("dir");
|
217
|
+
}
|
218
|
+
};
|
219
|
+
var kebabCase = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
220
|
+
var handleBodyClasses = (config) => {
|
221
|
+
const specialBodyClassRules = {
|
222
|
+
ripple: [
|
223
|
+
{
|
224
|
+
condition: (v) => v === false,
|
225
|
+
className: "p-ripple-disabled"
|
226
|
+
}
|
227
|
+
],
|
228
|
+
inputStyle: [
|
229
|
+
{
|
230
|
+
condition: (v) => v === "filled",
|
231
|
+
className: "p-input-filled"
|
232
|
+
}
|
233
|
+
]
|
234
|
+
};
|
235
|
+
for (const key in config) {
|
236
|
+
const value = config[key];
|
237
|
+
if (value === void 0) continue;
|
238
|
+
const rules = specialBodyClassRules[key];
|
239
|
+
if (rules && rules.length) {
|
240
|
+
for (const rule of rules) {
|
241
|
+
const shouldApply = rule.condition(value);
|
242
|
+
document.body.classList.toggle(rule.className, shouldApply);
|
243
|
+
}
|
244
|
+
} else {
|
245
|
+
const prefix = `powell-${kebabCase(key)}-`;
|
246
|
+
document.body.classList.forEach((cls) => {
|
247
|
+
if (cls.startsWith(prefix)) {
|
248
|
+
document.body.classList.remove(cls);
|
249
|
+
}
|
250
|
+
});
|
251
|
+
const finalValue = typeof value === "boolean" ? value ? "enabled" : "disabled" : value;
|
252
|
+
document.body.classList.add(`${prefix}${finalValue}`);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
};
|
256
|
+
|
257
|
+
// src/powell/hooks/useApplyConfig.ts
|
258
|
+
var splitProps = (props, groups) => {
|
259
|
+
const result = {};
|
260
|
+
const rest = {};
|
261
|
+
const assigned = {};
|
262
|
+
const restEligible = {};
|
263
|
+
for (const groupName in groups) {
|
264
|
+
for (const descriptor of groups[groupName]) {
|
265
|
+
const key = typeof descriptor === "string" ? descriptor : descriptor.key;
|
266
|
+
const alias = typeof descriptor === "string" ? void 0 : descriptor.alias;
|
267
|
+
const defaultValue = typeof descriptor === "string" ? void 0 : descriptor.defaultValue;
|
268
|
+
const keepInRest = typeof descriptor === "string" ? false : descriptor.keepInRest ?? false;
|
269
|
+
if (!result[groupName]) {
|
270
|
+
result[groupName] = {};
|
271
|
+
}
|
272
|
+
const value = key in props ? props[key] : typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
273
|
+
result[groupName][alias ?? key] = value;
|
274
|
+
assigned[key] = true;
|
275
|
+
if (keepInRest) {
|
276
|
+
restEligible[key] = true;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
}
|
280
|
+
for (const key in props) {
|
281
|
+
const typedKey = key;
|
282
|
+
if (!assigned[typedKey] || restEligible[typedKey]) {
|
283
|
+
rest[typedKey] = props[typedKey];
|
284
|
+
}
|
285
|
+
}
|
286
|
+
result.rest = rest;
|
287
|
+
return result;
|
288
|
+
};
|
289
|
+
var useApplyConfig = (props, options) => {
|
290
|
+
const [config] = usePowellConfig();
|
291
|
+
const { sizable = true, isFixLabel = false, groups = {} } = options;
|
292
|
+
const result = {
|
293
|
+
...props,
|
294
|
+
rtl: props.rtl ?? config.rtl,
|
295
|
+
showRequiredStar: props.showRequiredStar ?? config.showRequiredStar,
|
296
|
+
labelPosition: props.labelPosition ?? (isFixLabel ? config.fixLabelPosition : config.labelPosition),
|
297
|
+
..."variant" in props ? { variant: props.variant ?? config.inputStyle } : {}
|
298
|
+
};
|
299
|
+
if (sizable) {
|
300
|
+
result.inputSize = props.inputSize ?? config.inputSize;
|
301
|
+
}
|
302
|
+
return splitProps(result, groups);
|
303
|
+
};
|
304
|
+
|
305
|
+
// src/powell/hooks/useFormContext.ts
|
306
|
+
import { useContext as useContext2 } from "react";
|
307
|
+
|
308
|
+
// src/powell/components/FormContainer/FormContainer.tsx
|
309
|
+
import { forwardRef, useEffect as useEffect3, useRef as useRef3 } from "react";
|
310
|
+
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
311
|
+
var FormContent = (props) => {
|
312
|
+
const { children, onInit } = props;
|
313
|
+
const formikContext = useSafeFormikContext();
|
314
|
+
const initialized = useRef3(false);
|
315
|
+
useEffect3(() => {
|
316
|
+
if (!initialized.current) {
|
317
|
+
onInit?.(formikContext);
|
318
|
+
initialized.current = true;
|
319
|
+
}
|
320
|
+
}, [formikContext, onInit]);
|
321
|
+
return /* @__PURE__ */ jsx2(Fragment, { children });
|
322
|
+
};
|
323
|
+
var FormContainer = forwardRef((props, ref) => {
|
324
|
+
const { children, onInit, className, ...rest } = props;
|
325
|
+
return /* @__PURE__ */ jsx2(Formik, { ...rest, children: (context) => /* @__PURE__ */ jsx2(FormProvider, { ...rest, children: /* @__PURE__ */ jsx2(Form, { ref, className, children: /* @__PURE__ */ jsx2(FormContent, { onInit, children: typeof children === "function" ? children(context) : children }) }) }) });
|
326
|
+
});
|
327
|
+
|
328
|
+
// src/powell/components/FormContainer/FormContext.tsx
|
329
|
+
import { createContext } from "react";
|
330
|
+
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
331
|
+
var FormContext = createContext(void 0);
|
332
|
+
var FormProvider = (props) => {
|
333
|
+
const { children, ...rest } = props;
|
334
|
+
return /* @__PURE__ */ jsx3(FormContext.Provider, { value: rest, children: /* @__PURE__ */ jsx3(Fragment2, { children }) });
|
335
|
+
};
|
336
|
+
|
337
|
+
// src/powell/hooks/useFormContext.ts
|
338
|
+
var useFormContext = () => {
|
339
|
+
const context = useContext2(FormContext);
|
340
|
+
const formikContext = useSafeFormikContext();
|
341
|
+
if (!context || !formikContext) {
|
342
|
+
return null;
|
343
|
+
}
|
344
|
+
return { ...context, ...formikContext };
|
345
|
+
};
|
346
|
+
function useSafeFormikContext() {
|
347
|
+
const context = useContext2(FormikContext);
|
348
|
+
try {
|
349
|
+
if (context) {
|
350
|
+
return useFormikContext();
|
351
|
+
}
|
352
|
+
return void 0;
|
353
|
+
} catch {
|
354
|
+
return void 0;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
358
|
+
// src/powell/api/PowellProvider.tsx
|
359
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
360
|
+
var createThemeLink = () => {
|
361
|
+
const headEl = document.head;
|
362
|
+
const linkEl = document.createElement("link");
|
363
|
+
linkEl.rel = "stylesheet";
|
364
|
+
linkEl.type = "text/css";
|
365
|
+
linkEl.id = "powell-theme-link";
|
366
|
+
headEl.appendChild(linkEl);
|
367
|
+
return linkEl;
|
368
|
+
};
|
369
|
+
var applyTheme = (theme) => {
|
370
|
+
let themeEl = document.getElementById("powell-theme-link");
|
371
|
+
if (!themeEl) {
|
372
|
+
themeEl = createThemeLink();
|
373
|
+
}
|
374
|
+
const basePath = new URL("./themes/", import.meta.url).toString();
|
375
|
+
themeEl.setAttribute("href", `${basePath}${theme}`);
|
376
|
+
};
|
377
|
+
var PowellProvider = (props) => {
|
378
|
+
const { children, config } = props;
|
379
|
+
const defaultConfig = {
|
380
|
+
...powellDefaults,
|
381
|
+
...config
|
382
|
+
};
|
383
|
+
configService.set(defaultConfig);
|
384
|
+
applyConfigToDom(defaultConfig);
|
385
|
+
applyTheme(defaultConfig.theme);
|
386
|
+
return /* @__PURE__ */ jsxs(PrimeReactProvider, { value: defaultConfig, children: [
|
387
|
+
/* @__PURE__ */ jsx4(Toast2, {}),
|
388
|
+
/* @__PURE__ */ jsx4(ConfirmDialog, {}),
|
389
|
+
/* @__PURE__ */ jsx4(ConfirmPopup, {}),
|
390
|
+
children
|
391
|
+
] });
|
392
|
+
};
|
393
|
+
|
394
|
+
// src/powell/api/primereact.ts
|
395
|
+
import {
|
396
|
+
AutoComplete
|
397
|
+
} from "primereact/autocomplete";
|
398
|
+
import {
|
399
|
+
Calendar
|
400
|
+
} from "primereact/calendar";
|
401
|
+
import {
|
402
|
+
CascadeSelect
|
403
|
+
} from "primereact/cascadeselect";
|
404
|
+
import {
|
405
|
+
Checkbox
|
406
|
+
} from "primereact/checkbox";
|
407
|
+
import {
|
408
|
+
Chips
|
409
|
+
} from "primereact/chips";
|
410
|
+
import {
|
411
|
+
ColorPicker
|
412
|
+
} from "primereact/colorpicker";
|
413
|
+
import {
|
414
|
+
Dropdown
|
415
|
+
} from "primereact/dropdown";
|
416
|
+
import {
|
417
|
+
Editor
|
418
|
+
} from "primereact/editor";
|
419
|
+
import {
|
420
|
+
FloatLabel
|
421
|
+
} from "primereact/floatlabel";
|
422
|
+
import {
|
423
|
+
InputIcon
|
424
|
+
} from "primereact/inputicon";
|
425
|
+
import {
|
426
|
+
IconField
|
427
|
+
} from "primereact/iconfield";
|
428
|
+
import { InputMask } from "primereact/inputmask";
|
429
|
+
import {
|
430
|
+
InputSwitch
|
431
|
+
} from "primereact/inputswitch";
|
432
|
+
import {
|
433
|
+
InputNumber
|
434
|
+
} from "primereact/inputnumber";
|
435
|
+
import {
|
436
|
+
InputOtp
|
437
|
+
} from "primereact/inputotp";
|
438
|
+
import {
|
439
|
+
InputText
|
440
|
+
} from "primereact/inputtext";
|
441
|
+
import {
|
442
|
+
InputTextarea
|
443
|
+
} from "primereact/inputtextarea";
|
444
|
+
import {
|
445
|
+
Knob
|
446
|
+
} from "primereact/knob";
|
447
|
+
import {
|
448
|
+
ListBox
|
449
|
+
} from "primereact/listbox";
|
450
|
+
import {
|
451
|
+
Mention
|
452
|
+
} from "primereact/mention";
|
453
|
+
import {
|
454
|
+
MultiSelect
|
455
|
+
} from "primereact/multiselect";
|
456
|
+
import {
|
457
|
+
MultiStateCheckbox
|
458
|
+
} from "primereact/multistatecheckbox";
|
459
|
+
import {
|
460
|
+
Password
|
461
|
+
} from "primereact/password";
|
462
|
+
import {
|
463
|
+
RadioButton
|
464
|
+
} from "primereact/radiobutton";
|
465
|
+
import {
|
466
|
+
Rating
|
467
|
+
} from "primereact/rating";
|
468
|
+
import {
|
469
|
+
SelectButton
|
470
|
+
} from "primereact/selectbutton";
|
471
|
+
import {
|
472
|
+
Slider
|
473
|
+
} from "primereact/slider";
|
474
|
+
import {
|
475
|
+
TreeSelect
|
476
|
+
} from "primereact/treeselect";
|
477
|
+
import {
|
478
|
+
TriStateCheckbox
|
479
|
+
} from "primereact/tristatecheckbox";
|
480
|
+
import {
|
481
|
+
ToggleButton
|
482
|
+
} from "primereact/togglebutton";
|
483
|
+
import {
|
484
|
+
Button
|
485
|
+
} from "primereact/button";
|
486
|
+
import {
|
487
|
+
SpeedDial
|
488
|
+
} from "primereact/speeddial";
|
489
|
+
import {
|
490
|
+
SplitButton
|
491
|
+
} from "primereact/splitbutton";
|
492
|
+
import {
|
493
|
+
DataTable
|
494
|
+
} from "primereact/datatable";
|
495
|
+
import {
|
496
|
+
DataView,
|
497
|
+
DataViewLayoutOptions
|
498
|
+
} from "primereact/dataview";
|
499
|
+
import {
|
500
|
+
DataScroller
|
501
|
+
} from "primereact/datascroller";
|
502
|
+
import {
|
503
|
+
OrderList
|
504
|
+
} from "primereact/orderlist";
|
505
|
+
import {
|
506
|
+
OrganizationChart
|
507
|
+
} from "primereact/organizationchart";
|
508
|
+
import {
|
509
|
+
Paginator
|
510
|
+
} from "primereact/paginator";
|
511
|
+
import {
|
512
|
+
PickList
|
513
|
+
} from "primereact/picklist";
|
514
|
+
import {
|
515
|
+
Tree
|
516
|
+
} from "primereact/tree";
|
517
|
+
import {
|
518
|
+
TreeTable
|
519
|
+
} from "primereact/treetable";
|
520
|
+
import {
|
521
|
+
Timeline
|
522
|
+
} from "primereact/timeline";
|
523
|
+
import {
|
524
|
+
VirtualScroller
|
525
|
+
} from "primereact/virtualscroller";
|
526
|
+
import {
|
527
|
+
Accordion,
|
528
|
+
AccordionTab
|
529
|
+
} from "primereact/accordion";
|
530
|
+
import {
|
531
|
+
Card
|
532
|
+
} from "primereact/card";
|
533
|
+
import {
|
534
|
+
DeferredContent
|
535
|
+
} from "primereact/deferredcontent";
|
536
|
+
import {
|
537
|
+
Divider
|
538
|
+
} from "primereact/divider";
|
539
|
+
import {
|
540
|
+
Fieldset
|
541
|
+
} from "primereact/fieldset";
|
542
|
+
import {
|
543
|
+
Panel
|
544
|
+
} from "primereact/panel";
|
545
|
+
import {
|
546
|
+
ScrollPanel
|
547
|
+
} from "primereact/scrollpanel";
|
548
|
+
import {
|
549
|
+
Splitter,
|
550
|
+
SplitterPanel
|
551
|
+
} from "primereact/splitter";
|
552
|
+
import {
|
553
|
+
Stepper
|
554
|
+
} from "primereact/stepper";
|
555
|
+
import {
|
556
|
+
TabView,
|
557
|
+
TabPanel
|
558
|
+
} from "primereact/tabview";
|
559
|
+
import {
|
560
|
+
Toolbar
|
561
|
+
} from "primereact/toolbar";
|
562
|
+
import {
|
563
|
+
ConfirmDialog,
|
564
|
+
confirmDialog
|
565
|
+
} from "primereact/confirmdialog";
|
566
|
+
import {
|
567
|
+
ConfirmPopup,
|
568
|
+
confirmPopup
|
569
|
+
} from "primereact/confirmpopup";
|
570
|
+
import {
|
571
|
+
Dialog
|
572
|
+
} from "primereact/dialog";
|
573
|
+
import {
|
574
|
+
OverlayPanel
|
575
|
+
} from "primereact/overlaypanel";
|
576
|
+
import {
|
577
|
+
Sidebar
|
578
|
+
} from "primereact/sidebar";
|
579
|
+
import {
|
580
|
+
Tooltip
|
581
|
+
} from "primereact/tooltip";
|
582
|
+
import {
|
583
|
+
FileUpload
|
584
|
+
} from "primereact/fileupload";
|
585
|
+
import {
|
586
|
+
BreadCrumb
|
587
|
+
} from "primereact/breadcrumb";
|
588
|
+
import {
|
589
|
+
ContextMenu
|
590
|
+
} from "primereact/contextmenu";
|
591
|
+
import {
|
592
|
+
Dock
|
593
|
+
} from "primereact/dock";
|
594
|
+
import {
|
595
|
+
MegaMenu
|
596
|
+
} from "primereact/megamenu";
|
597
|
+
import {
|
598
|
+
Menu
|
599
|
+
} from "primereact/menu";
|
600
|
+
import {
|
601
|
+
Menubar
|
602
|
+
} from "primereact/menubar";
|
603
|
+
import {
|
604
|
+
PanelMenu
|
605
|
+
} from "primereact/panelmenu";
|
606
|
+
import {
|
607
|
+
Steps
|
608
|
+
} from "primereact/steps";
|
609
|
+
import {
|
610
|
+
TabMenu
|
611
|
+
} from "primereact/tabmenu";
|
612
|
+
import {
|
613
|
+
TieredMenu
|
614
|
+
} from "primereact/tieredmenu";
|
615
|
+
import {
|
616
|
+
Message
|
617
|
+
} from "primereact/message";
|
618
|
+
import {
|
619
|
+
Messages
|
620
|
+
} from "primereact/messages";
|
621
|
+
import {
|
622
|
+
Toast
|
623
|
+
} from "primereact/toast";
|
624
|
+
import {
|
625
|
+
Carousel
|
626
|
+
} from "primereact/carousel";
|
627
|
+
import {
|
628
|
+
Galleria
|
629
|
+
} from "primereact/galleria";
|
630
|
+
import {
|
631
|
+
Image
|
632
|
+
} from "primereact/image";
|
633
|
+
import {
|
634
|
+
Avatar
|
635
|
+
} from "primereact/avatar";
|
636
|
+
import {
|
637
|
+
Badge
|
638
|
+
} from "primereact/badge";
|
639
|
+
import {
|
640
|
+
BlockUI
|
641
|
+
} from "primereact/blockui";
|
642
|
+
import {
|
643
|
+
Chip
|
644
|
+
} from "primereact/chip";
|
645
|
+
import {
|
646
|
+
Inplace,
|
647
|
+
InplaceContent,
|
648
|
+
InplaceDisplay
|
649
|
+
} from "primereact/inplace";
|
650
|
+
import {
|
651
|
+
MeterGroup
|
652
|
+
} from "primereact/metergroup";
|
653
|
+
import {
|
654
|
+
ScrollTop
|
655
|
+
} from "primereact/scrolltop";
|
656
|
+
import {
|
657
|
+
Skeleton
|
658
|
+
} from "primereact/skeleton";
|
659
|
+
import {
|
660
|
+
ProgressBar
|
661
|
+
} from "primereact/progressbar";
|
662
|
+
import {
|
663
|
+
ProgressSpinner
|
664
|
+
} from "primereact/progressspinner";
|
665
|
+
import {
|
666
|
+
Ripple
|
667
|
+
} from "primereact/ripple";
|
668
|
+
import { StyleClass } from "primereact/styleclass";
|
669
|
+
import { Tag } from "primereact/tag";
|
670
|
+
import {
|
671
|
+
Terminal
|
672
|
+
} from "primereact/terminal";
|
673
|
+
import {
|
674
|
+
addLocale,
|
675
|
+
locale,
|
676
|
+
localeOption,
|
677
|
+
localeOptions,
|
678
|
+
PrimeReactContext,
|
679
|
+
PrimeReactProvider,
|
680
|
+
updateLocaleOption,
|
681
|
+
updateLocaleOptions,
|
682
|
+
FilterMatchMode,
|
683
|
+
FilterOperator,
|
684
|
+
FilterService,
|
685
|
+
ariaLabel,
|
686
|
+
PrimeIcons,
|
687
|
+
MessageSeverity
|
688
|
+
} from "primereact/api";
|
689
|
+
import {
|
690
|
+
classNames,
|
691
|
+
UniqueComponentId,
|
692
|
+
DomHandler,
|
693
|
+
mask,
|
694
|
+
EventBus,
|
695
|
+
IconUtils,
|
696
|
+
ObjectUtils,
|
697
|
+
ZIndexUtils,
|
698
|
+
mergeProps
|
699
|
+
} from "primereact/utils";
|
700
|
+
|
701
|
+
// src/powell/components/Button/Button.tsx
|
702
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
703
|
+
var Button2 = (props) => {
|
704
|
+
const {
|
705
|
+
async,
|
706
|
+
onClickAsync,
|
707
|
+
onClick,
|
708
|
+
nextLabel,
|
709
|
+
nextIcon,
|
710
|
+
nextRaised,
|
711
|
+
nextSeverity,
|
712
|
+
nextAppearance,
|
713
|
+
state = "default",
|
714
|
+
onStateChange,
|
715
|
+
type = "button",
|
716
|
+
...rest
|
717
|
+
} = props;
|
718
|
+
const [_state, _setState] = useState2(state);
|
719
|
+
const getButtonTempProps = (newState) => {
|
720
|
+
return {
|
721
|
+
label: newState === "default" ? rest.label : nextLabel ?? rest.label,
|
722
|
+
icon: newState === "default" ? rest.icon : nextIcon ?? rest.icon,
|
723
|
+
appearance: newState === "default" ? rest.appearance : nextAppearance ?? rest.appearance,
|
724
|
+
raised: newState === "default" ? rest.raised : nextRaised ?? rest.raised,
|
725
|
+
severity: newState === "default" ? rest.severity : nextSeverity ?? rest.severity
|
726
|
+
};
|
727
|
+
};
|
728
|
+
const tempProps = useRef4(getButtonTempProps(state));
|
729
|
+
const handleClick = (event) => {
|
730
|
+
if (async) {
|
731
|
+
onClickAsync?.({ event, loadingCallback: removeLoading });
|
732
|
+
_setState("loading");
|
733
|
+
onStateChange?.("loading");
|
734
|
+
} else {
|
735
|
+
onClick?.(event);
|
736
|
+
}
|
737
|
+
};
|
738
|
+
const removeLoading = (toggleState) => {
|
739
|
+
const newState = toggleState ? "next" : "default";
|
740
|
+
tempProps.current = getButtonTempProps(newState);
|
741
|
+
_setState(newState);
|
742
|
+
onStateChange?.(newState);
|
743
|
+
};
|
744
|
+
return /* @__PURE__ */ jsx5(
|
745
|
+
Button,
|
746
|
+
{
|
747
|
+
type,
|
748
|
+
...rest,
|
749
|
+
onClick: handleClick,
|
750
|
+
label: async ? tempProps.current.label : rest.label,
|
751
|
+
icon: async ? tempProps.current.icon : rest.icon,
|
752
|
+
severity: async ? tempProps.current.severity : rest.severity,
|
753
|
+
raised: async ? tempProps.current.raised : rest.raised,
|
754
|
+
text: async ? tempProps.current.appearance === "text" : rest.appearance === "text",
|
755
|
+
outlined: async ? tempProps.current.appearance === "outlined" : rest.appearance === "outlined",
|
756
|
+
link: async ? tempProps.current.appearance === "link" : rest.appearance === "link",
|
757
|
+
loading: _state === "loading",
|
758
|
+
className: classNames(rest.className, `state-${_state}`)
|
759
|
+
}
|
760
|
+
);
|
761
|
+
};
|
762
|
+
export {
|
763
|
+
Accordion as $Accordion,
|
764
|
+
AccordionTab as $AccordionTab,
|
765
|
+
AutoComplete as $AutoComplete,
|
766
|
+
Avatar as $Avatar,
|
767
|
+
Badge as $Badge,
|
768
|
+
BlockUI as $BlockUI,
|
769
|
+
BreadCrumb as $BreadCrumb,
|
770
|
+
Button as $Button,
|
771
|
+
Calendar as $Calendar,
|
772
|
+
Card as $Card,
|
773
|
+
Carousel as $Carousel,
|
774
|
+
CascadeSelect as $CascadeSelect,
|
775
|
+
Checkbox as $Checkbox,
|
776
|
+
Chip as $Chip,
|
777
|
+
Chips as $Chips,
|
778
|
+
ColorPicker as $ColorPicker,
|
779
|
+
ConfirmDialog as $ConfirmDialog,
|
780
|
+
ConfirmPopup as $ConfirmPopup,
|
781
|
+
ContextMenu as $ContextMenu,
|
782
|
+
DataScroller as $DataScroller,
|
783
|
+
DataTable as $DataTable,
|
784
|
+
DataView as $DataView,
|
785
|
+
DataViewLayoutOptions as $DataViewLayoutOptions,
|
786
|
+
DeferredContent as $DeferredContent,
|
787
|
+
Dialog as $Dialog,
|
788
|
+
Divider as $Divider,
|
789
|
+
Dock as $Dock,
|
790
|
+
DomHandler as $DomHandler,
|
791
|
+
Dropdown as $Dropdown,
|
792
|
+
Editor as $Editor,
|
793
|
+
ErrorMessage as $ErrorMessage,
|
794
|
+
EventBus as $EventBus,
|
795
|
+
FastField as $FastField,
|
796
|
+
Field as $Field,
|
797
|
+
FieldArray as $FieldArray,
|
798
|
+
Fieldset as $Fieldset,
|
799
|
+
FileUpload as $FileUpload,
|
800
|
+
FilterMatchMode as $FilterMatchMode,
|
801
|
+
FilterOperator as $FilterOperator,
|
802
|
+
FilterService as $FilterService,
|
803
|
+
FloatLabel as $FloatLabel,
|
804
|
+
Form as $Form,
|
805
|
+
Formik as $Formik,
|
806
|
+
FormikConsumer as $FormikConsumer,
|
807
|
+
FormikContext as $FormikContext,
|
808
|
+
FormikProvider as $FormikProvider,
|
809
|
+
Galleria as $Galleria,
|
810
|
+
IconField as $IconField,
|
811
|
+
IconUtils as $IconUtils,
|
812
|
+
Image as $Image,
|
813
|
+
Inplace as $Inplace,
|
814
|
+
InplaceContent as $InplaceContent,
|
815
|
+
InplaceDisplay as $InplaceDisplay,
|
816
|
+
InputIcon as $InputIcon,
|
817
|
+
InputMask as $InputMask,
|
818
|
+
InputNumber as $InputNumber,
|
819
|
+
InputOtp as $InputOtp,
|
820
|
+
InputSwitch as $InputSwitch,
|
821
|
+
InputText as $InputText,
|
822
|
+
InputTextarea as $InputTextarea,
|
823
|
+
Knob as $Knob,
|
824
|
+
ListBox as $ListBox,
|
825
|
+
MegaMenu as $MegaMenu,
|
826
|
+
Mention as $Mention,
|
827
|
+
Menu as $Menu,
|
828
|
+
Menubar as $Menubar,
|
829
|
+
Message as $Message,
|
830
|
+
MessageSeverity as $MessageSeverity,
|
831
|
+
Messages as $Messages,
|
832
|
+
MeterGroup as $MeterGroup,
|
833
|
+
MultiSelect as $MultiSelect,
|
834
|
+
MultiStateCheckbox as $MultiStateCheckbox,
|
835
|
+
ObjectUtils as $ObjectUtils,
|
836
|
+
OrderList as $OrderList,
|
837
|
+
OrganizationChart as $OrganizationChart,
|
838
|
+
OverlayPanel as $OverlayPanel,
|
839
|
+
Paginator as $Paginator,
|
840
|
+
Panel as $Panel,
|
841
|
+
PanelMenu as $PanelMenu,
|
842
|
+
Password as $Password,
|
843
|
+
PickList as $PickList,
|
844
|
+
PrimeIcons as $PrimeIcons,
|
845
|
+
PrimeReactContext as $PrimeReactContext,
|
846
|
+
PrimeReactProvider as $PrimeReactProvider,
|
847
|
+
ProgressBar as $ProgressBar,
|
848
|
+
ProgressSpinner as $ProgressSpinner,
|
849
|
+
RadioButton as $RadioButton,
|
850
|
+
Rating as $Rating,
|
851
|
+
Ripple as $Ripple,
|
852
|
+
ScrollPanel as $ScrollPanel,
|
853
|
+
ScrollTop as $ScrollTop,
|
854
|
+
SelectButton as $SelectButton,
|
855
|
+
Sidebar as $Sidebar,
|
856
|
+
Skeleton as $Skeleton,
|
857
|
+
Slider as $Slider,
|
858
|
+
SpeedDial as $SpeedDial,
|
859
|
+
SplitButton as $SplitButton,
|
860
|
+
Splitter as $Splitter,
|
861
|
+
SplitterPanel as $SplitterPanel,
|
862
|
+
Stepper as $Stepper,
|
863
|
+
Steps as $Steps,
|
864
|
+
StyleClass as $StyleClass,
|
865
|
+
TabMenu as $TabMenu,
|
866
|
+
TabPanel as $TabPanel,
|
867
|
+
TabView as $TabView,
|
868
|
+
Tag as $Tag,
|
869
|
+
Terminal as $Terminal,
|
870
|
+
TieredMenu as $TieredMenu,
|
871
|
+
Timeline as $Timeline,
|
872
|
+
Toast as $Toast,
|
873
|
+
ToggleButton as $ToggleButton,
|
874
|
+
Toolbar as $Toolbar,
|
875
|
+
Tooltip as $Tooltip,
|
876
|
+
Tree as $Tree,
|
877
|
+
TreeSelect as $TreeSelect,
|
878
|
+
TreeTable as $TreeTable,
|
879
|
+
TriStateCheckbox as $TriStateCheckbox,
|
880
|
+
UniqueComponentId as $UniqueComponentId,
|
881
|
+
VirtualScroller as $VirtualScroller,
|
882
|
+
Yup as $Yup,
|
883
|
+
ZIndexUtils as $ZIndexUtils,
|
884
|
+
addLocale as $addLocale,
|
885
|
+
ariaLabel as $ariaLabel,
|
886
|
+
classNames as $classNames,
|
887
|
+
confirmDialog as $confirmDialog,
|
888
|
+
confirmPopup as $confirmPopup,
|
889
|
+
connect as $connect,
|
890
|
+
getActiveElement as $getActiveElement,
|
891
|
+
getIn as $getIn,
|
892
|
+
insert as $insert,
|
893
|
+
isEmptyArray as $isEmptyArray,
|
894
|
+
isEmptyChildren as $isEmptyChildren,
|
895
|
+
isFunction as $isFunction,
|
896
|
+
isInputEvent as $isInputEvent,
|
897
|
+
isInteger as $isInteger,
|
898
|
+
isNaN as $isNaN,
|
899
|
+
isObject as $isObject,
|
900
|
+
isPromise as $isPromise,
|
901
|
+
isString as $isString,
|
902
|
+
locale as $locale,
|
903
|
+
localeOption as $localeOption,
|
904
|
+
localeOptions as $localeOptions,
|
905
|
+
mask as $mask,
|
906
|
+
mergeProps as $mergeProps,
|
907
|
+
move as $move,
|
908
|
+
prepareDataForValidation as $prepareDataForValidation,
|
909
|
+
replace as $replace,
|
910
|
+
setIn as $setIn,
|
911
|
+
setNestedObjectValues as $setNestedObjectValues,
|
912
|
+
swap as $swap,
|
913
|
+
updateLocaleOption as $updateLocaleOption,
|
914
|
+
updateLocaleOptions as $updateLocaleOptions,
|
915
|
+
useField as $useField,
|
916
|
+
useFormik as $useFormik,
|
917
|
+
useFormikContext as $useFormikContext,
|
918
|
+
validateYupSchema as $validateYupSchema,
|
919
|
+
withFormik as $withFormik,
|
920
|
+
yupToFormErrors as $yupToFormErrors,
|
921
|
+
Button2 as Button,
|
922
|
+
PowellProvider,
|
923
|
+
applyConfigToDom,
|
924
|
+
configService,
|
925
|
+
globalState,
|
926
|
+
powellDefaults,
|
927
|
+
useApplyConfig,
|
928
|
+
useFormContext,
|
929
|
+
usePowellConfig,
|
930
|
+
useSafeFormikContext
|
931
|
+
};
|
932
|
+
//# sourceMappingURL=index.mjs.map
|