playbook_ui 15.5.0.pre.rc.1 → 15.5.0.pre.rc.2
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_currency/docs/_currency_abbreviated.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_matching_decimals_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +10 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_rails.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_no_symbol_react.md +1 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +7 -0
- data/app/pb_kits/playbook/pb_currency/docs/_description.md +2 -2
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -61
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_focus.html.erb +2 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +11 -19
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_simple.html.erb +1 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky.html.erb +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor.rb +7 -16
- data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
- data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
- data/dist/chunks/{_line_graph-8BUASxIP.js → _line_graph-BuucBJlH.js} +1 -1
- data/dist/chunks/_typeahead-VFd5WMRg.js +6 -0
- data/dist/chunks/{_weekday_stacked-EQMaMJvC.js → _weekday_stacked-B4_b9xef.js} +2 -2
- data/dist/chunks/{lib-CzQFzKzw.js → lib-COXg9aPA.js} +1 -1
- data/dist/chunks/{pb_form_validation-Bf9TK15t.js → pb_form_validation-DR765aoq.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +19 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +20 -10
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_inline_rails.md +0 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_sticky_rails.md +0 -1
- data/dist/chunks/_typeahead-DESMSfUO.js +0 -24
|
@@ -18,15 +18,9 @@ module Playbook
|
|
|
18
18
|
default: false
|
|
19
19
|
|
|
20
20
|
prop :value
|
|
21
|
+
prop :template
|
|
21
22
|
prop :placeholder
|
|
22
23
|
prop :input_options
|
|
23
|
-
prop :advanced_editor_toolbar, type: Playbook::Props::Boolean,
|
|
24
|
-
default: true
|
|
25
|
-
prop :extensions, type: Playbook::Props::HashArray,
|
|
26
|
-
default: []
|
|
27
|
-
prop :max_width, type: Playbook::Props::Enum,
|
|
28
|
-
values: %w[xs sm md lg xl],
|
|
29
|
-
default: "md"
|
|
30
24
|
|
|
31
25
|
def classname
|
|
32
26
|
generate_classname("pb_rich_text_editor_kit", simple_class, focus_class, sticky_class, separator: " ")
|
|
@@ -46,20 +40,17 @@ module Playbook
|
|
|
46
40
|
|
|
47
41
|
def rich_text_options
|
|
48
42
|
{
|
|
49
|
-
advancedEditorToolbar: advanced_editor_toolbar,
|
|
50
|
-
className: classname,
|
|
51
|
-
extensions: extensions,
|
|
52
|
-
focus: focus,
|
|
53
43
|
id: id,
|
|
54
44
|
inline: inline,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
placeholder: placeholder,
|
|
58
|
-
railsEditor: true,
|
|
45
|
+
className: classname,
|
|
46
|
+
focus: focus,
|
|
59
47
|
simple: simple,
|
|
60
48
|
sticky: sticky,
|
|
61
49
|
toolbarBottom: toolbar_bottom,
|
|
62
|
-
value: value
|
|
50
|
+
value: value,
|
|
51
|
+
template: template,
|
|
52
|
+
placeholder: placeholder,
|
|
53
|
+
inputOptions: input_options,
|
|
63
54
|
}
|
|
64
55
|
end
|
|
65
56
|
end
|
|
@@ -119,21 +119,22 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
|
119
119
|
header.classList.add('sticky-left-shadow');
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
123
|
+
accumulatedWidth += headerWidth;
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
cells.forEach((cell) => {
|
|
126
|
+
cell.classList.add('sticky');
|
|
127
|
+
(cell as HTMLElement).style.left = `${accumulatedWidth - headerWidth}px`;
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
if (!isLastColumn) {
|
|
130
|
+
cell.classList.add('with-border-right');
|
|
131
|
+
cell.classList.remove('sticky-left-shadow');
|
|
132
|
+
} else {
|
|
133
|
+
cell.classList.remove('with-border-right');
|
|
134
|
+
cell.classList.add('sticky-left-shadow');
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
137
138
|
});
|
|
138
139
|
};
|
|
139
140
|
|
|
@@ -170,21 +171,22 @@ const Table = (props: TableProps): React.ReactElement => {
|
|
|
170
171
|
header.classList.add('sticky-right-shadow');
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
175
|
+
accumulatedWidth += headerWidth;
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
cells.forEach((cell) => {
|
|
178
|
+
cell.classList.add('sticky');
|
|
179
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - headerWidth}px`;
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
181
|
+
if (!isLastColumn) {
|
|
182
|
+
cell.classList.add('with-border-left');
|
|
183
|
+
cell.classList.remove('sticky-right-shadow');
|
|
184
|
+
} else {
|
|
185
|
+
cell.classList.remove('with-border-left');
|
|
186
|
+
cell.classList.add('sticky-right-shadow');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
188
190
|
});
|
|
189
191
|
};
|
|
190
192
|
|
|
@@ -213,10 +213,24 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
|
|
213
213
|
|
|
214
214
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
|
215
215
|
const keys: string[] = Object.keys(prop)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
const screenSizeValues = ["xs", "sm", "md", "lg", "xl"]
|
|
217
|
+
let classResult = ''
|
|
218
|
+
|
|
219
|
+
// Handle default value separately (generates base class without size prefix)
|
|
220
|
+
if (prop.default !== undefined) {
|
|
221
|
+
const defaultValue: string = typeof(prop.default) === 'string' ? camelToSnakeCase(prop.default) : prop.default
|
|
222
|
+
classResult += `${classPrefix}_${defaultValue} `
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Handle responsive sizes (generates classes with size prefix)
|
|
226
|
+
keys.forEach((key) => {
|
|
227
|
+
if (screenSizeValues.includes(key)) {
|
|
228
|
+
const propValue: string = typeof(prop[key]) === 'string' ? camelToSnakeCase(prop[key]) : prop[key]
|
|
229
|
+
classResult += `${classPrefix}_${key}_${propValue} `
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
return classResult.trim()
|
|
220
234
|
}
|
|
221
235
|
|
|
222
236
|
//reusable function for top, bottom, right and left props
|
|
@@ -436,9 +450,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
|
436
450
|
if (typeof zIndexEntry[1] == "number") {
|
|
437
451
|
css += `z_index_${zIndexEntry[1]} `
|
|
438
452
|
} else if (typeof zIndexEntry[1] == "object") {
|
|
439
|
-
|
|
440
|
-
|
|
453
|
+
const responsiveObj: {[key: string]: string} = {}
|
|
454
|
+
Object.entries(zIndexEntry[1]).forEach(([key, value]) => {
|
|
455
|
+
responsiveObj[key] = value.toString()
|
|
441
456
|
})
|
|
457
|
+
css += getResponsivePropClasses(responsiveObj, 'z_index')
|
|
442
458
|
} else if (zIndexEntry[1] === 'max') {
|
|
443
459
|
css += `z_index_max `
|
|
444
460
|
}
|
|
@@ -463,9 +479,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
|
463
479
|
if (typeof displayEntry[1] == "string") {
|
|
464
480
|
css += `display_${displayEntry[1]} `
|
|
465
481
|
} else if (typeof displayEntry[1] == "object") {
|
|
466
|
-
|
|
467
|
-
|
|
482
|
+
const responsiveObj: {[key: string]: string} = {}
|
|
483
|
+
Object.entries(displayEntry[1]).forEach(([key, value]) => {
|
|
484
|
+
responsiveObj[key] = typeof value === 'string' ? value : value.toString()
|
|
468
485
|
})
|
|
486
|
+
css += getResponsivePropClasses(responsiveObj, 'display')
|
|
469
487
|
} else {
|
|
470
488
|
' '
|
|
471
489
|
}
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
alignContent={{ default: "spaceAround", xs: "center", sm: "spaceAround", md: "center" }}
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`align_content_space_around`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`align_content_xs_center`)
|
|
53
|
+
expect(kit).toHaveClass(`align_content_sm_space_around`)
|
|
54
|
+
expect(kit).toHaveClass(`align_content_md_center`)
|
|
55
|
+
})
|
|
@@ -34,3 +34,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
34
34
|
})
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
|
+
|
|
38
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
39
|
+
const testId = `${testSubject}-default-responsive`
|
|
40
|
+
render(
|
|
41
|
+
<Body
|
|
42
|
+
alignItems={{ default: "end", xs: "center", sm: "end", md: "center" }}
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
text="Hi"
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
const kit = screen.getByTestId(testId)
|
|
48
|
+
// Should have base class for default value
|
|
49
|
+
expect(kit).toHaveClass(`align_items_end`)
|
|
50
|
+
// Should have responsive classes for screen sizes
|
|
51
|
+
expect(kit).toHaveClass(`align_items_xs_center`)
|
|
52
|
+
expect(kit).toHaveClass(`align_items_sm_end`)
|
|
53
|
+
expect(kit).toHaveClass(`align_items_md_center`)
|
|
54
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
alignSelf={{ default: "end", xs: "center", sm: "end", md: "center" }}
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`align_self_end`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`align_self_xs_center`)
|
|
53
|
+
expect(kit).toHaveClass(`align_self_sm_end`)
|
|
54
|
+
expect(kit).toHaveClass(`align_self_md_center`)
|
|
55
|
+
})
|
|
@@ -36,3 +36,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
|
+
|
|
40
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
41
|
+
const testId = `${testSubject}-default-responsive`
|
|
42
|
+
render(
|
|
43
|
+
<Body
|
|
44
|
+
data={{ testid: testId }}
|
|
45
|
+
display={{ default: "none", xs: "block", sm: "none", md: "block" }}
|
|
46
|
+
text="Hi"
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
const kit = screen.getByTestId(testId)
|
|
50
|
+
// Should have base class for default value
|
|
51
|
+
expect(kit).toHaveClass(`display_none`)
|
|
52
|
+
// Should have responsive classes for screen sizes
|
|
53
|
+
expect(kit).toHaveClass(`display_xs_block`)
|
|
54
|
+
expect(kit).toHaveClass(`display_sm_none`)
|
|
55
|
+
expect(kit).toHaveClass(`display_md_block`)
|
|
56
|
+
})
|
|
@@ -62,3 +62,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
62
62
|
})
|
|
63
63
|
}
|
|
64
64
|
})
|
|
65
|
+
|
|
66
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
67
|
+
const testId = `${testSubject}-default-responsive`
|
|
68
|
+
render(
|
|
69
|
+
<Body
|
|
70
|
+
data={{ testid: testId }}
|
|
71
|
+
flex={{ default: "3", xs: "1", sm: "3", md: "1" }}
|
|
72
|
+
text="Hi"
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
const kit = screen.getByTestId(testId)
|
|
76
|
+
// Should have base class for default value
|
|
77
|
+
expect(kit).toHaveClass(`flex_3`)
|
|
78
|
+
// Should have responsive classes for screen sizes
|
|
79
|
+
expect(kit).toHaveClass(`flex_xs_1`)
|
|
80
|
+
expect(kit).toHaveClass(`flex_sm_3`)
|
|
81
|
+
expect(kit).toHaveClass(`flex_md_1`)
|
|
82
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
flexDirection={{ default: "column", xs: "row", sm: "column", md: "row" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`flex_direction_column`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`flex_direction_xs_row`)
|
|
53
|
+
expect(kit).toHaveClass(`flex_direction_sm_column`)
|
|
54
|
+
expect(kit).toHaveClass(`flex_direction_md_row`)
|
|
55
|
+
})
|
|
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
|
+
|
|
37
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
38
|
+
const testId = `${testSubject}-default-responsive`
|
|
39
|
+
render(
|
|
40
|
+
<Body
|
|
41
|
+
data={{ testid: testId }}
|
|
42
|
+
flexGrow={{ default: 1, xs: 0, sm: 1, md: 0 }}
|
|
43
|
+
text="Hi"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
const kit = screen.getByTestId(testId)
|
|
47
|
+
// Should have base class for default value
|
|
48
|
+
expect(kit).toHaveClass(`flex_grow_1`)
|
|
49
|
+
// Should have responsive classes for screen sizes
|
|
50
|
+
expect(kit).toHaveClass(`flex_grow_xs_0`)
|
|
51
|
+
expect(kit).toHaveClass(`flex_grow_sm_1`)
|
|
52
|
+
expect(kit).toHaveClass(`flex_grow_md_0`)
|
|
53
|
+
})
|
|
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
|
+
|
|
37
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
38
|
+
const testId = `${testSubject}-default-responsive`
|
|
39
|
+
render(
|
|
40
|
+
<Body
|
|
41
|
+
data={{ testid: testId }}
|
|
42
|
+
flexShrink={{ default: 0, xs: 1, sm: 0, md: 1 }}
|
|
43
|
+
text="Hi"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
const kit = screen.getByTestId(testId)
|
|
47
|
+
// Should have base class for default value
|
|
48
|
+
expect(kit).toHaveClass(`flex_shrink_0`)
|
|
49
|
+
// Should have responsive classes for screen sizes
|
|
50
|
+
expect(kit).toHaveClass(`flex_shrink_xs_1`)
|
|
51
|
+
expect(kit).toHaveClass(`flex_shrink_sm_0`)
|
|
52
|
+
expect(kit).toHaveClass(`flex_shrink_md_1`)
|
|
53
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
flexWrap={{ default: "wrap", xs: "nowrap", sm: "wrap", md: "nowrap" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`flex_wrap_wrap`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`flex_wrap_xs_nowrap`)
|
|
53
|
+
expect(kit).toHaveClass(`flex_wrap_sm_wrap`)
|
|
54
|
+
expect(kit).toHaveClass(`flex_wrap_md_nowrap`)
|
|
55
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
justifyContent={{ default: "spaceBetween", xs: "start", sm: "spaceBetween", md: "start" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`justify_content_space_between`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`justify_content_xs_start`)
|
|
53
|
+
expect(kit).toHaveClass(`justify_content_sm_space_between`)
|
|
54
|
+
expect(kit).toHaveClass(`justify_content_md_start`)
|
|
55
|
+
})
|
|
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
40
|
+
const testId = `${testSubject}-default-responsive`
|
|
41
|
+
render(
|
|
42
|
+
<Body
|
|
43
|
+
data={{ testid: testId }}
|
|
44
|
+
justifySelf={{ default: "end", xs: "start", sm: "end", md: "center" }}
|
|
45
|
+
text="Hi"
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
const kit = screen.getByTestId(testId)
|
|
49
|
+
// Should have base class for default value
|
|
50
|
+
expect(kit).toHaveClass(`justify_self_end`)
|
|
51
|
+
// Should have responsive classes for screen sizes
|
|
52
|
+
expect(kit).toHaveClass(`justify_self_xs_start`)
|
|
53
|
+
expect(kit).toHaveClass(`justify_self_sm_end`)
|
|
54
|
+
expect(kit).toHaveClass(`justify_self_md_center`)
|
|
55
|
+
})
|
|
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
|
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
})
|
|
36
|
+
|
|
37
|
+
test('Global Props: returns proper class name with default key', () => {
|
|
38
|
+
const testId = `${testSubject}-default-responsive`
|
|
39
|
+
render(
|
|
40
|
+
<Body
|
|
41
|
+
data={{ testid: testId }}
|
|
42
|
+
order={{ default: 3, xs: 1, sm: 3, md: 1 }}
|
|
43
|
+
text="Hi"
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
const kit = screen.getByTestId(testId)
|
|
47
|
+
// Should have base class for default value
|
|
48
|
+
expect(kit).toHaveClass(`flex_order_3`)
|
|
49
|
+
// Should have responsive classes for screen sizes
|
|
50
|
+
expect(kit).toHaveClass(`flex_order_xs_1`)
|
|
51
|
+
expect(kit).toHaveClass(`flex_order_sm_3`)
|
|
52
|
+
expect(kit).toHaveClass(`flex_order_md_1`)
|
|
53
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-DESMSfUO.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CzQFzKzw.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
|
|
1
|
+
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-VFd5WMRg.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-COXg9aPA.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
|