@pepperi-addons/ngx-lib-react 0.0.2 → 0.0.3

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/pep-menu.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ declare type PepStyleType = 'weak' | 'regular' | 'strong';
3
+ declare type PepSizeType = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
+ export declare type PepMenuType = 'action' | 'select' | 'action-select';
5
+ export interface PepMenuItem {
6
+ [key: string]: any;
7
+ }
8
+ export interface PepMenuProps extends React.HTMLAttributes<HTMLElement> {
9
+ text?: string;
10
+ iconName?: string;
11
+ iconPosition?: 'before' | 'after';
12
+ type?: PepMenuType;
13
+ styleType?: PepStyleType;
14
+ sizeType?: PepSizeType;
15
+ classNames?: string;
16
+ xPosition?: 'before' | 'after';
17
+ hideOnEmptyItems?: boolean;
18
+ items?: PepMenuItem[];
19
+ selectedItem?: PepMenuItem | null;
20
+ disabled?: boolean;
21
+ onStateChange?: (e: any) => void;
22
+ onMenuItemClick?: (e: any) => void;
23
+ onMenuClick?: () => void;
24
+ }
25
+ export declare const PepMenu: React.FC<PepMenuProps>;
26
+ export {};
package/pep-menu.js ADDED
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepMenu = ({ text, iconName, iconPosition, type, styleType, sizeType, classNames, xPosition, hideOnEmptyItems, items, selectedItem, disabled, onStateChange, onMenuItemClick, onMenuClick, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ const el = ref.current;
7
+ if (!el)
8
+ return;
9
+ if (typeof classNames !== 'undefined')
10
+ el.classNames = classNames;
11
+ if (typeof hideOnEmptyItems !== 'undefined')
12
+ el.hideOnEmptyItems = !!hideOnEmptyItems;
13
+ if (typeof items !== 'undefined')
14
+ el.items = items;
15
+ if (typeof selectedItem !== 'undefined')
16
+ el.selectedItem = selectedItem;
17
+ if (typeof disabled !== 'undefined')
18
+ el.disabled = !!disabled;
19
+ if (typeof styleType !== 'undefined')
20
+ el.styleType = styleType;
21
+ if (typeof sizeType !== 'undefined')
22
+ el.sizeType = sizeType;
23
+ if (typeof type !== 'undefined')
24
+ el.type = type;
25
+ if (typeof iconName !== 'undefined')
26
+ el.iconName = iconName;
27
+ if (typeof iconPosition !== 'undefined')
28
+ el.iconPosition = iconPosition;
29
+ if (typeof xPosition !== 'undefined')
30
+ el.xPosition = xPosition;
31
+ if (typeof text !== 'undefined')
32
+ el.text = text;
33
+ }, [classNames, hideOnEmptyItems, items, selectedItem, disabled, styleType, sizeType, type, iconName, iconPosition, xPosition, text]);
34
+ useEffect(() => {
35
+ const el = ref.current;
36
+ if (!el)
37
+ return;
38
+ const handlers = [];
39
+ if (onStateChange)
40
+ handlers.push(['stateChange', (e) => { var _a; return onStateChange((_a = e.detail) !== null && _a !== void 0 ? _a : e); }]);
41
+ if (onMenuItemClick)
42
+ handlers.push(['menuItemClick', (e) => { var _a; return onMenuItemClick((_a = e.detail) !== null && _a !== void 0 ? _a : e); }]);
43
+ if (onMenuClick)
44
+ handlers.push(['menuClick', () => onMenuClick()]);
45
+ handlers.forEach(([n, h]) => el.addEventListener(n, h));
46
+ return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
47
+ }, [onStateChange, onMenuItemClick, onMenuClick]);
48
+ return (_jsx("pep-menu", { ref: ref, className: className, text: text, "icon-name": iconName, "icon-position": iconPosition, type: type, "style-type": styleType, "size-type": sizeType, "x-position": xPosition, ...rest }));
49
+ };
50
+ //# sourceMappingURL=pep-menu.js.map
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ declare type PepStyleType = 'weak' | 'regular' | 'strong';
3
+ export declare type PepQuantitySelectorFieldType = 'qs' | 'package';
4
+ export interface IPepFieldClickEvent {
5
+ key?: string;
6
+ value?: any;
7
+ controlType?: string;
8
+ eventWhich?: number;
9
+ otherData?: any;
10
+ }
11
+ export interface PepQuantitySelectorProps extends React.HTMLAttributes<HTMLElement> {
12
+ keyProp?: string;
13
+ value?: string;
14
+ label?: string;
15
+ type?: PepQuantitySelectorFieldType;
16
+ mandatory?: boolean;
17
+ disabled?: boolean;
18
+ readonly?: boolean;
19
+ textColor?: string;
20
+ xAlignment?: any;
21
+ rowSpan?: number;
22
+ allowDecimal?: boolean;
23
+ minFractionDigits?: number;
24
+ maxFractionDigits?: number;
25
+ additionalValue?: string;
26
+ notificationInfo?: any;
27
+ isInFocus?: boolean;
28
+ styleType?: PepStyleType;
29
+ onValueChange?: (value: string) => void;
30
+ onElementClick?: (e: IPepFieldClickEvent) => void;
31
+ onValidationChange?: (isValid: boolean) => void;
32
+ }
33
+ export declare const PepQuantitySelector: React.FC<PepQuantitySelectorProps>;
34
+ export {};
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepQuantitySelector = ({ keyProp, value, label, type, mandatory, disabled, readonly, textColor, xAlignment, rowSpan, allowDecimal, minFractionDigits, maxFractionDigits, additionalValue, notificationInfo, isInFocus, styleType, onValueChange, onElementClick, onValidationChange, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ const el = ref.current;
7
+ if (!el)
8
+ return;
9
+ if (typeof keyProp !== 'undefined')
10
+ el.key = keyProp;
11
+ if (typeof mandatory !== 'undefined')
12
+ el.mandatory = !!mandatory;
13
+ if (typeof disabled !== 'undefined')
14
+ el.disabled = !!disabled;
15
+ if (typeof readonly !== 'undefined')
16
+ el.readonly = !!readonly;
17
+ if (typeof textColor !== 'undefined')
18
+ el.textColor = textColor;
19
+ if (typeof xAlignment !== 'undefined')
20
+ el.xAlignment = xAlignment;
21
+ if (typeof rowSpan !== 'undefined')
22
+ el.rowSpan = rowSpan;
23
+ if (typeof allowDecimal !== 'undefined')
24
+ el.allowDecimal = !!allowDecimal;
25
+ if (typeof minFractionDigits !== 'undefined')
26
+ el.minFractionDigits = minFractionDigits;
27
+ if (typeof maxFractionDigits !== 'undefined')
28
+ el.maxFractionDigits = maxFractionDigits;
29
+ if (typeof additionalValue !== 'undefined')
30
+ el.additionalValue = additionalValue;
31
+ if (typeof notificationInfo !== 'undefined')
32
+ el.notificationInfo = notificationInfo;
33
+ if (typeof isInFocus !== 'undefined')
34
+ el.isInFocus = !!isInFocus;
35
+ if (typeof styleType !== 'undefined')
36
+ el.styleType = styleType;
37
+ if (typeof type !== 'undefined')
38
+ el.type = type;
39
+ if (typeof value !== 'undefined')
40
+ el.value = value;
41
+ if (typeof label !== 'undefined')
42
+ el.label = label;
43
+ }, [keyProp, mandatory, disabled, readonly, textColor, xAlignment, rowSpan, allowDecimal, minFractionDigits, maxFractionDigits, additionalValue, notificationInfo, isInFocus, styleType, type, value, label]);
44
+ useEffect(() => {
45
+ const el = ref.current;
46
+ if (!el)
47
+ return;
48
+ const handlers = [];
49
+ if (onValueChange)
50
+ handlers.push(['valueChange', (e) => { var _a, _b; return onValueChange((_a = e.detail) !== null && _a !== void 0 ? _a : (_b = e.target) === null || _b === void 0 ? void 0 : _b.value); }]);
51
+ if (onElementClick)
52
+ handlers.push(['elementClick', (e) => { var _a; return onElementClick((_a = e.detail) !== null && _a !== void 0 ? _a : e); }]);
53
+ if (onValidationChange)
54
+ handlers.push(['validationChange', (e) => { var _a; return onValidationChange(!!((_a = e.detail) !== null && _a !== void 0 ? _a : e)); }]);
55
+ handlers.forEach(([n, h]) => el.addEventListener(n, h));
56
+ return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
57
+ }, [onValueChange, onElementClick, onValidationChange]);
58
+ return (_jsx("pep-quantity-selector", { ref: ref, className: className, label: label, type: type, ...rest }));
59
+ };
60
+ //# sourceMappingURL=pep-quantity-selector.js.map
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ export interface PepSliderProps extends React.HTMLAttributes<HTMLElement> {
3
+ label?: string;
4
+ disabled?: boolean;
5
+ hint?: string;
6
+ background?: string;
7
+ step?: number;
8
+ minValue?: number;
9
+ maxValue?: number;
10
+ value?: number;
11
+ onValueChange?: (value: number) => void;
12
+ onInputChange?: (value: number) => void;
13
+ }
14
+ export declare const PepSlider: React.FC<PepSliderProps>;
package/pep-slider.js ADDED
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepSlider = ({ label, disabled, hint, background, step, minValue, maxValue, value, onValueChange, onInputChange, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ const el = ref.current;
7
+ if (!el)
8
+ return;
9
+ if (typeof disabled !== 'undefined')
10
+ el.disabled = !!disabled;
11
+ if (typeof background !== 'undefined')
12
+ el.background = background;
13
+ if (typeof step !== 'undefined')
14
+ el.step = step;
15
+ if (typeof minValue !== 'undefined')
16
+ el.minValue = minValue;
17
+ if (typeof maxValue !== 'undefined')
18
+ el.maxValue = maxValue;
19
+ if (typeof hint !== 'undefined')
20
+ el.hint = hint;
21
+ if (typeof label !== 'undefined')
22
+ el.label = label;
23
+ if (typeof value !== 'undefined')
24
+ el.value = value;
25
+ }, [disabled, background, step, minValue, maxValue, hint, label, value]);
26
+ useEffect(() => {
27
+ const el = ref.current;
28
+ if (!el)
29
+ return;
30
+ const handlers = [];
31
+ if (onValueChange)
32
+ handlers.push(['valueChange', (e) => { var _a, _b; return onValueChange(Number((_a = e.detail) !== null && _a !== void 0 ? _a : (_b = e === null || e === void 0 ? void 0 : e.target) === null || _b === void 0 ? void 0 : _b.value)); }]);
33
+ if (onInputChange)
34
+ handlers.push(['inputChange', (e) => { var _a, _b; return onInputChange(Number((_a = e.detail) !== null && _a !== void 0 ? _a : (_b = e === null || e === void 0 ? void 0 : e.target) === null || _b === void 0 ? void 0 : _b.value)); }]);
35
+ handlers.forEach(([n, h]) => el.addEventListener(n, h));
36
+ return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
37
+ }, [onValueChange, onInputChange]);
38
+ return (_jsx("pep-slider", { ref: ref, className: className, label: label, ...rest }));
39
+ };
40
+ //# sourceMappingURL=pep-slider.js.map
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export interface PepTextareaProps extends React.HTMLAttributes<HTMLElement> {
3
+ value?: string;
4
+ label?: string;
5
+ placeholder?: string;
6
+ disabled?: boolean;
7
+ readonly?: boolean;
8
+ rows?: number;
9
+ onValueChange?: (value: any) => void;
10
+ }
11
+ export declare const PepTextarea: React.FC<PepTextareaProps>;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepTextarea = ({ value, label, placeholder, disabled, readonly, rows, onValueChange, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ const el = ref.current;
7
+ if (!el)
8
+ return;
9
+ if (typeof disabled !== 'undefined')
10
+ el.disabled = !!disabled;
11
+ if (typeof readonly !== 'undefined')
12
+ el.readonly = !!readonly;
13
+ if (typeof rows !== 'undefined')
14
+ el.rows = rows;
15
+ if (typeof value !== 'undefined')
16
+ el.value = value;
17
+ }, [disabled, readonly, rows, value]);
18
+ useEffect(() => {
19
+ const el = ref.current;
20
+ if (!el || !onValueChange)
21
+ return;
22
+ const h = (e) => { var _a, _b; return onValueChange((_a = e.detail) !== null && _a !== void 0 ? _a : (_b = e.target) === null || _b === void 0 ? void 0 : _b.value); };
23
+ el.addEventListener('valueChange', h);
24
+ return () => el.removeEventListener('valueChange', h);
25
+ }, [onValueChange]);
26
+ return (_jsx("pep-textarea", { ref: ref, className: className, value: value, label: label, placeholder: placeholder, ...rest }));
27
+ };
28
+ //# sourceMappingURL=pep-textarea.js.map