@pepperi-addons/ngx-lib-react 0.0.4 → 0.5.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/index.d.ts CHANGED
@@ -11,3 +11,6 @@ export * from './pep-color.js';
11
11
  export * from './pep-slider.js';
12
12
  export * from './pep-group-buttons.js';
13
13
  export * from './pep-menu.js';
14
+ export * from './pep-separator.js';
15
+ export * from './pep-draggable-item.js';
16
+ export * from './pep-checkbox.js';
package/index.js CHANGED
@@ -11,4 +11,7 @@ export * from './pep-color.js';
11
11
  export * from './pep-slider.js';
12
12
  export * from './pep-group-buttons.js';
13
13
  export * from './pep-menu.js';
14
+ export * from './pep-separator.js';
15
+ export * from './pep-draggable-item.js';
16
+ export * from './pep-checkbox.js';
14
17
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pepperi-addons/ngx-lib-react",
3
- "version": "0.0.4",
3
+ "version": "0.5.0",
4
4
  "description": "Thin React wrappers for Pepperi Angular Elements (Web Components) to improve DX in React.",
5
5
  "license": "MIT",
6
6
  "author": "Pepperi",
@@ -34,8 +34,6 @@
34
34
  "types": "./index.d.ts",
35
35
  "default": "./index.js"
36
36
  },
37
- "./elements/register.js": "./elements/register.js",
38
- "./elements/register.auto.js": "./elements/register.auto.js",
39
37
  "./elements/styles.css": "./elements/styles.css",
40
38
  "./elements/main.js": "./elements/main.js",
41
39
  "./elements/runtime.js": "./elements/runtime.js",
package/pep-button.js CHANGED
@@ -30,6 +30,6 @@ export const PepButton = ({ value, styleType, styleStateType, sizeType, disabled
30
30
  el.addEventListener('buttonClick', handler);
31
31
  return () => el.removeEventListener('buttonClick', handler);
32
32
  }, [onButtonClick]);
33
- return (_jsx("pep-button", { ref: ref, value: value, "style-type": styleType, "style-state-type": styleStateType, "size-type": sizeType, className: className, ...rest }));
33
+ return (_jsx("pep-button-element", { ref: ref, value: value, "style-type": styleType, "style-state-type": styleStateType, "size-type": sizeType, className: className, ...rest }));
34
34
  };
35
35
  //# sourceMappingURL=pep-button.js.map
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ export declare type PepCheckboxFieldType = 'checkbox' | 'booleanText';
3
+ export declare type PepHorizontalAlignment = 'start' | 'center' | 'end' | string;
4
+ export interface PepCheckboxProps extends React.HTMLAttributes<HTMLElement> {
5
+ keyProp?: string;
6
+ value?: boolean;
7
+ label?: string;
8
+ type?: PepCheckboxFieldType;
9
+ mandatory?: boolean;
10
+ disabled?: boolean;
11
+ readonly?: boolean;
12
+ xAlignment?: PepHorizontalAlignment;
13
+ rowSpan?: number;
14
+ additionalValue?: any;
15
+ visible?: boolean;
16
+ onValueChange?: (value: boolean) => void;
17
+ onValidationChange?: (isValid: boolean) => void;
18
+ className?: string;
19
+ }
20
+ export declare const PepCheckbox: React.FC<PepCheckboxProps>;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepCheckbox = ({ keyProp, value, label, type, mandatory, disabled, readonly, xAlignment, rowSpan, additionalValue, visible, onValueChange, onValidationChange, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ // Sync props as properties on the custom element
6
+ useEffect(() => {
7
+ const el = ref.current;
8
+ if (!el)
9
+ return;
10
+ if (typeof keyProp !== 'undefined')
11
+ el.key = keyProp;
12
+ if (typeof value !== 'undefined')
13
+ el.value = !!value;
14
+ if (typeof mandatory !== 'undefined')
15
+ el.mandatory = !!mandatory;
16
+ if (typeof disabled !== 'undefined')
17
+ el.disabled = !!disabled;
18
+ if (typeof readonly !== 'undefined')
19
+ el.readonly = !!readonly;
20
+ if (typeof xAlignment !== 'undefined')
21
+ el.xAlignment = xAlignment;
22
+ if (typeof rowSpan !== 'undefined')
23
+ el.rowSpan = rowSpan;
24
+ if (typeof additionalValue !== 'undefined')
25
+ el.additionalValue = additionalValue;
26
+ if (typeof visible !== 'undefined')
27
+ el.visible = !!visible;
28
+ if (typeof type !== 'undefined')
29
+ el.type = type;
30
+ }, [
31
+ keyProp,
32
+ value,
33
+ mandatory,
34
+ disabled,
35
+ readonly,
36
+ xAlignment,
37
+ rowSpan,
38
+ additionalValue,
39
+ visible,
40
+ type,
41
+ ]);
42
+ // Wire events
43
+ useEffect(() => {
44
+ const el = ref.current;
45
+ if (!el)
46
+ return;
47
+ const handlers = [];
48
+ if (onValueChange)
49
+ 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)); }]);
50
+ if (onValidationChange)
51
+ handlers.push(['validationChange', (e) => { var _a; return onValidationChange(!!((_a = e.detail) !== null && _a !== void 0 ? _a : e)); }]);
52
+ handlers.forEach(([n, h]) => el.addEventListener(n, h));
53
+ return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
54
+ }, [onValueChange, onValidationChange]);
55
+ return (_jsx("pep-checkbox-element", { ref: ref, className: className, label: label, type: type, ...rest }));
56
+ };
57
+ //# sourceMappingURL=pep-checkbox.js.map
package/pep-chips.js CHANGED
@@ -37,6 +37,6 @@ export const PepChips = ({ chips, label, inline, orientation, styleType, multiSe
37
37
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
38
38
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
39
39
  }, [onFieldClick, onSelectionChange]);
40
- return (_jsx("pep-chips", { ref: ref, className: className, label: label, placeholder: placeholder, ...rest }));
40
+ return (_jsx("pep-chips-element", { ref: ref, className: className, label: label, placeholder: placeholder, ...rest }));
41
41
  };
42
42
  //# sourceMappingURL=pep-chips.js.map
package/pep-color.js CHANGED
@@ -27,6 +27,6 @@ export const PepColor = ({ value, label, disabled, type, showAAComplient, checkA
27
27
  el.addEventListener('valueChange', h);
28
28
  return () => el.removeEventListener('valueChange', h);
29
29
  }, [onValueChange]);
30
- return (_jsx("pep-color", { ref: ref, className: className, label: label, ...rest }));
30
+ return (_jsx("pep-color-element", { ref: ref, className: className, label: label, ...rest }));
31
31
  };
32
32
  //# sourceMappingURL=pep-color.js.map
package/pep-date.js CHANGED
@@ -10,6 +10,6 @@ export const PepDate = ({ onValueChange, className, ...rest }) => {
10
10
  el.addEventListener('valueChange', h);
11
11
  return () => el.removeEventListener('valueChange', h);
12
12
  }, [onValueChange]);
13
- return _jsx("pep-date", { ref: ref, className: className, ...rest });
13
+ return _jsx("pep-date-element", { ref: ref, className: className, ...rest });
14
14
  };
15
15
  //# sourceMappingURL=pep-date.js.map
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ declare type PepStyleType = 'weak' | 'regular' | 'strong';
3
+ interface PepMenuItem {
4
+ [key: string]: any;
5
+ }
6
+ export interface PepDraggableItemProps extends React.HTMLAttributes<HTMLElement> {
7
+ title?: string;
8
+ titlePrefix?: string;
9
+ titleClassNames?: string;
10
+ data?: any;
11
+ disabled?: boolean;
12
+ shadow?: boolean;
13
+ styleType?: PepStyleType;
14
+ toggleContent?: boolean;
15
+ isToggleContentOpen?: boolean;
16
+ actionsMenu?: PepMenuItem[] | null;
17
+ menuStyleType?: PepStyleType;
18
+ onContentToggle?: (open: boolean) => void;
19
+ onActionsMenuItemClick?: (e: any) => void;
20
+ className?: string;
21
+ }
22
+ export declare const PepDraggableItem: React.FC<PepDraggableItemProps>;
23
+ export {};
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepDraggableItem = ({ title, titlePrefix, titleClassNames, data, disabled, shadow, styleType, toggleContent, isToggleContentOpen, actionsMenu, menuStyleType, onContentToggle, onActionsMenuItemClick, className, ...rest }) => {
4
+ const ref = useRef(null);
5
+ // Sync complex/boolean props as properties
6
+ useEffect(() => {
7
+ const el = ref.current;
8
+ if (!el)
9
+ return;
10
+ if (typeof title !== 'undefined')
11
+ el.title = title;
12
+ if (typeof titlePrefix !== 'undefined')
13
+ el.titlePrefix = titlePrefix;
14
+ if (typeof titleClassNames !== 'undefined')
15
+ el.titleClassNames = titleClassNames;
16
+ if (typeof data !== 'undefined')
17
+ el.data = data;
18
+ if (typeof disabled !== 'undefined')
19
+ el.disabled = !!disabled;
20
+ if (typeof shadow !== 'undefined')
21
+ el.shadow = !!shadow;
22
+ if (typeof styleType !== 'undefined')
23
+ el.styleType = styleType;
24
+ if (typeof toggleContent !== 'undefined')
25
+ el.toggleContent = !!toggleContent;
26
+ if (typeof isToggleContentOpen !== 'undefined')
27
+ el.isToggleContentOpen = !!isToggleContentOpen;
28
+ if (typeof actionsMenu !== 'undefined')
29
+ el.actionsMenu = actionsMenu;
30
+ if (typeof menuStyleType !== 'undefined')
31
+ el.menuStyleType = menuStyleType;
32
+ }, [
33
+ title,
34
+ titlePrefix,
35
+ titleClassNames,
36
+ data,
37
+ disabled,
38
+ shadow,
39
+ styleType,
40
+ toggleContent,
41
+ isToggleContentOpen,
42
+ actionsMenu,
43
+ menuStyleType,
44
+ ]);
45
+ // Wire events
46
+ useEffect(() => {
47
+ const el = ref.current;
48
+ if (!el)
49
+ return;
50
+ const handlers = [];
51
+ if (onContentToggle)
52
+ handlers.push(['contentToggle', (e) => { var _a; return onContentToggle(!!((_a = e.detail) !== null && _a !== void 0 ? _a : e)); }]);
53
+ if (onActionsMenuItemClick)
54
+ handlers.push(['actionsMenuItemClick', (e) => { var _a; return onActionsMenuItemClick((_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
+ }, [onContentToggle, onActionsMenuItemClick]);
58
+ return (_jsx("pep-draggable-item-element", { ref: ref, className: className,
59
+ // simple string attributes for initial render
60
+ title: title, "title-prefix": titlePrefix, "title-class-names": titleClassNames, "style-type": styleType, "menu-style-type": menuStyleType, ...rest }));
61
+ };
62
+ //# sourceMappingURL=pep-draggable-item.js.map
@@ -47,6 +47,6 @@ export const PepFilesUploader = ({ keyProp, src, label, mandatory, disabled, xAl
47
47
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
48
48
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
49
49
  }, [onChooseFile, onFileChange, onElementClick]);
50
- return (_jsx("pep-files-uploader", { ref: ref, className: className, label: label, ...rest }, keyProp));
50
+ return (_jsx("pep-files-uploader-element", { ref: ref, className: className, label: label, ...rest }, keyProp));
51
51
  };
52
52
  //# sourceMappingURL=pep-files-uploader.js.map
@@ -31,6 +31,6 @@ export const PepGroupButtons = ({ viewType, styleType, sizeType, buttons, button
31
31
  el.addEventListener('buttonClick', h);
32
32
  return () => el.removeEventListener('buttonClick', h);
33
33
  }, [onButtonClick]);
34
- return (_jsx("pep-group-buttons", { ref: ref, className: className, "view-type": viewType, "style-type": styleType, "size-type": sizeType, ...rest }));
34
+ return (_jsx("pep-group-buttons-element", { ref: ref, className: className, "view-type": viewType, "style-type": styleType, "size-type": sizeType, ...rest }));
35
35
  };
36
36
  //# sourceMappingURL=pep-group-buttons.js.map
package/pep-link.js CHANGED
@@ -37,6 +37,6 @@ export const PepLink = ({ keyProp, value, label, placeholder, mandatory, disable
37
37
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
38
38
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
39
39
  }, [onValueChange, onElementClick, onKeyup, onValidationChange]);
40
- return (_jsx("pep-link", { ref: ref, className: className, value: value, label: label, placeholder: placeholder, ...rest }));
40
+ return (_jsx("pep-link-element", { ref: ref, className: className, value: value, label: label, placeholder: placeholder, ...rest }));
41
41
  };
42
42
  //# sourceMappingURL=pep-link.js.map
package/pep-menu.js CHANGED
@@ -45,6 +45,6 @@ export const PepMenu = ({ text, iconName, iconPosition, type, styleType, sizeTyp
45
45
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
46
46
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
47
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 }));
48
+ return (_jsx("pep-menu-element", { 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
49
  };
50
50
  //# sourceMappingURL=pep-menu.js.map
@@ -55,6 +55,6 @@ export const PepQuantitySelector = ({ keyProp, value, label, type, mandatory, di
55
55
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
56
56
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
57
57
  }, [onValueChange, onElementClick, onValidationChange]);
58
- return (_jsx("pep-quantity-selector", { ref: ref, className: className, label: label, type: type, ...rest }));
58
+ return (_jsx("pep-quantity-selector-element", { ref: ref, className: className, label: label, type: type, ...rest }));
59
59
  };
60
60
  //# sourceMappingURL=pep-quantity-selector.js.map
package/pep-select.js CHANGED
@@ -33,7 +33,7 @@ export const PepSelect = ({ keyProp, value, label, placeholder, type, disabled,
33
33
  el.addEventListener('valueChange', handler);
34
34
  return () => el.removeEventListener('valueChange', handler);
35
35
  }, [onValueChange]);
36
- return (_jsx("pep-select", { ref: ref,
36
+ return (_jsx("pep-select-element", { ref: ref,
37
37
  // attributes (strings)
38
38
  value: value, label: label, placeholder: placeholder, type: type, ...rest }, keyProp));
39
39
  };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export interface PepSeparatorProps extends React.HTMLAttributes<HTMLElement> {
3
+ keyProp?: string;
4
+ label?: string;
5
+ xAlignment?: 'start' | 'center' | 'end' | string;
6
+ visible?: boolean;
7
+ }
8
+ export declare const PepSeparator: React.FC<PepSeparatorProps>;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
+ export const PepSeparator = ({ keyProp, label, xAlignment, visible, 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 xAlignment !== 'undefined')
12
+ el.xAlignment = xAlignment;
13
+ if (typeof visible !== 'undefined')
14
+ el.visible = !!visible;
15
+ }, [keyProp, xAlignment, visible]);
16
+ return (_jsx("pep-separator-element", { ref: ref, className: className, label: label, ...rest }));
17
+ };
18
+ //# sourceMappingURL=pep-separator.js.map
package/pep-slider.js CHANGED
@@ -35,6 +35,6 @@ export const PepSlider = ({ label, disabled, hint, background, step, minValue, m
35
35
  handlers.forEach(([n, h]) => el.addEventListener(n, h));
36
36
  return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
37
37
  }, [onValueChange, onInputChange]);
38
- return (_jsx("pep-slider", { ref: ref, className: className, label: label, ...rest }));
38
+ return (_jsx("pep-slider-element", { ref: ref, className: className, label: label, ...rest }));
39
39
  };
40
40
  //# sourceMappingURL=pep-slider.js.map
package/pep-textarea.js CHANGED
@@ -23,6 +23,6 @@ export const PepTextarea = ({ value, label, placeholder, disabled, readonly, row
23
23
  el.addEventListener('valueChange', h);
24
24
  return () => el.removeEventListener('valueChange', h);
25
25
  }, [onValueChange]);
26
- return (_jsx("pep-textarea", { ref: ref, className: className, value: value, label: label, placeholder: placeholder, ...rest }));
26
+ return (_jsx("pep-textarea-element", { ref: ref, className: className, value: value, label: label, placeholder: placeholder, ...rest }));
27
27
  };
28
28
  //# sourceMappingURL=pep-textarea.js.map
package/pep-textbox.js CHANGED
@@ -60,6 +60,6 @@ export const PepTextbox = ({ keyProp, value, label, placeholder, type, accessory
60
60
  handlers.forEach(([name, h]) => el.addEventListener(name, h));
61
61
  return () => handlers.forEach(([name, h]) => el.removeEventListener(name, h));
62
62
  }, [onValueChange, onKeyup, onValidationChange]);
63
- return (_jsx("pep-textbox", { ref: ref, value: value, label: label, placeholder: placeholder, type: type, ...rest }, keyProp));
63
+ return (_jsx("pep-textbox-element", { ref: ref, value: value, label: label, placeholder: placeholder, type: type, ...rest }, keyProp));
64
64
  };
65
65
  //# sourceMappingURL=pep-textbox.js.map