playbook_ui_docs 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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.html.erb +28 -0
  3. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.jsx +42 -0
  4. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_size.md +1 -0
  5. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +2 -0
  6. data/app/pb_kits/playbook/pb_circle_icon_button/docs/index.js +1 -0
  7. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.html.erb +14 -0
  8. data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails.md +3 -0
  9. data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +1 -0
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames.html.erb +117 -0
  11. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_turbo_frames_rails.md +9 -0
  12. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
  13. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +31 -0
  14. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
  15. data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
  16. data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.jsx +49 -0
  18. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_background.md +1 -0
  19. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.jsx +81 -0
  20. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_fullscreen_opacity.md +1 -0
  21. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_overlay/docs/index.js +2 -0
  23. data/dist/playbook-doc.js +1 -1
  24. metadata +15 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2900bd6939cc2287d04cfc751885d9682695f2701643cfb71a3b312371bf009
4
- data.tar.gz: df922ff349761c2b4ee6fa132dd108d8a66bca141643dd9e4984824238466364
3
+ metadata.gz: af41094e29ed2d3de146bd91de5f6cea739b2d3e072d9afacec4b21c886526d6
4
+ data.tar.gz: 1f612e7d4be527c0ee0f1513251058d3abb9235f472f9ed6541fb18e45d56f19
5
5
  SHA512:
6
- metadata.gz: 17707bc936592cfe9cbe958f2b4bffcc4b0522e7ee4f9c79f4a805638b9097237443fbed67967f29b078729bffaa5bd43dbdc3408ea7f39adcc6990c2fef0c49
7
- data.tar.gz: 495536380b0be28825f3b91d710caa7cc70f28de17cd392cb0c15a92ce10766770d5d7ff2bd90a0ddbc2a4bb5417770282bf750e3097f7232542a90abb499912
6
+ metadata.gz: 9cb9da613064a0b79590f9c9f316427cd5d7eb9557ded4ed3a7950aa151ae9b651fa2332655d5fec21dea7f4564b67ffc36ce854f144061b9cf333c62d24e4e0
7
+ data.tar.gz: a1681cb02dd1d7711fef564f0b0530ea1df0189f20a54f31999f868e56f01b1a4950916d304a34e3b162daf52e1a8cd53103ed46994cedf8fa20e7003d7c4bc1
@@ -0,0 +1,28 @@
1
+ <%= pb_rails("flex", props: { orientation: "column", gap: "sm" }) do %>
2
+ <%= pb_rails("circle_icon_button", props: {
3
+ icon: "plus",
4
+ size: "sm",
5
+ variant: "primary"
6
+ }) %>
7
+
8
+ <%= pb_rails("circle_icon_button", props: {
9
+ icon: "pen",
10
+ loading: true,
11
+ size: "sm",
12
+ variant: "secondary"
13
+ }) %>
14
+
15
+ <%= pb_rails("circle_icon_button", props: {
16
+ disabled: true,
17
+ icon: "times",
18
+ size: "sm"
19
+ }) %>
20
+
21
+ <%= pb_rails("circle_icon_button", props: {
22
+ icon: "info",
23
+ link: "https://playbook.powerapp.cloud/",
24
+ size: "sm",
25
+ target: "child",
26
+ variant: "link"
27
+ }) %>
28
+ <% end %>
@@ -0,0 +1,42 @@
1
+ import React from 'react'
2
+
3
+ import CircleIconButton from '../_circle_icon_button'
4
+ import Flex from '../../pb_flex/_flex'
5
+
6
+ const CircleIconButtonSize = (props) => (
7
+ <>
8
+ <Flex gap="sm"
9
+ orientation="column"
10
+ >
11
+ <CircleIconButton
12
+ icon="plus"
13
+ size="sm"
14
+ variant="primary"
15
+ {...props}
16
+ />
17
+ <CircleIconButton
18
+ icon="pen"
19
+ loading
20
+ size="sm"
21
+ variant="secondary"
22
+ {...props}
23
+ />
24
+ <CircleIconButton
25
+ disabled
26
+ icon="times"
27
+ size="sm"
28
+ {...props}
29
+ />
30
+ <CircleIconButton
31
+ icon="info"
32
+ link="https://playbook.powerapp.cloud/"
33
+ size="sm"
34
+ target="child"
35
+ variant="link"
36
+ {...props}
37
+ />
38
+ </Flex>
39
+ </>
40
+ )
41
+
42
+ export default CircleIconButtonSize
@@ -0,0 +1 @@
1
+ The `size` prop accepts "sm" as a value to make the Circle Icon Button 20px x 20px instead of the default 40px x 40px size.
@@ -4,9 +4,11 @@ examples:
4
4
  - circle_icon_button_default: Default
5
5
  - circle_icon_button_link: Link
6
6
  - circle_icon_button_loading: Loading
7
+ - circle_icon_button_size: Size
7
8
 
8
9
  react:
9
10
  - circle_icon_button_default: Default
10
11
  - circle_icon_button_click: Click Handler
11
12
  - circle_icon_button_link: Link
12
13
  - circle_icon_button_loading: Loading
14
+ - circle_icon_button_size: Size
@@ -2,3 +2,4 @@ export { default as CircleIconButtonDefault } from './_circle_icon_button_defaul
2
2
  export { default as CircleIconButtonClick } from './_circle_icon_button_click.jsx'
3
3
  export { default as CircleIconButtonLink } from './_circle_icon_button_link.jsx'
4
4
  export { default as CircleIconButtonLoading } from './_circle_icon_button_loading.jsx'
5
+ export { default as CircleIconButtonSize } from './_circle_icon_button_size.jsx'
@@ -0,0 +1,14 @@
1
+ <%= pb_rails("body", props: { cursor: "pointer", data: { "external-copy-from": "hookbody"} }) do %>
2
+ <span id="hookbody">I'm a custom copy hook! Click this body to copy this text!</span>
3
+ <% end %>
4
+
5
+ <%= pb_rails("tooltip", props: {
6
+ trigger_element_selector: "#hookbody",
7
+ tooltip_id: "hookbody_tooltip",
8
+ position: 'top',
9
+ trigger_method: "click"
10
+ }) do %>
11
+ Copied!
12
+ <% end %>
13
+
14
+ <%= pb_rails("textarea", props: { margin_top: "xs", placeholder: "Paste here" }) %>
@@ -0,0 +1,3 @@
1
+ You can use any external control (like the text itself or an icon) to copy. To use this hook, set the `data-external-copy-from` attribute on the external control to the copying ID. This will grab the `innerText` from `your_id` element, or `value` if it is an input element. Alternatively, you can set a `data-external-copy-value` attribute and copy custom text.
2
+
3
+ See the code example for details.
@@ -2,6 +2,7 @@ examples:
2
2
  rails:
3
3
  - copy_button_default: Default
4
4
  - copy_button_from: Copy From
5
+ - copy_button_hook_rails: Copy Hook
5
6
 
6
7
  react:
7
8
  - copy_button_default: Default
@@ -0,0 +1,117 @@
1
+ <%= pb_rails("flex", props:{ gap: "xs", wrap:true}) do %>
2
+ <%= pb_rails("button", props: { id: "button-open-example-turbo-frames", margin_right: "md", text: "Open Dialog via Custom Event" }) %>
3
+ <%= pb_rails("button", props: { id: "open-dialog-button", data: { open_dialog: "dialog-confirm-turbo-frames" }, margin_right: "md", text: "Custom Event Linked to Confirm Button" }) %>
4
+ <%= pb_rails("button", props: { id: "button-open-multi-dialog", text: "Mutliple Events Example" }) %>
5
+ <% end %>
6
+
7
+ <!-- Example 1: Basic dialog with custom event opening -->
8
+ <%= pb_rails("dialog", props: {
9
+ id: "dialog-open-turbo-frames",
10
+ title: "Click Event Simulation",
11
+ text: "Demonstrating Opening the Dialog with a Custom Event.",
12
+ custom_event_type: "dialogOpen",
13
+ cancel_button: "Cancel Button",
14
+ confirm_button: "Okay",
15
+ confirm_button_id: "confirm-button-turbo-frames"
16
+ }) %>
17
+
18
+ <script>
19
+ document.getElementById("button-open-example-turbo-frames").addEventListener("click", () => {
20
+ console.log("📣 Dispatching 'dialogOpen' custom event")
21
+
22
+ window.dispatchEvent(new CustomEvent("dialogOpen", {
23
+ bubbles: true,
24
+ detail: {
25
+ dialogId: "dialog-open-turbo-frames",
26
+ action: "open"
27
+ }
28
+ }))
29
+
30
+ console.log("✅ Custom event dispatched - dialog should open")
31
+ })
32
+ </script>
33
+
34
+ <!-- Example 2: Dialog with custom event linking confirm button to closing the dialog-->
35
+ <%= pb_rails("dialog", props: {
36
+ id: "dialog-confirm-turbo-frames",
37
+ title: "Custom Event Button Action",
38
+ text: "Clicking this dialog's confirm button triggers closing the dialog as well.",
39
+ custom_event_type: "turboResponse",
40
+ cancel_button: "Cancel",
41
+ cancel_button_id: "cancel-button-id-turbo-frames",
42
+ confirm_button: "Confirm Button",
43
+ confirm_button_id: "confirm-button-id-turbo-frames"
44
+ }) %>
45
+
46
+ <script>
47
+ window.addEventListener("turboResponse", (event) => {
48
+ const { dialogId, action, cancelButtonId } = event.detail || {}
49
+ console.log("📦 turboResponse event triggered:", { dialogId, action, cancelButtonId })
50
+
51
+ if (action === "close" && cancelButtonId) {
52
+ const dialog = document.getElementById(dialogId)
53
+ if (dialog?.close) {
54
+ console.log("🚪 Closing dialog programmatically")
55
+ dialog.close()
56
+ }
57
+ }
58
+ })
59
+
60
+ document.getElementById("confirm-button-id-turbo-frames").addEventListener("click", function () {
61
+ console.log("✅ Confirm button clicked! Triggering cancel via turboResponse")
62
+
63
+ window.dispatchEvent(new CustomEvent("turboResponse", {
64
+ detail: {
65
+ dialogId: "dialog-confirm-turbo-frames",
66
+ action: "close",
67
+ cancelButtonId: "cancel-button-id-turbo-frames"
68
+ }
69
+ }))
70
+ })
71
+ </script>
72
+
73
+ <!-- Example 3: Dialog with multiple custom event types -->
74
+ <%= pb_rails("dialog", props: {
75
+ id: "multi-event-dialog",
76
+ title: "Multiple Event Types",
77
+ text: "This dialog responds to multiple custom event types - see console logs.",
78
+ custom_event_type: "dialogOpenMutli,turboResponseMulti",
79
+ cancel_button: "Cancel",
80
+ cancel_button_id: "multi-event-cancel",
81
+ confirm_button: "Confirm",
82
+ confirm_button_id: "multi-event-confirm"
83
+ }) %>
84
+
85
+ <script>
86
+ document.getElementById("button-open-multi-dialog").addEventListener("click", () => {
87
+ console.log("📣 Dispatching 'dialogOpenMutli' custom event")
88
+ window.dispatchEvent(new CustomEvent("dialogOpenMutli", {
89
+ detail: {
90
+ dialogId: "multi-event-dialog",
91
+ action: "open"
92
+ }
93
+ }))
94
+ })
95
+
96
+ document.getElementById("multi-event-confirm")?.addEventListener("click", function() {
97
+ console.log("✅ Confirm clicked — dispatching 'turboResponseMulti' to simulate dialog close")
98
+
99
+ window.dispatchEvent(new CustomEvent("turboResponseMulti", {
100
+ detail: {
101
+ dialogId: "multi-event-dialog",
102
+ action: "close",
103
+ cancelButtonId: "multi-event-cancel"
104
+ }
105
+ }))
106
+ })
107
+
108
+ window.addEventListener("turboResponseMulti", (event) => {
109
+ const { dialogId, action, cancelButtonId } = event.detail || {}
110
+
111
+ if (action === "close" && dialogId) {
112
+ const dialog = document.getElementById(dialogId)
113
+ dialog.close?.()
114
+ console.log("🚪 Closing dialog programmatically")
115
+ }
116
+ })
117
+ </script>
@@ -0,0 +1,9 @@
1
+ The `custom_event_type` prop allows you to specify custom events that will trigger the dialog's initialization or control its behavior. This is especially useful when working with Turbo Frame updates where standard DOM events might not suffice.
2
+
3
+ The examples demonstrate two use cases:
4
+ 1) Opening a dialog via custom event dispatch: The first example shows how to configure a dialog to listen for a specific custom event (dialogOpen). When this event is dispatched, the dialog will automatically open, making it easy to trigger the dialog from JavaScript or after Turbo Frame operations.
5
+ 2) Controlling dialog button actions with custom events: The second example demonstrates how to set up a dialog that can have its confirm button triggered through external events (turboResponse). This pattern is useful when you need to programmatically confirm a dialog after some background operation completes.
6
+ 3) Multiple custom events: The third example combines the first two to show how `custom_event_type` prop can support multiple event types separated by a comma.
7
+
8
+ For Turbo integration, you can use standard Turbo events like turbo:frame-load or turbo:submit-end as your `custom_event_type` to ensure the dialog responds properly after Turbo navigation or form submissions. The dialog component will listen for these events automatically.
9
+ The implementation handles various actions including 'open', 'close', 'clickConfirm', and 'clickCancel', making it flexible for different interaction patterns in your Turbo-enhanced application.
@@ -11,6 +11,7 @@ examples:
11
11
  - dialog_full_height: Full Height
12
12
  - dialog_full_height_placement: Full Height Placement
13
13
  - dialog_loading: Loading
14
+ - dialog_turbo_frames: Within Turbo Frames
14
15
 
15
16
 
16
17
  react:
@@ -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,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'