playbook_ui 9.2.0 → 9.3.0.alpha.inline2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aef1741f04bc8e69735bca02d3a02371f3b505fa00e89886e0765ef9966cabb4
4
- data.tar.gz: 7ba329497b8405ca204af5e7d41e18ec51e14d3691b33741f36767d385a0506e
3
+ metadata.gz: 1e20caf1837f44b6c5be1ffcae71ee939cf1a723790e3d44d0f59aeae84883ae
4
+ data.tar.gz: c5514b3b2f4d50d8ad2e08f8399790c3e8cbbfd065aabb20d2e34839c4eb5a01
5
5
  SHA512:
6
- metadata.gz: 29359809591a9728d7be433e38691ca397c133c1b1ed9bbe85e75b95775fcd6d90f4c25c65eccd288f4197af1c5a7ed2016821d61967a1b737b9d467ac22baad
7
- data.tar.gz: 85d37c87b12da09850947cc291b02e8a7edb081a4f165d8824d47a2cb0bc26a6a02eb30e486f0899b3b259753a67fe32d25486fdabee9fcdb9724bbc192b6f47
6
+ metadata.gz: d6373e36a14612c70ff8aec38af5aa5540d44104c7d8eec5b83def7fa0564d0e813cf54019875775739dfb09a0230b208269d3cd4dc3146938c4cf50d5cd358a
7
+ data.tar.gz: c90a08fd44034fbbabe827ef2041891f4c3a1ff7544747678868fadb53f22d52b18601a47488b9b725d6a751de96f5b4d0bcd41926b6a002403eeb65679347fb
@@ -3,6 +3,7 @@
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { globalProps } from '../utilities/globalProps.js'
6
+ import { Icon } from '../'
6
7
 
7
8
  import {
8
9
  buildAriaProps,
@@ -13,8 +14,15 @@ import {
13
14
  type BadgeProps = {
14
15
  aria?: object,
15
16
  className?: string,
17
+ closeProps?: {
18
+ onClick?: EventHandler,
19
+ onMouseDown?: EventHandler,
20
+ onTouchEnd?: EventHandler,
21
+ },
16
22
  data?: object,
17
23
  id?: string,
24
+ removeIcon?: Boolean,
25
+ removeOnClick?: EventHandler,
18
26
  rounded?: boolean,
19
27
  text?: string,
20
28
  variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
@@ -23,8 +31,11 @@ const Badge = (props: BadgeProps) => {
23
31
  const {
24
32
  aria = {},
25
33
  className,
34
+ closeProps = {},
26
35
  data = {},
27
36
  id,
37
+ removeIcon = false,
38
+ removeOnClick = () => {},
28
39
  rounded = false,
29
40
  text,
30
41
  variant = 'neutral',
@@ -44,7 +55,21 @@ const Badge = (props: BadgeProps) => {
44
55
  className={css}
45
56
  id={id}
46
57
  >
47
- <span>{text}</span>
58
+ <span>
59
+ {text}
60
+ <If condition={removeIcon}>
61
+ <span
62
+ onClick={removeOnClick}
63
+ style={{ cursor: 'pointer' }}
64
+ {...closeProps}
65
+ >
66
+ <Icon
67
+ fixedWidth
68
+ icon="times"
69
+ />
70
+ </span>
71
+ </If>
72
+ </span>
48
73
  </div>
49
74
  )
50
75
  }
@@ -25,6 +25,8 @@ type DatePickerProps = {
25
25
  id?: String,
26
26
  inputAria?: object,
27
27
  inputData?: object,
28
+ inputOnChange?: (String) => void,
29
+ inputValue?: any,
28
30
  label?: String,
29
31
  maxDate: String,
30
32
  minDate: String,
@@ -55,6 +57,8 @@ const DatePicker = (props: DatePickerProps) => {
55
57
  id,
56
58
  inputAria,
57
59
  inputData,
60
+ inputOnChange,
61
+ inputValue,
58
62
  label = 'Date Picker',
59
63
  maxDate,
60
64
  minDate,
@@ -114,7 +118,6 @@ const DatePicker = (props: DatePickerProps) => {
114
118
  className={classes}
115
119
  id={id}
116
120
  >
117
- {className}
118
121
  <div className="input_wrapper">
119
122
  <TextInput
120
123
  aria={inputAria}
@@ -126,7 +129,9 @@ const DatePicker = (props: DatePickerProps) => {
126
129
  id={pickerId}
127
130
  label={hideLabel ? null : label}
128
131
  name={name}
132
+ onChange={inputOnChange}
129
133
  placeholder={placeholder}
134
+ value={inputValue}
130
135
  />
131
136
  <If condition={!hideIcon}>
132
137
  <div
@@ -166,6 +166,9 @@ const datePickerHelper = (config) => {
166
166
  picker.input.style.caretColor = 'transparent'
167
167
  picker.input.style.cursor = 'pointer'
168
168
  }
169
+
170
+ // Fix event bubbling bug on wrapper
171
+ document.querySelector(`#${pickerId}`).parentElement.addEventListener('click', (e) => e.stopPropagation())
169
172
  }
170
173
 
171
174
  export default datePickerHelper
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
 
3
- import React from 'react'
3
+ import React, { forwardRef } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import { buildCss } from '../utilities/props'
6
6
  import { globalProps } from '../utilities/globalProps.js'
@@ -22,11 +22,12 @@ type FlexProps = {
22
22
  wrap?: boolean,
23
23
  }
24
24
 
25
- const Flex = (props: FlexProps) => {
25
+ const Flex = (props: FlexProps, ref: React.ElementRef<"div">) => {
26
26
  const {
27
27
  align = 'none',
28
28
  children,
29
29
  className,
30
+ id,
30
31
  inline = false,
31
32
  horizontal = 'left',
32
33
  justify = 'none',
@@ -70,10 +71,12 @@ const Flex = (props: FlexProps) => {
70
71
  globalProps(props),
71
72
  className
72
73
  )}
74
+ id={id}
75
+ ref={ref}
73
76
  >
74
77
  {children}
75
78
  </div>
76
79
  )
77
80
  }
78
81
 
79
- export default Flex
82
+ export default forwardRef(Flex)
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
 
3
- import React, { useEffect, useRef } from 'react'
3
+ import React, { forwardRef, useEffect, useRef } from 'react'
4
4
  import classnames from 'classnames'
5
5
  import useFocus from './useFocus.js'
6
6
  import Trix from 'trix'
@@ -22,7 +22,7 @@ type RichTextEditorProps = {
22
22
  value?: string,
23
23
  }
24
24
 
25
- const RichTextEditor = (props: RichTextEditorProps) => {
25
+ const RichTextEditor = (props: RichTextEditorProps, ref: React.ElementRef<"input">) => {
26
26
  const {
27
27
  aria = {},
28
28
  className,
@@ -120,6 +120,7 @@ const RichTextEditor = (props: RichTextEditorProps) => {
120
120
  <input
121
121
  id={id}
122
122
  name={name}
123
+ ref={ref}
123
124
  type="hidden"
124
125
  value={value}
125
126
  />
@@ -133,4 +134,4 @@ const RichTextEditor = (props: RichTextEditorProps) => {
133
134
  )
134
135
  }
135
136
 
136
- export default RichTextEditor
137
+ export default forwardRef(RichTextEditor)
@@ -81,6 +81,7 @@
81
81
  position: sticky;
82
82
  top: 0;
83
83
  z-index: 1;
84
+ background-color: $white;
84
85
  }
85
86
  }
86
87
  trix-editor {
@@ -211,6 +212,11 @@
211
212
  border-color: $error_dark;
212
213
  }
213
214
  }
215
+ &.sticky {
216
+ trix-toolbar {
217
+ background-color: tint($bg_dark, 10%) !important;
218
+ }
219
+ }
214
220
  .trix-dialog.trix-dialog--link.trix-active {
215
221
  background-color: tint($bg_dark, 10%) !important;
216
222
  border: 1px solid rgba($white, 0.1);
@@ -19,6 +19,7 @@ type TextInputProps = {
19
19
  id?: string,
20
20
  name: string,
21
21
  label: string,
22
+ onBlur: (String) => void,
22
23
  onChange: (String) => void,
23
24
  placeholder: string,
24
25
  required?: boolean,
@@ -41,6 +42,7 @@ const TextInput = (
41
42
  id,
42
43
  name,
43
44
  label,
45
+ onBlur = () => {},
44
46
  onChange = () => {},
45
47
  placeholder,
46
48
  required,
@@ -79,6 +81,7 @@ const TextInput = (
79
81
  disabled={disabled}
80
82
  id={id}
81
83
  name={name}
84
+ onBlur={onBlur}
82
85
  onChange={onChange}
83
86
  placeholder={placeholder}
84
87
  ref={ref}
@@ -24,6 +24,7 @@ type TextareaProps = {
24
24
  required?: boolean,
25
25
  rows?: number,
26
26
  resize: 'none' | 'both' | 'horizontal' | 'vertical' | 'auto',
27
+ onBlur?: InputCallback<HTMLTextAreaElement>,
27
28
  onChange?: InputCallback<HTMLTextAreaElement>,
28
29
  }
29
30
 
@@ -37,6 +38,7 @@ const Textarea = ({
37
38
  label,
38
39
  maxCharacters,
39
40
  name,
41
+ onBlur = () => {},
40
42
  onChange = () => {},
41
43
  placeholder,
42
44
  required,
@@ -75,6 +77,7 @@ const Textarea = ({
75
77
  className="pb_textarea_kit"
76
78
  disabled={disabled}
77
79
  name={name}
80
+ onBlur={onBlur}
78
81
  onChange={onChange}
79
82
  placeholder={placeholder}
80
83
  ref={ref}
@@ -3,12 +3,14 @@
3
3
  import React from 'react'
4
4
  import Select from 'react-select'
5
5
  import AsyncSelect from 'react-select/async'
6
+ import CreateableSelect from 'react-select/creatable'
6
7
  import { get } from 'lodash'
7
8
  import { globalProps } from '../utilities/globalProps.js'
8
9
 
9
10
  import Control from './components/Control'
10
11
  import ClearIndicator from './components/ClearIndicator'
11
12
  import IndicatorsContainer from './components/IndicatorsContainer'
13
+ // import Input from './components/Input'
12
14
  import MenuList from './components/MenuList'
13
15
  import MultiValue from './components/MultiValue'
14
16
  import Option from './components/Option'
@@ -26,6 +28,7 @@ import { noop } from '../utilities/props'
26
28
 
27
29
  type Props = {
28
30
  async?: boolean,
31
+ createable?: boolean,
29
32
  dark?: boolean,
30
33
  label?: string,
31
34
  loadOptions?: noop | string,
@@ -41,12 +44,14 @@ type Props = {
41
44
 
42
45
  const Typeahead = (props: Props) => {
43
46
  const selectProps = {
47
+ badges: false,
44
48
  cacheOptions: true,
45
49
  components: {
46
50
  Control,
47
51
  ClearIndicator,
48
52
  IndicatorsContainer,
49
53
  IndicatorSeparator: null,
54
+ // Input,
50
55
  MenuList,
51
56
  MultiValue,
52
57
  Option,
@@ -58,6 +63,8 @@ const Typeahead = (props: Props) => {
58
63
  isClearable: true,
59
64
  isSearchable: true,
60
65
  name,
66
+ onCreate: () => {},
67
+ plusIcon: false,
61
68
  ...props,
62
69
  }
63
70
 
@@ -65,7 +72,8 @@ const Typeahead = (props: Props) => {
65
72
  if (typeof(props.getOptionLabel) === 'string') selectProps.getOptionLabel = get(window, props.getOptionLabel)
66
73
  if (typeof(props.getOptionValue) === 'string') selectProps.getOptionValue = get(window, props.getOptionValue)
67
74
 
68
- const Tag = props.async ? AsyncSelect : Select
75
+ let Tag = props.async ? AsyncSelect : Select
76
+ if (props.createable) Tag = CreateableSelect
69
77
 
70
78
  const handleOnChange = (data, { action, option, removedValue }) => {
71
79
  if (action === 'select-option') {
@@ -154,4 +154,17 @@
154
154
  box-sizing: border-box;
155
155
  }
156
156
  }
157
+ .placeholder+.input-wrapper .typeahead-plus-icon {
158
+ display: none;
159
+ }
160
+ .typeahead-kit-select__control--is-focused .typeahead-plus-icon {
161
+ display: none;
162
+ }
163
+ .typeahead-plus-icon {
164
+ color: $text_lt_lighter;
165
+ }
166
+ [class^=pb_badge_kit] span {
167
+ line-height: 16.5px;
168
+ letter-spacing: normal;
169
+ }
157
170
  }
@@ -0,0 +1,27 @@
1
+ /* @flow */
2
+
3
+ import React from 'react'
4
+ import { components } from 'react-select'
5
+ import { Flex, Icon } from '../../'
6
+
7
+ const Input = (props: any) => (
8
+ <>
9
+ <Flex
10
+ align="center"
11
+ className="input-wrapper"
12
+ >
13
+ <If condition={props.selectProps.plusIcon}>
14
+ <Icon
15
+ className="typeahead-plus-icon"
16
+ icon="plus"
17
+ />
18
+ </If>
19
+ <components.Input
20
+ className="input"
21
+ {...props}
22
+ />
23
+ </Flex>
24
+ </>
25
+ )
26
+
27
+ export default Input
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import { components } from 'react-select'
5
5
 
6
- import { FormPill } from '../../'
6
+ import { Badge, FormPill } from '../../'
7
7
 
8
8
  type Props = {
9
9
  data: object,
@@ -15,6 +15,7 @@ type Props = {
15
15
  const MultiValue = (props: Props) => {
16
16
  const { removeProps } = props
17
17
  const { imageUrl, label } = props.data
18
+ const { badges } = props.selectProps
18
19
 
19
20
  const formPillProps = {
20
21
  marginRight: 'xs',
@@ -28,19 +29,28 @@ const MultiValue = (props: Props) => {
28
29
  className="text_input_multivalue_container"
29
30
  {...props}
30
31
  >
31
- <If condition={imageUrl}>
32
- <FormPill
33
- avatarUrl={imageUrl}
32
+ <If condition={badges}>
33
+ <Badge
34
34
  closeProps={removeProps}
35
- marginRight="xs"
36
- name={label}
37
- />
38
- <Else />
39
- <FormPill
40
- closeProps={removeProps}
41
- marginRight="xs"
35
+ removeIcon
42
36
  text={label}
37
+ variant="primary"
43
38
  />
39
+ <Else />
40
+ <If condition={imageUrl}>
41
+ <FormPill
42
+ avatarUrl={imageUrl}
43
+ closeProps={removeProps}
44
+ marginRight="xs"
45
+ name={label}
46
+ />
47
+ <Else />
48
+ <FormPill
49
+ closeProps={removeProps}
50
+ marginRight="xs"
51
+ text={label}
52
+ />
53
+ </If>
44
54
  </If>
45
55
  </components.MultiValueContainer>
46
56
  )
@@ -1,13 +1,26 @@
1
1
  /* @flow */
2
2
 
3
3
  import React from 'react'
4
+ import { Flex, Icon } from '../../'
4
5
  import { components } from 'react-select'
5
6
 
6
7
  const Placeholder = (props: any) => (
7
- <components.IndicatorsContainer
8
- className="placeholder"
9
- {...props}
10
- />
8
+ <>
9
+ <Flex
10
+ align="center"
11
+ className="placeholder"
12
+ >
13
+ <components.IndicatorsContainer
14
+ {...props}
15
+ />
16
+ <If condition={props.selectProps.plusIcon}>
17
+ <Icon
18
+ className="typeahead-plus-icon"
19
+ icon="plus"
20
+ />
21
+ </If>
22
+ </Flex>
23
+ </>
11
24
  )
12
25
 
13
26
  export default Placeholder
@@ -13,6 +13,7 @@ const options = [
13
13
  const TypeaheadDefault = (props) => {
14
14
  return (
15
15
  <Typeahead
16
+ // badges
16
17
  label="Colors"
17
18
  options={options}
18
19
  {...props}
@@ -3,7 +3,7 @@
3
3
  import React from 'react'
4
4
  import { Typeahead } from '../..'
5
5
 
6
- const options = [
6
+ const initOptions = [
7
7
  { label: 'Windows', value: '#FFA500' },
8
8
  { label: 'Siding', value: '#FF0000' },
9
9
  { label: 'Doors', value: '#00FF00' },
@@ -11,13 +11,18 @@ const options = [
11
11
  ]
12
12
 
13
13
  const TypeaheadWithPills = (props) => {
14
+ // const [values, setValues] = useState([])
14
15
  return (
15
16
  <>
16
17
  <Typeahead
18
+ badges
19
+ createable
17
20
  isMulti
18
21
  label="Colors"
19
- options={options}
20
- placeholder=""
22
+ // onChange={(value) => console.log(value)}
23
+ options={initOptions}
24
+ placeholder="Placeholder"
25
+ plusIcon
21
26
  {...props}
22
27
  />
23
28
  </>
@@ -7,8 +7,8 @@ examples:
7
7
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
8
8
 
9
9
  react:
10
- - typeahead_default: Default
10
+ # - typeahead_default: Default
11
11
  - typeahead_with_pills: With Pills
12
- - typeahead_with_pills_async: With Pills (Async Data)
13
- - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
14
- - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
12
+ # - typeahead_with_pills_async: With Pills (Async Data)
13
+ # - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
14
+ # - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "9.2.0"
4
+ VERSION = "9.3.0.alpha.inline2"
5
5
  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: 9.2.0
4
+ version: 9.3.0.alpha.inline2
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: 2021-04-06 00:00:00.000000000 Z
12
+ date: 2021-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -175,28 +175,28 @@ dependencies:
175
175
  requirements:
176
176
  - - "~>"
177
177
  - !ruby/object:Gem::Version
178
- version: '4.2'
178
+ version: '4.3'
179
179
  type: :runtime
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - "~>"
184
184
  - !ruby/object:Gem::Version
185
- version: '4.2'
185
+ version: '4.3'
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: webpacker-react
188
188
  requirement: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - "~>"
191
191
  - !ruby/object:Gem::Version
192
- version: '0.3'
192
+ version: 0.3.2
193
193
  type: :runtime
194
194
  prerelease: false
195
195
  version_requirements: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '0.3'
199
+ version: 0.3.2
200
200
  - !ruby/object:Gem::Dependency
201
201
  name: better_errors
202
202
  requirement: !ruby/object:Gem::Requirement
@@ -1940,6 +1940,7 @@ files:
1940
1940
  - app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.jsx
1941
1941
  - app/pb_kits/playbook/pb_typeahead/components/Control.jsx
1942
1942
  - app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx
1943
+ - app/pb_kits/playbook/pb_typeahead/components/Input.jsx
1943
1944
  - app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx
1944
1945
  - app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
1945
1946
  - app/pb_kits/playbook/pb_typeahead/components/Option.jsx
@@ -2103,12 +2104,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
2103
2104
  version: '0'
2104
2105
  required_rubygems_version: !ruby/object:Gem::Requirement
2105
2106
  requirements:
2106
- - - ">="
2107
+ - - ">"
2107
2108
  - !ruby/object:Gem::Version
2108
- version: '0'
2109
+ version: 1.3.1
2109
2110
  requirements: []
2110
- rubyforge_project:
2111
- rubygems_version: 2.7.3
2111
+ rubygems_version: 3.1.4
2112
2112
  signing_key:
2113
2113
  specification_version: 4
2114
2114
  summary: Playbook Design System