playbook_ui 13.28.0 → 13.29.0.pre.alpha.PBNTR329draggablev33059

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -3
  3. data/app/pb_kits/playbook/index.js +2 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.html.erb +40 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_subrow_headers.md +3 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/table_body.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +14 -4
  11. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +10 -2
  12. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +2 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +34 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +31 -0
  16. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +4 -1
  17. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +31 -0
  18. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +16 -0
  19. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +2 -1
  20. data/app/pb_kits/playbook/pb_bar_graph/docs/{_bar_graph_custom.html.erb → _bar_graph_custom_rails.html.erb} +3 -3
  21. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.md +2 -0
  22. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -1
  23. data/app/pb_kits/playbook/pb_card/_card.scss +5 -0
  24. data/app/pb_kits/playbook/pb_card/_card.tsx +56 -9
  25. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
  26. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -2
  27. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +9 -3
  28. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +45 -0
  29. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +24 -1
  30. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +53 -0
  31. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +14 -8
  32. data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +24 -0
  33. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +7 -1
  34. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +9 -1
  35. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +13 -0
  36. data/app/pb_kits/playbook/pb_draggable/_draggable.tsx +53 -0
  37. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +92 -0
  38. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +53 -0
  39. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +4 -0
  40. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +158 -0
  41. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +101 -0
  42. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +50 -0
  43. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +1 -0
  44. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +51 -0
  45. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +11 -0
  46. data/app/pb_kits/playbook/pb_draggable/docs/index.js +5 -0
  47. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +63 -0
  48. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +54 -0
  49. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +57 -0
  50. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +10 -0
  51. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -2
  52. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +4 -1
  53. data/app/pb_kits/playbook/pb_gauge/gauge.rb +6 -1
  54. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +35 -0
  55. data/app/pb_kits/playbook/pb_icon/icon.rb +3 -2
  56. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +8 -2
  57. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +52 -0
  58. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +22 -1
  59. data/app/pb_kits/playbook/pb_list/_list.tsx +43 -2
  60. data/app/pb_kits/playbook/pb_list/_list_item.tsx +46 -10
  61. data/app/pb_kits/playbook/pb_pill/docs/_description.md +1 -1
  62. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -0
  63. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +30 -32
  64. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +0 -2
  65. data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +35 -28
  66. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +5 -1
  67. data/app/pb_kits/playbook/pb_table/_table.tsx +5 -0
  68. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.jsx +33 -32
  69. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column.md +1 -1
  70. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_column_rails.md +2 -0
  71. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.jsx +33 -33
  72. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row.md +1 -1
  73. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.html.erb +34 -0
  74. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_row_rails.md +2 -0
  75. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.jsx +51 -50
  76. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.md +1 -1
  77. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.html.erb +54 -0
  78. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data_rails.md +2 -0
  79. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.jsx +37 -38
  80. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.md +1 -0
  81. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.html.erb +53 -0
  82. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row_rails.md +1 -0
  83. data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_row.html.erb → _table_outer_padding.html.erb} +7 -7
  84. data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.jsx +76 -0
  85. data/app/pb_kits/playbook/pb_table/docs/_table_outer_padding.md +1 -0
  86. data/app/pb_kits/playbook/pb_table/docs/example.yml +9 -9
  87. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -0
  88. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -0
  89. data/app/pb_kits/playbook/pb_table/styles/_outer_padding.scss +21 -0
  90. data/app/pb_kits/playbook/pb_table/table.rb +14 -1
  91. data/app/pb_kits/playbook/pb_table/table.test.js +5 -1
  92. data/app/pb_kits/playbook/pb_tooltip/index.js +1 -0
  93. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +12 -9
  94. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +61 -0
  95. data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +6 -1
  96. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  97. data/app/pb_kits/playbook/tokens/_vertical_align.scss +18 -0
  98. data/app/pb_kits/playbook/utilities/_vertical_align.scss +16 -0
  99. data/app/pb_kits/playbook/utilities/globalProps.ts +12 -1
  100. data/dist/menu.yml +5 -2
  101. data/dist/playbook-rails.js +7 -7
  102. data/lib/playbook/classnames.rb +1 -0
  103. data/lib/playbook/forms/builder/dropdown_field.rb +14 -0
  104. data/lib/playbook/forms/builder.rb +1 -0
  105. data/lib/playbook/kit_base.rb +2 -0
  106. data/lib/playbook/version.rb +2 -2
  107. data/lib/playbook/vertical_align.rb +37 -0
  108. metadata +49 -10
  109. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_data.html.erb +0 -63
  110. data/app/pb_kits/playbook/pb_table/docs/_table_alignment_shift_row.html.erb +0 -52
  111. /data/app/pb_kits/playbook/pb_table/docs/{_table_alignment_column.html.erb → _table_alignment_column_rails.html.erb} +0 -0
@@ -9,6 +9,7 @@ module Playbook
9
9
  prop :axis_title
10
10
  prop :chart_data, type: Playbook::Props::Array,
11
11
  default: []
12
+ prop :custom_options, default: {}
12
13
  prop :gradient, type: Playbook::Props::Boolean,
13
14
  default: false
14
15
  prop :point_start, type: Playbook::Props::Numeric
@@ -38,7 +39,7 @@ module Playbook
38
39
  gradient ? "area" : "line"
39
40
  end
40
41
 
41
- def chart_options
42
+ def standard_options
42
43
  {
43
44
  align: align,
44
45
  id: id,
@@ -64,6 +65,26 @@ module Playbook
64
65
  }
65
66
  end
66
67
 
68
+ def chart_options
69
+ standard_options.deep_merge(custom_options)
70
+ end
71
+
72
+ def vertical_align_props
73
+ if vertical_align
74
+ if object.vertical_align
75
+ original_result = super
76
+ class_to_remove = "vertical_align_#{object.vertical_align}"
77
+
78
+ modified_result = original_result.gsub(class_to_remove, "").strip
79
+ modified_result.empty? ? nil : modified_result
80
+ else
81
+ super
82
+ end
83
+ else
84
+ super
85
+ end
86
+ end
87
+
67
88
  def classname
68
89
  generate_classname("pb_line_graph")
69
90
  end
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import classnames from "classnames";
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
4
  import { globalProps } from "../utilities/globalProps";
5
+ import Draggable from "../pb_draggable/_draggable";
5
6
 
6
7
  type ListProps = {
7
8
  aria?: { [key: string]: string };
@@ -9,6 +10,7 @@ type ListProps = {
9
10
  className?: string;
10
11
  children: React.ReactNode[] | React.ReactNode;
11
12
  dark?: boolean;
13
+ draggable?: boolean;
12
14
  data?: Record<string, unknown>;
13
15
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
14
16
  id?: string;
@@ -30,6 +32,7 @@ const List = (props: ListProps) => {
30
32
  className,
31
33
  dark = false,
32
34
  data = {},
35
+ draggable = false,
33
36
  htmlOptions = {},
34
37
  id,
35
38
  layout = "",
@@ -51,7 +54,7 @@ const List = (props: ListProps) => {
51
54
  const childrenWithProps = React.Children.map(
52
55
  children,
53
56
  (child: React.ReactElement) => {
54
- return React.cloneElement(child, { text, variant });
57
+ return React.cloneElement(child, { text, variant, draggable });
55
58
  }
56
59
  );
57
60
  const ariaProps = buildAriaProps(aria);
@@ -69,7 +72,11 @@ const List = (props: ListProps) => {
69
72
  );
70
73
 
71
74
  return (
72
- <div className={classes}>
75
+ <>
76
+ {
77
+ draggable ? (
78
+ <Draggable.Container>
79
+ <div className={classes}>
73
80
  {ordered ? (
74
81
  <ol
75
82
  {...ariaProps}
@@ -96,6 +103,40 @@ const List = (props: ListProps) => {
96
103
  </ul>
97
104
  )}
98
105
  </div>
106
+ </Draggable.Container>
107
+ ) :
108
+ (
109
+ <div className={classes}>
110
+ {ordered ? (
111
+ <ol
112
+ {...ariaProps}
113
+ {...dataProps}
114
+ {...htmlProps}
115
+ className={className}
116
+ id={id}
117
+ role={role}
118
+ tabIndex={tabIndex}
119
+ >
120
+ {childrenWithProps}
121
+ </ol>
122
+ ) : (
123
+ <ul
124
+ {...ariaProps}
125
+ {...dataProps}
126
+ {...htmlProps}
127
+ className={className}
128
+ id={id}
129
+ role={role}
130
+ tabIndex={tabIndex}
131
+ >
132
+ {childrenWithProps}
133
+ </ul>
134
+ )}
135
+ </div>
136
+ )
137
+ }
138
+
139
+ </>
99
140
  );
100
141
  };
101
142
 
@@ -2,12 +2,16 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps, GlobalProps } from '../utilities/globalProps'
5
+ import Icon from '../pb_icon/_icon'
6
+ import Body from '../pb_body/_body'
7
+ import Draggable from '../pb_draggable/_draggable'
5
8
 
6
9
  type ListItemProps = {
7
10
  aria?: { [key: string]: string },
8
11
  children: React.ReactNode[] | React.ReactNode,
9
12
  className?: string,
10
13
  data?: Record<string, unknown>,
14
+ dragHandle?: boolean,
11
15
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
12
16
  id?: string,
13
17
  tabIndex?: number,
@@ -19,6 +23,8 @@ const ListItem = (props: ListItemProps) => {
19
23
  children,
20
24
  className,
21
25
  data = {},
26
+ draggable = false,
27
+ dragHandle = true,
22
28
  htmlOptions = {},
23
29
  id,
24
30
  tabIndex,
@@ -35,16 +41,46 @@ const ListItem = (props: ListItemProps) => {
35
41
 
36
42
  return (
37
43
  <>
38
- <li
39
- {...ariaProps}
40
- {...dataProps}
41
- {...htmlProps}
42
- className={classes}
43
- id={id}
44
- tabIndex={tabIndex}
45
- >
46
- {children}
47
- </li>
44
+ {
45
+ draggable ? (
46
+ <Draggable.Item id={id}>
47
+ <li
48
+ {...ariaProps}
49
+ {...dataProps}
50
+ {...htmlProps}
51
+ className={classes}
52
+ id={id}
53
+ tabIndex={tabIndex}
54
+ >
55
+ {
56
+ dragHandle && (
57
+ <span style={{verticalAlign: 'middle'}}>
58
+ <Body color="light">
59
+ <Icon
60
+ icon="grip-dots-vertical"
61
+ verticalAlign="middle"
62
+ />
63
+ </Body>
64
+ </span>
65
+ )
66
+ }
67
+ {children}
68
+ </li>
69
+ </Draggable.Item>
70
+ ) : (
71
+ <li
72
+ {...ariaProps}
73
+ {...dataProps}
74
+ {...htmlProps}
75
+ className={classes}
76
+ id={id}
77
+ tabIndex={tabIndex}
78
+ >
79
+ {children}
80
+ </li>
81
+ )
82
+ }
83
+
48
84
  </>
49
85
  )
50
86
  }
@@ -1 +1 @@
1
- A pill uses both a keyword and a specific color to categorize an item. Each pill directly corresponds to a data color here: https://playbook.powerapp.cloud/utilities
1
+ A pill uses both a keyword and a specific color to categorize an item. Each pill directly corresponds to a data color <a href="https://playbook.powerapp.cloud/visual_guidelines/colors" target="_blank">here</a>.
@@ -28,6 +28,7 @@ $pb_selectable_card_border: 2px;
28
28
  padding: $space_sm;
29
29
  margin-bottom: $space_sm;
30
30
  cursor: pointer;
31
+ outline: 1px solid transparent;
31
32
 
32
33
  @media (hover:hover) {
33
34
  &:hover {
@@ -131,43 +131,41 @@ const SelectableCard = (props: SelectableCardProps) => {
131
131
  className={globalProps(labelProps)}
132
132
  htmlFor={inputIdPresent}
133
133
  >
134
- <div className="buffer">
135
- {variant === 'displayInput' ?
136
- <Flex vertical="center">
137
- <Flex
138
- orientation="column"
139
- padding="sm"
140
- paddingRight="xs"
141
- vertical="center"
142
- >
143
- <Input
144
- dark={dark}
145
- >
146
- <input
147
- checked={checked}
148
- disabled={disabled}
149
- onClick={handleClick}
150
- readOnly
151
- type={inputType}
152
- />
153
- </Input>
154
- </Flex>
155
- <div className="separator" />
156
- <div className="psuedo_separator"/>
157
- <Card
158
- borderNone
134
+ {variant === 'displayInput' ?
135
+ <Flex vertical="center">
136
+ <Flex
137
+ orientation="column"
138
+ padding="sm"
139
+ paddingRight="xs"
140
+ vertical="center"
141
+ >
142
+ <Input
159
143
  dark={dark}
160
- padding="sm"
161
- status={error ? 'negative' : null}
162
144
  >
163
- {text ||props.children}
164
- </Card>
145
+ <input
146
+ checked={checked}
147
+ disabled={disabled}
148
+ onClick={handleClick}
149
+ readOnly
150
+ type={inputType}
151
+ />
152
+ </Input>
165
153
  </Flex>
166
- :
154
+ <div className="separator" />
155
+ <div className="psuedo_separator"/>
156
+ <Card
157
+ borderNone
158
+ dark={dark}
159
+ padding="sm"
160
+ status={error ? 'negative' : null}
161
+ >
162
+ {text ||props.children}
163
+ </Card>
164
+ </Flex>
165
+ :
167
166
  text || props.children
168
- }
167
+ }
169
168
  {displayIcon()}
170
- </div>
171
169
  </label>
172
170
  </div>
173
171
  )
@@ -11,7 +11,6 @@
11
11
  <% end %>
12
12
 
13
13
  <label class="<%= object.label_class %>" for="<%= object.input_id_present %>">
14
- <div class="buffer">
15
14
  <% if object.variant == "display_input" %>
16
15
  <%= pb_rails("flex", props: { vertical: "center" }) do %>
17
16
  <%= pb_rails("flex", props: {
@@ -46,7 +45,6 @@
46
45
  </div>
47
46
  <% end %>
48
47
  <% end %>
49
- </div>
50
48
  </label>
51
49
 
52
50
  <% if object.variant == "display_input" %>
@@ -7,14 +7,16 @@ import { globalProps } from "../utilities/globalProps";
7
7
  import Checkbox from "../pb_checkbox/_checkbox";
8
8
  import ListItem from "../pb_list/_list_item";
9
9
  import Radio from "../pb_radio/_radio";
10
+ import { GenericObject } from "../types";
10
11
 
11
12
  export type SelectableListItemProps = {
12
13
  aria?: { [key: string]: string };
13
14
  children: React.ReactNode[] | React.ReactNode;
14
15
  checked?: boolean;
15
16
  className?: string;
16
- data?: object;
17
+ data?: GenericObject;
17
18
  defaultChecked?: boolean;
19
+ dragHandle?: boolean;
18
20
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
19
21
  id?: string;
20
22
  label?: string;
@@ -31,6 +33,7 @@ const SelectableListItem = ({
31
33
  children,
32
34
  className,
33
35
  data = {},
36
+ dragHandle = true,
34
37
  defaultChecked,
35
38
  htmlOptions = {},
36
39
  id,
@@ -39,7 +42,7 @@ const SelectableListItem = ({
39
42
  name = "",
40
43
  value = "",
41
44
  variant = "checkbox",
42
- onChange = () => {},
45
+ onChange = () => {void 0},
43
46
  ...props
44
47
  }: SelectableListItemProps) => {
45
48
  const ariaProps = buildAriaProps(aria);
@@ -61,28 +64,31 @@ const SelectableListItem = ({
61
64
 
62
65
  return (
63
66
  <ListItem
64
- {...props}
65
- className={classnames(checkedState ? "checked_item" : "", className)}
67
+ {...props}
68
+ className={classnames(checkedState ? "checked_item" : "", className)}
69
+ dragHandle={dragHandle}
70
+ id={id}
66
71
  >
67
72
  <div
68
- {...ariaProps}
69
- {...dataProps}
70
- {...htmlProps}
71
- className={classes}
73
+ {...ariaProps}
74
+ {...dataProps}
75
+ {...htmlProps}
76
+ className={classes}
72
77
  >
73
78
  {variant == "checkbox" && (
74
79
  <>
75
80
  <Checkbox
76
- checked={checkedState}
77
- id={id}
78
- name={name}
79
- onChange={handleChecked}
80
- // eslint suppressor, text is needed to display on screen
81
- //@ts-ignore
82
- text={label || (text && false)}
83
- type="checkbox"
84
- value={value}
85
- {...props}
81
+ checked={checkedState}
82
+ id={id}
83
+ name={name}
84
+ onChange={handleChecked}
85
+ // eslint suppressor, text is needed to display on screen
86
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
87
+ //@ts-ignore
88
+ text={label || (text && false)}
89
+ type="checkbox"
90
+ value={value}
91
+ {...props}
86
92
  />
87
93
  {children}
88
94
  </>
@@ -90,16 +96,17 @@ const SelectableListItem = ({
90
96
  {variant == "radio" && (
91
97
  <>
92
98
  <Radio
93
- defaultChecked={defaultChecked}
94
- id={id}
95
- label={label}
96
- name={name}
97
- onChange={onChange}
98
- //@ts-ignore
99
- text={label}
100
- type="radio"
101
- value={value}
102
- {...props}
99
+ defaultChecked={defaultChecked}
100
+ id={id}
101
+ label={label}
102
+ name={name}
103
+ onChange={onChange}
104
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
105
+ //@ts-ignore
106
+ text={label}
107
+ type="radio"
108
+ value={value}
109
+ {...props}
103
110
  />
104
111
  {children}
105
112
  </>
@@ -14,6 +14,7 @@ type SelectableListProps = {
14
14
  children?: React.ReactElement[],
15
15
  className?: string,
16
16
  data?: GenericObject,
17
+ draggable?: boolean,
17
18
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
19
  id?: string,
19
20
  variant?: 'checkbox' | 'radio',
@@ -25,6 +26,7 @@ const SelectableList = (props: SelectableListProps) => {
25
26
  children,
26
27
  className,
27
28
  data = {},
29
+ draggable = false,
28
30
  htmlOptions = {},
29
31
  id,
30
32
  } = props
@@ -66,7 +68,9 @@ const SelectableList = (props: SelectableListProps) => {
66
68
  className={classes}
67
69
  id={id}
68
70
  >
69
- <List variant={props.variant}>
71
+ <List draggable={draggable}
72
+ variant={props.variant}
73
+ >
70
74
  {selectableListItems}
71
75
  </List>
72
76
  </div>
@@ -23,6 +23,7 @@ type TableProps = {
23
23
  disableHover?: boolean,
24
24
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
25
25
  id?: string,
26
+ outerPadding?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
26
27
  responsive?: "collapse" | "scroll" | "none",
27
28
  singleLine?: boolean,
28
29
  size?: "sm" | "md" | "lg",
@@ -45,6 +46,7 @@ const Table = (props: TableProps) => {
45
46
  disableHover = false,
46
47
  htmlOptions = {},
47
48
  id,
49
+ outerPadding = '',
48
50
  responsive = 'collapse',
49
51
  singleLine = false,
50
52
  size = 'sm',
@@ -59,6 +61,8 @@ const Table = (props: TableProps) => {
59
61
  const htmlProps = buildHtmlProps(htmlOptions)
60
62
  const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''
61
63
  const verticalBorderCss = verticalBorder ? 'vertical-border' : ''
64
+ const spaceCssName = outerPadding !== 'none' ? 'space_' : ''
65
+ const outerPaddingCss = outerPadding ? `outer_padding_${spaceCssName}${outerPadding}` : ''
62
66
  const isTableTag = tag === 'table'
63
67
 
64
68
  const classNames = classnames(
@@ -73,6 +77,7 @@ const Table = (props: TableProps) => {
73
77
  'no-hover': disableHover,
74
78
  'sticky-header': sticky,
75
79
  'striped': striped,
80
+ [outerPaddingCss]: outerPadding !== '',
76
81
  },
77
82
  globalProps(props),
78
83
  tableCollapseCss,
@@ -7,39 +7,40 @@ const TableAlignmentColumn = (props) => {
7
7
  <Table
8
8
  {...props}
9
9
  >
10
- <thead>
11
- <tr>
12
- <th>{'Column 1'}</th>
13
- <th>{'Column 2'}</th>
14
- <th>{'Column 3'}</th>
15
- <th align="center">{'Rating'}</th>
16
- <th align="right">{'Money'}</th>
17
- </tr>
18
- </thead>
19
- <tbody>
20
- <tr>
21
- <td>{'Value 1'}</td>
22
- <td>{'Value 2'}</td>
23
- <td>{'Value 3'}</td>
24
- <td align="center">{'3'}</td>
25
- <td align="right">{'$57.32'}</td>
26
- </tr>
27
- <tr>
28
- <td>{'Value 1'}</td>
29
- <td>{'Value 2'}</td>
30
- <td>{'Value 3'}</td>
31
- <td align="center">{'2'}</td>
32
- <td align="right">{'$5,657.08'}</td>
33
- </tr>
34
- <tr>
35
- <td>{'Value 1'}</td>
36
- <td>{'Value 2'}</td>
37
- <td>{'Value 3'}</td>
38
- <td align="center">{'4'}</td>
39
- <td align="right">{'$358.77'}</td>
40
- </tr>
41
- </tbody>
10
+ <Table.Head>
11
+ <Table.Row>
12
+ <Table.Header>{'Column 1'}</Table.Header>
13
+ <Table.Header>{'Column 2'}</Table.Header>
14
+ <Table.Header>{'Column 3'}</Table.Header>
15
+ <Table.Header textAlign="center">{'Rating'}</Table.Header>
16
+ <Table.Header textAlign="right">{'Money'}</Table.Header>
17
+ </Table.Row>
18
+ </Table.Head>
19
+ <Table.Body>
20
+ <Table.Row>
21
+ <Table.Cell>{'Value 1'}</Table.Cell>
22
+ <Table.Cell>{'Value 2'}</Table.Cell>
23
+ <Table.Cell>{'Value 3'}</Table.Cell>
24
+ <Table.Cell textAlign="center">{'3'}</Table.Cell>
25
+ <Table.Cell textAlign="right">{'$57.32'}</Table.Cell>
26
+ </Table.Row>
27
+ <Table.Row>
28
+ <Table.Cell>{'Value 1'}</Table.Cell>
29
+ <Table.Cell>{'Value 2'}</Table.Cell>
30
+ <Table.Cell>{'Value 3'}</Table.Cell>
31
+ <Table.Cell textAlign="center">{'2'}</Table.Cell>
32
+ <Table.Cell textAlign="right">{'$5,657.08'}</Table.Cell>
33
+ </Table.Row>
34
+ <Table.Row>
35
+ <Table.Cell>{'Value 1'}</Table.Cell>
36
+ <Table.Cell>{'Value 2'}</Table.Cell>
37
+ <Table.Cell>{'Value 3'}</Table.Cell>
38
+ <Table.Cell textAlign="center">{'4'}</Table.Cell>
39
+ <Table.Cell textAlign="right">{'$358.77'}</Table.Cell>
40
+ </Table.Row>
41
+ </Table.Body>
42
42
  </Table>
43
+
43
44
  )
44
45
  }
45
46
 
@@ -1,2 +1,2 @@
1
- You can individually align a piece of table data, but a more practical use would be applied to align a column.
1
+ Pass our `textAlign` global prop to any `table.cell` subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
2
2
  In the table above the "Rating" column contents is centered and the "Money" column contents is right aligned.
@@ -0,0 +1,2 @@
1
+ Pass our `text_align` global prop to any `table/table_cell` subcomponent to change the text alignment of individual cells, or apply this prop persistently to align entire columns.
2
+ In the table above the "Rating" column contents is centered and the "Money" column contents is right aligned.
@@ -7,39 +7,39 @@ const TableAlignmentRow = (props) => {
7
7
  <Table
8
8
  {...props}
9
9
  >
10
- <thead>
11
- <tr>
12
- <th>{'Column 1'}</th>
13
- <th>{'Column 2'}</th>
14
- <th>{'Column 3'}</th>
15
- <th>{'Column 4'}</th>
16
- <th>{'Column 5'}</th>
17
- </tr>
18
- </thead>
19
- <tbody>
20
- <tr>
21
- <td>{'Value 1'}</td>
22
- <td>{'Value 2'}</td>
23
- <td>{'Value 3'}</td>
24
- <td>{'Value 4'}</td>
25
- <td>{'Value 5'}</td>
26
- </tr>
27
- <tr align="center">
28
- <td>{'Value 1'}</td>
29
- <td>{'Value 2'}</td>
30
- <td>{'Value 3'}</td>
31
- <td>{'Value 4'}</td>
32
- <td>{'Value 5'}</td>
33
- </tr>
34
- <tr align="right">
35
- <td>{'Value 1'}</td>
36
- <td>{'Value 2'}</td>
37
- <td>{'Value 3'}</td>
38
- <td>{'Value 4'}</td>
39
- <td>{'Value 5'}</td>
40
- </tr>
41
- </tbody>
42
- </Table>
10
+ <Table.Head>
11
+ <Table.Row>
12
+ <Table.Header>{'Column 1'}</Table.Header>
13
+ <Table.Header>{'Column 2'}</Table.Header>
14
+ <Table.Header>{'Column 3'}</Table.Header>
15
+ <Table.Header>{'Column 4'}</Table.Header>
16
+ <Table.Header>{'Column 5'}</Table.Header>
17
+ </Table.Row>
18
+ </Table.Head>
19
+ <Table.Body>
20
+ <Table.Row>
21
+ <Table.Cell>{'Value 1'}</Table.Cell>
22
+ <Table.Cell>{'Value 2'}</Table.Cell>
23
+ <Table.Cell>{'Value 3'}</Table.Cell>
24
+ <Table.Cell>{'Value 4'}</Table.Cell>
25
+ <Table.Cell>{'Value 5'}</Table.Cell>
26
+ </Table.Row>
27
+ <Table.Row textAlign="center">
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.Row>
34
+ <Table.Row textAlign="right">
35
+ <Table.Cell>{'Value 1'}</Table.Cell>
36
+ <Table.Cell>{'Value 2'}</Table.Cell>
37
+ <Table.Cell>{'Value 3'}</Table.Cell>
38
+ <Table.Cell>{'Value 4'}</Table.Cell>
39
+ <Table.Cell>{'Value 5'}</Table.Cell>
40
+ </Table.Row>
41
+ </Table.Body>
42
+ </Table>
43
43
  )
44
44
  }
45
45
 
@@ -1,2 +1,2 @@
1
- This is to be used to shift the whole row.
1
+ Pass our `textAlign` global prop to any `table.row` subcomponent to change the text alignment of all cells within that row.
2
2
  The header/ first row is the default, followed by the second row being centered, and then the last row shifted to the right.