playbook_ui 14.24.0.pre.alpha.PLAY1984responsivegapprops9652 → 14.24.0.pre.alpha.PLAY2116datepickercursorfix9610
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_advanced_table/Components/RegularTableView.tsx +1 -4
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +19 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +0 -3
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +6 -9
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.html.erb +1 -12
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.jsx +1 -26
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.md +9 -0
- data/app/pb_kits/playbook/pb_flex/flex.rb +12 -6
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +15 -0
- data/app/pb_kits/playbook/utilities/_gap.scss +24 -12
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +4 -28
- data/dist/chunks/{_line_graph-B9yItXkt.js → _line_graph-Bs1q77QJ.js} +1 -1
- data/dist/chunks/_typeahead-DDDKDPZS.js +6 -0
- data/dist/chunks/{_weekday_stacked-C-5U1QRT.js → _weekday_stacked-DkFv7FEh.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/classnames.rb +0 -2
- data/lib/playbook/spacing.rb +1 -53
- data/lib/playbook/version.rb +1 -1
- metadata +6 -7
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_rails.md +0 -11
- data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_react.md +0 -11
- data/dist/chunks/_typeahead-Mbp0CWgZ.js +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151efff8e8919ee754e1a1aca5222e70bc7735ea5fbbc7f5447251fec5c9253d
|
4
|
+
data.tar.gz: f150ecf4dbff7c034aef1475c0b6f10c0654da5a9e4326ef68cec2bbeded2db3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ac762524de32467af5a48e79dedb6ff9d146fffa4e94d31e534b49053a99d75b1961af8ffd3480503389a5f730a48102814238ed64d0166941db4eea69e23f
|
7
|
+
data.tar.gz: 889f58a73872c045d76a5fb24785ac9ec994a77a22b9c4c62f99d3472efe0e727987ac7dec8f3b7f9cbb85934365c5fc155ce07e717cb460e7805292d893289d
|
@@ -134,15 +134,13 @@ export const RegularTableView = ({
|
|
134
134
|
const columnDefinitions = table.options.meta?.columnDefinitions || [];
|
135
135
|
// Row pinning
|
136
136
|
function PinnedRow({ row }: { row: Row<any> }) {
|
137
|
-
const customRowStyle = rowStyling?.length > 0 && rowStyling?.find((s: GenericObject) => s?.rowId === row.id);
|
138
137
|
return (
|
139
138
|
<tr
|
140
139
|
className={classnames(
|
141
140
|
`pinned-row`,
|
142
141
|
)}
|
143
142
|
style={{
|
144
|
-
backgroundColor:
|
145
|
-
color: customRowStyle?.fontColor,
|
143
|
+
backgroundColor: 'white',
|
146
144
|
position: 'sticky',
|
147
145
|
top:
|
148
146
|
row.getIsPinned() === 'top'
|
@@ -155,7 +153,6 @@ export const RegularTableView = ({
|
|
155
153
|
collapsibleTrail={collapsibleTrail}
|
156
154
|
columnDefinitions={columnDefinitions}
|
157
155
|
columnPinning={columnPinning}
|
158
|
-
customRowStyle={customRowStyle}
|
159
156
|
loading={loading}
|
160
157
|
row={row}
|
161
158
|
stickyLeftColumn={stickyLeftColumn}
|
@@ -4,6 +4,7 @@ import classnames from 'classnames'
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
5
|
import { deprecatedProps, globalProps, GlobalProps } from '../utilities/globalProps'
|
6
6
|
import { getAllIcons } from "../utilities/icons/allicons"
|
7
|
+
import { camelToSnakeCase } from '../utilities/text'
|
7
8
|
|
8
9
|
import datePickerHelper from './date_picker_helper'
|
9
10
|
import Icon from '../pb_icon/_icon'
|
@@ -114,6 +115,20 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
114
115
|
const inputAriaProps = buildAriaProps(inputAria)
|
115
116
|
const inputDataProps = buildDataProps(inputData)
|
116
117
|
|
118
|
+
// Convert cursor prop to CSS-style format to apply to input tag below
|
119
|
+
const getCursorStyle = (cursor?: string): string => {
|
120
|
+
// If input is disabled, always use 'not-allowed'
|
121
|
+
if (disableInput) return 'not-allowed'
|
122
|
+
|
123
|
+
// If cursor prop is provided, convert it to styling format
|
124
|
+
if (cursor) {
|
125
|
+
return camelToSnakeCase(cursor).replace(/_/g, '-')
|
126
|
+
}
|
127
|
+
|
128
|
+
// Default to 'pointer'
|
129
|
+
return 'pointer'
|
130
|
+
}
|
131
|
+
|
117
132
|
useEffect(() => {
|
118
133
|
datePickerHelper({
|
119
134
|
allowInput,
|
@@ -149,6 +164,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
149
164
|
required: false,
|
150
165
|
}, scrollContainer)
|
151
166
|
}, initializeOnce ? [] : undefined)
|
167
|
+
|
152
168
|
const filteredProps = {...props}
|
153
169
|
if (filteredProps.marginBottom === undefined) {
|
154
170
|
filteredProps.marginBottom = "sm"
|
@@ -163,6 +179,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
163
179
|
error ? 'error' : null,
|
164
180
|
className
|
165
181
|
)
|
182
|
+
|
166
183
|
const iconWrapperClass = () => {
|
167
184
|
let base = 'cal_icon_wrapper'
|
168
185
|
if (dark) {
|
@@ -176,6 +193,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
176
193
|
}
|
177
194
|
return base
|
178
195
|
}
|
196
|
+
|
179
197
|
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
180
198
|
|
181
199
|
return (
|
@@ -206,6 +224,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
206
224
|
name={name}
|
207
225
|
onChange={inputOnChange}
|
208
226
|
placeholder={placeholder}
|
227
|
+
style={{ cursor: getCursorStyle(filteredProps.cursor) }}
|
209
228
|
value={inputValue}
|
210
229
|
/>
|
211
230
|
|
@@ -1 +1 @@
|
|
1
|
-
<%= pb_rails("date_picker", props: { picker_id: "date-picker-default"}) %>
|
1
|
+
<%= pb_rails("date_picker", props: { cursor: "notAllowed", picker_id: "date-picker-default"}) %>
|
@@ -284,9 +284,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
284
284
|
this.adjustDropdownHeight();
|
285
285
|
}
|
286
286
|
});
|
287
|
-
this.element.querySelector(DROPDOWN_INPUT).value = Array.from(this.selectedOptions)
|
288
|
-
.map((opt) => JSON.parse(opt).id)
|
289
|
-
.join(",");
|
290
287
|
} else {
|
291
288
|
options.forEach((option) => {
|
292
289
|
option.classList.remove("pb_dropdown_option_selected");
|
@@ -4,9 +4,6 @@ import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
4
4
|
import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
|
5
5
|
import { GenericObject, Sizes } from '../types'
|
6
6
|
|
7
|
-
type SizeType = Sizes | "none"
|
8
|
-
type SizeResponsiveType = { [key: string]: SizeType }
|
9
|
-
|
10
7
|
type FlexProps = {
|
11
8
|
children: React.ReactChild[] | React.ReactNode,
|
12
9
|
className?: string,
|
@@ -21,9 +18,9 @@ type FlexProps = {
|
|
21
18
|
reverse?: boolean,
|
22
19
|
vertical?: "top" | "center" | "bottom" | "stretch" | "baseline" | "none",
|
23
20
|
align?: "start" | "center" | "end" | "stretch" | "baseline" | "none",
|
24
|
-
gap?:
|
25
|
-
rowGap?:
|
26
|
-
columnGap?:
|
21
|
+
gap?: Sizes | "none",
|
22
|
+
rowGap?: Sizes| "none",
|
23
|
+
columnGap?: Sizes| "none",
|
27
24
|
wrap?: boolean,
|
28
25
|
alignSelf?: "start" | "end" | "center" | "stretch" | "none"
|
29
26
|
} & GlobalProps
|
@@ -56,9 +53,9 @@ const Flex = (props: FlexProps): React.ReactElement => {
|
|
56
53
|
const alignClass = align !== 'none' ? `align_items_${align}` : `align_items_${vertical}`
|
57
54
|
const inlineClass = inline === true ? 'inline' : ''
|
58
55
|
const spacingClass = spacing !== undefined ? `spacing_${spacing}` : ''
|
59
|
-
const gapClass =
|
60
|
-
const rowGapClass =
|
61
|
-
const columnGapClass =
|
56
|
+
const gapClass = gap !== 'none' ? `gap_${gap}` : ''
|
57
|
+
const rowGapClass = rowGap !== 'none' ? `rowGap_${rowGap}` : ''
|
58
|
+
const columnGapClass = columnGap !== 'none' ? `columnGap_${columnGap}` : ''
|
62
59
|
const wrapClass = wrap === true ? 'wrap' : ''
|
63
60
|
const reverseClass = reverse === true ? 'reverse' : ''
|
64
61
|
const alignSelfClass = alignSelf !== 'none' ? `align_self_${alignSelf}` : ''
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= pb_rails("title", props: {size: 4, text: "
|
1
|
+
<%= pb_rails("title", props: {size: 4, text: "Row"}) %>
|
2
2
|
<br/>
|
3
3
|
<div class="flex-doc-example">
|
4
4
|
<%= pb_rails("flex", props:{ gap: "xxs", wrap:true}) do %>
|
@@ -31,14 +31,3 @@
|
|
31
31
|
<%= pb_rails("flex/flex_item") do %>4<% end %>
|
32
32
|
<% end %>
|
33
33
|
</div>
|
34
|
-
|
35
|
-
<br/><br/>
|
36
|
-
<%= pb_rails("title", props: {size: 4, text: "Responsive"}) %>
|
37
|
-
<br/>
|
38
|
-
<div class="flex-doc-example">
|
39
|
-
<%= pb_rails("flex", props: { gap: { xs: "none", sm: "sm", md: "md", lg: "lg", xl: "xl" }, wrap: true }) do %>
|
40
|
-
<% 40.times do |i| %>
|
41
|
-
<%= pb_rails("flex/flex_item") do %> <%=i%> <% end %>
|
42
|
-
<% end %>
|
43
|
-
<% end %>
|
44
|
-
</div>
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import Flex from '../../pb_flex/_flex'
|
3
3
|
import FlexItem from '../../pb_flex/_flex_item'
|
4
|
-
import Title from '../../pb_title/_title'
|
5
4
|
|
6
5
|
const FlexGap = (props) => {
|
7
6
|
const count = () => {
|
@@ -14,8 +13,6 @@ const FlexGap = (props) => {
|
|
14
13
|
|
15
14
|
return (
|
16
15
|
<>
|
17
|
-
<Title size={4}>Gap</Title>
|
18
|
-
<br />
|
19
16
|
<div className="flex-doc-example">
|
20
17
|
<Flex
|
21
18
|
gap="xxs"
|
@@ -30,10 +27,8 @@ const FlexGap = (props) => {
|
|
30
27
|
</Flex>
|
31
28
|
</div>
|
32
29
|
|
33
|
-
<br /><br />
|
34
|
-
|
35
|
-
<Title size={4}>Column Gap</Title>
|
36
30
|
<br />
|
31
|
+
|
37
32
|
<div className="flex-doc-example">
|
38
33
|
<Flex
|
39
34
|
columnGap="lg"
|
@@ -53,9 +48,6 @@ const FlexGap = (props) => {
|
|
53
48
|
</FlexItem>
|
54
49
|
</Flex>
|
55
50
|
</div>
|
56
|
-
<br /><br />
|
57
|
-
|
58
|
-
<Title size={4}>Row Gap</Title>
|
59
51
|
<br />
|
60
52
|
<div className="flex-doc-example">
|
61
53
|
<Flex
|
@@ -77,23 +69,6 @@ const FlexGap = (props) => {
|
|
77
69
|
</FlexItem>
|
78
70
|
</Flex>
|
79
71
|
</div>
|
80
|
-
|
81
|
-
<br /><br />
|
82
|
-
<Title size={4}>Responsive</Title>
|
83
|
-
<br />
|
84
|
-
<div className="flex-doc-example">
|
85
|
-
<Flex
|
86
|
-
gap={{ xs: "none", sm: "sm", md: "md", lg: "lg", xl: "xl" }}
|
87
|
-
wrap
|
88
|
-
{...props}
|
89
|
-
>
|
90
|
-
{count().map((v, key) => (
|
91
|
-
<FlexItem key={key}>
|
92
|
-
{v}
|
93
|
-
</FlexItem>
|
94
|
-
))}
|
95
|
-
</Flex>
|
96
|
-
</div>
|
97
72
|
</>
|
98
73
|
)
|
99
74
|
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
##### Prop
|
2
|
+
|
3
|
+
* `gap` | `row_gap` | `rowGap` | `column_gap` | `columnGap` | **Type**: String | **Values**: xxs | xs | sm | md | lg | xl | none
|
4
|
+
|
5
|
+
- Setting the gap prop sets the row_gap || rowGap and the column_gap || columnGap props to the same size and creates equal space within a flex container.
|
6
|
+
|
7
|
+
- Setting the row_gap || rowGap prop creates space between rows in a flex container.
|
8
|
+
|
9
|
+
- Setting the column_gap || columnGap prop creates space between columns in a flex container.
|
@@ -24,11 +24,17 @@ module Playbook
|
|
24
24
|
default: "none",
|
25
25
|
deprecated: true
|
26
26
|
|
27
|
-
prop :gap
|
27
|
+
prop :gap, type: Playbook::Props::Enum,
|
28
|
+
values: %w[xxs xs sm md lg xl none],
|
29
|
+
default: "none"
|
28
30
|
|
29
|
-
prop :row_gap
|
31
|
+
prop :row_gap, type: Playbook::Props::Enum,
|
32
|
+
values: %w[xxs xs sm md lg xl none],
|
33
|
+
default: "none"
|
30
34
|
|
31
|
-
prop :column_gap
|
35
|
+
prop :column_gap, type: Playbook::Props::Enum,
|
36
|
+
values: %w[xxs xs sm md lg xl none],
|
37
|
+
default: "none"
|
32
38
|
|
33
39
|
prop :reverse, type: Playbook::Props::Boolean,
|
34
40
|
default: false
|
@@ -127,7 +133,7 @@ module Playbook
|
|
127
133
|
end
|
128
134
|
|
129
135
|
def gap_class
|
130
|
-
if gap == "none"
|
136
|
+
if gap == "none"
|
131
137
|
nil
|
132
138
|
else
|
133
139
|
"gap_#{gap}"
|
@@ -135,7 +141,7 @@ module Playbook
|
|
135
141
|
end
|
136
142
|
|
137
143
|
def row_gap_class
|
138
|
-
if row_gap == "none"
|
144
|
+
if row_gap == "none"
|
139
145
|
nil
|
140
146
|
else
|
141
147
|
"rowGap_#{row_gap}"
|
@@ -143,7 +149,7 @@ module Playbook
|
|
143
149
|
end
|
144
150
|
|
145
151
|
def column_gap_class
|
146
|
-
if column_gap == "none"
|
152
|
+
if column_gap == "none"
|
147
153
|
nil
|
148
154
|
else
|
149
155
|
"columnGap_#{column_gap}"
|
@@ -77,6 +77,7 @@ module Playbook
|
|
77
77
|
name: mask.present? ? "" : name,
|
78
78
|
pattern: validation_pattern || mask_pattern,
|
79
79
|
placeholder: placeholder,
|
80
|
+
style: "cursor: #{cursor_style}",
|
80
81
|
required: required,
|
81
82
|
type: type,
|
82
83
|
value: value,
|
@@ -84,6 +85,20 @@ module Playbook
|
|
84
85
|
}.merge(input_options)
|
85
86
|
end
|
86
87
|
|
88
|
+
def cursor_style
|
89
|
+
# If input is disabled, always use 'not-allowed'
|
90
|
+
return "not-allowed" if disabled
|
91
|
+
|
92
|
+
# If cursor prop is provided, convert it to kebab-case
|
93
|
+
if cursor.present?
|
94
|
+
# Convert camelCase (ex. notAllowed) to kebab-case (ex. not-allowed)
|
95
|
+
cursor.to_s.gsub(/([a-z\d])([A-Z])/, '\1-\2').downcase
|
96
|
+
else
|
97
|
+
# Default to 'pointer'
|
98
|
+
"pointer"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
87
102
|
def validation_message
|
88
103
|
validation[:message] || ""
|
89
104
|
end
|
@@ -1,17 +1,29 @@
|
|
1
1
|
@import "spacing";
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
xs: $space_xs,
|
7
|
-
sm: $space_sm,
|
8
|
-
md: $space_md,
|
9
|
-
lg: $space_lg,
|
10
|
-
xl: $space_xl,
|
11
|
-
);
|
3
|
+
.gap_none {
|
4
|
+
gap: 0;
|
5
|
+
}
|
12
6
|
|
13
|
-
|
7
|
+
.gap_xxs {
|
8
|
+
gap: $space_xxs;
|
9
|
+
}
|
14
10
|
|
15
|
-
|
11
|
+
.gap_xs {
|
12
|
+
gap: $space_xs;
|
13
|
+
}
|
16
14
|
|
17
|
-
|
15
|
+
.gap_sm {
|
16
|
+
gap: $space_sm;
|
17
|
+
}
|
18
|
+
|
19
|
+
.gap_md {
|
20
|
+
gap: $space_md;
|
21
|
+
}
|
22
|
+
|
23
|
+
.gap_lg {
|
24
|
+
gap: $space_lg;
|
25
|
+
}
|
26
|
+
|
27
|
+
.gap_xl {
|
28
|
+
gap: $space_xl;
|
29
|
+
}
|
@@ -112,14 +112,6 @@ type Gap = {
|
|
112
112
|
gap?: string,
|
113
113
|
}
|
114
114
|
|
115
|
-
type ColumnGap = {
|
116
|
-
columnGap?: string,
|
117
|
-
}
|
118
|
-
|
119
|
-
type RowGap = {
|
120
|
-
rowGap?: string,
|
121
|
-
}
|
122
|
-
|
123
115
|
type NumberSpacing = {
|
124
116
|
numberSpacing?: "tabular",
|
125
117
|
}
|
@@ -208,7 +200,7 @@ type MinHeight = {
|
|
208
200
|
export type GlobalProps = AlignContent & AlignItems & AlignSelf &
|
209
201
|
BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
|
210
202
|
FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
|
211
|
-
LineHeight & Margin & Width & MinWidth & MaxWidth & Gap &
|
203
|
+
LineHeight & Margin & Width & MinWidth & MaxWidth & Gap & NumberSpacing & Order & Overflow & Padding &
|
212
204
|
Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
|
213
205
|
|
214
206
|
const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
|
@@ -385,25 +377,9 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
|
|
385
377
|
return css.trimEnd()
|
386
378
|
},
|
387
379
|
gapProps: ({ gap }: Gap) => {
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
return gap ? `gap_${gap}` : ''
|
392
|
-
}
|
393
|
-
},
|
394
|
-
columnGapProps: ({ columnGap }: ColumnGap) => {
|
395
|
-
if (typeof columnGap === 'object') {
|
396
|
-
return getResponsivePropClasses(columnGap, 'column_gap')
|
397
|
-
} else {
|
398
|
-
return columnGap ? `column_gap_${columnGap}` : ''
|
399
|
-
}
|
400
|
-
},
|
401
|
-
rowGapProps: ({ rowGap }: RowGap) => {
|
402
|
-
if (typeof rowGap === 'object') {
|
403
|
-
return getResponsivePropClasses(rowGap, 'row_gap')
|
404
|
-
} else {
|
405
|
-
return rowGap ? `row_gap_${rowGap}` : ''
|
406
|
-
}
|
380
|
+
let css = ''
|
381
|
+
css += gap ? `gap_${gap} ` : ''
|
382
|
+
return css.trimEnd()
|
407
383
|
},
|
408
384
|
minHeightProps: ({ minHeight }: MinHeight) => {
|
409
385
|
const heightValues = ["auto", "xs", "sm", "md", "lg", "xl", "xxl", "xxxl"]
|
@@ -1 +1 @@
|
|
1
|
-
import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-Mbp0CWgZ.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CY5ZPzic.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{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-DDDKDPZS.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CY5ZPzic.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};
|