playbook_ui 11.19.0.pre.typeahead1 → 11.20.0.pre.alpha.focus1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_body/_body.scss +10 -1
  3. data/app/pb_kits/playbook/pb_body/docs/_body_styled.html.erb +9 -0
  4. data/app/pb_kits/playbook/pb_body/docs/_body_styled.jsx +20 -0
  5. data/app/pb_kits/playbook/pb_body/docs/_body_styled.md +1 -0
  6. data/app/pb_kits/playbook/pb_body/docs/example.yml +2 -0
  7. data/app/pb_kits/playbook/pb_body/docs/index.js +1 -0
  8. data/app/pb_kits/playbook/pb_button/_button.scss +0 -5
  9. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +33 -2
  10. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options.html.erb +2 -2
  11. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options.jsx +2 -0
  12. data/app/pb_kits/playbook/pb_button/docs/_button_link.html.erb +3 -3
  13. data/app/pb_kits/playbook/pb_button/docs/_button_link.jsx +3 -0
  14. data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +3 -3
  15. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +3 -0
  16. data/app/pb_kits/playbook/pb_button/docs/_button_size.html.erb +3 -3
  17. data/app/pb_kits/playbook/pb_button/docs/_button_size.jsx +3 -0
  18. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +7 -7
  19. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +8 -8
  20. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +69 -3
  21. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -1
  22. data/app/pb_kits/playbook/pb_dialog/dialog.rb +1 -1
  23. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +12 -0
  24. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +15 -7
  25. data/app/pb_kits/playbook/pb_file_upload/docs/_description.md +2 -3
  26. data/app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_message.jsx +40 -0
  27. data/app/pb_kits/playbook/pb_file_upload/docs/example.yml +2 -2
  28. data/app/pb_kits/playbook/pb_file_upload/docs/index.js +1 -0
  29. data/app/pb_kits/playbook/pb_file_upload/fileupload.test.js +12 -0
  30. data/app/pb_kits/playbook/pb_list/_list.tsx +97 -0
  31. data/app/pb_kits/playbook/pb_list/{_list_item.jsx → _list_item.tsx} +4 -6
  32. data/app/pb_kits/playbook/pb_popover/_popover.tsx +239 -0
  33. data/app/pb_kits/playbook/pb_popover/{index.js → index.ts} +10 -6
  34. data/app/pb_kits/playbook/pb_popover/popover.test.js +222 -0
  35. data/app/pb_kits/playbook/pb_radio/_radio.tsx +4 -4
  36. data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
  37. data/app/pb_kits/playbook/pb_selectable_card/{_selectable_card.jsx → _selectable_card.tsx} +47 -42
  38. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.jsx +1 -2
  39. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_single_select.jsx +1 -1
  40. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.test.js +185 -0
  41. data/app/pb_kits/playbook/pb_selectable_icon/{_selectable_icon.jsx → _selectable_icon.tsx} +29 -32
  42. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx +1 -5
  43. data/app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_single_select.jsx +1 -4
  44. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.test.js +148 -0
  45. data/app/pb_kits/playbook/tokens/_accessibility.scss +6 -0
  46. data/app/pb_kits/playbook/tokens/_colors.scss +3 -1
  47. data/lib/playbook/version.rb +2 -2
  48. metadata +16 -8
  49. data/app/pb_kits/playbook/pb_list/_list.jsx +0 -98
  50. data/app/pb_kits/playbook/pb_popover/_popover.jsx +0 -227
@@ -0,0 +1,6 @@
1
+ @mixin focus {
2
+ &:focus-visible {
3
+ outline: $focus_color solid 2px;
4
+ outline-offset: 2px;
5
+ }
6
+ }
@@ -94,11 +94,13 @@ $hover_colors: (
94
94
  );
95
95
 
96
96
  /* Focus colors -----------------------*/
97
+ $focus_color: $primary;
97
98
  $focus_input_light: rgba($active_light, $opacity_5);
98
99
  $focus_input_dark: rgba(#144075, $opacity_5);
99
100
  $focus_input_colors: (
100
101
  focus_input_light: $focus_input_light,
101
- focus_input_dark: $focus_input_dark
102
+ focus_input_dark: $focus_input_dark,
103
+ focus_color: $focus_color
102
104
  );
103
105
 
104
106
  /* Border colors ----------------------*/
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "11.18.0"
5
- VERSION = "11.19.0.pre.typeahead1"
4
+ PREVIOUS_VERSION = "11.20.0"
5
+ VERSION = "11.20.0.pre.alpha.focus1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.19.0.pre.typeahead1
4
+ version: 11.20.0.pre.alpha.focus1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-11 00:00:00.000000000 Z
12
+ date: 2023-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -397,6 +397,9 @@ files:
397
397
  - app/pb_kits/playbook/pb_body/docs/_body_light.html.erb
398
398
  - app/pb_kits/playbook/pb_body/docs/_body_light.jsx
399
399
  - app/pb_kits/playbook/pb_body/docs/_body_light.md
400
+ - app/pb_kits/playbook/pb_body/docs/_body_styled.html.erb
401
+ - app/pb_kits/playbook/pb_body/docs/_body_styled.jsx
402
+ - app/pb_kits/playbook/pb_body/docs/_body_styled.md
400
403
  - app/pb_kits/playbook/pb_body/docs/_description.md
401
404
  - app/pb_kits/playbook/pb_body/docs/_footer.md
402
405
  - app/pb_kits/playbook/pb_body/docs/example.yml
@@ -887,6 +890,7 @@ files:
887
890
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_accept.jsx
888
891
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.jsx
889
892
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_description.md
893
+ - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_custom_message.jsx
890
894
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_default.jsx
891
895
  - app/pb_kits/playbook/pb_file_upload/docs/_file_upload_max_size.jsx
892
896
  - app/pb_kits/playbook/pb_file_upload/docs/example.yml
@@ -1336,9 +1340,9 @@ files:
1336
1340
  - app/pb_kits/playbook/pb_line_graph/lineGraphSettings.js
1337
1341
  - app/pb_kits/playbook/pb_line_graph/line_graph.html.erb
1338
1342
  - app/pb_kits/playbook/pb_line_graph/line_graph.rb
1339
- - app/pb_kits/playbook/pb_list/_list.jsx
1340
1343
  - app/pb_kits/playbook/pb_list/_list.scss
1341
- - app/pb_kits/playbook/pb_list/_list_item.jsx
1344
+ - app/pb_kits/playbook/pb_list/_list.tsx
1345
+ - app/pb_kits/playbook/pb_list/_list_item.tsx
1342
1346
  - app/pb_kits/playbook/pb_list/_list_mixin.scss
1343
1347
  - app/pb_kits/playbook/pb_list/docs/_description.md
1344
1348
  - app/pb_kits/playbook/pb_list/docs/_list_borderless.html.erb
@@ -1533,8 +1537,8 @@ files:
1533
1537
  - app/pb_kits/playbook/pb_pill/docs/index.js
1534
1538
  - app/pb_kits/playbook/pb_pill/pill.html.erb
1535
1539
  - app/pb_kits/playbook/pb_pill/pill.rb
1536
- - app/pb_kits/playbook/pb_popover/_popover.jsx
1537
1540
  - app/pb_kits/playbook/pb_popover/_popover.scss
1541
+ - app/pb_kits/playbook/pb_popover/_popover.tsx
1538
1542
  - app/pb_kits/playbook/pb_popover/docs/_description.md
1539
1543
  - app/pb_kits/playbook/pb_popover/docs/_popover_close.html.erb
1540
1544
  - app/pb_kits/playbook/pb_popover/docs/_popover_close.jsx
@@ -1549,9 +1553,10 @@ files:
1549
1553
  - app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
1550
1554
  - app/pb_kits/playbook/pb_popover/docs/example.yml
1551
1555
  - app/pb_kits/playbook/pb_popover/docs/index.js
1552
- - app/pb_kits/playbook/pb_popover/index.js
1556
+ - app/pb_kits/playbook/pb_popover/index.ts
1553
1557
  - app/pb_kits/playbook/pb_popover/popover.html.erb
1554
1558
  - app/pb_kits/playbook/pb_popover/popover.rb
1559
+ - app/pb_kits/playbook/pb_popover/popover.test.js
1555
1560
  - app/pb_kits/playbook/pb_progress_pills/_progress_pills.jsx
1556
1561
  - app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss
1557
1562
  - app/pb_kits/playbook/pb_progress_pills/docs/_description.md
@@ -1698,8 +1703,8 @@ files:
1698
1703
  - app/pb_kits/playbook/pb_select/select.html.erb
1699
1704
  - app/pb_kits/playbook/pb_select/select.rb
1700
1705
  - app/pb_kits/playbook/pb_select/select.test.js
1701
- - app/pb_kits/playbook/pb_selectable_card/_selectable_card.jsx
1702
1706
  - app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss
1707
+ - app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx
1703
1708
  - app/pb_kits/playbook/pb_selectable_card/docs/_description.md
1704
1709
  - app/pb_kits/playbook/pb_selectable_card/docs/_footer.md
1705
1710
  - app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_block.html.erb
@@ -1724,6 +1729,7 @@ files:
1724
1729
  - app/pb_kits/playbook/pb_selectable_card/docs/index.js
1725
1730
  - app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb
1726
1731
  - app/pb_kits/playbook/pb_selectable_card/selectable_card.rb
1732
+ - app/pb_kits/playbook/pb_selectable_card/selectable_card.test.js
1727
1733
  - app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.jsx
1728
1734
  - app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.scss
1729
1735
  - app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_checkmark.html.erb
@@ -1737,8 +1743,8 @@ files:
1737
1743
  - app/pb_kits/playbook/pb_selectable_card_icon/docs/index.js
1738
1744
  - app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb
1739
1745
  - app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.rb
1740
- - app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.jsx
1741
1746
  - app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.scss
1747
+ - app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx
1742
1748
  - app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.html.erb
1743
1749
  - app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_default.jsx
1744
1750
  - app/pb_kits/playbook/pb_selectable_icon/docs/_selectable_icon_options.html.erb
@@ -1748,6 +1754,7 @@ files:
1748
1754
  - app/pb_kits/playbook/pb_selectable_icon/docs/index.js
1749
1755
  - app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb
1750
1756
  - app/pb_kits/playbook/pb_selectable_icon/selectable_icon.rb
1757
+ - app/pb_kits/playbook/pb_selectable_icon/selectable_icon.test.js
1751
1758
  - app/pb_kits/playbook/pb_selectable_list/_item.jsx
1752
1759
  - app/pb_kits/playbook/pb_selectable_list/_selectable_list.jsx
1753
1760
  - app/pb_kits/playbook/pb_selectable_list/_selectable_list.scss
@@ -2228,6 +2235,7 @@ files:
2228
2235
  - app/pb_kits/playbook/playbook-doc.js
2229
2236
  - app/pb_kits/playbook/playbook-rails-react-bindings.js
2230
2237
  - app/pb_kits/playbook/playbook-rails.js
2238
+ - app/pb_kits/playbook/tokens/_accessibility.scss
2231
2239
  - app/pb_kits/playbook/tokens/_animation-curves.scss
2232
2240
  - app/pb_kits/playbook/tokens/_border_radius.scss
2233
2241
  - app/pb_kits/playbook/tokens/_colors.scss
@@ -1,98 +0,0 @@
1
- /* @flow */
2
-
3
- import React, { type Node } from 'react'
4
- import classnames from 'classnames'
5
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
6
- import { globalProps } from '../utilities/globalProps'
7
-
8
- type ListProps = {
9
- aria?: object,
10
- borderless: boolean,
11
- className?: string,
12
- children: array<Node> | Node,
13
- dark: boolean,
14
- data?: object,
15
- id?: string,
16
- layout: "" | "left" | "right",
17
- ordered: boolean,
18
- role?: string,
19
- tabIndex?: string,
20
- text?: string,
21
- size?: string,
22
- variant?: string,
23
- xpadding: boolean,
24
- }
25
-
26
- const List = (props: ListProps) => {
27
- const {
28
- aria = {},
29
- borderless = false,
30
- children,
31
- className,
32
- dark = false,
33
- data = {},
34
- id,
35
- layout = '',
36
- ordered = false,
37
- role,
38
- size = '',
39
- tabIndex,
40
- xpadding = false,
41
- variant,
42
- text,
43
- } = props
44
-
45
- const layoutClass = {
46
- left: 'layout_left',
47
- right: 'layout_right',
48
- default: '',
49
- }
50
-
51
- const childrenWithProps = React.Children.map(children, (child) => {
52
- return React.cloneElement(child, { text, variant })
53
- })
54
- const ariaProps = buildAriaProps(aria)
55
- const dataProps = buildDataProps(data)
56
- const classes = classnames(
57
- buildCss('pb_list_kit', layoutClass[layout], size, {
58
- dark: dark,
59
- borderless: borderless,
60
- ordered: ordered,
61
- xpadding: xpadding,
62
- }),
63
- globalProps(props),
64
- className
65
- )
66
-
67
- return (
68
- <div
69
- className={classes}
70
- >
71
- <If condition={ordered}>
72
- <ol
73
- {...ariaProps}
74
- {...dataProps}
75
- className={className}
76
- id={id}
77
- role={role}
78
- tabIndex={tabIndex}
79
- >
80
- {childrenWithProps}
81
- </ol>
82
- <Else />
83
- <ul
84
- {...ariaProps}
85
- {...dataProps}
86
- className={className}
87
- id={id}
88
- role={role}
89
- tabIndex={tabIndex}
90
- >
91
- {childrenWithProps}
92
- </ul>
93
- </If>
94
- </div>
95
- )
96
- }
97
-
98
- export default List
@@ -1,227 +0,0 @@
1
- /* eslint-disable react/no-multi-comp */
2
- // @flow
3
-
4
- import React, {useEffect} from "react";
5
- import ReactDOM from "react-dom";
6
-
7
- import {
8
- Popper,
9
- Manager as PopperManager,
10
- PopperProps,
11
- Reference as PopperReference,
12
- } from "react-popper";
13
-
14
- import {
15
- buildAriaProps,
16
- buildCss,
17
- buildDataProps,
18
- noop,
19
- } from "../utilities/props";
20
-
21
- import classnames from "classnames";
22
- import { globalProps } from "../utilities/globalProps";
23
-
24
- type PbPopoverProps = {
25
- aria?: object,
26
- className?: string,
27
- closeOnClick?: "outside" | "inside",
28
- data?: object,
29
- id?: String,
30
- offset?: boolean,
31
- reference: PopperReference,
32
- show?: boolean,
33
- shouldClosePopover?: () => boolean,
34
- } & PopperProps;
35
-
36
- // Prop enabled default modifiers here
37
- // https://popper.js.org/docs/v2/modifiers
38
-
39
- const POPOVER_MODIFIERS = {
40
- offset: {
41
- //https://popper.js.org/docs/v2/modifiers/offset/
42
- enabled: true,
43
- name: "offset",
44
- options: {
45
- offset: [0, 20],
46
- },
47
- phase: "main",
48
- },
49
- };
50
-
51
- const popoverModifiers = ({ modifiers, offset }) => {
52
- return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers;
53
- };
54
-
55
- const Popover = (props: PbPopoverProps) => {
56
- const {
57
- aria = {},
58
- className,
59
- children,
60
- data = {},
61
- id,
62
- modifiers,
63
- offset,
64
- placement,
65
- referenceElement,
66
- zIndex,
67
- maxHeight,
68
- maxWidth,
69
- minHeight,
70
- minWidth,
71
- } = props;
72
-
73
- const popoverSpacing =
74
- globalProps(props).includes("dark") || !globalProps(props)
75
- ? "p_sm"
76
- : globalProps(props);
77
- const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
78
- const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
79
- const widthHeightStyles = () => {
80
- return Object.assign(
81
- {},
82
- maxHeight ? { maxHeight: maxHeight } : {},
83
- maxWidth ? { maxWidth: maxWidth } : {},
84
- minHeight ? { minHeight: minHeight } : {},
85
- minWidth ? { minWidth: minWidth } : {}
86
- );
87
- };
88
- const ariaProps = buildAriaProps(aria);
89
- const dataProps = buildDataProps(data);
90
- const classes = classnames(
91
- buildCss("pb_popover_kit"),
92
- globalProps(props),
93
- className
94
- );
95
-
96
- return (
97
- <Popper
98
- modifiers={popoverModifiers({ modifiers, offset })}
99
- placement={placement}
100
- referenceElement={referenceElement}
101
- >
102
- {({ placement, ref, style }) => {
103
- return (
104
- <div
105
- {...ariaProps}
106
- {...dataProps}
107
- className={classes}
108
- data-placement={placement}
109
- id={id}
110
- ref={ref}
111
- style={Object.assign({}, style, zIndexStyle)}
112
- >
113
- <div
114
- className={classnames(`${buildCss("pb_popover_tooltip")} show`)}
115
- >
116
- <div
117
- className={classnames(
118
- "pb_popover_body",
119
- popoverSpacing,
120
- overflowHandling
121
- )}
122
- style={widthHeightStyles()}
123
- >
124
- {children}
125
- </div>
126
- </div>
127
- </div>
128
- );
129
- }}
130
- </Popper>
131
- );
132
- };
133
-
134
- const PbReactPopover = (props: PbPopoverProps) => {
135
- const {
136
- className,
137
- children,
138
- modifiers = [],
139
- offset = false,
140
- placement = "left",
141
- portal = "body",
142
- reference,
143
- referenceElement,
144
- show = false,
145
- usePortal = true,
146
- zIndex,
147
- maxHeight,
148
- maxWidth,
149
- minHeight,
150
- minWidth,
151
- } = props;
152
-
153
- useEffect(() => {
154
- const { closeOnClick, shouldClosePopover = noop } = props
155
-
156
- if (!closeOnClick) return
157
-
158
- document.body.addEventListener('click', ({ target }) => {
159
- const targetIsPopover =
160
- target.closest('[class^=pb_popover_tooltip]') !== null
161
- const targetIsReference =
162
- target.closest('.pb_popover_reference_wrapper') !== null
163
-
164
- switch (closeOnClick) {
165
- case 'outside':
166
- if (!targetIsPopover || targetIsReference) {
167
- shouldClosePopover(true)
168
- }
169
- break
170
- case 'inside':
171
- if (targetIsPopover || targetIsReference) {
172
- shouldClosePopover(true)
173
- }
174
- break
175
- case 'any':
176
- shouldClosePopover(true)
177
- break
178
- }
179
- }, { capture: true })
180
- }, [])
181
-
182
- const popoverComponent = (
183
- <Popover
184
- className={className}
185
- maxHeight={maxHeight}
186
- maxWidth={maxWidth}
187
- minHeight={minHeight}
188
- minWidth={minWidth}
189
- modifiers={modifiers}
190
- offset={offset}
191
- placement={placement}
192
- referenceElement={referenceElement}
193
- zIndex={zIndex}
194
- {...props}
195
- >
196
- {children}
197
- </Popover>
198
- );
199
-
200
- return (
201
- <PopperManager>
202
- <If condition={reference && !referenceElement}>
203
- <PopperReference>
204
- {({ ref }) => (
205
- <span className="pb_popover_reference_wrapper"
206
- ref={ref}
207
- >
208
- <reference.type {...reference.props} />
209
- </span>
210
- )}
211
- </PopperReference>
212
- </If>
213
- <If condition={show}>
214
- <If condition={usePortal}>
215
- {ReactDOM.createPortal(
216
- popoverComponent,
217
- document.querySelector(portal)
218
- )}
219
- <Else />
220
- {popoverComponent}
221
- </If>
222
- </If>
223
- </PopperManager>
224
- );
225
- };
226
-
227
- export default PbReactPopover;