playbook_ui 14.23.0.pre.rc.2 → 14.23.0.pre.rc.3

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -6
  3. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -1
  4. data/app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx +3 -3
  5. data/app/pb_kits/playbook/pb_body/docs/_body_truncate_react.md +4 -0
  6. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +36 -1
  7. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +71 -26
  8. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -16
  9. data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors.md → _circle_chart_colors_rails.md} +1 -1
  10. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +2 -0
  11. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +28 -16
  12. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +4 -2
  13. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +23 -15
  14. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +81 -51
  15. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +103 -75
  16. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +3 -6
  17. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +19 -13
  18. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -17
  19. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +34 -20
  20. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +29 -20
  21. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +28 -20
  22. data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +1 -0
  23. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -1
  24. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -1
  25. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +12 -4
  26. data/app/pb_kits/playbook/pb_draggable/context/types.ts +5 -2
  27. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +27 -17
  28. data/app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx +3 -3
  29. data/app/pb_kits/playbook/pb_title/docs/_title_truncate_react.md +4 -0
  30. data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
  31. data/dist/chunks/{_typeahead-C2h5Gq3P.js → _typeahead-B1tu_vWi.js} +3 -3
  32. data/dist/chunks/{_weekday_stacked-XhCaqWUk.js → _weekday_stacked-CKk0dR5s.js} +1 -1
  33. data/dist/chunks/{lib-C0HyLoRj.js → lib-DYpq0k8j.js} +1 -1
  34. data/dist/chunks/{pb_form_validation-C3CDCB0e.js → pb_form_validation-BUOKwfvW.js} +1 -1
  35. data/dist/chunks/vendor.js +1 -1
  36. data/dist/menu.yml +68 -8
  37. data/dist/playbook-doc.js +2 -2
  38. data/dist/playbook-rails-react-bindings.js +1 -1
  39. data/dist/playbook-rails.js +1 -1
  40. data/lib/playbook/version.rb +1 -1
  41. metadata +14 -12
  42. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
  43. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
  44. data/dist/chunks/_bar_graph-DVfSt34a.js +0 -1
  45. /data/app/pb_kits/playbook/pb_body/docs/{_body_truncate.md → _body_truncate_rails.md} +0 -0
  46. /data/app/pb_kits/playbook/pb_title/docs/{_title_truncate.md → _title_truncate_rails.md} +0 -0
@@ -6,14 +6,16 @@ export interface ItemType {
6
6
 
7
7
  export interface InitialStateType {
8
8
  items: ItemType[];
9
- dragData: { id: string; initialGroup: string };
9
+ dragData: { id: string; initialGroup: string, originId?: string };
10
10
  isDragging: string;
11
11
  activeContainer: string;
12
12
  }
13
13
 
14
14
  export type ActionType =
15
15
  | { type: 'SET_ITEMS'; payload: ItemType[] }
16
- | { type: 'SET_DRAG_DATA'; payload: { id: string; initialGroup: string } }
16
+ | { type: 'SET_DRAG_DATA'; payload: {
17
+ originId: string; id: string; initialGroup: string
18
+ } }
17
19
  | { type: 'SET_IS_DRAGGING'; payload: string }
18
20
  | { type: 'SET_ACTIVE_CONTAINER'; payload: string }
19
21
  | { type: 'CHANGE_CATEGORY'; payload: { itemId: string; container: string } }
@@ -35,4 +37,5 @@ export type ActionType =
35
37
  onDrop?: (container: string) => void;
36
38
  onDragOver?: (e: Event, container: string) => void;
37
39
  dropZone?: DropZoneConfig | string; // Can accept string for backward compatibility
40
+ providerId?: string;
38
41
  }
@@ -68,7 +68,7 @@ const containOnlyNumbers = (value: string) => {
68
68
  return /^[()+\-\ .\d]*$/g.test(value)
69
69
  }
70
70
 
71
- const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefObject<unknown>) => {
71
+ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>) => {
72
72
  const {
73
73
  aria = {},
74
74
  className,
@@ -106,15 +106,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
106
106
  className
107
107
  )
108
108
 
109
- const inputRef = useRef<HTMLInputElement>()
109
+ const inputRef = useRef<HTMLInputElement | null>(null)
110
110
  const itiRef = useRef<any>(null);
111
111
  const [inputValue, setInputValue] = useState(value)
112
112
  const [error, setError] = useState(props.error)
113
113
  const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
114
114
  const [selectedData, setSelectedData] = useState()
115
+ const [hasTyped, setHasTyped] = useState(false)
115
116
 
116
117
  useEffect(() => {
117
- if (error?.length > 0) {
118
+ if ((error ?? '').length > 0) {
118
119
  onValidate(false)
119
120
  } else {
120
121
  onValidate(true)
@@ -131,6 +132,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
131
132
  clearField() {
132
133
  setInputValue("")
133
134
  setError("")
135
+ setHasTyped(false)
134
136
  },
135
137
  inputNode() {
136
138
  return inputRef.current
@@ -201,6 +203,8 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
201
203
  }
202
204
 
203
205
  const validateErrors = () => {
206
+ if (!hasTyped && !error) return
207
+
204
208
  if (itiRef.current) isValid(itiRef.current.isValidNumber())
205
209
  if (validateOnlyNumbers(itiRef.current)) return
206
210
  if (validateTooLongNumber(itiRef.current)) return
@@ -214,6 +218,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
214
218
  }
215
219
 
216
220
  const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
221
+ if (!hasTyped) setHasTyped(true)
217
222
  setInputValue(evt.target.value)
218
223
  let phoneNumberData
219
224
  if (formatAsYouType) {
@@ -259,16 +264,17 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
259
264
 
260
265
  itiRef.current = telInputInit;
261
266
 
262
- inputRef.current.addEventListener("countrychange", (evt: Event) => {
263
- const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
264
- setSelectedData(phoneNumberData)
265
- onChange(phoneNumberData)
266
- validateErrors()
267
- })
268
-
269
- inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
270
- inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
267
+ if (inputRef.current) {
268
+ inputRef.current.addEventListener("countrychange", (evt: Event) => {
269
+ const phoneNumberData = getCurrentSelectedData(telInputInit, (evt.target as HTMLInputElement).value)
270
+ setSelectedData(phoneNumberData)
271
+ onChange(phoneNumberData)
272
+ validateErrors()
273
+ })
271
274
 
275
+ inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
276
+ inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
277
+ }
272
278
  if (formatAsYouType) {
273
279
  inputRef.current?.addEventListener("input", (evt) => {
274
280
  handleOnChange(evt as unknown as React.ChangeEvent<HTMLInputElement>);
@@ -303,12 +309,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
303
309
  {...htmlProps}
304
310
  >
305
311
  <TextInput
306
- ref={
307
- inputNode => {
308
- ref ? ref.current = inputNode : null
309
- inputRef.current = inputNode
312
+ ref={inputNode => {
313
+ if (ref) {
314
+ if (typeof ref === 'function') {
315
+ ref(inputNode)
316
+ } else {
317
+ (ref as React.MutableRefObject<HTMLInputElement | null>).current = inputNode
318
+ }
310
319
  }
311
- }
320
+ inputRef.current = inputNode
321
+ }}
312
322
  {...textInputProps}
313
323
  />
314
324
  </div>
@@ -20,7 +20,7 @@ const TitleTruncate = (props) => {
20
20
  marginBottom="md"
21
21
  size={4}
22
22
  text={lorem}
23
- truncate="1"
23
+ truncate={1}
24
24
  {...props}
25
25
  />
26
26
 
@@ -32,7 +32,7 @@ const TitleTruncate = (props) => {
32
32
  marginBottom="md"
33
33
  size={4}
34
34
  text={lorem}
35
- truncate="2"
35
+ truncate={2}
36
36
  {...props}
37
37
  />
38
38
 
@@ -43,7 +43,7 @@ const TitleTruncate = (props) => {
43
43
  <Title
44
44
  size={4}
45
45
  text={lorem}
46
- truncate="3"
46
+ truncate={3}
47
47
  {...props}
48
48
  />
49
49
  </Flex>
@@ -0,0 +1,4 @@
1
+ ##### Prop
2
+ `truncate` | **Type**: Enum | **Values**: 1 | 2 | 3 | 4 | 5
3
+
4
+ The `truncate` prop truncates overflowing text up to a maximum of five rows and adds an ellipsis at the end.
@@ -0,0 +1 @@
1
+ import{jsx,Fragment,jsxs}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,f as HighchartsMore}from"./_typeahead-B1tu_vWi.js";import{h as highchartsTheme,m as merge,a as highchartsDarkTheme}from"./lib-DYpq0k8j.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})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,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);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors.length>0?mapColors(colors):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};export{BarGraph as B,CircleChart as C};