genesys-react-components 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/alertblock/AlertBlock.d.ts +2 -1
- package/build/codefence/CodeFence.d.ts +2 -1
- package/build/copybutton/CopyButton.d.ts +2 -1
- package/build/datatable/DataTable.d.ts +2 -2
- package/build/dxaccordion/DxAccordionGroup.d.ts +2 -1
- package/build/dxbutton/DxButton.d.ts +2 -2
- package/build/dxitemgroup/DxCheckbox.d.ts +2 -2
- package/build/dxlabel/DxLabel.d.ts +2 -1
- package/build/index.d.ts +10 -7
- package/build/index.js +33 -33
- package/build/index.js.map +1 -1
- package/build/loadingplaceholder/LoadingPlaceholder.d.ts +2 -1
- package/package.json +1 -1
- package/src/alertblock/AlertBlock.tsx +4 -1
- package/src/codefence/CodeFence.tsx +3 -2
- package/src/copybutton/CopyButton.tsx +4 -2
- package/src/datatable/DataTable.tsx +7 -5
- package/src/dxaccordion/DxAccordion.tsx +2 -1
- package/src/dxaccordion/DxAccordionGroup.tsx +8 -2
- package/src/dxbutton/DxButton.tsx +4 -3
- package/src/dxitemgroup/DxCheckbox.tsx +4 -3
- package/src/dxitemgroup/DxItemGroup.tsx +6 -4
- package/src/dxlabel/DxLabel.tsx +10 -4
- package/src/dxtabbedcontent/DxTabPanel.tsx +5 -1
- package/src/dxtabbedcontent/DxTabbedContent.tsx +1 -1
- package/src/dxtextbox/DxTextbox.tsx +1 -1
- package/src/dxtoggle/DxToggle.tsx +3 -2
- package/src/index.ts +11 -7
- package/src/loadingplaceholder/LoadingPlaceholder.tsx +4 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
+
|
|
3
4
|
import { DxAccordionProps } from '..';
|
|
4
5
|
|
|
5
6
|
import './DxAccordion.scss';
|
|
@@ -36,7 +37,7 @@ export default function DxAccordion(props: DxAccordionProps) {
|
|
|
36
37
|
if (props.headingIcon) icon = <GenesysDevIcon icon={props.headingIcon} className="heading-icon" />;
|
|
37
38
|
|
|
38
39
|
return (
|
|
39
|
-
<div id={props.containerId || undefined} className={`dx-accordion${props.className ? ' ' + props.className : ''}`}>
|
|
40
|
+
<div id={props.id || props.containerId || undefined} className={`dx-accordion${props.className ? ' ' + props.className : ''}`}>
|
|
40
41
|
<div className="accordion-heading" style={style} onClick={() => setIsOpen(!isOpen)}>
|
|
41
42
|
<span className="accordion-heading__left">
|
|
42
43
|
{icon} {props.title}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { BaseComponentProps } from '..';
|
|
4
|
+
|
|
3
5
|
import './DxAccordionGroup.scss';
|
|
4
6
|
|
|
5
|
-
interface IProps {
|
|
7
|
+
interface IProps extends BaseComponentProps {
|
|
6
8
|
children: React.ReactNode;
|
|
7
9
|
className?: string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export default function DxAccordionGroup(props: IProps) {
|
|
11
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<div id={props.id} className={`dx-accordion-group${props.className ? ' ' + props.className : ''}`}>
|
|
15
|
+
{props.children}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
12
18
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { BaseComponentProps, VoidEventCallback } from '..';
|
|
3
4
|
|
|
4
5
|
import './DxButton.scss';
|
|
5
6
|
|
|
6
|
-
interface IProps {
|
|
7
|
+
interface IProps extends BaseComponentProps {
|
|
7
8
|
type?: 'primary' | 'secondary' | 'link';
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
children?: React.ReactNode;
|
|
@@ -34,7 +35,7 @@ export default function DxButton(props: IProps) {
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<button className={classNames.join(' ')} type="button" onClick={handleClick} disabled={props.disabled === true}>
|
|
38
|
+
<button id={props.id} className={classNames.join(' ')} type="button" onClick={handleClick} disabled={props.disabled === true}>
|
|
38
39
|
{props.children}
|
|
39
40
|
</button>
|
|
40
41
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { BaseComponentProps, CheckedChangedCallback } from '..';
|
|
3
4
|
|
|
4
5
|
import './DxCheckbox.scss';
|
|
5
6
|
|
|
6
|
-
interface IProps {
|
|
7
|
+
interface IProps extends BaseComponentProps {
|
|
7
8
|
label: string;
|
|
8
9
|
itemValue: string;
|
|
9
10
|
description?: string;
|
|
@@ -31,7 +32,7 @@ export default function DxCheckbox(props: IProps) {
|
|
|
31
32
|
}, [checked]);
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
|
-
<label className={`dx-checkbox${props.className ? ' ' + props.className : ''}${props.disabled ? ' disabled' : ''}`}>
|
|
35
|
+
<label id={props.id} className={`dx-checkbox${props.className ? ' ' + props.className : ''}${props.disabled ? ' disabled' : ''}`}>
|
|
35
36
|
<input
|
|
36
37
|
type={props.useRadioType ? 'radio' : 'checkbox'}
|
|
37
38
|
name={props.name}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { DxItemGroupItem, DxItemGroupItemValue, DxItemGroupProps } from '..';
|
|
5
|
+
import DxLabel from '../dxlabel/DxLabel';
|
|
6
|
+
import DxCheckbox from './DxCheckbox';
|
|
4
7
|
|
|
5
8
|
import './DxItemGroup.scss';
|
|
6
9
|
import './radiobutton.scss';
|
|
7
10
|
import './dropdown.scss';
|
|
8
11
|
import './multiselect.scss';
|
|
9
|
-
import DxLabel from '../dxlabel/DxLabel';
|
|
10
|
-
import DxCheckbox from './DxCheckbox';
|
|
11
12
|
|
|
12
13
|
export default function DxItemGroup(props: DxItemGroupProps) {
|
|
13
14
|
const [data, setData] = useState<DxItemGroupItemValue[]>(
|
|
@@ -75,7 +76,7 @@ export default function DxItemGroup(props: DxItemGroupProps) {
|
|
|
75
76
|
case 'dropdown': {
|
|
76
77
|
const isMulti = format === 'multiselect';
|
|
77
78
|
return (
|
|
78
|
-
<DxLabel label={title} description={description} className={className}>
|
|
79
|
+
<DxLabel id={props.id} label={title} description={description} className={className}>
|
|
79
80
|
<div className={`dx-item-group${isMulti ? ' dx-multiselect-group' : ' dx-select-group'}${disabled ? ' disabled' : ''}`}>
|
|
80
81
|
<select
|
|
81
82
|
multiple={isMulti}
|
|
@@ -102,6 +103,7 @@ export default function DxItemGroup(props: DxItemGroupProps) {
|
|
|
102
103
|
default: {
|
|
103
104
|
return (
|
|
104
105
|
<DxLabel
|
|
106
|
+
id={props.id}
|
|
105
107
|
label={title}
|
|
106
108
|
description={description}
|
|
107
109
|
className={`dx-item-group${disabled ? ' disabled' : ''}${className ? ' ' + className : ''}`}
|
package/src/dxlabel/DxLabel.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
import { BaseComponentProps } from '..';
|
|
5
|
+
|
|
4
6
|
import './DxLabel.scss';
|
|
5
7
|
|
|
6
|
-
interface IProps {
|
|
8
|
+
interface IProps extends BaseComponentProps {
|
|
7
9
|
label?: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
useFieldset?: boolean;
|
|
@@ -15,7 +17,7 @@ export default function DxLabel(props: IProps) {
|
|
|
15
17
|
const hasLabel = props.label && props.label !== '';
|
|
16
18
|
|
|
17
19
|
const description = props.description ? (
|
|
18
|
-
<div className=
|
|
20
|
+
<div className="input-description">
|
|
19
21
|
<GenesysDevIcon icon={GenesysDevIcons.AppInfoSolid} />
|
|
20
22
|
<span>{props.description}</span>
|
|
21
23
|
</div>
|
|
@@ -24,7 +26,7 @@ export default function DxLabel(props: IProps) {
|
|
|
24
26
|
const contents = (
|
|
25
27
|
<React.Fragment>
|
|
26
28
|
{' '}
|
|
27
|
-
{hasLabel ? <span className=
|
|
29
|
+
{hasLabel ? <span className="label-text">{props.label}</span> : undefined}
|
|
28
30
|
{props.children}
|
|
29
31
|
{description}
|
|
30
32
|
</React.Fragment>
|
|
@@ -35,5 +37,9 @@ export default function DxLabel(props: IProps) {
|
|
|
35
37
|
if (props.useFieldset) {
|
|
36
38
|
return <fieldset className={className}>{contents}</fieldset>;
|
|
37
39
|
}
|
|
38
|
-
return
|
|
40
|
+
return (
|
|
41
|
+
<label id={props.id} className={className}>
|
|
42
|
+
{contents}
|
|
43
|
+
</label>
|
|
44
|
+
);
|
|
39
45
|
}
|
|
@@ -4,5 +4,9 @@ import { DxTabPanelProps } from '..';
|
|
|
4
4
|
import './DxTabPanel.scss';
|
|
5
5
|
|
|
6
6
|
export default function DxTabPanel(props: DxTabPanelProps) {
|
|
7
|
-
return
|
|
7
|
+
return (
|
|
8
|
+
<div id={props.id} className={`dx-tab-panel${props.className ? ' ' + props.className : ''}`}>
|
|
9
|
+
{props.children}
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
8
12
|
}
|
|
@@ -7,7 +7,7 @@ export default function DxTabbedContent(props: DxTabbedContentProps) {
|
|
|
7
7
|
const [activeTab, setActiveTab] = useState(props.initialTabId || 0);
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
|
-
<div className={`dx-tabbed-content${props.className ? ' ' + props.className : ''}`}>
|
|
10
|
+
<div id={props.id} className={`dx-tabbed-content${props.className ? ' ' + props.className : ''}`}>
|
|
11
11
|
<div className="tab-titles">
|
|
12
12
|
{React.Children.toArray(props.children).map((child: any, i) => {
|
|
13
13
|
if (!child) return;
|
|
@@ -184,7 +184,7 @@ export default function DxTextbox(props: DxTextboxProps) {
|
|
|
184
184
|
|
|
185
185
|
// Render
|
|
186
186
|
return (
|
|
187
|
-
<DxLabel label={props.label} description={props.description} className={props.className}>
|
|
187
|
+
<DxLabel id={props.id} label={props.label} description={props.description} className={props.className}>
|
|
188
188
|
{component}
|
|
189
189
|
</DxLabel>
|
|
190
190
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
|
|
3
|
+
|
|
3
4
|
import { BooleanChangedCallback, DxToggleProps } from '..';
|
|
5
|
+
import DxLabel from '../dxlabel/DxLabel';
|
|
4
6
|
|
|
5
7
|
import './DxToggle.scss';
|
|
6
|
-
import DxLabel from '../dxlabel/DxLabel';
|
|
7
8
|
|
|
8
9
|
export default function DxToggle(props: DxToggleProps) {
|
|
9
10
|
let initialValue: boolean | undefined = props.value !== undefined ? props.value : props.initialValue;
|
|
@@ -45,7 +46,7 @@ export default function DxToggle(props: DxToggleProps) {
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
return (
|
|
48
|
-
<DxLabel label={props.label} description={props.description} className={props.className}>
|
|
49
|
+
<DxLabel id={props.id} label={props.label} description={props.description} className={props.className}>
|
|
49
50
|
<div aria-checked={getToggleValue()} className={`dx-toggle-container${props.disabled ? ' disabled' : ''}`}>
|
|
50
51
|
<div className="dx-toggle" onClick={setToggleValue}>
|
|
51
52
|
{value !== false ? <GenesysDevIcon icon={falseIcon} /> : undefined}
|
package/src/index.ts
CHANGED
|
@@ -51,6 +51,10 @@ export interface VoidEventCallback {
|
|
|
51
51
|
(): void;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
export interface BaseComponentProps {
|
|
55
|
+
id?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
// Item in a DxItemGroup
|
|
55
59
|
export interface DxItemGroupItem {
|
|
56
60
|
label: string;
|
|
@@ -73,7 +77,7 @@ export interface ItemGroupChangedCallback {
|
|
|
73
77
|
(items: DxItemGroupItemValue[]): void;
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
export interface DxToggleProps {
|
|
80
|
+
export interface DxToggleProps extends BaseComponentProps {
|
|
77
81
|
isTriState?: boolean;
|
|
78
82
|
initialValue?: boolean;
|
|
79
83
|
value?: boolean;
|
|
@@ -88,7 +92,7 @@ export interface DxToggleProps {
|
|
|
88
92
|
|
|
89
93
|
export type DxTextboxType = 'text' | 'textarea' | 'password' | 'email' | 'date' | 'datetime-local' | 'time' | 'integer' | 'decimal';
|
|
90
94
|
|
|
91
|
-
export interface DxTextboxProps {
|
|
95
|
+
export interface DxTextboxProps extends BaseComponentProps {
|
|
92
96
|
initialValue?: string;
|
|
93
97
|
value?: string;
|
|
94
98
|
inputType?: DxTextboxType;
|
|
@@ -109,19 +113,19 @@ export interface DxTextboxProps {
|
|
|
109
113
|
onKeyboardEvent?: { (event: KeyboardEvent): void };
|
|
110
114
|
}
|
|
111
115
|
|
|
112
|
-
export interface DxAccordionProps {
|
|
116
|
+
export interface DxAccordionProps extends BaseComponentProps {
|
|
117
|
+
containerId?: string; // Deprecated, use id
|
|
113
118
|
title: React.ReactNode;
|
|
114
119
|
children: React.ReactNode;
|
|
115
120
|
showOpen?: boolean;
|
|
116
121
|
className?: string;
|
|
117
122
|
expandTrigger?: any;
|
|
118
123
|
showOpenTrigger?: any;
|
|
119
|
-
containerId?: string;
|
|
120
124
|
headingIcon?: any;
|
|
121
125
|
headingColor?: string;
|
|
122
126
|
}
|
|
123
127
|
|
|
124
|
-
export interface DxItemGroupProps {
|
|
128
|
+
export interface DxItemGroupProps extends BaseComponentProps {
|
|
125
129
|
title?: string;
|
|
126
130
|
description?: string;
|
|
127
131
|
format: DxItemGroupFormat;
|
|
@@ -134,13 +138,13 @@ export interface DxItemGroupProps {
|
|
|
134
138
|
|
|
135
139
|
export type DxItemGroupFormat = 'checkbox' | 'radio' | 'dropdown' | 'multiselect';
|
|
136
140
|
|
|
137
|
-
export interface DxTabbedContentProps {
|
|
141
|
+
export interface DxTabbedContentProps extends BaseComponentProps {
|
|
138
142
|
children: React.ReactNode;
|
|
139
143
|
initialTabId?: number;
|
|
140
144
|
className?: string;
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
export interface DxTabPanelProps {
|
|
147
|
+
export interface DxTabPanelProps extends BaseComponentProps {
|
|
144
148
|
title: React.ReactNode;
|
|
145
149
|
children: React.ReactNode;
|
|
146
150
|
className?: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
+
import { BaseComponentProps } from '..';
|
|
4
|
+
|
|
3
5
|
import './LoadingPlaceholder.scss';
|
|
4
6
|
|
|
5
7
|
// SimCity loading messages! https://gist.github.com/erikcox/7e96d031d00d7ecb1a2f
|
|
@@ -95,13 +97,13 @@ const MESSAGES = [
|
|
|
95
97
|
'Unable to Reveal Current Activity',
|
|
96
98
|
];
|
|
97
99
|
|
|
98
|
-
interface IProps {
|
|
100
|
+
interface IProps extends BaseComponentProps {
|
|
99
101
|
text?: string;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
export default function LoadingPlaceholder(props: IProps) {
|
|
103
105
|
return (
|
|
104
|
-
<div className="loading-placeholder">
|
|
106
|
+
<div id={props.id} className="loading-placeholder">
|
|
105
107
|
<span className="text">{props.text || MESSAGES[Math.floor(Math.random() * (MESSAGES.length - 1))]}</span>
|
|
106
108
|
<div></div>
|
|
107
109
|
<div></div>
|