playbook_ui 14.18.0.pre.rc.4 → 14.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +39 -1
  3. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.tsx +4 -0
  4. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +9 -1
  5. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.test.js +14 -0
  6. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
  7. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
  8. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
  9. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
  12. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
  13. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
  14. data/app/pb_kits/playbook/pb_copy_button/index.js +46 -20
  15. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +10 -1
  16. data/app/pb_kits/playbook/pb_dialog/dialog.rb +2 -0
  17. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
  18. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
  19. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  20. data/app/pb_kits/playbook/pb_dialog/index.js +106 -14
  21. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +31 -0
  22. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
  23. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
  24. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  25. data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +83 -0
  26. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +34 -0
  27. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +25 -4
  28. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
  29. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
  30. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
  31. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
  32. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +2 -0
  33. data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
  34. data/dist/chunks/_typeahead-C_FX7o_S.js +22 -0
  35. data/dist/chunks/{_weekday_stacked-Bm5175-u.js → _weekday_stacked-B4RLTeDo.js} +2 -2
  36. data/dist/chunks/lazysizes-DHz07jlL.js +1 -0
  37. data/dist/chunks/lib-ySl8uEpT.js +29 -0
  38. data/dist/chunks/{pb_form_validation-Bx1OK6xs.js → pb_form_validation-BRjyJrKh.js} +1 -1
  39. data/dist/chunks/vendor.js +1 -1
  40. data/dist/menu.yml +2 -2
  41. data/dist/playbook-doc.js +1 -1
  42. data/dist/playbook-rails-react-bindings.js +1 -1
  43. data/dist/playbook-rails.js +1 -1
  44. data/dist/playbook.css +1 -1
  45. data/lib/playbook/version.rb +1 -1
  46. metadata +21 -7
  47. data/dist/chunks/_typeahead-aRwivA3u.js +0 -22
  48. data/dist/chunks/lazysizes-B7xYodB-.js +0 -1
  49. data/dist/chunks/lib-Cj4H6j1c.js +0 -29
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+ import gaugeTheme from '../gaugeTheme'
3
+ import Highcharts from "highcharts"
4
+ import HighchartsReact from "highcharts-react-official"
5
+ import HighchartsMore from "highcharts/highcharts-more"
6
+ import SolidGauge from "highcharts/modules/solid-gauge"
7
+
8
+ HighchartsMore(Highcharts);
9
+ SolidGauge(Highcharts);
10
+
11
+ const data = [{ name: "Name", y: 45 }]
12
+
13
+ const baseOptions = {
14
+ title: { text: "" },
15
+ series: [{ data: data }],
16
+ };
17
+
18
+ const GaugePbStyles = () => {
19
+ const options = Highcharts.merge({}, gaugeTheme, baseOptions);
20
+
21
+ return (
22
+ <div>
23
+ <HighchartsReact
24
+ highcharts={Highcharts}
25
+ options={options}
26
+ />
27
+ </div>
28
+ );
29
+ };
30
+
31
+ export default GaugePbStyles;
@@ -0,0 +1 @@
1
+ You don't need to use the Gauge Kit to apply Playbook styles to your Highcharts gauge chart. Just import gaugeTheme.ts and merge it with your chart options—Playbook’s styling will apply automatically.
@@ -15,6 +15,7 @@ examples:
15
15
 
16
16
  react:
17
17
  - gauge_default: Default
18
+ - gauge_pb_styles: Playbook Styles
18
19
  - gauge_disable_animation: Disable Animation
19
20
  - gauge_title: Title
20
21
  - gauge_units: Units
@@ -1,4 +1,5 @@
1
1
  export { default as GaugeDefault } from './_gauge_default.jsx'
2
+ export { default as GaugePbStyles } from './_gauge_pb_styles.jsx'
2
3
  export { default as GaugeDisableAnimation } from './_gauge_disable_animation.jsx'
3
4
  export { default as GaugeFullCircle } from './_gauge_full_circle.jsx'
4
5
  export { default as GaugeHeight } from './_gauge_height.jsx'
@@ -0,0 +1,83 @@
1
+ import colors from '../tokens/exports/_colors.module.scss'
2
+ import typography from '../tokens/exports/_typography.module.scss'
3
+
4
+ const gaugeTheme = {
5
+ chart: {
6
+ type: "solidgauge",
7
+ events: {
8
+ render() {
9
+ this.container
10
+ const arc = this.container.querySelector('path.gauge-pane');
11
+ if (arc) arc.setAttribute('stroke-linejoin', 'round');
12
+ }
13
+ }
14
+ },
15
+ pane: {
16
+ size: "90%",
17
+ startAngle: -100,
18
+ endAngle: 100,
19
+ background: [
20
+ {
21
+ borderWidth: 20,
22
+ innerRadius: "90%",
23
+ outerRadius: "90%",
24
+ shape: "arc",
25
+ className: "gauge-pane",
26
+ borderColor: colors.border_light,
27
+ borderRadius: '50%',
28
+ },
29
+ ],
30
+ },
31
+ tooltip: {
32
+ backgroundColor: {
33
+ linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
34
+ stops: [
35
+ [0, colors.bg_dark],
36
+ [1, colors.bg_dark],
37
+ ],
38
+ },
39
+ pointFormat:
40
+ '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
41
+ "<b>{point.y}</b>",
42
+ followPointer: true,
43
+ shadow: false,
44
+ borderWidth: 0,
45
+ borderRadius: 10,
46
+ style: {
47
+ fontFamily: typography.font_family_base,
48
+ color: colors.text_dk_default,
49
+ fontWeight: typography.regular,
50
+ fontSize: typography.text_smaller,
51
+ },
52
+ },
53
+ yAxis: {
54
+ min: 0,
55
+ max: 100,
56
+ lineWidth: 0,
57
+ tickPositions: [] as number[],
58
+ },
59
+ plotOptions: {
60
+ solidgauge: {
61
+ borderColor: colors.data_1,
62
+ borderWidth: 20,
63
+ color: colors.data_1,
64
+ radius: 90,
65
+ innerRadius: "90%",
66
+ y: -26,
67
+ dataLabels: {
68
+ borderWidth: 0,
69
+ color: colors.text_lt_default,
70
+ enabled: true,
71
+ format: '<span class="fix">{y:,f}</span>',
72
+ style: {
73
+ fontFamily: typography.font_family_base,
74
+ fontWeight: typography.regular,
75
+ fontSize: typography.heading_2,
76
+ },
77
+ y: -26,
78
+ },
79
+ },
80
+ }
81
+ }
82
+
83
+ export default gaugeTheme;
@@ -88,6 +88,40 @@ $overlay_colors: (
88
88
  }
89
89
  }
90
90
 
91
+ &.overlay-full-screen {
92
+ position: fixed;
93
+ top: 0;
94
+ left: 0;
95
+ right: 0;
96
+ bottom: 0;
97
+ width: 100vw;
98
+ height: 100vh;
99
+ z-index: 9999;
100
+
101
+ &.no_gradient {
102
+ @each $color_name, $color in $overlay_colors {
103
+ &[data-overlay-color="#{$color_name}"] {
104
+ &::before {
105
+ content: "";
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ right: 0;
110
+ bottom: 0;
111
+ background: $color;
112
+ pointer-events: none;
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
+ @each $key, $value in $opacity {
119
+ &.#{$key}::before {
120
+ opacity: $value;
121
+ }
122
+ }
123
+ }
124
+
91
125
  &.no_gradient {
92
126
  @each $color_name, $color in $overlay_colors {
93
127
  .overlay_#{$color_name} {
@@ -9,6 +9,7 @@ export type OverlayChildrenProps = {
9
9
  children: React.ReactNode[] | React.ReactNode,
10
10
  color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
11
11
  dynamic?: boolean,
12
+ gradient?: boolean,
12
13
  position: string,
13
14
  size: string,
14
15
  scrollBarNone?: boolean,
@@ -21,6 +22,7 @@ type OverlayProps = {
21
22
  color: "card_light" | "bg_light" | "card_dark" | "bg_dark" | "black" | "white" | "success" | "error",
22
23
  data?: { [key: string]: string },
23
24
  dynamic?: false,
25
+ fullScreen?: boolean,
24
26
  gradient?: boolean,
25
27
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
26
28
  id?: string,
@@ -38,6 +40,7 @@ const Overlay = (props: OverlayProps) => {
38
40
  color = "card_light",
39
41
  data = {},
40
42
  dynamic = false,
43
+ fullScreen = false,
41
44
  gradient = true,
42
45
  htmlOptions = {},
43
46
  id,
@@ -51,8 +54,9 @@ const Overlay = (props: OverlayProps) => {
51
54
  const classes = classnames(
52
55
  buildCss('pb_overlay'),
53
56
  { 'overlay-hide-scrollbar': scrollBarNone },
57
+ { 'overlay-full-screen': fullScreen },
58
+ { 'no_gradient': gradient === false },
54
59
  globalProps(props),
55
- gradient === false ? 'no_gradient' : '',
56
60
  opacity,
57
61
  className
58
62
  )
@@ -64,6 +68,9 @@ const Overlay = (props: OverlayProps) => {
64
68
  }
65
69
 
66
70
  const getSize = () => {
71
+ if (fullScreen) {
72
+ return "100%"
73
+ }
67
74
  return Object.values(layout)[0]
68
75
  }
69
76
 
@@ -75,23 +82,37 @@ const Overlay = (props: OverlayProps) => {
75
82
  {...dataProps}
76
83
  {...htmlProps}
77
84
  className={classes}
85
+ data-overlay-color={color}
78
86
  id={id}
79
- style={dynamicInlineProps}
87
+ style={{
88
+ ...(fullScreen ? {
89
+ position: 'fixed',
90
+ top: 0,
91
+ left: 0,
92
+ right: 0,
93
+ bottom: 0,
94
+ zIndex: 9999,
95
+ '--overlay-color': `var(--${color})`,
96
+ } : {}),
97
+ ...dynamicInlineProps
98
+ }}
80
99
  >
81
100
  {isSizePercentage ?
82
101
  OverlayPercentage({
83
102
  children,
84
103
  color,
104
+ gradient,
85
105
  position: getPosition(),
86
106
  scrollBarNone,
87
- size: getSize()
107
+ size: getSize(),
88
108
  }) : OverlayToken({
89
109
  children,
90
110
  color,
91
111
  dynamic: dynamic,
112
+ gradient,
92
113
  position: getPosition(),
93
114
  scrollBarNone,
94
- size: getSize()
115
+ size: getSize(),
95
116
  })
96
117
  }
97
118
  </div>
@@ -0,0 +1,49 @@
1
+ import React, { useState } from 'react'
2
+ import Overlay from '../../pb_overlay/_overlay'
3
+ import Button from '../../pb_button/_button'
4
+ import FixedConfirmationToast from '../../pb_fixed_confirmation_toast/_fixed_confirmation_toast'
5
+
6
+ const OverlayFullscreenBackground = () => {
7
+ const [openBackground, setOpenBackground] = useState(false)
8
+
9
+ const handleClickBackground = () => {
10
+ setOpenBackground(true)
11
+ }
12
+
13
+ const handleCloseBackground = () => {
14
+ setOpenBackground(false)
15
+ }
16
+
17
+ return (
18
+ <>
19
+ <div>
20
+ <Button
21
+ onClick={handleClickBackground}
22
+ text="Background Dark"
23
+ variant="secondary"
24
+ />
25
+
26
+ {openBackground && (
27
+ <Overlay
28
+ color="bg_dark"
29
+ fullScreen
30
+ gradient={false}
31
+ opacity="opacity_4"
32
+ >
33
+ <FixedConfirmationToast
34
+ closeable
35
+ horizontal='center'
36
+ onClose={handleCloseBackground}
37
+ open={openBackground}
38
+ status="tip"
39
+ text='Fullscreen Overlay with color set to Background Dark.'
40
+ vertical='top'
41
+ />
42
+ </Overlay>
43
+ )}
44
+ </div>
45
+ </>
46
+ )
47
+ }
48
+
49
+ export default OverlayFullscreenBackground
@@ -0,0 +1 @@
1
+ The `fullScreen` prop also allows you to use `color` along with it.
@@ -0,0 +1,81 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import Overlay from '../../pb_overlay/_overlay'
4
+ import Button from '../../pb_button/_button'
5
+ import FixedConfirmationToast from '../../pb_fixed_confirmation_toast/_fixed_confirmation_toast'
6
+
7
+ const OverlayFullscreenOpacity = () => {
8
+ const [openOpacity40, setOpenOpacity40] = useState(false)
9
+ const [openOpacity80, setOpenOpacity80] = useState(false)
10
+
11
+ const handleClickOpacity40 = () => {
12
+ setOpenOpacity40(true)
13
+ }
14
+ const handleCloseOpacity40 = () => {
15
+ setOpenOpacity40(false)
16
+ }
17
+
18
+ const handleClickOpacity80 = () => {
19
+ setOpenOpacity80(true)
20
+ }
21
+ const handleCloseOpacity80 = () => {
22
+ setOpenOpacity80(false)
23
+ }
24
+
25
+ return (
26
+ <>
27
+ <div>
28
+ <Button
29
+ onClick={handleClickOpacity40}
30
+ text="40% Opacity"
31
+ variant="secondary"
32
+ />
33
+ {' '}
34
+ <Button
35
+ onClick={handleClickOpacity80}
36
+ text="80% Opacity"
37
+ variant="secondary"
38
+ />
39
+
40
+ {openOpacity40 && (
41
+ <Overlay
42
+ fullScreen
43
+ gradient={false}
44
+ opacity="opacity_4"
45
+ >
46
+ <FixedConfirmationToast
47
+ closeable
48
+ horizontal='center'
49
+ onClose={handleCloseOpacity40}
50
+ open={openOpacity40}
51
+ status="tip"
52
+ text='Fullscreen Overlay at 40% Opacity.'
53
+ vertical='top'
54
+ />
55
+ </Overlay>
56
+ )}
57
+
58
+ {openOpacity80 && (
59
+ <Overlay
60
+ fullScreen
61
+ gradient={false}
62
+ opacity="opacity_8"
63
+ >
64
+ <FixedConfirmationToast
65
+ closeable
66
+ display="block"
67
+ horizontal='center'
68
+ onClose={handleCloseOpacity80}
69
+ open={openOpacity80}
70
+ status="tip"
71
+ text='Fullscreen Overlay at 80% Opacity.'
72
+ vertical='top'
73
+ />
74
+ </Overlay>
75
+ )}
76
+ </div>
77
+ </>
78
+ )
79
+ }
80
+
81
+ export default OverlayFullscreenOpacity
@@ -0,0 +1 @@
1
+ To enable the overlay to cover the full size of your screen, you can pass the `fullScreen` prop. You can also pass an opacity along with it.
@@ -8,6 +8,8 @@ examples:
8
8
  - overlay_vertical_dynamic_multi_directional: Vertical Dynamic Multi-directional
9
9
  - overlay_toggle: Toggle
10
10
  - overlay_hide_scroll_bar: Hide Scroll Bar
11
+ - overlay_fullscreen_opacity: Full Page Opacity
12
+ - overlay_fullscreen_background: Full Page Using Background Color Tokens
11
13
 
12
14
  rails:
13
15
  - overlay_default: Default
@@ -6,3 +6,5 @@ export { default as OverlayMultiDirectional } from './_overlay_multi_directional
6
6
  export { default as OverlayToggle } from './_overlay_toggle.jsx'
7
7
  export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
8
8
  export { default as OverlayHideScrollBar } from './_overlay_hide_scroll_bar.jsx'
9
+ export { default as OverlayFullscreenOpacity } from './_overlay_fullscreen_opacity.jsx'
10
+ export { default as OverlayFullscreenBackground } from './_overlay_fullscreen_background.jsx'