genesys-react-components 0.1.0-alpha.2 → 0.1.0-alpha.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.
Files changed (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/{dist/esm/lib → build}/dxaccordion/DxAccordion.d.ts +9 -9
  4. package/{dist/esm/lib → build}/dxaccordion/DxAccordionGroup.d.ts +7 -7
  5. package/{dist/cjs/lib → build}/dxbutton/DxButton.d.ts +12 -12
  6. package/{dist/esm/lib → build}/dxitemgroup/DxItemGroup.d.ts +18 -18
  7. package/{dist/esm/lib → build}/dxlabel/DxLabel.d.ts +11 -11
  8. package/{dist/cjs/lib → build}/dxtabbedcontent/DxTabPanel.d.ts +8 -8
  9. package/{dist/esm/lib → build}/dxtabbedcontent/DxTabbedContent.d.ts +8 -8
  10. package/{dist/esm/lib → build}/dxtextbox/DxTextbox.d.ts +20 -20
  11. package/{dist/cjs/lib → build}/dxtoggle/DxToggle.d.ts +14 -14
  12. package/build/index.d.ts +33 -0
  13. package/build/index.js +304 -0
  14. package/build/index.js.map +1 -0
  15. package/package.json +24 -31
  16. package/dist/cjs/index.js +0 -2870
  17. package/dist/cjs/index.js.map +0 -1
  18. package/dist/cjs/lib/dxaccordion/DxAccordion.d.ts +0 -9
  19. package/dist/cjs/lib/dxaccordion/DxAccordionGroup.d.ts +0 -7
  20. package/dist/cjs/lib/dxitemgroup/DxItemGroup.d.ts +0 -18
  21. package/dist/cjs/lib/dxlabel/DxLabel.d.ts +0 -11
  22. package/dist/cjs/lib/dxtabbedcontent/DxTabbedContent.d.ts +0 -8
  23. package/dist/cjs/lib/dxtextbox/DxTextbox.d.ts +0 -20
  24. package/dist/cjs/lib/index.d.ts +0 -31
  25. package/dist/esm/index.js +0 -2859
  26. package/dist/esm/index.js.map +0 -1
  27. package/dist/esm/lib/dxbutton/DxButton.d.ts +0 -12
  28. package/dist/esm/lib/dxtabbedcontent/DxTabPanel.d.ts +0 -8
  29. package/dist/esm/lib/dxtoggle/DxToggle.d.ts +0 -14
  30. package/dist/esm/lib/index.d.ts +0 -31
  31. package/dist/index.d.ts +0 -101
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Genesys Cloud Services, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Genesys React Components
2
+
3
+ A React component library containing standardized form elements.
4
+
@@ -1,9 +1,9 @@
1
- import React from 'react';
2
- import './DxAccordion.scss';
3
- interface IProps {
4
- title: React.ReactNode;
5
- children: React.ReactNode;
6
- showOpen?: boolean;
7
- }
8
- export default function DxAccordion(props: IProps): JSX.Element;
9
- export {};
1
+ import React from 'react';
2
+ import './DxAccordion.scss';
3
+ interface IProps {
4
+ title: React.ReactNode;
5
+ children: React.ReactNode;
6
+ showOpen?: boolean;
7
+ }
8
+ export default function DxAccordion(props: IProps): JSX.Element;
9
+ export {};
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import './DxAccordionGroup.scss';
3
- interface IProps {
4
- children: React.ReactNode;
5
- }
6
- export default function DxAccordionGroup(props: IProps): JSX.Element;
7
- export {};
1
+ import React from 'react';
2
+ import './DxAccordionGroup.scss';
3
+ interface IProps {
4
+ children: React.ReactNode;
5
+ }
6
+ export default function DxAccordionGroup(props: IProps): JSX.Element;
7
+ export {};
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- import { VoidEventCallback } from '..';
3
- import './DxButton.scss';
4
- interface IProps {
5
- type?: 'primary' | 'secondary';
6
- disabled?: boolean;
7
- children?: React.ReactNode;
8
- className?: string;
9
- onClick?: VoidEventCallback;
10
- }
11
- export default function DxButton(props: IProps): JSX.Element;
12
- export {};
1
+ import React from 'react';
2
+ import { VoidEventCallback } from '..';
3
+ import './DxButton.scss';
4
+ interface IProps {
5
+ type?: 'primary' | 'secondary';
6
+ disabled?: boolean;
7
+ children?: React.ReactNode;
8
+ className?: string;
9
+ onClick?: VoidEventCallback;
10
+ }
11
+ export default function DxButton(props: IProps): JSX.Element;
12
+ export {};
@@ -1,18 +1,18 @@
1
- /// <reference types="react" />
2
- import { DxItemGroupItem, ItemChangedCallback, ItemGroupChangedCallback } from '..';
3
- import './DxItemGroup.scss';
4
- import './checkbox.scss';
5
- import './radiobutton.scss';
6
- import './dropdown.scss';
7
- import './multiselect.scss';
8
- interface IProps {
9
- title?: string;
10
- description?: string;
11
- format: DxItemGroupFormat;
12
- items: DxItemGroupItem[];
13
- onItemChanged?: ItemChangedCallback;
14
- onItemsChanged?: ItemGroupChangedCallback;
15
- }
16
- export declare type DxItemGroupFormat = 'checkbox' | 'radio' | 'dropdown' | 'multiselect';
17
- export default function DxItemGroup(props: IProps): JSX.Element;
18
- export {};
1
+ /// <reference types="react" />
2
+ import { DxItemGroupItem, ItemChangedCallback, ItemGroupChangedCallback } from '..';
3
+ import './DxItemGroup.scss';
4
+ import './checkbox.scss';
5
+ import './radiobutton.scss';
6
+ import './dropdown.scss';
7
+ import './multiselect.scss';
8
+ interface IProps {
9
+ title?: string;
10
+ description?: string;
11
+ format: DxItemGroupFormat;
12
+ items: DxItemGroupItem[];
13
+ onItemChanged?: ItemChangedCallback;
14
+ onItemsChanged?: ItemGroupChangedCallback;
15
+ }
16
+ export declare type DxItemGroupFormat = 'checkbox' | 'radio' | 'dropdown' | 'multiselect';
17
+ export default function DxItemGroup(props: IProps): JSX.Element;
18
+ export {};
@@ -1,11 +1,11 @@
1
- import React from 'react';
2
- import './DxLabel.scss';
3
- interface IProps {
4
- label?: string;
5
- description?: string;
6
- useFieldset?: boolean;
7
- className?: string;
8
- children: React.ReactNode;
9
- }
10
- export default function DxLabel(props: IProps): JSX.Element;
11
- export {};
1
+ import React from 'react';
2
+ import './DxLabel.scss';
3
+ interface IProps {
4
+ label?: string;
5
+ description?: string;
6
+ useFieldset?: boolean;
7
+ className?: string;
8
+ children: React.ReactNode;
9
+ }
10
+ export default function DxLabel(props: IProps): JSX.Element;
11
+ export {};
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import './DxTabPanel.scss';
3
- interface IProps {
4
- title: React.ReactNode;
5
- children: React.ReactNode;
6
- }
7
- export default function DxTabPanel(props: IProps): JSX.Element;
8
- export {};
1
+ import React from 'react';
2
+ import './DxTabPanel.scss';
3
+ interface IProps {
4
+ title: React.ReactNode;
5
+ children: React.ReactNode;
6
+ }
7
+ export default function DxTabPanel(props: IProps): JSX.Element;
8
+ export {};
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import './DxTabbedContent.scss';
3
- interface IProps {
4
- children: React.ReactNode;
5
- initialTabId?: number;
6
- }
7
- export default function DxTabbedContent(props: IProps): JSX.Element;
8
- export {};
1
+ import React from 'react';
2
+ import './DxTabbedContent.scss';
3
+ interface IProps {
4
+ children: React.ReactNode;
5
+ initialTabId?: number;
6
+ }
7
+ export default function DxTabbedContent(props: IProps): JSX.Element;
8
+ export {};
@@ -1,20 +1,20 @@
1
- import React from 'react';
2
- import { GenesysDevIcons } from 'genesys-dev-icons';
3
- import { StringChangedCallback, VoidEventCallback } from '..';
4
- import './DxTextbox.scss';
5
- export declare type DxTextboxType = 'text' | 'password' | 'email' | 'date' | 'datetime-local' | 'time' | 'integer' | 'decimal';
6
- export interface DxTextboxProps {
7
- initialValue?: string;
8
- inputType?: DxTextboxType;
9
- label?: string;
10
- description?: string;
11
- placeholder?: string;
12
- icon?: GenesysDevIcons;
13
- clearButton?: boolean;
14
- onChange?: StringChangedCallback;
15
- changeDebounceMs?: number;
16
- inputRef?: React.RefObject<HTMLInputElement>;
17
- onFocus?: VoidEventCallback;
18
- onBlur?: VoidEventCallback;
19
- }
20
- export default function DxTextbox(props: DxTextboxProps): JSX.Element;
1
+ import { GenesysDevIcons } from 'genesys-dev-icons';
2
+ import React from 'react';
3
+ import { StringChangedCallback, VoidEventCallback } from '..';
4
+ import './DxTextbox.scss';
5
+ export declare type DxTextboxType = 'text' | 'password' | 'email' | 'date' | 'datetime-local' | 'time' | 'integer' | 'decimal';
6
+ export interface DxTextboxProps {
7
+ initialValue?: string;
8
+ inputType?: DxTextboxType;
9
+ label?: string;
10
+ description?: string;
11
+ placeholder?: string;
12
+ icon?: GenesysDevIcons;
13
+ clearButton?: boolean;
14
+ onChange?: StringChangedCallback;
15
+ changeDebounceMs?: number;
16
+ inputRef?: React.RefObject<HTMLInputElement>;
17
+ onFocus?: VoidEventCallback;
18
+ onBlur?: VoidEventCallback;
19
+ }
20
+ export default function DxTextbox(props: DxTextboxProps): JSX.Element;
@@ -1,14 +1,14 @@
1
- /// <reference types="react" />
2
- import { GenesysDevIcons } from 'genesys-dev-icons';
3
- import { BooleanChangedCallback } from '..';
4
- import './DxToggle.scss';
5
- export interface DxToggleProps {
6
- isTriState?: boolean;
7
- initialValue?: boolean;
8
- label?: string;
9
- description?: string;
10
- trueIcon?: GenesysDevIcons;
11
- falseIcon?: GenesysDevIcons;
12
- onChange?: BooleanChangedCallback;
13
- }
14
- export default function DxToggle(props: DxToggleProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { GenesysDevIcons } from 'genesys-dev-icons';
3
+ import { BooleanChangedCallback } from '..';
4
+ import './DxToggle.scss';
5
+ export interface DxToggleProps {
6
+ isTriState?: boolean;
7
+ initialValue?: boolean;
8
+ label?: string;
9
+ description?: string;
10
+ trueIcon?: GenesysDevIcons;
11
+ falseIcon?: GenesysDevIcons;
12
+ onChange?: BooleanChangedCallback;
13
+ }
14
+ export default function DxToggle(props: DxToggleProps): JSX.Element;
@@ -0,0 +1,33 @@
1
+ import DxAccordion from './dxaccordion/DxAccordion';
2
+ import DxAccordionGroup from './dxaccordion/DxAccordionGroup';
3
+ import DxButton from './dxbutton/DxButton';
4
+ import DxItemGroup from './dxitemgroup/DxItemGroup';
5
+ import DxLabel from './dxlabel/DxLabel';
6
+ import DxTabbedContent from './dxtabbedcontent/DxTabbedContent';
7
+ import DxTabPanel from './dxtabbedcontent/DxTabPanel';
8
+ import DxTextbox from './dxtextbox/DxTextbox';
9
+ import DxToggle from './dxtoggle/DxToggle';
10
+ export { DxAccordion, DxAccordionGroup, DxButton, DxItemGroup, DxLabel, DxTabbedContent, DxTabPanel, DxTextbox, DxToggle };
11
+ export interface StringChangedCallback {
12
+ (value: string): void;
13
+ }
14
+ export interface BooleanChangedCallback {
15
+ (value?: boolean): void;
16
+ }
17
+ export interface VoidEventCallback {
18
+ (): void;
19
+ }
20
+ export interface DxItemGroupItem {
21
+ label: string;
22
+ value: string;
23
+ }
24
+ export interface DxItemGroupItemValue {
25
+ item: DxItemGroupItem;
26
+ isSelected: boolean;
27
+ }
28
+ export interface ItemChangedCallback {
29
+ (item: DxItemGroupItem, isSelected: boolean): void;
30
+ }
31
+ export interface ItemGroupChangedCallback {
32
+ (items: DxItemGroupItemValue[]): void;
33
+ }
package/build/index.js ADDED
@@ -0,0 +1,304 @@
1
+ import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { v4 } from 'uuid';
4
+
5
+ function styleInject(css, ref) {
6
+ if ( ref === void 0 ) ref = {};
7
+ var insertAt = ref.insertAt;
8
+
9
+ if (!css || typeof document === 'undefined') { return; }
10
+
11
+ var head = document.head || document.getElementsByTagName('head')[0];
12
+ var style = document.createElement('style');
13
+ style.type = 'text/css';
14
+
15
+ if (insertAt === 'top') {
16
+ if (head.firstChild) {
17
+ head.insertBefore(style, head.firstChild);
18
+ } else {
19
+ head.appendChild(style);
20
+ }
21
+ } else {
22
+ head.appendChild(style);
23
+ }
24
+
25
+ if (style.styleSheet) {
26
+ style.styleSheet.cssText = css;
27
+ } else {
28
+ style.appendChild(document.createTextNode(css));
29
+ }
30
+ }
31
+
32
+ var css_248z$c = ".dx-accordion {\n margin: 0;\n}\n.dx-accordion .accordion-heading {\n border-width: 0 0 1px 0;\n border-style: solid;\n border-color: #bfd4e4;\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n line-height: 14px;\n color: #54565a;\n padding: 13px 20px;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n}\n.dx-accordion .accordion-heading .icon {\n line-height: 0;\n}\n.dx-accordion .accordion-content {\n padding: 13px 20px 20px 20px;\n border-bottom: 1px solid #bfd4e4;\n}\n.dx-accordion .accordion-content *:first-child {\n margin-top: 0;\n}\n.dx-accordion .accordion-content *:last-child {\n margin-bottom: 0;\n}";
33
+ styleInject(css_248z$c);
34
+
35
+ function DxAccordion(props) {
36
+ const [isOpen, setIsOpen] = useState(props.showOpen || false);
37
+ return (React.createElement("div", { className: 'dx-accordion' },
38
+ React.createElement("div", { className: 'accordion-heading', onClick: () => setIsOpen(!isOpen) },
39
+ props.title,
40
+ " ",
41
+ React.createElement(GenesysDevIcon, { icon: isOpen ? GenesysDevIcons.AppChevronUp : GenesysDevIcons.AppChevronDown })),
42
+ isOpen ? React.createElement("div", { className: 'accordion-content' }, props.children) : undefined));
43
+ }
44
+
45
+ var css_248z$b = ".dx-accordion-group {\n margin: 40px 0;\n}";
46
+ styleInject(css_248z$b);
47
+
48
+ function DxAccordionGroup(props) {
49
+ return React.createElement("div", { className: 'dx-accordion-group' }, props.children);
50
+ }
51
+
52
+ var css_248z$a = ".dx-button {\n margin: 15px 10px;\n border-radius: 2px;\n padding: 8px 15px;\n cursor: pointer;\n font-weight: 500;\n}\n.dx-button-primary {\n color: #ffffff;\n border: 1px solid #419bb2;\n background-color: #419bb2;\n}\n.dx-button-primary:hover {\n background-color: #317b8d;\n border-color: #317b8d;\n transition: 0.1s;\n}\n.dx-button-primary:focus {\n background-color: #419bb2;\n border-color: #419bb2;\n box-shadow: 0 0 0 2px #aac9ff;\n transition: 0.1s;\n}\n.dx-button-primary:disabled {\n background-color: #9aafb540;\n border-color: #9aafb540;\n transition: 0.1s;\n}\n.dx-button-secondary {\n color: #419bb2;\n border: 1px solid #419bb2;\n background-color: #ffffff;\n}\n.dx-button-secondary:hover {\n color: #317b8d;\n border-color: #317b8d;\n transition: 0.1s;\n}\n.dx-button-secondary:focus {\n color: #419bb2;\n border-color: #419bb2;\n box-shadow: 0 0 0 2px #aac9ff;\n transition: 0.1s;\n}\n.dx-button-secondary:disabled {\n color: #8a9a9e;\n background-color: #e0e6e8;\n border-color: #e0e6e8;\n transition: 0.1s;\n}";
53
+ styleInject(css_248z$a);
54
+
55
+ function DxButton(props) {
56
+ let classNames = ['dx-button'];
57
+ classNames.push(`dx-button-${props.type || 'primary'}`);
58
+ if (props.className)
59
+ classNames.push(props.className);
60
+ const handleClick = (e) => {
61
+ if (!props.onClick)
62
+ return;
63
+ e.preventDefault();
64
+ e.stopPropagation();
65
+ props.onClick();
66
+ };
67
+ return (React.createElement("button", { className: classNames.join(' '), type: 'button', onClick: handleClick, disabled: props.disabled === true }, props.children));
68
+ }
69
+
70
+ var css_248z$9 = ".dx-item-group {\n display: block;\n border: 0;\n margin: 0;\n padding: 0;\n}\n.dx-item-group label {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n margin: 15px 0;\n}\n.dx-item-group label:first-of-type {\n margin-top: 0;\n}\n.dx-item-group label .label-text {\n font-family: Roboto;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 18px;\n color: #75757a;\n}";
71
+ styleInject(css_248z$9);
72
+
73
+ var css_248z$8 = ".dx-item-group input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n margin: 0 8px 0 0;\n width: 16px;\n height: 16px;\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n flex-shrink: 0;\n}\n.dx-item-group input[type=checkbox]::before {\n display: none;\n}\n.dx-item-group input[type=checkbox]:checked {\n background-color: #8a96a3;\n}\n.dx-item-group input[type=checkbox]:checked::before {\n display: block;\n position: relative;\n top: 7px;\n left: 3px;\n font-size: 9px;\n line-height: 0;\n color: #ffffff;\n content: \"\\f103\";\n font-family: genesys-dev-icons !important;\n font-style: normal;\n font-weight: normal !important;\n font-feature-settings: normal;\n font-variant: normal;\n text-transform: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.dx-item-group input[type=checkbox]:not(:disabled):hover {\n border-color: #4d5061;\n}\n.dx-item-group input[type=checkbox]:not(:disabled):focus {\n outline: #aac9ff solid 2px;\n}\n.dx-item-group input[type=checkbox]:not(:disabled):focus-visible {\n outline: 0;\n}";
74
+ styleInject(css_248z$8);
75
+
76
+ var css_248z$7 = ".dx-item-group input[type=radio] {\n -webkit-appearance: none;\n appearance: none;\n margin: 0 8px 0 0;\n width: 16px;\n height: 16px;\n border: 1px solid #8a96a3;\n border-radius: 8px;\n background-color: #ffffff;\n flex-shrink: 0;\n}\n.dx-item-group input[type=radio]::before {\n display: none;\n}\n.dx-item-group input[type=radio]:checked::before {\n content: \"\";\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 8px;\n position: relative;\n top: 2px;\n left: 2px;\n background-color: #8a96a3;\n}\n.dx-item-group input[type=radio]:not(:disabled):hover {\n border-color: #4d5061;\n}\n.dx-item-group input[type=radio]:not(:disabled):focus {\n outline: #aac9ff solid 2px;\n}\n.dx-item-group input[type=radio]:not(:disabled):focus-visible {\n outline: 0;\n}";
77
+ styleInject(css_248z$7);
78
+
79
+ var css_248z$6 = ".dx-select-group {\n appearance: none;\n position: relative;\n}\n.dx-select-group select {\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n padding: 8px 32px 8px 12px;\n width: 100%;\n appearance: none;\n}\n.dx-select-group select:focus-visible {\n outline: 2px solid #aac9ff;\n}\n.dx-select-group select option {\n background: #aac9ff -webkit-linear-gradient(bottom, #aac9ff 0%, #aac9ff 100%);\n}\n.dx-select-group::after {\n position: absolute;\n bottom: 12px;\n right: 12px;\n content: \"\\f104\";\n font-size: 8px;\n font-family: genesys-dev-icons !important;\n font-style: normal;\n font-weight: normal !important;\n font-feature-settings: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n pointer-events: none;\n}";
80
+ styleInject(css_248z$6);
81
+
82
+ var css_248z$5 = ".dx-multiselect-group {\n appearance: none;\n position: relative;\n}\n.dx-multiselect-group select {\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n width: 100%;\n appearance: none;\n scrollbar-color: #b0b2b5 transparent;\n}\n.dx-multiselect-group select:focus-visible {\n outline: 2px solid #aac9ff;\n}\n.dx-multiselect-group select option {\n overflow: hidden;\n white-space: pre;\n text-overflow: ellipsis;\n -webkit-appearance: none;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 31px;\n padding: 8px 12px;\n color: #75757a;\n}\n.dx-multiselect-group select option:checked {\n background: #aac9ff -webkit-linear-gradient(bottom, #aac9ff 0%, #aac9ff 100%);\n}\n.dx-multiselect-group select::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 7px;\n height: 7px;\n}\n.dx-multiselect-group select::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: #b0b2b5;\n}\n.dx-multiselect-group select::-webkit-scrollbar-corner {\n background: transparent;\n}";
83
+ styleInject(css_248z$5);
84
+
85
+ var css_248z$4 = ".dx-label {\n margin: 20px 0;\n display: block;\n}\n.dx-label .label-text,\n.dx-label .input-description {\n display: block;\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n}\n.dx-label .label-text {\n margin: 0 0 4px 0;\n}\n.dx-label .input-description {\n padding: 6px 20px;\n display: flex;\n flex-flow: row nowrap;\n gap: 8px;\n}\n.dx-label .input-description .icon {\n color: #597393;\n line-height: 0;\n}";
86
+ styleInject(css_248z$4);
87
+
88
+ function DxLabel(props) {
89
+ const hasLabel = props.label && props.label !== '';
90
+ const description = props.description ? (React.createElement("div", { className: 'input-description' },
91
+ React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppInfoSolid }),
92
+ React.createElement("span", null, props.description))) : undefined;
93
+ if (props.useFieldset) {
94
+ return (React.createElement("fieldset", { className: 'dx-label ' + props.className || '' },
95
+ props.label ? React.createElement("legend", { className: 'label-text' }, props.label) : undefined,
96
+ props.children,
97
+ description));
98
+ }
99
+ return (React.createElement("label", { className: 'dx-label ' + props.className || '' },
100
+ hasLabel ? React.createElement("span", { className: 'label-text' }, props.label) : undefined,
101
+ props.children,
102
+ description));
103
+ }
104
+
105
+ function DxItemGroup(props) {
106
+ const [data, setData] = useState(props.items.map((item) => {
107
+ return { item, isSelected: false };
108
+ }));
109
+ const [id] = useState(v4());
110
+ // data changed
111
+ useEffect(() => {
112
+ if (props.onItemsChanged)
113
+ props.onItemsChanged(data);
114
+ // eslint-disable-next-line react-hooks/exhaustive-deps
115
+ }, [data]);
116
+ // Handle checkbox changed
117
+ const onChange = (idx, item, e) => {
118
+ if (props.onItemChanged)
119
+ props.onItemChanged(item, e.target.checked);
120
+ let newData = [...data];
121
+ // Unselect everything if it's radio buttons
122
+ if (props.format === 'radio')
123
+ newData.forEach((value) => (value.isSelected = false));
124
+ // Set the selected state of the new item
125
+ newData[idx].isSelected = e.target.checked;
126
+ setData(newData);
127
+ };
128
+ switch (props.format) {
129
+ case 'multiselect':
130
+ case 'dropdown': {
131
+ return (React.createElement(DxLabel, { label: props.title, description: props.description },
132
+ React.createElement("div", { className: `dx-item-group${props.format === 'multiselect' ? ' dx-multiselect-group' : ' dx-select-group'}` },
133
+ React.createElement("select", { multiple: props.format === 'multiselect' }, data.map((d, i) => (React.createElement("option", { key: i, value: d.item.value }, d.item.label)))))));
134
+ }
135
+ case 'checkbox':
136
+ case 'radio':
137
+ default: {
138
+ return (React.createElement(DxLabel, { label: props.title, description: props.description, className: 'dx-item-group', useFieldset: true }, data.map((d, i) => (React.createElement("label", { key: i },
139
+ React.createElement("input", { type: props.format, name: props.format === 'checkbox' ? `${id}-${i}` : id, id: d.item.label, value: d.item.value, checked: d.isSelected, onChange: (e) => onChange(i, d.item, e) }),
140
+ React.createElement("span", { className: 'label-text' }, d.item.label))))));
141
+ }
142
+ }
143
+ }
144
+
145
+ var css_248z$3 = ".dx-tabbed-content {\n margin: 40px 0;\n}\n.dx-tabbed-content .tab-titles {\n border-bottom: 1px solid #bfd4e4;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n}\n.dx-tabbed-content .tab-titles .tab-title {\n display: inline-block;\n padding: 5px 20px;\n border-bottom: 1px solid transparent;\n cursor: pointer;\n}\n.dx-tabbed-content .tab-titles .tab-title.active {\n border-bottom-color: #597393;\n font-weight: bold;\n}\n.dx-tabbed-content .tab-titles .tab-title p {\n margin: 0;\n display: inline;\n}\n.dx-tabbed-content .tab-content {\n padding: 13px 20px 20px 20px;\n border-bottom: 1px solid #bfd4e4;\n}\n.dx-tabbed-content .tab-content *:first-child {\n margin-top: 0;\n}\n.dx-tabbed-content .tab-content *:last-child {\n margin-bottom: 0;\n}";
146
+ styleInject(css_248z$3);
147
+
148
+ function DxTabbedContent(props) {
149
+ const [activeTab, setActiveTab] = useState(props.initialTabId || 0);
150
+ const [titles] = useState(
151
+ // Scrape titles from child elements
152
+ React.Children.toArray(props.children).map((child) => {
153
+ if (!child || !child.props || !child.props.title)
154
+ return 'Unknown title';
155
+ return child.props.title;
156
+ }));
157
+ return (React.createElement("div", { className: 'dx-tabbed-content' },
158
+ React.createElement("div", { className: 'tab-titles' }, titles.map((title, i) => (React.createElement("span", { key: i, className: `tab-title${i === activeTab ? ' active' : ''}`, onClick: () => setActiveTab(i) }, title)))),
159
+ React.createElement("div", { className: 'tab-content' }, React.Children.toArray(props.children)[activeTab])));
160
+ }
161
+
162
+ var css_248z$2 = "";
163
+ styleInject(css_248z$2);
164
+
165
+ function DxTabPanel(props) {
166
+ return React.createElement("div", { className: 'dx-tab-panel' }, props.children);
167
+ }
168
+
169
+ var css_248z$1 = ".dx-textbox {\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n gap: 10px;\n border: 1px solid #c6cbd1;\n border-radius: 2px;\n margin: 0;\n padding: 0 10px;\n height: 32px;\n}\n.dx-textbox.with-label {\n margin-top: 0;\n}\n.dx-textbox:focus-within {\n outline: #aac9ff solid 2px;\n}\n.dx-textbox .icon {\n display: block;\n flex: none;\n color: #75757a;\n}\n.dx-textbox .icon.input-icon {\n font-size: 14px;\n line-height: 0;\n}\n.dx-textbox .icon.clear-icon {\n font-size: 11px;\n line-height: 0;\n cursor: pointer;\n padding: 4px;\n margin-right: -4px;\n}\n.dx-textbox input {\n flex-grow: 1;\n border: 0;\n background: #ffffff;\n box-sizing: border-box;\n height: 32px;\n width: 100%;\n padding: 0;\n margin: 0;\n font-family: Roboto;\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n line-height: 16px;\n color: #272d2d;\n}\n.dx-textbox input:focus-visible {\n outline: 0;\n}\n.dx-textbox input::placeholder {\n font-family: Roboto;\n font-style: normal;\n font-weight: 300;\n font-size: 14px;\n line-height: 16px;\n color: #757576;\n}";
170
+ styleInject(css_248z$1);
171
+
172
+ function DxTextbox(props) {
173
+ const [debounceMs, setDebounceMs] = useState(props.changeDebounceMs || 300);
174
+ const [value, setValue] = useState(props.initialValue || '');
175
+ const [isFocused, setIsFocused] = useState(false);
176
+ const [escapePressed, setEscapePressed] = useState(Date.now());
177
+ const [step, setStep] = useState(undefined);
178
+ let [timer, setTimer] = useState(undefined);
179
+ // Constructor
180
+ useEffect(() => {
181
+ // Register global key bindings
182
+ document.addEventListener('keydown', globalKeyBindings, false);
183
+ return () => {
184
+ document.removeEventListener('keydown', globalKeyBindings, false);
185
+ };
186
+ }, []);
187
+ // Escape pressed
188
+ useEffect(() => {
189
+ var _a;
190
+ if (!isFocused)
191
+ return;
192
+ setValue('');
193
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
194
+ // eslint-disable-next-line react-hooks/exhaustive-deps
195
+ }, [escapePressed]);
196
+ // Value changed
197
+ useEffect(() => {
198
+ if (props.inputType === 'decimal') {
199
+ // Normalize step setting
200
+ if (!isNaN(parseFloat(value))) {
201
+ const match = /\.(.+)/.exec(value);
202
+ console.log(match);
203
+ if (match) {
204
+ const s = `0.${Array.apply(null, Array(match[1].length - 1))
205
+ .map(() => '0')
206
+ .join('')}1`;
207
+ console.log(s);
208
+ setStep(s);
209
+ }
210
+ }
211
+ }
212
+ else if (props.inputType === 'integer') {
213
+ // Overwrite value as integer to forcibly truncate floating point numbers
214
+ setValue(parseInt(value).toString());
215
+ }
216
+ // Debounce onChange notification
217
+ if (!props.onChange)
218
+ return;
219
+ clearTimeout(timer);
220
+ setTimer(setTimeout(() => (props.onChange ? props.onChange(value) : undefined), debounceMs));
221
+ // eslint-disable-next-line react-hooks/exhaustive-deps
222
+ }, [value]);
223
+ // Update state from props
224
+ useEffect(() => {
225
+ setDebounceMs(props.changeDebounceMs || 300);
226
+ }, [props.changeDebounceMs]);
227
+ // Normalize inputRef
228
+ let inputRef = useRef(null);
229
+ if (props.inputRef)
230
+ inputRef = props.inputRef;
231
+ const hasLabel = props.label && props.label !== '';
232
+ // Global key bindings
233
+ function globalKeyBindings(event) {
234
+ // Escape - cancel search
235
+ if (event.key === 'Escape') {
236
+ event.stopPropagation();
237
+ event.preventDefault();
238
+ setEscapePressed(Date.now());
239
+ return;
240
+ }
241
+ }
242
+ // Normalize input type
243
+ let inputType = props.inputType;
244
+ if (inputType === 'integer' || inputType === 'decimal')
245
+ inputType = 'number';
246
+ // TODO: handle props.inputType
247
+ let component = (React.createElement("div", { className: `dx-textbox${hasLabel ? ' with-label' : ''}`, style: {} },
248
+ props.icon ? React.createElement(GenesysDevIcon, { icon: props.icon, className: 'input-icon' }) : undefined,
249
+ React.createElement("input", { className: 'dx-input', type: inputType, step: step, value: value, placeholder: props.placeholder, onChange: (e) => setValue(e.target.value), ref: inputRef, onFocus: () => {
250
+ setIsFocused(true);
251
+ if (props.onFocus)
252
+ props.onFocus();
253
+ }, onBlur: () => {
254
+ setIsFocused(false);
255
+ if (props.onBlur)
256
+ props.onBlur();
257
+ } }),
258
+ props.clearButton && (value || isFocused) ? (React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppTimes, className: 'clear-icon', onClick: () => setValue('') })) : undefined));
259
+ // Render
260
+ return (React.createElement(DxLabel, { label: props.label, description: props.description }, component));
261
+ }
262
+
263
+ var css_248z = ".dx-toggle-container {\n display: inline-block;\n}\n.dx-toggle-container .dx-toggle {\n background: #f5f8fb;\n border: 1px solid #c6cbd1;\n border-radius: 6px;\n height: 26px;\n padding: 0px 4px;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n gap: 2px;\n cursor: pointer;\n}\n.dx-toggle-container .dx-toggle:hover .slider {\n border-color: #aac9ff;\n}\n.dx-toggle-container .dx-toggle .icon {\n font-size: 10px;\n line-height: 0;\n margin: 0 5px;\n color: #c4c4c4;\n}\n.dx-toggle-container .dx-toggle .clear-placeholder {\n width: 19px;\n padding: 0 1px 0 0;\n margin: 0;\n display: block;\n}\n.dx-toggle-container .dx-toggle .slider {\n height: 22px;\n width: 22px;\n border-radius: 22px;\n background-color: #419bb2;\n box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);\n display: flex;\n align-items: center;\n justify-content: center;\n border: 1px solid transparent;\n}\n.dx-toggle-container .dx-toggle .slider .icon {\n font-size: 10px;\n line-height: 0;\n color: #ffffff;\n padding: 0;\n margin: 0;\n}";
264
+ styleInject(css_248z);
265
+
266
+ function DxToggle(props) {
267
+ const [value, setValue] = useState(props.isTriState ? props.initialValue : props.initialValue || false);
268
+ const trueIcon = props.trueIcon || GenesysDevIcons.AppCheck;
269
+ const falseIcon = props.falseIcon || GenesysDevIcons.AppTimes;
270
+ useEffect(() => {
271
+ if (props.onChange)
272
+ props.onChange(value);
273
+ // eslint-disable-next-line react-hooks/exhaustive-deps
274
+ }, [value]);
275
+ const toggleValue = () => {
276
+ if (props.isTriState) {
277
+ if (value === undefined)
278
+ setValue(true);
279
+ else if (value === true)
280
+ setValue(false);
281
+ else
282
+ setValue(undefined);
283
+ }
284
+ else {
285
+ setValue(!value);
286
+ }
287
+ };
288
+ return (React.createElement(DxLabel, { label: props.label, description: props.description },
289
+ React.createElement("div", { className: 'dx-toggle-container' },
290
+ React.createElement("div", { className: 'dx-toggle', onClick: toggleValue },
291
+ value !== false ? React.createElement(GenesysDevIcon, { icon: falseIcon }) : undefined,
292
+ value === true && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
293
+ React.createElement("div", { className: 'slider' }, value !== undefined ? React.createElement(GenesysDevIcon, { icon: value ? trueIcon : falseIcon }) : undefined),
294
+ value === false && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
295
+ value !== true ? React.createElement(GenesysDevIcon, { icon: trueIcon }) : undefined))));
296
+ }
297
+
298
+ // Add this in your component file
299
+ require('react-dom');
300
+ window.React2 = require('react');
301
+ console.log(window.React1 === window.React2);
302
+
303
+ export { DxAccordion, DxAccordionGroup, DxButton, DxItemGroup, DxLabel, DxTabPanel, DxTabbedContent, DxTextbox, DxToggle };
304
+ //# sourceMappingURL=index.js.map