playbook_ui 14.7.0.pre.alpha.spacingquickchange4482 → 14.7.0.pre.rc.0
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 +2 -3
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +28 -21
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +1 -37
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +2 -13
- data/app/pb_kits/playbook/pb_card/_card.tsx +5 -8
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.md +1 -1
- data/app/pb_kits/playbook/pb_currency/_currency.tsx +6 -16
- data/app/pb_kits/playbook/pb_currency/currency.rb +11 -38
- data/app/pb_kits/playbook/pb_currency/currency.test.js +0 -35
- data/app/pb_kits/playbook/pb_currency/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date/_date.scss +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +10 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -6
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +26 -30
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +1 -24
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +2 -25
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +8 -46
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -67
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +0 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -5
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +23 -59
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +0 -8
- data/app/pb_kits/playbook/pb_timeline/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_timeline/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_timeline/item.html.erb +21 -17
- data/app/pb_kits/playbook/pb_timeline/item.rb +0 -4
- data/app/pb_kits/playbook/pb_timeline/timeline.test.js +0 -84
- data/app/pb_kits/playbook/tokens/_typography.scss +0 -35
- data/app/pb_kits/playbook/utilities/_hover.scss +43 -46
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +0 -5
- data/dist/chunks/_typeahead-BhHnXJjy.js +22 -0
- data/dist/chunks/_weekday_stacked-C_QAqbqJ.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -8
- 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/hover.rb +1 -4
- data/lib/playbook/kit_base.rb +15 -33
- data/lib/playbook/version.rb +2 -2
- metadata +5 -69
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.html.erb +0 -7
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.jsx +0 -18
- data/app/pb_kits/playbook/pb_currency/docs/_currency_comma_separator.md +0 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.html.erb +0 -26
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default_rails.md +0 -7
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.html.erb +0 -38
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.html.erb +0 -19
- data/app/pb_kits/playbook/pb_draggable/draggable.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +0 -3
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +0 -15
- data/app/pb_kits/playbook/pb_draggable/draggable_item.html.erb +0 -7
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +0 -18
- data/app/pb_kits/playbook/pb_draggable/index.js +0 -125
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_rails.md +0 -3
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text_react.md +0 -1
- data/app/pb_kits/playbook/pb_link/_link.scss +0 -66
- data/app/pb_kits/playbook/pb_link/_link.tsx +0 -107
- data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +0 -30
- data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +0 -40
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +0 -5
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +0 -15
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +0 -15
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +0 -25
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +0 -35
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +0 -45
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +0 -5
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +0 -15
- data/app/pb_kits/playbook/pb_link/docs/example.yml +0 -16
- data/app/pb_kits/playbook/pb_link/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_link/link.html.erb +0 -21
- data/app/pb_kits/playbook/pb_link/link.rb +0 -44
- data/app/pb_kits/playbook/pb_link/link.test.jsx +0 -92
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.scss +0 -37
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading.tsx +0 -67
- data/app/pb_kits/playbook/pb_skeleton_loading/_skeleton_loading_mixins.scss +0 -40
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.jsx +0 -51
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_border_radius.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.jsx +0 -26
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_color.md +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_default.jsx +0 -11
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.jsx +0 -59
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_height_width.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.jsx +0 -20
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/_skeleton_loading_layout.md +0 -3
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/example.yml +0 -13
- data/app/pb_kits/playbook/pb_skeleton_loading/docs/index.js +0 -5
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.html.erb +0 -12
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.rb +0 -8
- data/app/pb_kits/playbook/pb_skeleton_loading/skeleton_loading.test.jsx +0 -81
- data/app/pb_kits/playbook/pb_timeline/detail.html.erb +0 -3
- data/app/pb_kits/playbook/pb_timeline/detail.rb +0 -11
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -43
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -68
- data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.md +0 -2
- data/app/pb_kits/playbook/pb_timeline/label.html.erb +0 -12
- data/app/pb_kits/playbook/pb_timeline/label.rb +0 -13
- data/app/pb_kits/playbook/pb_timeline/step.html.erb +0 -14
- data/app/pb_kits/playbook/pb_timeline/step.rb +0 -16
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Detail.tsx +0 -29
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Label.tsx +0 -38
- data/app/pb_kits/playbook/pb_timeline/subcomponents/Step.tsx +0 -42
- data/app/pb_kits/playbook/pb_timeline/subcomponents/index.tsx +0 -3
- data/dist/chunks/_typeahead-DhLic2Fe.js +0 -22
- data/dist/chunks/_weekday_stacked-Mx8TYP5I.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 656e9e66e2df384c9f3d9ad833d269551418aa20f70c3e8cb4b8b017ce1b2db1
|
4
|
+
data.tar.gz: 28c337d7bd834f0d8448010014dc8bbbab8162f02ee5afe95cd8caacc250aee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6578a809aafafb0bbe3be5e2ad11701e14dc359fb34d4157153a1909fc6d06ca9b3ac9c98461a7205bd9f3565d51fa626b64500fcea13b55d79302c9e011f7b0
|
7
|
+
data.tar.gz: 598e947939ac29bdc05f48871d9a63d41295836bc44cf225a3374a1c72c6f92e13c9e684b26d26ba9d04095b50a126dac0d79f4e322c54470021efbe51b29ce5
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
@import 'pb_advanced_table/advanced_table';
|
2
3
|
@import 'pb_avatar/avatar';
|
3
4
|
@import 'pb_avatar_action_button/avatar_action_button';
|
@@ -29,7 +30,6 @@
|
|
29
30
|
@import 'pb_dialog/dialog';
|
30
31
|
@import 'pb_distribution_bar/distribution_bar';
|
31
32
|
@import 'pb_draggable/draggable';
|
32
|
-
@import 'pb_drawer/drawer';
|
33
33
|
@import 'pb_dropdown/dropdown';
|
34
34
|
@import 'pb_file_upload/file_upload';
|
35
35
|
@import 'pb_filter/filter';
|
@@ -54,7 +54,6 @@
|
|
54
54
|
@import 'pb_legend/legend';
|
55
55
|
@import 'pb_lightbox/lightbox';
|
56
56
|
@import 'pb_line_graph/line_graph';
|
57
|
-
@import 'pb_link/link';
|
58
57
|
@import 'pb_list/list';
|
59
58
|
@import 'pb_loading_inline/loading_inline';
|
60
59
|
@import 'pb_map/map';
|
@@ -84,7 +83,6 @@
|
|
84
83
|
@import 'pb_selectable_card_icon/selectable_card_icon';
|
85
84
|
@import 'pb_selectable_icon/selectable_icon';
|
86
85
|
@import 'pb_selectable_list/selectable_list';
|
87
|
-
@import 'pb_skeleton_loading/skeleton_loading';
|
88
86
|
@import 'pb_source/source';
|
89
87
|
@import 'pb_star_rating/star_rating';
|
90
88
|
@import 'pb_stat_change/stat_change';
|
@@ -108,6 +106,7 @@
|
|
108
106
|
@import 'pb_user_badge/user_badge';
|
109
107
|
@import 'pb_walkthrough/walkthrough';
|
110
108
|
@import 'pb_weekday_stacked/weekday_stacked';
|
109
|
+
@import 'pb_drawer/drawer';
|
111
110
|
@import 'utilities/mixins';
|
112
111
|
@import 'utilities/spacing';
|
113
112
|
@import 'utilities/cursor';
|
@@ -16,7 +16,6 @@ interface CustomCellProps {
|
|
16
16
|
onRowToggleClick?: (arg: Row<GenericObject>) => void
|
17
17
|
row: Row<GenericObject>
|
18
18
|
value?: string
|
19
|
-
customRenderer?: (row: Row<GenericObject>, value: string | undefined) => React.ReactNode
|
20
19
|
}
|
21
20
|
|
22
21
|
export const CustomCell = ({
|
@@ -24,7 +23,6 @@ export const CustomCell = ({
|
|
24
23
|
onRowToggleClick,
|
25
24
|
row,
|
26
25
|
value,
|
27
|
-
customRenderer,
|
28
26
|
}: CustomCellProps & GlobalProps) => {
|
29
27
|
const { setExpanded, expanded, expandedControl, inlineRowLoading } = useContext(AdvancedTableContext);
|
30
28
|
|
@@ -63,12 +61,7 @@ export const CustomCell = ({
|
|
63
61
|
</button>
|
64
62
|
) : null}
|
65
63
|
<FlexItem paddingLeft={renderButton? "none" : "xs"}>
|
66
|
-
{row.depth === 0 ? (
|
67
|
-
customRenderer ? customRenderer(row, getValue()) : getValue()
|
68
|
-
) :(
|
69
|
-
customRenderer ? customRenderer(row, value) : value
|
70
|
-
)
|
71
|
-
}
|
64
|
+
{row.depth === 0 ? getValue() : value}
|
72
65
|
</FlexItem>
|
73
66
|
</Flex>
|
74
67
|
</div>
|
@@ -90,8 +90,8 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
90
90
|
|
91
91
|
const columnHelper = createColumnHelper()
|
92
92
|
|
93
|
-
//Create cells for
|
94
|
-
const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element
|
93
|
+
//Create cells for first columns
|
94
|
+
const createCellFunction = (cellAccessors: string[], customRenderer?: (row: Row<GenericObject>, value: any) => JSX.Element) => {
|
95
95
|
const columnCells = ({
|
96
96
|
row,
|
97
97
|
getValue,
|
@@ -101,16 +101,19 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
101
101
|
}) => {
|
102
102
|
const rowData = row.original
|
103
103
|
|
104
|
-
if
|
104
|
+
// Use customRenderer if provided, otherwise default rendering
|
105
|
+
if (customRenderer) {
|
106
|
+
return customRenderer(row, getValue())
|
107
|
+
}
|
108
|
+
|
105
109
|
switch (row.depth) {
|
106
110
|
case 0: {
|
107
111
|
return (
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
/>
|
112
|
+
<CustomCell
|
113
|
+
getValue={getValue}
|
114
|
+
onRowToggleClick={onRowToggleClick}
|
115
|
+
row={row}
|
116
|
+
/>
|
114
117
|
)
|
115
118
|
}
|
116
119
|
default: {
|
@@ -119,7 +122,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
119
122
|
const accessorValue = rowData[depthAccessor]
|
120
123
|
return accessorValue ? (
|
121
124
|
<CustomCell
|
122
|
-
customRenderer={customRenderer}
|
123
125
|
onRowToggleClick={onRowToggleClick}
|
124
126
|
row={row}
|
125
127
|
value={accessorValue}
|
@@ -130,13 +132,11 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
130
132
|
}
|
131
133
|
}
|
132
134
|
}
|
133
|
-
|
134
|
-
? customRenderer(row, getValue())
|
135
|
-
: getValue()
|
136
|
-
}
|
135
|
+
|
137
136
|
return columnCells
|
138
137
|
}
|
139
|
-
|
138
|
+
|
139
|
+
//Create column array in format needed by Tanstack
|
140
140
|
const columns =
|
141
141
|
columnDefinitions &&
|
142
142
|
columnDefinitions.map((column, index) => {
|
@@ -147,12 +147,19 @@ const AdvancedTable = (props: AdvancedTableProps) => {
|
|
147
147
|
}),
|
148
148
|
}
|
149
149
|
|
150
|
-
if
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
150
|
+
// Use the custom renderer if provided, EXCEPT for the first column
|
151
|
+
if (index !== 0) {
|
152
|
+
if (column.cellAccessors || column.customRenderer) {
|
153
|
+
columnStructure.cell = createCellFunction(
|
154
|
+
column.cellAccessors,
|
155
|
+
column.customRenderer
|
156
|
+
)
|
157
|
+
}
|
158
|
+
} else {
|
159
|
+
// For the first column, apply createCellFunction without customRenderer
|
160
|
+
if (column.cellAccessors) {
|
161
|
+
columnStructure.cell = createCellFunction(column.cellAccessors)
|
162
|
+
}
|
156
163
|
}
|
157
164
|
|
158
165
|
return columnStructure
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, {useState} from "react"
|
2
2
|
import { render, screen, waitFor } from "../utilities/test-utils"
|
3
3
|
|
4
|
-
import { AdvancedTable
|
4
|
+
import { AdvancedTable } from "playbook-ui"
|
5
5
|
|
6
6
|
const MOCK_DATA = [
|
7
7
|
{
|
@@ -88,28 +88,6 @@ const columnDefinitions = [
|
|
88
88
|
},
|
89
89
|
]
|
90
90
|
|
91
|
-
const columnDefinitionsCustomRenderer = [
|
92
|
-
{
|
93
|
-
accessor: "year",
|
94
|
-
label: "Year",
|
95
|
-
cellAccessors: ["quarter", "month", "day"],
|
96
|
-
},
|
97
|
-
{
|
98
|
-
accessor: "newEnrollments",
|
99
|
-
label: "New Enrollments",
|
100
|
-
customRenderer: (row, value) => (
|
101
|
-
<Pill text={value}
|
102
|
-
variant="success"
|
103
|
-
/>
|
104
|
-
),
|
105
|
-
},
|
106
|
-
{
|
107
|
-
accessor: "scheduledMeetings",
|
108
|
-
label: "Scheduled Meetings",
|
109
|
-
},
|
110
|
-
]
|
111
|
-
|
112
|
-
|
113
91
|
const subRowHeaders = ["Quarter"]
|
114
92
|
|
115
93
|
const testId = "advanced_table"
|
@@ -485,17 +463,3 @@ test("responsive none prop functions as expected", () => {
|
|
485
463
|
const kit = screen.getByTestId(testId)
|
486
464
|
expect(kit).toHaveClass("pb_advanced_table table-responsive-none")
|
487
465
|
})
|
488
|
-
|
489
|
-
test("customRenderer prop functions as expected", () => {
|
490
|
-
render(
|
491
|
-
<AdvancedTable
|
492
|
-
columnDefinitions={columnDefinitionsCustomRenderer}
|
493
|
-
data={{ testid: testId }}
|
494
|
-
tableData={MOCK_DATA}
|
495
|
-
/>
|
496
|
-
)
|
497
|
-
|
498
|
-
const kit = screen.getByTestId(testId)
|
499
|
-
const pill = kit.querySelector(".pb_pill_kit_success_lowercase")
|
500
|
-
expect(pill).toBeInTheDocument()
|
501
|
-
})
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from "react"
|
2
|
-
import { AdvancedTable, Pill, Body, Flex, Detail, Caption
|
2
|
+
import { AdvancedTable, Pill, Body, Flex, Detail, Caption } from "playbook-ui"
|
3
3
|
import MOCK_DATA from "./advanced_table_mock_data.json"
|
4
4
|
|
5
5
|
const AdvancedTableCustomCell = (props) => {
|
@@ -8,18 +8,7 @@ const AdvancedTableCustomCell = (props) => {
|
|
8
8
|
accessor: "year",
|
9
9
|
label: "Year",
|
10
10
|
cellAccessors: ["quarter", "month", "day"],
|
11
|
-
|
12
|
-
<Flex>
|
13
|
-
<Title size={4}
|
14
|
-
text={value}
|
15
|
-
/>
|
16
|
-
<Badge dark
|
17
|
-
marginLeft="xxs"
|
18
|
-
text={row.original.newEnrollments > 20 ? "High" : "Low"}
|
19
|
-
variant="neutral"
|
20
|
-
/>
|
21
|
-
</Flex>
|
22
|
-
),
|
11
|
+
|
23
12
|
},
|
24
13
|
{
|
25
14
|
accessor: "newEnrollments",
|
@@ -109,9 +109,6 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
109
109
|
// coerce to array
|
110
110
|
const cardChildren = React.Children.toArray(children)
|
111
111
|
const dynamicInlineProps = globalInlineProps(props);
|
112
|
-
const { style: htmlStyle = {}, ...restHtmlProps } = htmlProps as { style?: React.CSSProperties };
|
113
|
-
const mergedStyles: React.CSSProperties = { ...htmlStyle, ...dynamicInlineProps };
|
114
|
-
|
115
112
|
|
116
113
|
const subComponentTags = (tagName: string) => {
|
117
114
|
return cardChildren.filter((c: string) => (
|
@@ -127,7 +124,7 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
127
124
|
|
128
125
|
const tagOptions = ['div', 'section', 'footer', 'header', 'article', 'aside', 'main', 'nav']
|
129
126
|
const Tag = tagOptions.includes(tag) ? tag : 'div'
|
130
|
-
|
127
|
+
|
131
128
|
return (
|
132
129
|
<>
|
133
130
|
{
|
@@ -138,9 +135,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
138
135
|
<Tag
|
139
136
|
{...ariaProps}
|
140
137
|
{...dataProps}
|
138
|
+
{...htmlProps}
|
141
139
|
className={classnames(cardCss, globalProps(props), className)}
|
142
|
-
{
|
143
|
-
style={mergedStyles}
|
140
|
+
style={dynamicInlineProps}
|
144
141
|
>
|
145
142
|
{subComponentTags('Header')}
|
146
143
|
{
|
@@ -167,9 +164,9 @@ const Card = (props: CardPropTypes): React.ReactElement => {
|
|
167
164
|
<Tag
|
168
165
|
{...ariaProps}
|
169
166
|
{...dataProps}
|
167
|
+
{...htmlProps}
|
170
168
|
className={classnames(cardCss, globalProps(props), className)}
|
171
|
-
{
|
172
|
-
style={mergedStyles}
|
169
|
+
style={dynamicInlineProps}
|
173
170
|
>
|
174
171
|
{subComponentTags('Header')}
|
175
172
|
{nonHeaderChildren}
|
@@ -28,7 +28,8 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
|
|
28
28
|
|
29
29
|
@mixin pb_card_selected($border_color: $primary) {
|
30
30
|
border-color: $border_color;
|
31
|
-
border-width: $pb_card_border_width
|
31
|
+
border-width: $pb_card_border_width;
|
32
|
+
outline: 1px solid $border_color;
|
32
33
|
}
|
33
34
|
|
34
35
|
@mixin pb_card_selected_dark {
|
@@ -1 +1 @@
|
|
1
|
-
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
|
1
|
+
Card can leverage the max-width property. Learn more in our <a href="https://playbook.powerapp.cloud/visual_guidelines" target="_blank">visual guidelines.</a>
|
@@ -26,7 +26,6 @@ type CurrencyProps = {
|
|
26
26
|
variant?: 'default' | 'light' | 'bold',
|
27
27
|
unit?: string,
|
28
28
|
unstyled?: boolean,
|
29
|
-
commaSeparator?: boolean,
|
30
29
|
}
|
31
30
|
|
32
31
|
const sizes: {lg: 1, md: 3, sm: 4} = {
|
@@ -54,7 +53,6 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
54
53
|
variant = 'default',
|
55
54
|
dark = false,
|
56
55
|
unstyled = false,
|
57
|
-
commaSeparator = false,
|
58
56
|
} = props
|
59
57
|
|
60
58
|
const emphasizedClass = emphasized ? '' : '_deemphasized'
|
@@ -76,7 +74,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
76
74
|
className
|
77
75
|
)
|
78
76
|
|
79
|
-
const getFormattedNumber = (input: number | any) => new Intl.NumberFormat('en-US', {
|
77
|
+
const getFormattedNumber = (input: number | any ) => new Intl.NumberFormat('en-US', {
|
80
78
|
notation: 'compact',
|
81
79
|
maximumFractionDigits: 1,
|
82
80
|
}).format(input)
|
@@ -90,20 +88,12 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
|
|
90
88
|
return isAmount ? num.slice(0, -1) : isUnit ? num.slice(-1) : ''
|
91
89
|
}
|
92
90
|
|
93
|
-
const getMatchingDecimalAmount = decimals === "matching" ? amount : whole
|
94
|
-
|
91
|
+
const getMatchingDecimalAmount = decimals === "matching" ? amount : whole,
|
92
|
+
getMatchingDecimalValue = decimals === "matching" ? '' : `.${decimal}`
|
95
93
|
|
96
|
-
const
|
97
|
-
|
98
|
-
|
99
|
-
const [wholePart, decimalPart] = amount.split('.');
|
100
|
-
const formattedWhole = new Intl.NumberFormat('en-US').format(parseInt(wholePart));
|
101
|
-
return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
|
102
|
-
}
|
103
|
-
|
104
|
-
const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
|
105
|
-
const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
|
106
|
-
const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
|
94
|
+
const getAmount = abbreviate ? getAbbreviatedValue('amount') : getMatchingDecimalAmount,
|
95
|
+
getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null,
|
96
|
+
getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
|
107
97
|
|
108
98
|
return (
|
109
99
|
<div
|
@@ -43,9 +43,6 @@ module Playbook
|
|
43
43
|
prop :unstyled, type: Playbook::Props::Boolean,
|
44
44
|
default: false
|
45
45
|
|
46
|
-
prop :comma_separator, type: Playbook::Props::Boolean,
|
47
|
-
default: false
|
48
|
-
|
49
46
|
def classname
|
50
47
|
generate_classname("pb_currency_kit", align, size, dark_class)
|
51
48
|
end
|
@@ -68,7 +65,7 @@ module Playbook
|
|
68
65
|
def title_props
|
69
66
|
{
|
70
67
|
size: size_value,
|
71
|
-
text: abbreviate ? abbreviated_value :
|
68
|
+
text: abbreviate ? abbreviated_value : whole_value,
|
72
69
|
classname: "pb_currency_value",
|
73
70
|
dark: dark,
|
74
71
|
}
|
@@ -99,38 +96,28 @@ module Playbook
|
|
99
96
|
private
|
100
97
|
|
101
98
|
def whole_value
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
else
|
106
|
-
value
|
107
|
-
end
|
99
|
+
return amount if decimals == "matching"
|
100
|
+
|
101
|
+
amount.split(".").first.to_s
|
108
102
|
end
|
109
103
|
|
110
|
-
def
|
111
|
-
amount.split(".")
|
104
|
+
def abbreviated_value(index = 0..-2)
|
105
|
+
value = amount.split(".").first.split(",").join("")
|
106
|
+
abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "").to_s
|
107
|
+
abbreviated_num[index]
|
112
108
|
end
|
113
109
|
|
114
110
|
def units_element
|
115
111
|
return "" if decimals == "matching" && !abbreviate && !unit
|
116
112
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
else
|
121
|
-
".#{decimal_value}"
|
122
|
-
end
|
113
|
+
_, decimal_part = amount.split(".")
|
114
|
+
if unit.nil? && abbreviate == false
|
115
|
+
decimal_part.nil? ? ".00" : ".#{decimal_part}"
|
123
116
|
else
|
124
117
|
abbreviate ? "#{abbreviated_value(-1)}#{unit}" : unit
|
125
118
|
end
|
126
119
|
end
|
127
120
|
|
128
|
-
def abbreviated_value(index = 0..-2)
|
129
|
-
value = amount.split(".").first.gsub(",", "").to_i
|
130
|
-
abbreviated_num = number_to_human(value, units: { thousand: "K", million: "M", billion: "B", trillion: "T" }).gsub(/\s+/, "")
|
131
|
-
abbreviated_num[index]
|
132
|
-
end
|
133
|
-
|
134
121
|
def size_value
|
135
122
|
case size
|
136
123
|
when "lg"
|
@@ -145,20 +132,6 @@ module Playbook
|
|
145
132
|
def dark_class
|
146
133
|
dark ? "dark" : nil
|
147
134
|
end
|
148
|
-
|
149
|
-
def formatted_amount
|
150
|
-
return abbreviated_value if abbreviate
|
151
|
-
|
152
|
-
if decimals == "matching"
|
153
|
-
if comma_separator
|
154
|
-
number_with_delimiter(amount.gsub(",", ""))
|
155
|
-
else
|
156
|
-
amount
|
157
|
-
end
|
158
|
-
else
|
159
|
-
whole_value
|
160
|
-
end
|
161
|
-
end
|
162
135
|
end
|
163
136
|
end
|
164
137
|
end
|
@@ -61,38 +61,3 @@ test('decimals default prop returns decimals as body text', () => {
|
|
61
61
|
expect(currencyKit.querySelector('.pb_currency_value')).toHaveTextContent('320')
|
62
62
|
expect(currencyKit.querySelector('.unit')).toHaveTextContent('.20')
|
63
63
|
})
|
64
|
-
|
65
|
-
|
66
|
-
test('commaSeparator prop returns comma separated amount', () => {
|
67
|
-
render(
|
68
|
-
<Currency
|
69
|
-
amount="1234567890"
|
70
|
-
commaSeparator
|
71
|
-
data={{ testid: 'comma-test' }}
|
72
|
-
/>
|
73
|
-
)
|
74
|
-
expect(screen.getByTestId('comma-test')).toHaveTextContent('1,234,567,890')
|
75
|
-
})
|
76
|
-
|
77
|
-
test('commaSeparator prop returns comma separated amount with decimals', () => {
|
78
|
-
render(
|
79
|
-
<Currency
|
80
|
-
amount="1234567890.12"
|
81
|
-
commaSeparator
|
82
|
-
data={{ testid: 'comma-test-decimals' }}
|
83
|
-
/>
|
84
|
-
)
|
85
|
-
expect(screen.getByTestId('comma-test-decimals')).toHaveTextContent('1,234,567,890.12')
|
86
|
-
})
|
87
|
-
|
88
|
-
test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
|
89
|
-
render(
|
90
|
-
<Currency
|
91
|
-
amount="1234567890.12"
|
92
|
-
commaSeparator
|
93
|
-
data={{ testid: 'comma-test-decimals-matching' }}
|
94
|
-
decimals="matching"
|
95
|
-
/>
|
96
|
-
)
|
97
|
-
expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
|
98
|
-
})
|
@@ -8,8 +8,7 @@ examples:
|
|
8
8
|
- currency_abbreviated: Abbreviate Larger Amounts
|
9
9
|
- currency_matching_decimals: Matching Decimals
|
10
10
|
- currency_unstyled: Unstyled
|
11
|
-
|
12
|
-
|
11
|
+
|
13
12
|
react:
|
14
13
|
- currency_variants: Variants
|
15
14
|
- currency_size: Size
|
@@ -18,7 +17,6 @@ examples:
|
|
18
17
|
- currency_abbreviated: Abbreviate Larger Amounts
|
19
18
|
- currency_matching_decimals: Matching Decimals
|
20
19
|
- currency_unstyled: Unstyled
|
21
|
-
- currency_comma_separator: Comma Separator
|
22
20
|
|
23
21
|
swift:
|
24
22
|
- currency_size_swift: Size
|
@@ -5,4 +5,3 @@ export { default as CurrencyNoSymbol } from './_currency_no_symbol.jsx'
|
|
5
5
|
export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
|
6
6
|
export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
|
7
7
|
export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
|
8
|
-
export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
|
@@ -8,10 +8,4 @@ examples:
|
|
8
8
|
- draggable_with_cards: Draggable with Cards
|
9
9
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
10
10
|
|
11
|
-
rails:
|
12
|
-
- draggable_default_rails: Default
|
13
|
-
- draggable_with_list_rails: Draggable with List Kit
|
14
|
-
- draggable_with_cards_rails: Draggable with Cards
|
15
|
-
|
16
|
-
|
17
11
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
@import "./scss_partials/dropdown_animation";
|
11
11
|
|
12
|
-
|
12
|
+
.pb_dropdown {
|
13
13
|
.dropdown_wrapper {
|
14
14
|
[class*="dropdown_trigger_wrapper"] {
|
15
15
|
@include pb_body;
|
@@ -131,7 +131,7 @@
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
|
134
|
-
|
134
|
+
&.separators_hidden {
|
135
135
|
.dropdown_wrapper {
|
136
136
|
.pb_dropdown_container {
|
137
137
|
|
@@ -142,7 +142,7 @@
|
|
142
142
|
}
|
143
143
|
}
|
144
144
|
|
145
|
-
|
145
|
+
&.subtle {
|
146
146
|
.dropdown_wrapper {
|
147
147
|
.pb_dropdown_container {
|
148
148
|
|
@@ -178,7 +178,7 @@
|
|
178
178
|
}
|
179
179
|
}
|
180
180
|
|
181
|
-
|
181
|
+
&.separators_hidden {
|
182
182
|
.dropdown_wrapper {
|
183
183
|
.pb_dropdown_container {
|
184
184
|
[class*="pb_dropdown_option"]:first-child {
|
@@ -47,7 +47,7 @@ interface DropdownComponent
|
|
47
47
|
Container: typeof DropdownContainer;
|
48
48
|
}
|
49
49
|
|
50
|
-
|
50
|
+
const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
51
51
|
const {
|
52
52
|
aria = {},
|
53
53
|
autocomplete = false,
|
@@ -74,8 +74,10 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
74
74
|
const htmlProps = buildHtmlProps(htmlOptions);
|
75
75
|
const separatorsClass = separators ? '' : 'separators_hidden'
|
76
76
|
const classes = classnames(
|
77
|
-
buildCss("pb_dropdown"
|
77
|
+
buildCss("pb_dropdown"),
|
78
78
|
globalProps(props),
|
79
|
+
variant,
|
80
|
+
separatorsClass,
|
79
81
|
className
|
80
82
|
);
|
81
83
|
|
@@ -260,7 +262,7 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
260
262
|
<DropdownContainer>
|
261
263
|
{optionsWithBlankSelection &&
|
262
264
|
optionsWithBlankSelection?.map((option: GenericObject) => (
|
263
|
-
<
|
265
|
+
<Dropdown.Option key={option.id}
|
264
266
|
option={option}
|
265
267
|
/>
|
266
268
|
))}
|
@@ -278,12 +280,11 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
278
280
|
</DropdownContext.Provider>
|
279
281
|
</div>
|
280
282
|
)
|
281
|
-
}
|
283
|
+
}) as DropdownComponent
|
282
284
|
|
283
|
-
Dropdown =
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
(Dropdown as DropdownComponent).Container = DropdownContainer;
|
285
|
+
Dropdown.displayName = "Dropdown";
|
286
|
+
Dropdown.Option = DropdownOption;
|
287
|
+
Dropdown.Trigger = DropdownTrigger;
|
288
|
+
Dropdown.Container = DropdownContainer;
|
288
289
|
|
289
290
|
export default Dropdown;
|
@@ -24,7 +24,7 @@ module Playbook
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def classname
|
27
|
-
generate_classname("pb_dropdown", variant, separators_class)
|
27
|
+
generate_classname("pb_dropdown", variant, separators_class, separator: " ")
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -38,7 +38,7 @@ module Playbook
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def separators_class
|
41
|
-
separators ?
|
41
|
+
separators ? "" : "separators_hidden"
|
42
42
|
end
|
43
43
|
|
44
44
|
def options_with_blank
|
@@ -50,7 +50,7 @@ test('generated default kit and classname', () => {
|
|
50
50
|
|
51
51
|
const kit = screen.getByTestId(testId)
|
52
52
|
expect(kit).toBeInTheDocument()
|
53
|
-
expect(kit).toHaveClass('
|
53
|
+
expect(kit).toHaveClass('pb_dropdown')
|
54
54
|
})
|
55
55
|
|
56
56
|
test('generated default Trigger and Container when none passed in', () => {
|
@@ -142,9 +142,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
142
142
|
height: 12px !important;
|
143
143
|
width: 12px !important;
|
144
144
|
padding-right: $space_xs;
|
145
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag
|
146
|
-
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
147
|
-
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
145
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag {
|
148
146
|
padding-left: 0;
|
149
147
|
}
|
150
148
|
}
|
@@ -171,9 +169,7 @@ $form_pill_colors: map-merge($status_color_text, map-merge($data_colors, $produc
|
|
171
169
|
}
|
172
170
|
.pb_form_pill_icon {
|
173
171
|
padding-right: $space_xxs;
|
174
|
-
+ .pb_form_pill_text, + .pb_form_pill_tag
|
175
|
-
+ .pb_tooltip_kit .pb_form_pill_text, + .pb_tooltip_kit .pb_form_pill_tag,
|
176
|
-
+ div .pb_form_pill_text, + div .pb_form_pill_tag {
|
172
|
+
+ .pb_form_pill_text, + .pb_form_pill_tag {
|
177
173
|
padding-left: 0;
|
178
174
|
}
|
179
175
|
}
|