playbook_ui 14.14.0.pre.rc.0 → 14.14.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +1 -2
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +27 -0
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +3 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +47 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +88 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +1 -0
- data/app/pb_kits/playbook/pb_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_table/docs/index.js +2 -1
- data/dist/chunks/{_typeahead-btjo1UN5.js → _typeahead-DQTwAd_2.js} +1 -1
- data/dist/chunks/_weekday_stacked-ei-exO-N.js +45 -0
- data/dist/chunks/{lib-DjpLC8uO.js → lib-WQEeEj3t.js} +1 -1
- data/dist/chunks/{pb_form_validation-S56UaHZl.js → pb_form_validation-Cq64l4zn.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +10 -6
- data/dist/chunks/_weekday_stacked-TIh9nTmZ.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eabb80bb1d796af98d7b254a9ba4c280c90e14e743d9e8c7dea09975d584334
|
4
|
+
data.tar.gz: 39e7a02ab7f1971d2e2777b8c36c8bca9de1de691b812085b8df420dfbacd1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c593c8761bab46713d02620975deeba4c4db0bdb2b08b3e9ee6ba3aaf7fe46051ed701fdbc292c574b804d9ee3c3e273fd895e9a67be9570c0cf545c01d9c14
|
7
|
+
data.tar.gz: a5d9b70d254f89a272454beb72ca35baec9606d2536e59acb69695b9efa2380a79e10b0cb486d75e021ae68ef351e07efb6063e535ffad0ac50e095b3bf76148
|
@@ -29,6 +29,7 @@ type DatePickerProps = {
|
|
29
29
|
hideLabel?: boolean,
|
30
30
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
31
31
|
id?: string,
|
32
|
+
initializeOnce?: boolean,
|
32
33
|
inLine?: boolean,
|
33
34
|
inputAria?: { [key: string]: string },
|
34
35
|
inputData?: { [key: string]: string },
|
@@ -73,6 +74,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
73
74
|
hideLabel = false,
|
74
75
|
htmlOptions = {},
|
75
76
|
id,
|
77
|
+
initializeOnce = false,
|
76
78
|
inLine = false,
|
77
79
|
inputAria = {},
|
78
80
|
inputData = {},
|
@@ -134,7 +136,7 @@ useEffect(() => {
|
|
134
136
|
yearRange,
|
135
137
|
required: false,
|
136
138
|
}, scrollContainer)
|
137
|
-
})
|
139
|
+
}, initializeOnce ? [] : undefined)
|
138
140
|
const filteredProps = {...props}
|
139
141
|
if (filteredProps.marginBottom === undefined) {
|
140
142
|
filteredProps.marginBottom = "sm"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= pb_rails("flex", props: { align: "center"}) do %>
|
2
|
+
<%= pb_rails("icon_button", props: {size: "lg"}) %> <span>Large</span>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
6
|
+
<%= pb_rails("icon_button", props: {size: "sm"}) %> <span>Small</span>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
10
|
+
<%= pb_rails("icon_button", props: {size: "xs"}) %> <span>XSmall</span>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= pb_rails("flex", props: { align: "center", margin_top: "md" }) do %>
|
14
|
+
<%= pb_rails("icon_button", props: {size: "1x"}) %> <span>1x</span>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
18
|
+
<%= pb_rails("icon_button", props: {size: "2x"}) %> <span>2x</span>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
22
|
+
<%= pb_rails("icon_button", props: {size: "3x"}) %> <span>3x</span>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= pb_rails("flex", props: { align: "center" }) do %>
|
26
|
+
<%= pb_rails("icon_button", props: {size: "4x"}) %> <span>4x</span>
|
27
|
+
<% end %>
|
@@ -14,6 +14,9 @@ module Playbook
|
|
14
14
|
prop :variant, type: Playbook::Props::Enum,
|
15
15
|
values: %w[default link],
|
16
16
|
default: "default"
|
17
|
+
prop :size, type: Playbook::Props::Enum,
|
18
|
+
values: %w[1x 2x 3x 4x 5x 6x 7x 8x 9x 10x xs sm lg],
|
19
|
+
default: "2x"
|
17
20
|
def classname
|
18
21
|
generate_classname("pb_icon_button_kit", variant)
|
19
22
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<%= pb_rails("table", props: { size: "sm" }) do %>
|
2
|
+
<%= pb_rails("table/table_head") do %>
|
3
|
+
<%= pb_rails("table/table_row") do %>
|
4
|
+
<%= pb_rails("table/table_header", props: { text: "Column 1" }) %>
|
5
|
+
<%= pb_rails("table/table_header", props: { text: "Column 2" }) %>
|
6
|
+
<%= pb_rails("table/table_header", props: { text: "Column 3" }) %>
|
7
|
+
<%= pb_rails("table/table_header", props: { text: "Column 4" }) %>
|
8
|
+
<%= pb_rails("table/table_header", props: { text: "Column 5" }) %>
|
9
|
+
<%= pb_rails("table/table_header", props: { text: "" }) %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<%= pb_rails("table/table_body") do %>
|
13
|
+
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 1 clicked')" } }) do %>
|
14
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
15
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
16
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
17
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
18
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
19
|
+
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
20
|
+
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 2 clicked')" } }) do %>
|
25
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
26
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
27
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
28
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
29
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
30
|
+
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
31
|
+
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 3 clicked')" } }) do %>
|
36
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
37
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
38
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
39
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
40
|
+
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
41
|
+
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
42
|
+
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Table, Icon } from 'playbook-ui'
|
3
|
+
|
4
|
+
const TableWithClickableRows = (props) => {
|
5
|
+
|
6
|
+
|
7
|
+
return (
|
8
|
+
<Table
|
9
|
+
size="sm"
|
10
|
+
{...props}
|
11
|
+
>
|
12
|
+
<Table.Head>
|
13
|
+
<Table.Row>
|
14
|
+
<Table.Header>{"Column 1"}</Table.Header>
|
15
|
+
<Table.Header>{"Column 2"}</Table.Header>
|
16
|
+
<Table.Header>{"Column 3"}</Table.Header>
|
17
|
+
<Table.Header>{"Column 4"}</Table.Header>
|
18
|
+
<Table.Header>{"Column 5"}</Table.Header>
|
19
|
+
<Table.Header>{""}</Table.Header>
|
20
|
+
</Table.Row>
|
21
|
+
</Table.Head>
|
22
|
+
<Table.Body>
|
23
|
+
<Table.Row
|
24
|
+
cursor="pointer"
|
25
|
+
htmlOptions={{ onClick: () => alert("Row 1 clicked") }}
|
26
|
+
{...props}
|
27
|
+
>
|
28
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
29
|
+
<Table.Cell>{"Value 2"}</Table.Cell>
|
30
|
+
<Table.Cell>{"Value 3"}</Table.Cell>
|
31
|
+
<Table.Cell>{"Value 4"}</Table.Cell>
|
32
|
+
<Table.Cell>{"Value 5"}</Table.Cell>
|
33
|
+
<Table.Cell textAlign="right">
|
34
|
+
<Icon
|
35
|
+
color="primary_action"
|
36
|
+
fixedWidth
|
37
|
+
icon="chevron-right"
|
38
|
+
size="xs"
|
39
|
+
{...props}
|
40
|
+
/>
|
41
|
+
</Table.Cell>
|
42
|
+
</Table.Row>
|
43
|
+
<Table.Row
|
44
|
+
cursor="pointer"
|
45
|
+
htmlOptions={{ onClick: () => alert("Row 2 clicked") }}
|
46
|
+
{...props}
|
47
|
+
>
|
48
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
49
|
+
<Table.Cell>{"Value 2"}</Table.Cell>
|
50
|
+
<Table.Cell>{"Value 3"}</Table.Cell>
|
51
|
+
<Table.Cell>{"Value 4"}</Table.Cell>
|
52
|
+
<Table.Cell>{"Value 5"}</Table.Cell>
|
53
|
+
<Table.Cell textAlign="right">
|
54
|
+
<Icon
|
55
|
+
color="primary_action"
|
56
|
+
fixedWidth
|
57
|
+
icon="chevron-right"
|
58
|
+
size="xs"
|
59
|
+
{...props}
|
60
|
+
/>
|
61
|
+
</Table.Cell>
|
62
|
+
</Table.Row>
|
63
|
+
<Table.Row
|
64
|
+
cursor="pointer"
|
65
|
+
htmlOptions={{ onClick: () => alert("Row 3 clicked") }}
|
66
|
+
{...props}
|
67
|
+
>
|
68
|
+
<Table.Cell>{"Value 1"}</Table.Cell>
|
69
|
+
<Table.Cell>{"Value 2"}</Table.Cell>
|
70
|
+
<Table.Cell>{"Value 3"}</Table.Cell>
|
71
|
+
<Table.Cell>{"Value 4"}</Table.Cell>
|
72
|
+
<Table.Cell>{"Value 5"}</Table.Cell>
|
73
|
+
<Table.Cell textAlign="right">
|
74
|
+
<Icon
|
75
|
+
color="primary_action"
|
76
|
+
fixedWidth
|
77
|
+
icon="chevron-right"
|
78
|
+
size="xs"
|
79
|
+
{...props}
|
80
|
+
/>
|
81
|
+
</Table.Cell>
|
82
|
+
</Table.Row>
|
83
|
+
</Table.Body>
|
84
|
+
</Table>
|
85
|
+
)
|
86
|
+
}
|
87
|
+
|
88
|
+
export default TableWithClickableRows
|
@@ -0,0 +1 @@
|
|
1
|
+
Clickable table rows do not require any additional props. This doc example showcases how to set them up using `html_options`/`htmlOptions` and click events. Using the global prop for cursor to set it to "pointer" is also recommended for better UX.
|
@@ -34,6 +34,7 @@ examples:
|
|
34
34
|
- table_with_collapsible_with_custom_content_rails: Table with Collapsible with Custom Content
|
35
35
|
- table_with_collapsible_with_nested_rows_rails: Table with Collapsible with Nested Rows
|
36
36
|
- table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
|
37
|
+
- table_with_clickable_rows: Table with Clickable Rows
|
37
38
|
|
38
39
|
react:
|
39
40
|
- table_sm: Small
|
@@ -70,3 +71,4 @@ examples:
|
|
70
71
|
- table_with_collapsible_with_custom_content: Table with Collapsible with Custom Content
|
71
72
|
- table_with_collapsible_with_nested_rows: Table with Collapsible with Nested Rows
|
72
73
|
- table_with_collapsible_with_nested_table: Table with Collapsible with Nested Table
|
74
|
+
- table_with_clickable_rows: Table with Clickable Rows
|
@@ -32,4 +32,5 @@ export { default as TableWithCollapsible } from './_table_with_collapsible.jsx'
|
|
32
32
|
export { default as TableWithCollapsibleWithCustomContent } from './_table_with_collapsible_with_custom_content.jsx'
|
33
33
|
export { default as TableWithCollapsibleWithNestedTable } from './_table_with_collapsible_with_nested_table.jsx'
|
34
34
|
export { default as TableWithCollapsibleWithNestedRows } from './_table_with_collapsible_with_nested_rows.jsx'
|
35
|
-
export { default as TableWithCollapsibleWithCustomClick } from './_table_with_collapsible_with_custom_click.jsx'
|
35
|
+
export { default as TableWithCollapsibleWithCustomClick } from './_table_with_collapsible_with_custom_click.jsx'
|
36
|
+
export { default as TableWithClickableRows } from './_table_with_clickable_rows.jsx'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,useRef,createElement,useState,useLayoutEffect,forwardRef,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{r as getDefaultExportFromCjs,x as filter,y as omit,u as useCollapsible,z as get,j as getAllIcons,q as commonjsGlobal,w as colors$1,t as highchartsTheme,A as merge,s as highchartsDarkTheme,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-
|
1
|
+
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,useRef,createElement,useState,useLayoutEffect,forwardRef,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{r as getDefaultExportFromCjs,x as filter,y as omit,u as useCollapsible,z as get,j as getAllIcons,q as commonjsGlobal,w as colors$1,t as highchartsTheme,A as merge,s as highchartsDarkTheme,B as getAugmentedNamespace,C as createPopper,E as uniqueId,F as typography,G as cloneDeep,H as isString}from"./lib-WQEeEj3t.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return Object.assign(Object.assign({},state),{items:action.payload});case"SET_DRAG_DATA":return Object.assign(Object.assign({},state),{dragData:action.payload});case"SET_IS_DRAGGING":return Object.assign(Object.assign({},state),{isDragging:action.payload});case"SET_ACTIVE_CONTAINER":return Object.assign(Object.assign({},state),{activeContainer:action.payload});case"CHANGE_CATEGORY":return Object.assign(Object.assign({},state),{items:state.items.map((item=>item.id===action.payload.itemId?Object.assign(Object.assign({},item),{container:action.payload.container}):item))});case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return Object.assign(Object.assign({},state),{items:newItems})}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver})=>{const[state,dispatch]=useReducer(reducer,initialState);useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state]);return jsx$1(DragContext.Provider,Object.assign({value:contextValue},{children:children}),void 0)};var classnames$1={exports:{}};
|
2
2
|
/*!
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
4
4
|
Licensed under the MIT License (MIT), see
|