playbook_ui 13.14.0.pre.alpha.play1106filter1751 → 13.14.0.pre.alpha.play1120lintdatepicker1797
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +5 -5
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +3 -3
- data/app/pb_kits/playbook/pb_background/_background.tsx +9 -9
- data/app/pb_kits/playbook/pb_badge/_badge.tsx +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +3 -3
- data/app/pb_kits/playbook/pb_body/_body.scss +0 -5
- data/app/pb_kits/playbook/pb_body/_body.tsx +5 -9
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +0 -20
- data/app/pb_kits/playbook/pb_body/body.rb +1 -8
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumb_item.tsx +3 -4
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.tsx +3 -3
- data/app/pb_kits/playbook/pb_button/_button.tsx +40 -37
- data/app/pb_kits/playbook/pb_button/docs/_button_props_swift.md +11 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction_swift.md +26 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.tsx +3 -3
- data/app/pb_kits/playbook/pb_caption/_caption.tsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +2 -2
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +5 -4
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +3 -3
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -9
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +5 -7
- data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +2 -2
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +5 -4
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +16 -12
- data/app/pb_kits/playbook/pb_contact/_contact.tsx +3 -3
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +4 -57
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +4 -57
- data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +20 -16
- data/app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.tsx +1 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +7 -7
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +8 -8
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +6 -3
- data/app/pb_kits/playbook/pb_detail/_detail.scss +2 -2
- data/app/pb_kits/playbook/pb_detail/_detail.tsx +5 -5
- data/app/pb_kits/playbook/pb_detail/detail.rb +1 -1
- data/app/pb_kits/playbook/pb_detail/detail.test.jsx +2 -2
- data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +2 -2
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +42 -34
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +4 -5
- data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_header.tsx +4 -4
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default_swift.md +11 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height.jsx +8 -4
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_full_height_placement.jsx +8 -4
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_props_table.md +13 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_scrollable.jsx +4 -2
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes_swift.md +18 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +1 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status_swift.md +14 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_distribution_bar/_distribution_bar.tsx +5 -5
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -1
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_hashtag/_hashtag.tsx +1 -1
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +1 -1
- data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
- data/app/pb_kits/playbook/pb_label_pill/_label_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +1 -1
- data/app/pb_kits/playbook/pb_layout/_layout.tsx +1 -1
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Header/_lightbox_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/_lightbox.tsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_list/_list.tsx +1 -1
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_map/_map.tsx +1 -1
- data/app/pb_kits/playbook/pb_message/_message.tsx +1 -1
- data/app/pb_kits/playbook/pb_message/_message_mention.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +1 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_nav/_nav.tsx +1 -1
- data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +1 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +1 -1
- data/app/pb_kits/playbook/pb_person/_person.tsx +1 -1
- data/app/pb_kits/playbook/pb_person/docs/_person_default_swift.md +8 -0
- data/app/pb_kits/playbook/pb_person/docs/_person_props_swift.md +5 -0
- data/app/pb_kits/playbook/pb_person/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_pill/_pill.tsx +1 -1
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/pb_popover/index.ts +1 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +1 -1
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step.tsx +1 -1
- data/app/pb_kits/playbook/pb_progress_step/_progress_step_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +1 -1
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +1 -1
- data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -1
- data/app/pb_kits/playbook/pb_select/_select.tsx +1 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_default_swift.md +15 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_error_swift.md +18 -0
- data/app/pb_kits/playbook/pb_select/docs/_select_props_table.md +8 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +5 -0
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +1 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +1 -1
- data/app/pb_kits/playbook/pb_source/_source.tsx +1 -1
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +1 -1
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +1 -1
- data/app/pb_kits/playbook/pb_stat_value/_stat_value.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/_table_row.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +1 -1
- data/app/pb_kits/playbook/pb_time/_time.tsx +1 -1
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +1 -1
- data/app/pb_kits/playbook/pb_title/_title.scss +0 -5
- data/app/pb_kits/playbook/pb_title/_title.tsx +2 -5
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -19
- data/app/pb_kits/playbook/pb_title/title.rb +2 -9
- data/app/pb_kits/playbook/pb_title_count/_title_count.tsx +1 -1
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +1 -1
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -1
- data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
- data/app/pb_kits/playbook/pb_user/docs/_user_horizontal_swift.md +37 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +10 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_size_swift.md +35 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_text_only_swift.md +27 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_vertical_size_swift.md +35 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +1 -1
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +1 -1
- data/app/pb_kits/playbook/tokens/exports/exports.d.ts +1 -0
- data/app/pb_kits/playbook/utilities/_truncate.scss +20 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +13 -2
- data/app/pb_kits/playbook/utilities/props.ts +2 -2
- data/app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js +21 -0
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/classnames.rb +1 -0
- data/lib/playbook/kit_base.rb +2 -0
- data/lib/playbook/truncate.rb +29 -0
- data/lib/playbook/version.rb +1 -1
- metadata +21 -2
@@ -53,8 +53,8 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
53
53
|
|
54
54
|
const calculateDateRange = (timePeriod: string, amount: number): Date[] => {
|
55
55
|
const endDate = new Date();
|
56
|
-
|
57
|
-
|
56
|
+
const startDate = new Date();
|
57
|
+
|
58
58
|
switch (timePeriod) {
|
59
59
|
case 'days':
|
60
60
|
startDate.setDate(endDate.getDate() - amount);
|
@@ -76,7 +76,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
76
76
|
}
|
77
77
|
return [startDate, endDate];
|
78
78
|
};
|
79
|
-
|
79
|
+
|
80
80
|
|
81
81
|
type rangesType = {
|
82
82
|
[key: string]: Date[]
|
@@ -95,7 +95,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean, customQuickPickDates: cust
|
|
95
95
|
'Last year': [lastYearStartDate, lastYearEndDate]
|
96
96
|
};
|
97
97
|
|
98
|
-
|
98
|
+
|
99
99
|
if (customQuickPickDates && Object.keys(customQuickPickDates).length !== 0) {
|
100
100
|
if (customQuickPickDates.dates.length && customQuickPickDates.override === false) {
|
101
101
|
customQuickPickDates.dates.forEach((item) => {
|
@@ -16,7 +16,7 @@ type DateRangeInlineProps = {
|
|
16
16
|
align?: "left" | "center" | "vertical";
|
17
17
|
size?: "sm" | "xs";
|
18
18
|
dark?: boolean;
|
19
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
19
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => any)};
|
20
20
|
icon?: boolean;
|
21
21
|
startDate?: Date;
|
22
22
|
endDate?: Date;
|
@@ -34,7 +34,7 @@ const dateTimeIso = (dateValue: Date) => {
|
|
34
34
|
return DateTime.toIso(dateValue);
|
35
35
|
};
|
36
36
|
|
37
|
-
const DateRangeInline = (props: DateRangeInlineProps) => {
|
37
|
+
const DateRangeInline = (props: DateRangeInlineProps): React.ReactElement => {
|
38
38
|
const {
|
39
39
|
icon = false,
|
40
40
|
dark = false,
|
@@ -15,12 +15,12 @@ type DateRangeStackedProps = {
|
|
15
15
|
data?: string,
|
16
16
|
dark?: boolean,
|
17
17
|
endDate: Date,
|
18
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
18
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
19
19
|
id?: string,
|
20
20
|
startDate: Date,
|
21
21
|
}
|
22
22
|
|
23
|
-
const DateRangeStacked = (props: DateRangeStackedProps) => {
|
23
|
+
const DateRangeStacked = (props: DateRangeStackedProps): React.ReactElement => {
|
24
24
|
const {
|
25
25
|
className,
|
26
26
|
dark = false,
|
@@ -15,7 +15,7 @@ type DateStackedProps = {
|
|
15
15
|
dark?: boolean;
|
16
16
|
data?: string;
|
17
17
|
date: Date;
|
18
|
-
htmlOptions?: { [key: string]: string | number | boolean |
|
18
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
19
19
|
size?: "sm" | "md";
|
20
20
|
id?: string;
|
21
21
|
reverse?: boolean;
|
@@ -26,7 +26,7 @@ const sizes: {sm: 4, md: 3} = {
|
|
26
26
|
md: 3,
|
27
27
|
};
|
28
28
|
|
29
|
-
const DateStacked = (props: DateStackedProps) => {
|
29
|
+
const DateStacked = (props: DateStackedProps): React.ReactElement => {
|
30
30
|
const {
|
31
31
|
align = "left",
|
32
32
|
bold = false,
|
@@ -56,9 +56,9 @@ const DateStacked = (props: DateStackedProps) => {
|
|
56
56
|
<>
|
57
57
|
{bold == false ? (
|
58
58
|
<div
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
{...dataProps}
|
60
|
+
{...htmlProps}
|
61
|
+
className={classes}
|
62
62
|
>
|
63
63
|
<div className="pb_date_stacked_day_month">
|
64
64
|
<Caption text={DateTime.toMonth(date).toUpperCase()} />
|
@@ -72,9 +72,9 @@ const DateStacked = (props: DateStackedProps) => {
|
|
72
72
|
</div>
|
73
73
|
) : (
|
74
74
|
<div
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
{...dataProps}
|
76
|
+
{...htmlProps}
|
77
|
+
className={classes}
|
78
78
|
>
|
79
79
|
<div className="pb_date_stacked_day_month">
|
80
80
|
<Title
|
@@ -14,7 +14,7 @@ type DateTimeProps = {
|
|
14
14
|
className?: string,
|
15
15
|
data?: { [key: string]: string; },
|
16
16
|
datetime: Date,
|
17
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
17
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
18
18
|
id?: string,
|
19
19
|
size?: "sm" | "md",
|
20
20
|
showDayOfWeek: boolean,
|
@@ -22,7 +22,7 @@ type DateTimeProps = {
|
|
22
22
|
timeZone?: string
|
23
23
|
}
|
24
24
|
|
25
|
-
const DateTime = (props: DateTimeProps) => {
|
25
|
+
const DateTime = (props: DateTimeProps): React.ReactElement => {
|
26
26
|
const {
|
27
27
|
align = 'left',
|
28
28
|
aria = {},
|
@@ -11,7 +11,7 @@ import TimeStacked from '../pb_time_stacked/_time_stacked'
|
|
11
11
|
import DateStacked from '../pb_date_stacked/_date_stacked'
|
12
12
|
|
13
13
|
type DateTimeStackedProps = {
|
14
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
14
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
15
15
|
id?: string,
|
16
16
|
date: Date,
|
17
17
|
datetime: Date,
|
@@ -14,11 +14,11 @@ type DateYearStackedProps = {
|
|
14
14
|
dark?: boolean,
|
15
15
|
data?: string,
|
16
16
|
date: Date,
|
17
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
17
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
18
18
|
id?: string,
|
19
19
|
}
|
20
20
|
|
21
|
-
const DateYearStacked = (props: DateYearStackedProps) => {
|
21
|
+
const DateYearStacked = (props: DateYearStackedProps): React.ReactElement => {
|
22
22
|
const {
|
23
23
|
align = 'left',
|
24
24
|
className,
|
@@ -21,7 +21,8 @@ describe("DateYearStacked Kit", () => {
|
|
21
21
|
render(
|
22
22
|
<DateYearStacked
|
23
23
|
data={{ testid: testId }}
|
24
|
-
date={new Date(Date.now())}
|
24
|
+
date={new Date(Date.now())}
|
25
|
+
/>
|
25
26
|
);
|
26
27
|
|
27
28
|
const kit = screen.getByTestId(testId);
|
@@ -32,7 +33,8 @@ describe("DateYearStacked Kit", () => {
|
|
32
33
|
render(
|
33
34
|
<DateYearStacked
|
34
35
|
data={{ testid: testId }}
|
35
|
-
date={new Date(Date.now())}
|
36
|
+
date={new Date(Date.now())}
|
37
|
+
/>
|
36
38
|
);
|
37
39
|
|
38
40
|
const kit = screen.getByTestId(testId);
|
@@ -44,7 +46,8 @@ describe("DateYearStacked Kit", () => {
|
|
44
46
|
render(
|
45
47
|
<DateYearStacked
|
46
48
|
data={{ testid: testId }}
|
47
|
-
date={new Date(Date.now())}
|
49
|
+
date={new Date(Date.now())}
|
50
|
+
/>
|
48
51
|
);
|
49
52
|
|
50
53
|
const kit = screen.getByTestId(testId);
|
@@ -6,13 +6,13 @@
|
|
6
6
|
@include pb_detail;
|
7
7
|
|
8
8
|
@each $color_name, $color_value in $pb_detail_colors {
|
9
|
-
&[class*=
|
9
|
+
&[class*=color_#{$color_name}] {
|
10
10
|
@include pb_detail($color_value);
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
14
14
|
@each $dark_color_name, $dark_color_value in $pb_dark_detail_colors{
|
15
|
-
&[class*=
|
15
|
+
&[class*=color_#{$dark_color_name}][class*=dark]{
|
16
16
|
@include pb_detail($dark_color_value)
|
17
17
|
}
|
18
18
|
}
|
@@ -11,13 +11,13 @@ type DetailProps = {
|
|
11
11
|
color?: 'light' | 'default' | 'lighter' | 'link' | 'error' | 'success',
|
12
12
|
dark?: boolean,
|
13
13
|
data?: { [key: string]: string },
|
14
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
14
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
15
15
|
id?: string,
|
16
16
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
|
17
17
|
text?: string,
|
18
18
|
} & GlobalProps
|
19
19
|
|
20
|
-
const Detail = (props: DetailProps) => {
|
20
|
+
const Detail = (props: DetailProps): React.ReactElement => {
|
21
21
|
const {
|
22
22
|
aria = {},
|
23
23
|
bold = false,
|
@@ -31,12 +31,12 @@ const Detail = (props: DetailProps) => {
|
|
31
31
|
text= ''
|
32
32
|
} = props
|
33
33
|
|
34
|
-
const ariaProps: {[key: string]:
|
35
|
-
const dataProps: {[key: string]:
|
34
|
+
const ariaProps: {[key: string]: string} = buildAriaProps(aria)
|
35
|
+
const dataProps: {[key: string]: string} = buildDataProps(data)
|
36
36
|
const htmlProps = buildHtmlProps(htmlOptions);
|
37
37
|
const isBold = bold ? "bold" : null
|
38
38
|
const classes = classnames(
|
39
|
-
buildCss('pb_detail_kit', color),
|
39
|
+
buildCss('pb_detail_kit', `color`, color),
|
40
40
|
isBold,
|
41
41
|
globalProps(props),
|
42
42
|
className
|
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
|
|
12
12
|
)
|
13
13
|
|
14
14
|
const kit = screen.getByTestId('primary-test')
|
15
|
-
expect(kit).toHaveClass('
|
15
|
+
expect(kit).toHaveClass('pb_detail_kit_color_light')
|
16
16
|
})
|
17
17
|
|
18
18
|
test('with colors', () => {
|
@@ -28,7 +28,7 @@ test('with colors', () => {
|
|
28
28
|
)
|
29
29
|
|
30
30
|
const kit = screen.getByTestId(testId)
|
31
|
-
expect(kit).toHaveClass(`
|
31
|
+
expect(kit).toHaveClass(`pb_detail_kit_color_${color}`)
|
32
32
|
})
|
33
33
|
})
|
34
34
|
|
@@ -2,10 +2,10 @@ import React from 'react'
|
|
2
2
|
import Icon from '../pb_icon/_icon'
|
3
3
|
|
4
4
|
type CloseIconProps = {
|
5
|
-
onClose: () =>
|
5
|
+
onClose: () => void,
|
6
6
|
}
|
7
7
|
|
8
|
-
export const CloseIcon = (props: CloseIconProps) => {
|
8
|
+
export const CloseIcon = (props: CloseIconProps): React.ReactElement => {
|
9
9
|
const { onClose } = props
|
10
10
|
return (
|
11
11
|
<div
|
@@ -25,8 +25,8 @@ type DialogProps = {
|
|
25
25
|
className?: string;
|
26
26
|
closeable: boolean;
|
27
27
|
confirmButton?: string;
|
28
|
-
data?:
|
29
|
-
htmlOptions?: { [key: string]: string | number | boolean |
|
28
|
+
data?: {[key: string]: string},
|
29
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
30
30
|
id?: string;
|
31
31
|
fullHeight?: boolean;
|
32
32
|
loading?: boolean;
|
@@ -45,7 +45,7 @@ type DialogProps = {
|
|
45
45
|
trigger?: string;
|
46
46
|
};
|
47
47
|
|
48
|
-
const Dialog = (props: DialogProps) => {
|
48
|
+
const Dialog = (props: DialogProps): React.ReactElement => {
|
49
49
|
const {
|
50
50
|
aria = {},
|
51
51
|
cancelButton,
|
@@ -59,9 +59,9 @@ const Dialog = (props: DialogProps) => {
|
|
59
59
|
loading = false,
|
60
60
|
fullHeight = false,
|
61
61
|
opened,
|
62
|
-
onCancel
|
63
|
-
onConfirm
|
64
|
-
onClose
|
62
|
+
onCancel,
|
63
|
+
onConfirm,
|
64
|
+
onClose,
|
65
65
|
placement = "center",
|
66
66
|
portalClassName,
|
67
67
|
shouldCloseOnOverlayClick = true,
|
@@ -168,22 +168,22 @@ const Dialog = (props: DialogProps) => {
|
|
168
168
|
return (
|
169
169
|
<DialogContext.Provider value={api}>
|
170
170
|
<div
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
171
|
+
{...ariaProps}
|
172
|
+
{...dataProps}
|
173
|
+
{...htmlProps}
|
174
|
+
className={classes}
|
175
175
|
>
|
176
176
|
<Modal
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
177
|
+
ariaHideApp={false}
|
178
|
+
className={dialogClassNames}
|
179
|
+
closeTimeoutMS={200}
|
180
|
+
contentLabel="Minimal Modal Example"
|
181
|
+
id={id}
|
182
|
+
isOpen={modalIsOpened}
|
183
|
+
onRequestClose={onClose}
|
184
|
+
overlayClassName={overlayClassNames}
|
185
|
+
portalClassName={portalClassName}
|
186
|
+
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
|
187
187
|
>
|
188
188
|
<>
|
189
189
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -193,33 +193,41 @@ const Dialog = (props: DialogProps) => {
|
|
193
193
|
className="dialog_status_text_align"
|
194
194
|
padding="md"
|
195
195
|
>
|
196
|
-
<Flex align="center"
|
196
|
+
<Flex align="center"
|
197
|
+
orientation="column"
|
198
|
+
>
|
197
199
|
<IconCircle
|
198
|
-
|
199
|
-
|
200
|
-
|
200
|
+
icon={sweetAlertStatus[status].icon}
|
201
|
+
size={sweetAlertStatus[status].size}
|
202
|
+
variant={sweetAlertStatus[status].variant}
|
201
203
|
/>
|
202
|
-
<Title marginTop="sm"
|
204
|
+
<Title marginTop="sm"
|
205
|
+
size={3}
|
206
|
+
>
|
203
207
|
{title}
|
204
208
|
</Title>
|
205
|
-
<Body marginTop="xs"
|
209
|
+
<Body marginTop="xs"
|
210
|
+
text={text}
|
211
|
+
/>
|
206
212
|
</Flex>
|
207
213
|
</Dialog.Body>
|
208
214
|
)}
|
209
215
|
{cancelButton && confirmButton ? (
|
210
216
|
<Dialog.Footer>
|
211
217
|
<Button
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
218
|
+
htmlType="button"
|
219
|
+
loading={loading}
|
220
|
+
onClick={onConfirm}
|
221
|
+
variant="primary"
|
222
|
+
>
|
216
223
|
{confirmButton}
|
217
224
|
</Button>
|
218
225
|
<Button
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
226
|
+
htmlType="button"
|
227
|
+
id="cancel-button"
|
228
|
+
onClick={onCancel}
|
229
|
+
variant="link"
|
230
|
+
>
|
223
231
|
{cancelButton}
|
224
232
|
</Button>
|
225
233
|
</Dialog.Footer>
|
@@ -10,7 +10,7 @@ type DialogBodyProps = {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
// Body component
|
13
|
-
const DialogBody = (props: DialogBodyProps) => {
|
13
|
+
const DialogBody = (props: DialogBodyProps): React.ReactElement => {
|
14
14
|
const { children, className } = props
|
15
15
|
const bodyCSS = buildCss("dialog_body")
|
16
16
|
const bodySpacing = globalProps(props)
|
@@ -13,7 +13,7 @@ type DialogFooterProps = {
|
|
13
13
|
children: React.ReactChild[] | React.ReactChild | string,
|
14
14
|
className?: string,
|
15
15
|
data?: {[key: string]: string},
|
16
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
16
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
17
17
|
id?: string,
|
18
18
|
padding?: string,
|
19
19
|
paddingBottom?: string,
|
@@ -23,7 +23,7 @@ type DialogFooterProps = {
|
|
23
23
|
} & GlobalProps
|
24
24
|
|
25
25
|
// Footer component
|
26
|
-
const DialogFooter = (props: DialogFooterProps) => {
|
26
|
+
const DialogFooter = (props: DialogFooterProps): React.ReactElement => {
|
27
27
|
const {
|
28
28
|
children,
|
29
29
|
className,
|
@@ -38,13 +38,12 @@ const DialogFooter = (props: DialogFooterProps) => {
|
|
38
38
|
|
39
39
|
return (
|
40
40
|
<div
|
41
|
-
|
41
|
+
{...htmlProps}
|
42
42
|
>
|
43
43
|
{separator &&
|
44
44
|
<SectionSeparator />
|
45
45
|
}
|
46
|
-
<div className="dialog-pseudo-footer"
|
47
|
-
</div>
|
46
|
+
<div className="dialog-pseudo-footer" />
|
48
47
|
<Flex
|
49
48
|
className={classnames(footerCSS, footerSpacing, className)}
|
50
49
|
spacing={spacing}
|
@@ -13,8 +13,8 @@ type DialogHeaderProps = {
|
|
13
13
|
children: React.ReactNode[] | React.ReactNode | string,
|
14
14
|
className?: string,
|
15
15
|
closeable?: boolean,
|
16
|
-
data?:
|
17
|
-
htmlOptions?: {[key: string]: string | number | boolean |
|
16
|
+
data?: {[key: string]: string},
|
17
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
18
18
|
id?: string,
|
19
19
|
padding?: string,
|
20
20
|
separator?: boolean,
|
@@ -23,7 +23,7 @@ type DialogHeaderProps = {
|
|
23
23
|
title?: string,
|
24
24
|
} & GlobalProps
|
25
25
|
|
26
|
-
const DialogHeader = (props: DialogHeaderProps) => {
|
26
|
+
const DialogHeader = (props: DialogHeaderProps): React.ReactElement => {
|
27
27
|
const {
|
28
28
|
aria = {},
|
29
29
|
children,
|
@@ -56,7 +56,7 @@ const DialogHeader = (props: DialogHeaderProps) => {
|
|
56
56
|
{children}
|
57
57
|
{closeable &&
|
58
58
|
<CloseIcon
|
59
|
-
|
59
|
+
onClose={api.onClose}
|
60
60
|
/>
|
61
61
|
}
|
62
62
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
![user-default](https://github.com/powerhome/playbook/assets/54749071/f9b593d5-a688-49bf-a282-8fb70058b539)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
PBDialog(
|
5
|
+
title: "This is some informative text",
|
6
|
+
message: infoMessage,
|
7
|
+
cancelButton: ("Cancel", closeToast),
|
8
|
+
confirmButton: ("Okay", closeToast)
|
9
|
+
)
|
10
|
+
```
|
11
|
+
|
@@ -49,15 +49,18 @@ const DialogFullHeight = () => {
|
|
49
49
|
<Flex wrap>
|
50
50
|
<Button id="sm"
|
51
51
|
marginRight="md"
|
52
|
-
onClick={toggleHeaderSeparatorDialog}
|
52
|
+
onClick={toggleHeaderSeparatorDialog}
|
53
|
+
>
|
53
54
|
{"Small Dialog"}
|
54
55
|
</Button>
|
55
56
|
<Button marginRight="md"
|
56
|
-
onClick={toggleFooterSeparatorDialog}
|
57
|
+
onClick={toggleFooterSeparatorDialog}
|
58
|
+
>
|
57
59
|
{"Medium Dialog"}
|
58
60
|
</Button>
|
59
61
|
<Button marginRight="md"
|
60
|
-
onClick={toggleBothSeparatorsDialog}
|
62
|
+
onClick={toggleBothSeparatorsDialog}
|
63
|
+
>
|
61
64
|
{"Large Dialog"}
|
62
65
|
</Button>
|
63
66
|
</Flex>
|
@@ -89,7 +92,8 @@ const DialogFullHeight = () => {
|
|
89
92
|
<Dialog.Footer>
|
90
93
|
<Button onClick={toggle}>{"Send My Issue"}</Button>
|
91
94
|
<Button onClick={toggle}
|
92
|
-
variant="link"
|
95
|
+
variant="link"
|
96
|
+
>
|
93
97
|
{"Back"}
|
94
98
|
</Button>
|
95
99
|
</Dialog.Footer>
|
@@ -48,15 +48,18 @@ const DialogFullHeightPlacement = () => {
|
|
48
48
|
<Flex wrap>
|
49
49
|
<Button id="sm"
|
50
50
|
marginRight="md"
|
51
|
-
onClick={toggleHeaderSeparatorDialog}
|
51
|
+
onClick={toggleHeaderSeparatorDialog}
|
52
|
+
>
|
52
53
|
{"Left Dialog"}
|
53
54
|
</Button>
|
54
55
|
<Button marginRight="xl"
|
55
|
-
onClick={toggleFooterSeparatorDialog}
|
56
|
+
onClick={toggleFooterSeparatorDialog}
|
57
|
+
>
|
56
58
|
{"Center Dialog"}
|
57
59
|
</Button>
|
58
60
|
<Button marginRight="xl"
|
59
|
-
onClick={toggleBothSeparatorsDialog}
|
61
|
+
onClick={toggleBothSeparatorsDialog}
|
62
|
+
>
|
60
63
|
{"Right Dialog"}
|
61
64
|
</Button>
|
62
65
|
</Flex>
|
@@ -88,7 +91,8 @@ const DialogFullHeightPlacement = () => {
|
|
88
91
|
<Dialog.Footer>
|
89
92
|
<Button onClick={toggle}>{"Send My Issue"}</Button>
|
90
93
|
<Button onClick={toggle}
|
91
|
-
variant="link"
|
94
|
+
variant="link"
|
95
|
+
>
|
92
96
|
{"Back"}
|
93
97
|
</Button>
|
94
98
|
</Dialog.Footer>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
### Props
|
2
|
+
| Name | Type | Description | Default | Values |
|
3
|
+
| --- | ----------- | --------- | --------- | --------- |
|
4
|
+
| **content** | `Content` | Sets the View content | | |
|
5
|
+
| **title** | `String` | Sets title for dialog header | | |
|
6
|
+
| **message** | `String` | Sets dialog message| | |
|
7
|
+
| **variant** | `DialogVariant` | Changes variant of dialog | `.default` | `.default` `.status()` |
|
8
|
+
| **isStacked** | `isStacked` | Changes whether the dialog buttons are stacked or inline | `false` | `true` `false` |
|
9
|
+
| **cancelButton** | `Action` | Dismisses the dialog | | |
|
10
|
+
| **confirmButton** | `Action` | Confirms dialog message was received | | |
|
11
|
+
| **onClose** | `Action` | Starts action when dialog is closed | | |
|
12
|
+
| **size** | `DialogSize` | Determines size of dialog | `.medium`| `.small` `.medium` `large` |
|
13
|
+
| **shouldCloseOnOverlay** | `Bool` | Determines if overlay should close | `false` | `true` `false` |
|
@@ -16,10 +16,12 @@ const DialogScrollable = () => {
|
|
16
16
|
return (
|
17
17
|
<>
|
18
18
|
<Button marginRight="md"
|
19
|
-
onClick={toggleDialog1}
|
19
|
+
onClick={toggleDialog1}
|
20
|
+
>{'Open Dialog'}
|
20
21
|
</Button>
|
21
22
|
<Button marginRight="md"
|
22
|
-
onClick={toggleDialog2}
|
23
|
+
onClick={toggleDialog2}
|
24
|
+
>{'Open Full Height Dialog'}
|
23
25
|
</Button>
|
24
26
|
<Dialog
|
25
27
|
cancelButton="Cancel"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
![dialog-large](https://github.com/powerhome/playbook/assets/54749071/41ea273d-3f85-4514-88d7-21f49499f9a2)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
@State private var presentSmallDialog: Bool = false
|
5
|
+
@State private var presentMediumDialog: Bool = false
|
6
|
+
@State private var presentLargeDialog: Bool = false
|
7
|
+
let infoMessage = "This is a message for informational purposes only and requires no action."
|
8
|
+
|
9
|
+
PBDialog(
|
10
|
+
title: "Large",
|
11
|
+
message: infoMessage,
|
12
|
+
variant: .default,
|
13
|
+
isStacked: false,
|
14
|
+
cancelButton: ("Cancel", {}),
|
15
|
+
confirmButton: ("Okay", {}),
|
16
|
+
size: .large
|
17
|
+
)
|
18
|
+
```
|
@@ -0,0 +1,14 @@
|
|
1
|
+
![success](https://github.com/powerhome/playbook/assets/54749071/a3605f4f-ea77-4377-a1bd-977bb3c26a03)
|
2
|
+
|
3
|
+
```swift
|
4
|
+
|
5
|
+
PBDialog(
|
6
|
+
title: "Success!",
|
7
|
+
message: infoMessage,
|
8
|
+
variant: .status(.success),
|
9
|
+
isStacked: true,
|
10
|
+
cancelButton: ("Cancel", closeToast),
|
11
|
+
confirmButton: ("Okay", closeToast),
|
12
|
+
size: .small
|
13
|
+
)
|
14
|
+
```
|
@@ -22,3 +22,10 @@ examples:
|
|
22
22
|
- dialog_stacked_alert: Stacked Button Alert
|
23
23
|
- dialog_full_height: Full Height
|
24
24
|
- dialog_full_height_placement: Full Height Placement
|
25
|
+
|
26
|
+
swift:
|
27
|
+
- dialog_default_swift: Simple
|
28
|
+
- dialog_sizes_swift: Sizes
|
29
|
+
- dialog_status_swift: Status
|
30
|
+
- dialog_props_table: ""
|
31
|
+
|