playbook_ui 12.0.0 → 12.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +2 -1
  4. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +10 -10
  5. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +2 -0
  6. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +11 -0
  7. data/app/pb_kits/playbook/pb_dialog/child_kits/_dialog_footer.tsx +2 -0
  8. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +1 -0
  9. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +69 -0
  10. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb +1 -0
  11. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.md +6 -0
  12. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +6 -0
  13. data/app/pb_kits/playbook/pb_pagination/pagination.html.erb +7 -0
  14. data/app/pb_kits/playbook/pb_pagination/pagination.rb +18 -0
  15. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +66 -0
  16. data/app/pb_kits/playbook/pb_stat_change/stat_change.test.js +41 -0
  17. data/app/pb_kits/playbook/pb_stat_value/{_stat_value.jsx → _stat_value.tsx} +4 -6
  18. data/app/pb_kits/playbook/pb_stat_value/docs/_stat_value_unit.jsx +1 -1
  19. data/app/pb_kits/playbook/pb_stat_value/stat_value.test.js +27 -0
  20. data/app/pb_kits/playbook/pb_time_stacked/{_time_stacked.jsx → _time_stacked.tsx} +3 -5
  21. data/app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.jsx +1 -1
  22. data/app/pb_kits/playbook/pb_time_stacked/docs/index.js +1 -1
  23. data/app/pb_kits/playbook/pb_timestamp/{_timestamp.jsx → _timestamp.tsx} +5 -7
  24. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_align.jsx +1 -1
  25. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_default.jsx +1 -1
  26. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +1 -1
  27. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_timezones.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_updated.jsx +1 -1
  29. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +36 -28
  30. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_default_react.jsx +1 -0
  31. data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +14 -0
  32. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +1 -1
  33. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_without_pills.html.erb +4 -11
  34. data/app/pb_kits/playbook/tokens/_colors.scss +3 -1
  35. data/lib/playbook/pagination_renderer.rb +41 -0
  36. data/lib/playbook/version.rb +2 -2
  37. metadata +29 -6
  38. data/app/pb_kits/playbook/pb_stat_change/_stat_change.jsx +0 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e25065accaa0dd497f68c944bfb31b60695e3a4f2430e1818ec656b672763186
4
- data.tar.gz: 8605a87938bde42563130661b9f1213e23958f2ad5e53342c2f162933c101c38
3
+ metadata.gz: 74b102cf8c343860ef1b90352dabf96dfa1fee84c9e4912a287e6fe6a32dcabe
4
+ data.tar.gz: d25cb119dd297fe0512df07650aa237cf5be8eb80f2e79d32480da547c599b2c
5
5
  SHA512:
6
- metadata.gz: 85ba42392ecca25ae72e124adcdca9dce9e2122fa2eb961d7be15450ceb3042f1f41573fa55ad6305375db4749f41263e85b01e82c0dfb8b0d8e77b2ad82b853
7
- data.tar.gz: 8bd52867cb7e21d0616d7a8ba8e5a9a1b0dc4170796bf8c547013f74778c348f0248ecbf3a8fecc2fb9d120c02383264a97c934836903079b1e2ce2a2d283c3d
6
+ metadata.gz: a58a8f1cce99f05841d01f1a3fc64dcfb40121ffea77b1bead4c1cb6b83c2f6edd89a61a62df302452ea0defac80c070484d26fa05024ed36a35139152c56c84
7
+ data.tar.gz: 17e5d846daf75ea0ba6bb333e2a464910dd18435ed7414c69a60dd07ff9845a9404a1d3b2dd9aa1c46ba49a8d67d9295813272b9b0cb789bbc8cae4cef65c6f1
@@ -56,6 +56,7 @@
56
56
  @import 'pb_multiple_users_stacked/multiple_users_stacked';
57
57
  @import 'pb_nav/nav';
58
58
  @import 'pb_online_status/online_status';
59
+ @import 'pb_pagination/pagination';
59
60
  @import 'pb_passphrase/passphrase';
60
61
  @import 'pb_person/person';
61
62
  @import 'pb_person_contact/person_contact';
@@ -60,6 +60,7 @@ kits:
60
60
  - badge
61
61
  - hashtag
62
62
  - pill
63
+ - pagination
63
64
  - popover
64
65
  - progress:
65
66
  - progress_pills
@@ -103,4 +104,4 @@ kits:
103
104
  - title_count
104
105
  - title_detail
105
106
  - user_badge
106
- - walkthrough
107
+ - walkthrough
@@ -13,7 +13,7 @@ import classnames from "classnames";
13
13
  type BarGraphProps = {
14
14
  align?: "left" | "right" | "center";
15
15
  axisTitle: string;
16
- dark?: Boolean;
16
+ dark?: boolean;
17
17
  xAxisCategories: [];
18
18
  yAxisMin: number;
19
19
  yAxisMax: number;
@@ -62,7 +62,7 @@ const BarGraph = ({
62
62
  x = 0,
63
63
  y = 0,
64
64
  ...props
65
- }: BarGraphProps) => {
65
+ }: BarGraphProps): React.ReactElement => {
66
66
  const ariaProps = buildAriaProps(aria);
67
67
  const dataProps = buildDataProps(data);
68
68
  const setupTheme = () => {
@@ -130,14 +130,14 @@ const BarGraph = ({
130
130
 
131
131
  return (
132
132
  <HighchartsReact
133
- containerProps={{
134
- className: classnames(globalProps(props), className),
135
- id: id,
136
- ...ariaProps,
137
- ...dataProps,
138
- }}
139
- highcharts={Highcharts}
140
- options={options}
133
+ containerProps={{
134
+ className: classnames(globalProps(props), className),
135
+ id: id,
136
+ ...ariaProps,
137
+ ...dataProps,
138
+ }}
139
+ highcharts={Highcharts}
140
+ options={options}
141
141
  />
142
142
  );
143
143
  };
@@ -136,6 +136,8 @@ const highchartsDarkTheme: ThemeProps = {
136
136
 
137
137
  plotOptions: {
138
138
  series: {
139
+ borderColor: colors.bg_dark_card,
140
+ borderWidth: 2,
139
141
  type: 'area',
140
142
  nullColor: colors.text_dk_lighter,
141
143
  fillColor: {
@@ -227,6 +227,11 @@
227
227
  height: 100%;
228
228
  max-height: 100%;
229
229
  max-width: none;
230
+ //this empty div only has height when dialog is full height.
231
+ //fix for dialog body content disappearing behind sticky footer
232
+ .dialog-pseudo-footer {
233
+ height: $space_xl * 2;
234
+ }
230
235
  .dialog_footer {
231
236
  position:fixed;
232
237
  bottom: 0;
@@ -287,6 +292,11 @@
287
292
  height: 100% !important;
288
293
  max-height: 100% !important;
289
294
  max-width: 100%;
295
+ //this empty div only has height when dialog is full height.
296
+ //fix for dialog body content disappearing behind sticky footer
297
+ .dialog-pseudo-footer {
298
+ height: $space_xl * 2;
299
+ }
290
300
  .dialog_footer {
291
301
  position:fixed;
292
302
  bottom: 0;
@@ -316,6 +326,7 @@
316
326
  // fixes for stylesheets in nitro that were conflicting with our kit. DO NOT REMOVE.
317
327
  //conflicts were only apparent in nitro, not in playbook local env
318
328
  .pb_dialog_rails {
329
+ position: fixed !important;
319
330
  top: 0 !important;
320
331
  padding: unset !important;
321
332
  margin: auto;
@@ -41,6 +41,8 @@ const DialogFooter = (props: DialogFooterProps) => {
41
41
  {separator &&
42
42
  <SectionSeparator />
43
43
  }
44
+ <div className="dialog-pseudo-footer">
45
+ </div>
44
46
  <Flex
45
47
  className={classnames(footerCSS, footerSpacing, className)}
46
48
  spacing={spacing}
@@ -3,6 +3,7 @@
3
3
  data: object.data,
4
4
  aria: object.aria) do %>
5
5
  <% if object.confirm_button && object.cancel_button %>
6
+ <div class="dialog-pseudo-footer"></div>
6
7
  <%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
7
8
  <%= pb_rails("button", props: { type: "submit", id: object.confirm_button_id }) do %>
8
9
  <%= object.confirm_button %>
@@ -0,0 +1,69 @@
1
+ @import "../tokens/colors";
2
+ @import "../tokens/typography";
3
+ @import "../tokens/border_radius";
4
+ @import "../tokens/shadows";
5
+
6
+ $pagination_padding: 7px 13px 6px 13px;
7
+ $top_bottom_radius: 0px;
8
+
9
+ .pb_pagination {
10
+ display: inline-block;
11
+ border-radius: $border_rad_light;
12
+ border: $border_rad_lightest solid $border_light;
13
+ background-color: $white;
14
+ padding: $space_xxs 0px;
15
+ li {
16
+ display: inline;
17
+ > a, li > span {
18
+ padding: $pagination_padding;
19
+ text-decoration: none;
20
+ }}
21
+ li:first-child > a, li:first-child > span {
22
+ padding: $pagination_padding;
23
+ border-right: $border_rad_lightest solid $border_light;
24
+ z-index: 2;
25
+ border-top-right-radius: $top_bottom_radius;
26
+ border-bottom-right-radius: $top_bottom_radius;
27
+ }
28
+ li:last-child > a, li:last-child > span {
29
+ padding: $pagination_padding;
30
+ border-left: $border_rad_lightest solid $border_light;
31
+ z-index: 2;
32
+ border-top-left-radius: $top_bottom_radius;
33
+ border-bottom-left-radius: $top_bottom_radius;
34
+ }
35
+ a {
36
+ color: $text_lt_default;
37
+ font-size: $text_small;
38
+ font-weight: $regular;
39
+ border: none;
40
+ transition: all $transition_default ease-out;
41
+
42
+ &:hover {
43
+ background-color: $active_light;
44
+ color: $primary;
45
+ border-radius: $border_rad_light;
46
+ }
47
+
48
+ &:focus-visible {
49
+ outline: 1px solid $primary;
50
+ border-color: transparent !important;
51
+ border-radius: $border_rad_light !important;
52
+ transition: none;
53
+ }
54
+ }
55
+ .active > span {
56
+ background-color: $primary;
57
+ border-radius: $border_rad_light;
58
+ color: #fff;
59
+ padding: $pagination_padding;
60
+ border: 0;
61
+ text-decoration: none;
62
+ font-weight: $bold;
63
+ font-size: $text_small;
64
+ }
65
+ .disabled > span {
66
+ padding: $pagination_padding;
67
+ font-size: $text_small;
68
+ }
69
+ }
@@ -0,0 +1 @@
1
+ <%= pb_rails("pagination", props: { model: @users, view: self}) %>
@@ -0,0 +1,6 @@
1
+ <div class="pb_pill_kit_warning"><div class="pb_title_kit_size_4 pb_pill_text">Disclaimer</div></div>
2
+ Our Pagination kit depends on the <a href="https://github.com/mislav/will_paginate" target="_blank"> will\_paginate library. </a> Please follow the basic will\_paginate setup.
3
+
4
+ Once you have perfomed the paginated query in your controller file you can use our kit (see code example below) instead of `<%= will_paginate @users %>` in your view file.
5
+
6
+ You need to add: <code>require "playbook/pagination_renderer"</code> in your apps controller file.
@@ -0,0 +1,6 @@
1
+ examples:
2
+
3
+ rails:
4
+ - pagination_default: Default
5
+
6
+
@@ -0,0 +1,7 @@
1
+ <%= content_tag(:div,
2
+ aria: object.aria,
3
+ class: object.classname,
4
+ data: object.data,
5
+ id: object.id) do %>
6
+ <%= will_paginate object.model, renderer: Playbook::Pagination::Rails %>
7
+ <% end %>
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbPagination
5
+ class Pagination < ::Playbook::KitBase
6
+ prop :model
7
+ prop :view
8
+
9
+ def classname
10
+ generate_classname("pb_paginate")
11
+ end
12
+
13
+ def url_for(options = nil)
14
+ view.url_for(options)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,66 @@
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
+
4
+ import { buildCss } from '../utilities/props'
5
+ import { globalProps } from '../utilities/globalProps'
6
+
7
+ import Body from '../pb_body/_body'
8
+ import Icon from '../pb_icon/_icon'
9
+
10
+ const statusMap: {neutral: 'neutral', decrease: 'negative' ,increase: 'positive'} = {
11
+ increase: 'positive',
12
+ decrease: 'negative',
13
+ neutral: 'neutral',
14
+ }
15
+
16
+ const iconMap = {
17
+ increase: 'arrow-up',
18
+ decrease: 'arrow-down',
19
+ }
20
+
21
+ type StatChangeProps = {
22
+ change?: 'increase' | 'decrease' | 'neutral',
23
+ className?: string,
24
+ icon?: string,
25
+ id?: string,
26
+ value?: string | number,
27
+ }
28
+
29
+ const StatChange = (props: StatChangeProps): React.ReactElement => {
30
+ const { change = 'neutral', className, icon, id, value } = props
31
+ const status = statusMap[change as keyof typeof statusMap]
32
+ let returnedIcon = iconMap[change as keyof typeof iconMap]
33
+ if (icon) {
34
+ returnedIcon = icon
35
+ }
36
+
37
+ return (
38
+ <>
39
+ {value &&
40
+ <div
41
+ className={classnames(
42
+ buildCss('pb_stat_change_kit', status),
43
+ globalProps(props),
44
+ className
45
+ )}
46
+ id={id}
47
+ >
48
+ <Body status={status}>
49
+ {returnedIcon &&
50
+ <>
51
+ <Icon
52
+ fixed_width
53
+ icon={returnedIcon}
54
+ />
55
+ {' '}
56
+ </>
57
+ }
58
+ {`${value}%`}
59
+ </Body>
60
+ </div>
61
+ }
62
+ </>
63
+ )
64
+ }
65
+
66
+ export default StatChange
@@ -0,0 +1,41 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import StatChange from './_stat_change'
5
+
6
+ test('it renders each status', () => {
7
+ render(
8
+ <StatChange
9
+ change="increase"
10
+ value="28.4"
11
+ />
12
+ )
13
+
14
+ const kit = screen.getByText('28.4%')
15
+ expect(kit).toHaveClass(`pb_body_kit_positive`)
16
+ })
17
+
18
+ test('it renders preset icon', () => {
19
+ render(
20
+ <StatChange
21
+ change="increase"
22
+ value="28.4"
23
+ />
24
+ )
25
+
26
+ const kit = screen.getByLabelText('arrow-up icon')
27
+ expect(kit).toBeTruthy
28
+ })
29
+
30
+ test('it renders custom icon', () => {
31
+ render(
32
+ <StatChange
33
+ icon="chart-line-down"
34
+ value={6.1}
35
+ />
36
+
37
+ )
38
+
39
+ const kit = screen.getByLabelText('chart-line-down icon')
40
+ expect(kit).toBeTruthy
41
+ })
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
@@ -10,10 +8,10 @@ type StatValueProps = {
10
8
  className?: string,
11
9
  id?: string,
12
10
  unit?: string,
13
- value: string | number
11
+ value: string | number,
14
12
  }
15
13
 
16
- const StatValue = (props: StatValueProps) => {
14
+ const StatValue = (props: StatValueProps): React.ReactElement => {
17
15
  const {
18
16
  className,
19
17
  id,
@@ -21,7 +19,7 @@ const StatValue = (props: StatValueProps) => {
21
19
  value = 0,
22
20
  } = props
23
21
 
24
- const displayValue = function(value) {
22
+ const displayValue = function(value: string | number) {
25
23
  if (value || value === 0) {
26
24
  return (
27
25
  <Title
@@ -33,7 +31,7 @@ const StatValue = (props: StatValueProps) => {
33
31
  }
34
32
  }
35
33
 
36
- const displayUnit = function(unit) {
34
+ const displayUnit = function(unit: string) {
37
35
  if (unit) {
38
36
  return (
39
37
  <Title
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import StatValue from '../_stat_value.jsx'
2
+ import StatValue from '../_stat_value'
3
3
 
4
4
  const StatValueUnit = (props) => {
5
5
  return (
@@ -0,0 +1,27 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import StatValue from './_stat_value'
5
+
6
+ test('it renders the component with the value', () => {
7
+ render(
8
+ <StatValue
9
+ value={1048}
10
+ />
11
+ )
12
+
13
+ const kit = screen.getByText('1048')
14
+ expect(kit).toBeTruthy()
15
+ })
16
+
17
+ test('it renders the component with the unit', () => {
18
+ render(
19
+ <StatValue
20
+ unit="appt"
21
+ value="5,294"
22
+ />
23
+ )
24
+
25
+ const kit = screen.getByText('appt')
26
+ expect(kit).toBeTruthy()
27
+ })
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
@@ -12,16 +10,16 @@ import Caption from '../pb_caption/_caption'
12
10
 
13
11
  type TimeStackedProps = {
14
12
  align?: 'left' | 'center' | 'right',
15
- className?: string | array<string>,
13
+ className?: string | string[],
16
14
  dark?: boolean,
17
- data?: object,
15
+ data?: { [key: string]: string },
18
16
  date?: string,
19
17
  id?: string,
20
18
  time: number | Date,
21
19
  timeZone?: string,
22
20
  }
23
21
 
24
- const TimeStackedDefault = (props: TimeStackedProps) => {
22
+ const TimeStackedDefault = (props: TimeStackedProps): React.ReactElement => {
25
23
  if (props.date) deprecatedProps('Time Stacked', ['date']) //date prop is deprecated, use time instead
26
24
 
27
25
  const {
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import TimeStacked from '../_time_stacked.jsx'
2
+ import TimeStacked from '../_time_stacked'
3
3
 
4
4
  const TimeStackedDefault = (props) => {
5
5
  return (
@@ -1 +1 @@
1
- export { default as TimeStackedDefault } from './_time_stacked_default.jsx'
1
+ export { default as TimeStackedDefault } from './_time_stacked_default'
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import classnames from 'classnames'
5
3
 
@@ -11,8 +9,8 @@ import Caption from '../pb_caption/_caption'
11
9
 
12
10
  type TimestampProps = {
13
11
  align?: "left" | "center" | "right",
14
- aria?: object,
15
- className?: string | array<string>,
12
+ aria?: { [key: string]: string },
13
+ className?: string | string[],
16
14
  dark?: boolean,
17
15
  data?: string,
18
16
  text: string,
@@ -26,7 +24,7 @@ type TimestampProps = {
26
24
  variant?: "default" | "elapsed" | "updated"
27
25
  }
28
26
 
29
- const Timestamp = (props: TimestampProps) => {
27
+ const Timestamp = (props: TimestampProps): React.ReactElement => {
30
28
  const {
31
29
  align = 'left',
32
30
  aria = {},
@@ -90,9 +88,9 @@ const Timestamp = (props: TimestampProps) => {
90
88
  const captionText = () => {
91
89
  switch (variant) {
92
90
  case 'updated':
93
- return formatUpdatedString(userDisplay, dateTimestamp)
91
+ return formatUpdatedString()
94
92
  case 'elapsed':
95
- return formatElapsedString(userDisplay, timeDisplay, updatedText)
93
+ return formatElapsedString()
96
94
  default:
97
95
  return showDate ? timestamp ? fullDateDisplay() : text : fullTimeDisplay()
98
96
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Timestamp from '../_timestamp.jsx'
2
+ import Timestamp from '../_timestamp'
3
3
 
4
4
  const todaysDate = new Date()
5
5
  const futureYear = new Date().getFullYear() + 4
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Timestamp from '../_timestamp.jsx'
2
+ import Timestamp from '../_timestamp'
3
3
 
4
4
  const todaysDate = new Date()
5
5
  const futureYear = new Date().getFullYear() + 4
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Timestamp from '../_timestamp.jsx'
2
+ import Timestamp from '../_timestamp'
3
3
 
4
4
  const todaysDate = new Date()
5
5
  const year = new Date().getFullYear()
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Timestamp from '../_timestamp.jsx'
2
+ import Timestamp from '../_timestamp'
3
3
 
4
4
  const todaysDate = new Date()
5
5
  const futureYear = new Date().getFullYear() + 4
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import Timestamp from '../_timestamp.jsx'
2
+ import Timestamp from '../_timestamp'
3
3
 
4
4
  const todaysDate = new Date()
5
5
 
@@ -17,6 +17,7 @@ import Flex from "../pb_flex/_flex"
17
17
 
18
18
  type TooltipProps = {
19
19
  aria?: { [key: string]: string },
20
+ className?: string | string[],
20
21
  data?: { [key: string]: string },
21
22
  text: string,
22
23
  icon?: string,
@@ -26,9 +27,10 @@ type TooltipProps = {
26
27
  zIndex?: Pick<GlobalProps, "ZIndex">,
27
28
  } & GlobalProps
28
29
 
29
- const Tooltip = (props: TooltipProps) => {
30
+ const Tooltip = (props: TooltipProps): React.ReactElement => {
30
31
  const {
31
32
  aria = {},
33
+ className,
32
34
  children,
33
35
  data = {},
34
36
  icon = null,
@@ -42,7 +44,10 @@ const Tooltip = (props: TooltipProps) => {
42
44
  const dataProps: { [key: string]: any } = buildDataProps(data)
43
45
  const ariaProps: { [key: string]: any } = buildAriaProps(aria)
44
46
 
45
- const css = classnames(globalProps({...rest}))
47
+ const css = classnames(
48
+ globalProps({...rest}),
49
+ className
50
+ )
46
51
  const [open, setOpen] = useState(false)
47
52
  const arrowRef = useRef(null)
48
53
  const {
@@ -92,44 +97,47 @@ const Tooltip = (props: TooltipProps) => {
92
97
  return (
93
98
  <>
94
99
  <div
95
- ref={reference}
96
- className={`pb_tooltip_kit ${css}`}
97
- style={{ display: "inline-flex" }}
98
- role="tooltip_trigger"
99
- {...ariaProps}
100
- {...dataProps}
100
+ className={`pb_tooltip_kit ${css}`}
101
+ ref={reference}
102
+ role="tooltip_trigger"
103
+ style={{ display: "inline-flex" }}
104
+ {...ariaProps}
105
+ {...dataProps}
101
106
  >
102
107
  {children}
103
108
  </div>
104
109
  {open && (
105
110
  <div
106
- {...getFloatingProps({
107
- role: "tooltip",
108
- ref: floating,
109
- className: `tooltip_tooltip ${placement} visible`,
110
- style: {
111
- position: strategy,
112
- top: y ?? 0,
113
- left: x ?? 0,
114
- zIndex: zIndex ?? 0,
115
- },
116
- })}
111
+ {...getFloatingProps({
112
+ role: "tooltip",
113
+ ref: floating,
114
+ className: `tooltip_tooltip ${placement} visible`,
115
+ style: {
116
+ position: strategy,
117
+ top: y ?? 0,
118
+ left: x ?? 0,
119
+ zIndex: zIndex ?? 0,
120
+ },
121
+ })}
117
122
  >
118
- <Flex gap="xs" align="center">
123
+ <Flex
124
+ align="center"
125
+ gap="xs"
126
+ >
119
127
  {icon && (
120
128
  <i className={`pb_icon_kit far fa-${icon} fa-fw`} />
121
129
  )}
122
130
  {text}
123
131
  </Flex>
124
132
  <div
125
- ref={arrowRef}
126
- className="arrow_bg"
127
- style={{
128
- position: strategy,
129
- left: arrowX != null ? `${arrowX}px` : "",
130
- top: arrowY != null ? `${arrowY}px` : "",
131
- [staticSide]: "-5px",
132
- }}
133
+ className="arrow_bg"
134
+ ref={arrowRef}
135
+ style={{
136
+ position: strategy,
137
+ left: arrowX != null ? `${arrowX}px` : "",
138
+ top: arrowY != null ? `${arrowY}px` : "",
139
+ [staticSide]: "-5px",
140
+ }}
133
141
  />
134
142
  </div>
135
143
  )}
@@ -14,6 +14,7 @@ const TooltipDefaultReact = (props) => {
14
14
  >
15
15
  <FlexItem>
16
16
  <Tooltip
17
+ className={"customClassNameHere"}
17
18
  placement='top'
18
19
  text="Whoa. I'm a Tooltip"
19
20
  zIndex={10}
@@ -51,3 +51,17 @@ test("closes on mouseleave", async () => {
51
51
  cleanup();
52
52
  })
53
53
  });
54
+
55
+ test("closes on mouseleave", async () => {
56
+ render(
57
+ <Tooltip
58
+ className={"Hello World"}
59
+ data={{ testid: "className-test" }}
60
+ />
61
+ );
62
+
63
+ const kit = screen.getByTestId("className-test");
64
+ expect(kit).toHaveClass("Hello World");
65
+
66
+ cleanup();
67
+ });
@@ -93,7 +93,7 @@ const Typeahead = ({
93
93
  const handleOnChange = (_data, { action, option, removedValue }) => {
94
94
  if (action === 'select-option') {
95
95
  if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
96
- const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option })
96
+ const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
97
97
  document.dispatchEvent(multiValueClearEvent)
98
98
  }
99
99
  if (action === 'remove-value' || action === 'pop-value') {
@@ -8,7 +8,7 @@
8
8
  %>
9
9
 
10
10
  <%= pb_rails("typeahead", props: {
11
- id: "typeahead-pills-example1",
11
+ id: "typeahead-without-pills-example1",
12
12
  placeholder: "All Colors",
13
13
  options: options,
14
14
  label: "Colors",
@@ -19,19 +19,12 @@
19
19
 
20
20
  <!-- This section is an example of the available JavaScript event hooks -->
21
21
  <%= javascript_tag defer: "defer" do %>
22
- document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-option-select", function(event) {
23
- console.log('Option selected')
22
+ document.addEventListener("pb-typeahead-kit-typeahead-without-pills-example1-result-option-select", function(event) {
23
+ console.log('Single Option selected')
24
24
  console.dir(event.detail)
25
25
  })
26
- document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-option-remove", function(event) {
27
- console.log('Option removed')
28
- console.dir(event.detail)
29
- })
30
- document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-clear", function() {
26
+ document.addEventListener("pb-typeahead-kit-typeahead-without-pills-example1-result-clear", function() {
31
27
  console.log('All options cleared')
32
28
  })
33
29
 
34
- document.querySelector('#clear-pills').addEventListener('click', function() {
35
- document.dispatchEvent(new CustomEvent('pb-typeahead-kit-typeahead-pills-example1:clear'))
36
- })
37
30
  <% end %>
@@ -59,9 +59,11 @@ $main_colors: (
59
59
  Background colors ------------------*/
60
60
  $bg_light: $silver !default;
61
61
  $bg_dark: #0a0527 !default;
62
+ $bg_dark_card: #231E3D;
62
63
  $background_colors: (
63
64
  bg_light: $bg_light,
64
- bg_dark: $bg_dark
65
+ bg_dark: $bg_dark,
66
+ bg_dark_card: $bg_dark_card
65
67
  );
66
68
 
67
69
  /* Card colors ------------------*/
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "will_paginate/view_helpers/action_view"
4
+
5
+ module Playbook
6
+ module Pagination
7
+ class Rails < WillPaginate::ActionView::LinkRenderer
8
+ def container_attributes
9
+ { class: "pb_pagination" }
10
+ end
11
+
12
+ def page_number(page)
13
+ if page == current_page
14
+ tag("li", tag("span", page), class: "active")
15
+ else
16
+ tag("li", link(page, page, rel: rel_value(page)))
17
+ end
18
+ end
19
+
20
+ def previous_or_next_page(page, text, classname)
21
+ if page
22
+ tag("li", link(text, page), class: classname)
23
+ else
24
+ tag("li", tag("span", text), class: "%s disabled")
25
+ end
26
+ end
27
+
28
+ def gap; end
29
+
30
+ def previous_page
31
+ num = @collection.current_page > 1 && @collection.current_page - 1
32
+ previous_or_next_page(num, "<i class='far fa-chevron-left fa-xs'></i>", "prev")
33
+ end
34
+
35
+ def next_page
36
+ num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
37
+ previous_or_next_page(num, "<i class='far fa-chevron-right fa-xs'></i>", "next")
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "11.20.0"
5
- VERSION = "12.0.0"
4
+ PREVIOUS_VERSION = "12.1.0"
5
+ VERSION = "12.2.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.0
4
+ version: 12.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-30 00:00:00.000000000 Z
12
+ date: 2023-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -269,6 +269,20 @@ dependencies:
269
269
  - - '='
270
270
  - !ruby/object:Gem::Version
271
271
  version: 1.2018.9
272
+ - !ruby/object:Gem::Dependency
273
+ name: will_paginate
274
+ requirement: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - '='
277
+ - !ruby/object:Gem::Version
278
+ version: 3.3.1
279
+ type: :development
280
+ prerelease: false
281
+ version_requirements: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - '='
284
+ - !ruby/object:Gem::Version
285
+ version: 3.3.1
272
286
  description: Playbook Design System. Built for Nitro, but powering all.
273
287
  email:
274
288
  - nitroux@powerhrg.com
@@ -1467,6 +1481,12 @@ files:
1467
1481
  - app/pb_kits/playbook/pb_online_status/docs/index.js
1468
1482
  - app/pb_kits/playbook/pb_online_status/online_status.html.erb
1469
1483
  - app/pb_kits/playbook/pb_online_status/online_status.rb
1484
+ - app/pb_kits/playbook/pb_pagination/_pagination.scss
1485
+ - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb
1486
+ - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.md
1487
+ - app/pb_kits/playbook/pb_pagination/docs/example.yml
1488
+ - app/pb_kits/playbook/pb_pagination/pagination.html.erb
1489
+ - app/pb_kits/playbook/pb_pagination/pagination.rb
1470
1490
  - app/pb_kits/playbook/pb_passphrase/_passphrase.jsx
1471
1491
  - app/pb_kits/playbook/pb_passphrase/_passphrase.scss
1472
1492
  - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb
@@ -1792,8 +1812,8 @@ files:
1792
1812
  - app/pb_kits/playbook/pb_star_rating/docs/index.js
1793
1813
  - app/pb_kits/playbook/pb_star_rating/star_rating.html.erb
1794
1814
  - app/pb_kits/playbook/pb_star_rating/star_rating.rb
1795
- - app/pb_kits/playbook/pb_stat_change/_stat_change.jsx
1796
1815
  - app/pb_kits/playbook/pb_stat_change/_stat_change.scss
1816
+ - app/pb_kits/playbook/pb_stat_change/_stat_change.tsx
1797
1817
  - app/pb_kits/playbook/pb_stat_change/docs/_description.md
1798
1818
  - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.html.erb
1799
1819
  - app/pb_kits/playbook/pb_stat_change/docs/_stat_change_default.jsx
@@ -1806,8 +1826,9 @@ files:
1806
1826
  - app/pb_kits/playbook/pb_stat_change/docs/index.js
1807
1827
  - app/pb_kits/playbook/pb_stat_change/stat_change.html.erb
1808
1828
  - app/pb_kits/playbook/pb_stat_change/stat_change.rb
1809
- - app/pb_kits/playbook/pb_stat_value/_stat_value.jsx
1829
+ - app/pb_kits/playbook/pb_stat_change/stat_change.test.js
1810
1830
  - app/pb_kits/playbook/pb_stat_value/_stat_value.scss
1831
+ - app/pb_kits/playbook/pb_stat_value/_stat_value.tsx
1811
1832
  - app/pb_kits/playbook/pb_stat_value/docs/_description.md
1812
1833
  - app/pb_kits/playbook/pb_stat_value/docs/_footer.md
1813
1834
  - app/pb_kits/playbook/pb_stat_value/docs/_stat_value_default.html.erb
@@ -1821,6 +1842,7 @@ files:
1821
1842
  - app/pb_kits/playbook/pb_stat_value/docs/index.js
1822
1843
  - app/pb_kits/playbook/pb_stat_value/stat_value.html.erb
1823
1844
  - app/pb_kits/playbook/pb_stat_value/stat_value.rb
1845
+ - app/pb_kits/playbook/pb_stat_value/stat_value.test.js
1824
1846
  - app/pb_kits/playbook/pb_table/_table.jsx
1825
1847
  - app/pb_kits/playbook/pb_table/_table.scss
1826
1848
  - app/pb_kits/playbook/pb_table/_table_row.jsx
@@ -1978,8 +2000,8 @@ files:
1978
2000
  - app/pb_kits/playbook/pb_time_range_inline/docs/index.js
1979
2001
  - app/pb_kits/playbook/pb_time_range_inline/time_range_inline.html.erb
1980
2002
  - app/pb_kits/playbook/pb_time_range_inline/time_range_inline.rb
1981
- - app/pb_kits/playbook/pb_time_stacked/_time_stacked.jsx
1982
2003
  - app/pb_kits/playbook/pb_time_stacked/_time_stacked.scss
2004
+ - app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx
1983
2005
  - app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.html.erb
1984
2006
  - app/pb_kits/playbook/pb_time_stacked/docs/_time_stacked_default.jsx
1985
2007
  - app/pb_kits/playbook/pb_time_stacked/docs/example.yml
@@ -2005,8 +2027,8 @@ files:
2005
2027
  - app/pb_kits/playbook/pb_timeline/timeline.html.erb
2006
2028
  - app/pb_kits/playbook/pb_timeline/timeline.rb
2007
2029
  - app/pb_kits/playbook/pb_timestamp/_timestamp-mixins.scss
2008
- - app/pb_kits/playbook/pb_timestamp/_timestamp.jsx
2009
2030
  - app/pb_kits/playbook/pb_timestamp/_timestamp.scss
2031
+ - app/pb_kits/playbook/pb_timestamp/_timestamp.tsx
2010
2032
  - app/pb_kits/playbook/pb_timestamp/docs/_description.md
2011
2033
  - app/pb_kits/playbook/pb_timestamp/docs/_footer.md
2012
2034
  - app/pb_kits/playbook/pb_timestamp/docs/_time_stamp_default.md
@@ -2330,6 +2352,7 @@ files:
2330
2352
  - lib/playbook/markdown/template_handler.rb
2331
2353
  - lib/playbook/number_spacing.rb
2332
2354
  - lib/playbook/order.rb
2355
+ - lib/playbook/pagination_renderer.rb
2333
2356
  - lib/playbook/pb_doc_helper.rb
2334
2357
  - lib/playbook/pb_forms_helper.rb
2335
2358
  - lib/playbook/pb_kit_helper.rb
@@ -1,63 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
-
6
- import { buildCss } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps'
8
-
9
- import Body from '../pb_body/_body'
10
- import Icon from '../pb_icon/_icon'
11
-
12
- const statusMap = {
13
- increase: 'positive',
14
- decrease: 'negative',
15
- }
16
-
17
- const iconMap = {
18
- increase: 'arrow-up',
19
- decrease: 'arrow-down',
20
- }
21
-
22
- type StatChangeProps = {
23
- change?: "increase" | "decrease" | "neutral",
24
- className?: string,
25
- icon?: string,
26
- id?: string,
27
- value?: string | number,
28
- }
29
-
30
- const StatChange = (props: StatChangeProps) => {
31
- const { change = 'neutral', className, icon, id, value } = props
32
- const status = statusMap[change] || 'neutral'
33
- let returnedIcon = iconMap[change]
34
- if (icon) {
35
- returnedIcon = icon
36
- }
37
-
38
- return (
39
- <If condition={value}>
40
- <div
41
- className={classnames(
42
- buildCss('pb_stat_change_kit', status),
43
- globalProps(props),
44
- className
45
- )}
46
- id={id}
47
- >
48
- <Body status={status}>
49
- <If condition={returnedIcon}>
50
- <Icon
51
- fixed_width
52
- icon={returnedIcon}
53
- />
54
- {' '}
55
- </If>
56
- {`${value}%`}
57
- </Body>
58
- </div>
59
- </If>
60
- )
61
- }
62
-
63
- export default StatChange