playbook_ui 14.22.0.pre.alpha.popoverkittransitionpoppertofloatingui8781 → 14.22.0.pre.alpha.popoverkittransitionpoppertofloatingui8856

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -1
  3. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +36 -1
  4. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +71 -26
  5. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -16
  6. data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors.md → _circle_chart_colors_rails.md} +1 -1
  7. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +2 -0
  8. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +28 -16
  9. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +4 -2
  10. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +23 -15
  11. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +81 -51
  12. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +103 -75
  13. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +3 -6
  14. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +19 -13
  15. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -17
  16. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +34 -20
  17. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +29 -20
  18. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +28 -20
  19. data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +1 -0
  20. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -1
  21. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -1
  22. data/app/pb_kits/playbook/pb_filter/filter.test.js +1 -1
  23. data/app/pb_kits/playbook/pb_popover/_popover.tsx +16 -20
  24. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +3 -3
  25. data/dist/chunks/_circle_chart-DVSbcau1.js +1 -0
  26. data/dist/chunks/_typeahead-Dw_aUsLL.js +22 -0
  27. data/dist/chunks/_weekday_stacked-BNHzzslr.js +21 -0
  28. data/dist/chunks/{lib-BTYFzEXV.js → lib-Ca_BDmX1.js} +1 -1
  29. data/dist/chunks/{pb_form_validation-Cn7GCWm0.js → pb_form_validation-DczEjrcc.js} +1 -1
  30. data/dist/chunks/vendor.js +1 -1
  31. data/dist/playbook-doc.js +1 -19
  32. data/dist/playbook-rails-react-bindings.js +1 -1
  33. data/dist/playbook-rails.js +1 -1
  34. data/lib/playbook/version.rb +1 -1
  35. metadata +10 -12
  36. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
  37. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
  38. data/app/pb_kits/playbook/pb_popover/popover.test.js +0 -220
  39. data/app/pb_kits/playbook/pb_rich_text_editor/rich_text_editor_advanced.test.js +0 -47
  40. data/dist/chunks/_bar_graph-B9HqVkQv.js +0 -1
  41. data/dist/chunks/_typeahead-CiAYz-Py.js +0 -22
  42. data/dist/chunks/_weekday_stacked-_I9XNGZe.js +0 -45
@@ -1,220 +0,0 @@
1
- import React from "react";
2
- import { render, screen, fireEvent } from "../utilities/test-utils";
3
- import { Button, PbReactPopover } from "playbook-ui";
4
-
5
- const testId = "popover-kit";
6
-
7
- //Test default popover
8
- const PopoverTest = () => {
9
- const [mockState, setMockState] = React.useState(false)
10
- const togglePopover = () => {
11
- setMockState(!mockState)
12
- }
13
-
14
- const popoverReference = (
15
- <Button onClick={togglePopover}
16
- text="Click Me"
17
- />
18
- );
19
- return (
20
- <PbReactPopover
21
- offset
22
- reference={popoverReference}
23
- show={mockState}
24
- >
25
- {"Click Anywhere"}
26
- </PbReactPopover>
27
- )
28
- };
29
- //Test popover with z-index
30
- const PopoverTestZIndex = () => {
31
- const [mockState, setMockState] = React.useState(false)
32
- const togglePopover = () => {
33
- setMockState(!mockState)
34
- }
35
-
36
- const popoverReference = (
37
- <Button onClick={togglePopover}
38
- text="Click Me"
39
- />
40
- );
41
- return (
42
- <PbReactPopover
43
- offset
44
- reference={popoverReference}
45
- show={mockState}
46
- zIndex={3}
47
- >
48
- {"Click Anywhere"}
49
- </PbReactPopover>
50
- )
51
- };
52
-
53
- //Test popover with max-height and max-width
54
- const PopoverTestHeight = () => {
55
- const [mockState, setMockState] = React.useState(false)
56
- const togglePopover = () => {
57
- setMockState(!mockState)
58
- }
59
-
60
- const popoverReference = (
61
- <Button onClick={togglePopover}
62
- text="Click Me"
63
- />
64
- );
65
- return (
66
- <PbReactPopover
67
- maxHeight="150px"
68
- maxWidth="240px"
69
- offset
70
- reference={popoverReference}
71
- show={mockState}
72
- >
73
- {"Click Anywhere"}
74
- </PbReactPopover>
75
- )
76
- };
77
-
78
- //Test Popover with click to close 'anywhere'
79
- const PopoverTestClicktoClose = () => {
80
- const [mockState, setMockState] = React.useState(false)
81
- const togglePopover = () => {
82
- setMockState(!mockState)
83
- }
84
- const handleShouldClosePopover = (shouldClosePopover) => {
85
- setMockState(!shouldClosePopover)
86
- }
87
-
88
- const popoverReference = (
89
- <Button onClick={togglePopover}
90
- text="Click Me"
91
- />
92
- );
93
- return (
94
- <PbReactPopover
95
- closeOnClick="any"
96
- offset
97
- reference={popoverReference}
98
- shouldClosePopover={handleShouldClosePopover}
99
- show={mockState}
100
- >
101
- {"Click Anywhere"}
102
- </PbReactPopover>
103
- )
104
- };
105
-
106
- //Test Popover with click to close 'inside'
107
- const PopoverTestClicktoClose2 = () => {
108
- const [mockState, setMockState] = React.useState(false)
109
- const togglePopover = () => {
110
- setMockState(!mockState)
111
- }
112
- const handleShouldClosePopover = (shouldClosePopover) => {
113
- setMockState(!shouldClosePopover)
114
- }
115
-
116
- const popoverReference = (
117
- <Button onClick={togglePopover}
118
- text="Click Me"
119
- />
120
- );
121
- return (
122
- <PbReactPopover
123
- closeOnClick="inside"
124
- offset
125
- reference={popoverReference}
126
- shouldClosePopover={handleShouldClosePopover}
127
- show={mockState}
128
- >
129
- {"Click Inside"}
130
- </PbReactPopover>
131
- )
132
- };
133
-
134
- //Test Popover with click to close 'outside'
135
- const PopoverTestClicktoClose3 = () => {
136
- const [mockState, setMockState] = React.useState(false)
137
- const togglePopover = () => {
138
- setMockState(!mockState)
139
- }
140
- const handleShouldClosePopover = (shouldClosePopover) => {
141
- setMockState(!shouldClosePopover)
142
- }
143
-
144
- const popoverReference = (
145
- <Button onClick={togglePopover}
146
- text="Click Me"
147
- />
148
- );
149
- return (
150
- <PbReactPopover
151
- closeOnClick="outside"
152
- offset
153
- reference={popoverReference}
154
- shouldClosePopover={handleShouldClosePopover}
155
- show={mockState}
156
- >
157
- {"Click Outside"}
158
- </PbReactPopover>
159
- )
160
- };
161
-
162
-
163
- test("renders Popover", () => {
164
- render(<PopoverTest data={{ testid: testId}}/>)
165
- const btn = screen.getByText(/click me/i)
166
- fireEvent.click(btn);
167
- const kit = screen.getByText("Click Anywhere");
168
- expect(kit).toBeInTheDocument();
169
- });
170
-
171
- test("renders Popover with z index", () => {
172
- render(<PopoverTestZIndex data={{ testid: testId}}/>)
173
- const btn = screen.getByText(/click me/i)
174
- fireEvent.click(btn);
175
- const kit = screen.getByText("Click Anywhere");
176
- expect(kit).toHaveClass("pb_popover_body z_index_3");
177
- });
178
-
179
- test("renders Popover with max height and max width", () => {
180
- render(<PopoverTestHeight data={{ testid: testId}}/>)
181
- const btn = screen.getByText(/click me/i)
182
- fireEvent.click(btn);
183
- const kit = screen.getByText("Click Anywhere");
184
- expect(kit).toHaveClass("pb_popover_body p_sm overflow_handling");
185
- });
186
-
187
- test("closes Popover on click anywhere", async () => {
188
- render(<PopoverTestClicktoClose data={{ testid: testId}}/>)
189
- const btn = screen.getByText(/click me/i)
190
- fireEvent.click(btn);
191
- const kit = screen.getByText("Click Anywhere");
192
- expect(kit).toBeInTheDocument();
193
- fireEvent.click(document.body);
194
-
195
- expect(kit).not.toBeInTheDocument;
196
- });
197
-
198
- test("closes Popover on click inside", async () => {
199
- render(<PopoverTestClicktoClose2 data={{ testid: testId}}/>)
200
- const btn = screen.getByText(/click me/i)
201
- fireEvent.click(btn);
202
- const kit = screen.getByText("Click Inside");
203
- expect(kit).toBeInTheDocument();
204
- fireEvent.click(kit);
205
-
206
- expect(kit).not.toBeInTheDocument;
207
- });
208
-
209
- test("closes Popover on click outside", async () => {
210
- render(<PopoverTestClicktoClose3 data={{ testid: testId}}/>)
211
- const btn = screen.getByText(/click me/i)
212
- fireEvent.click(btn);
213
- const kit = screen.getByText("Click Outside");
214
- expect(kit).toBeInTheDocument();
215
- fireEvent.click(kit);
216
- expect(kit).toBeInTheDocument();
217
- fireEvent.click(btn);
218
-
219
- expect(kit).not.toBeInTheDocument;
220
- });
@@ -1,47 +0,0 @@
1
- import React from "react";
2
- import { render } from "../utilities/test-utils";
3
- import { useEditor, EditorContent } from "@tiptap/react";
4
- import StarterKit from "@tiptap/starter-kit";
5
- import Link from "@tiptap/extension-link";
6
-
7
- import RichTextEditor from "./_rich_text_editor";
8
-
9
- const kitClass = "pb_rich_text_editor_advanced_container";
10
-
11
- const EditorTest = (props) => {
12
- const editor = useEditor({
13
- extensions: [StarterKit, Link],
14
- content: "",
15
- });
16
-
17
- return (
18
- <RichTextEditor
19
- advancedEditor={editor}
20
- {...props}
21
- >
22
- <EditorContent editor={editor} />
23
- </RichTextEditor>
24
- );
25
- };
26
-
27
- test("returns namespaced class name", () => {
28
- const { container } = render(<EditorTest />);
29
-
30
- expect(container.getElementsByClassName(kitClass).length).toBeGreaterThan(0);
31
- });
32
-
33
- test("returns toolbar class name", () => {
34
- const { container } = render(<EditorTest />);
35
-
36
- expect(
37
- container.getElementsByClassName(`${kitClass} toolbar-active`).length
38
- ).toBeGreaterThan(0);
39
- });
40
-
41
- test("doesn't returns toolbar class name", () => {
42
- const { container } = render(<EditorTest advancedEditorToolbar={false} />);
43
-
44
- expect(
45
- container.getElementsByClassName(`${kitClass} toolbar-active`).length
46
- ).toBe(0);
47
- });
@@ -1 +0,0 @@
1
- import{jsx}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,m as mapColors,H as HighchartsReact,d as Highcharts,e as classnames,g as globalProps}from"./_typeahead-CiAYz-Py.js";import{h as highchartsTheme,m as merge,a as highchartsDarkTheme}from"./lib-BTYFzEXV.js";const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors!==void 0&&colors.length>0?mapColors(colors):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B};