playbook_ui 13.15.0.pre.alpha.PLAY11311893 → 13.15.0.pre.alpha.play1141iconkitusinglibrary1956

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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +40 -33
  3. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +4 -4
  4. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +44 -30
  5. data/app/pb_kits/playbook/pb_flex/_flex.tsx +4 -4
  6. data/app/pb_kits/playbook/pb_form_group/_form_group.tsx +3 -2
  7. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +7 -4
  8. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +10 -10
  9. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +10 -9
  10. data/app/pb_kits/playbook/pb_icon/_icon.tsx +21 -5
  11. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
  12. data/app/pb_kits/playbook/pb_icon_value/_icon_value.tsx +3 -2
  13. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +51 -50
  14. data/app/pb_kits/playbook/pb_person_contact/_person_contact.tsx +20 -19
  15. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -3
  16. data/app/pb_kits/playbook/pb_popover/_popover.tsx +6 -4
  17. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +20 -20
  18. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +4 -4
  19. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorButton.tsx +19 -17
  20. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/EditorTypes.ts +1 -1
  21. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +23 -21
  22. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/Toolbar.tsx +18 -10
  23. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +46 -23
  24. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarHistory.tsx +8 -8
  25. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarNodes.tsx +7 -7
  26. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +17 -15
  27. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +9 -7
  28. data/app/pb_kits/playbook/pb_selectable_card_icon/_selectable_card_icon.tsx +25 -24
  29. data/app/pb_kits/playbook/pb_selectable_icon/_selectable_icon.tsx +27 -26
  30. data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +2 -1
  31. data/app/pb_kits/playbook/pb_source/_source.tsx +15 -15
  32. data/dist/playbook-rails.js +4 -4
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +2 -2
@@ -9,7 +9,7 @@ import NavItem from '../../pb_nav/_item'
9
9
 
10
10
  import { ToolbarTypes } from './EditorTypes'
11
11
 
12
- const ToolbarDropdown = ({editor}: any) => {
12
+ const ToolbarDropdown = ({editor}: any): React.ReactElement => {
13
13
  const [showPopover, setShowPopover] = useState(false)
14
14
 
15
15
  const toolbarDropdownItems = [
@@ -81,11 +81,21 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
81
81
  if (isActive) {
82
82
  activeCount ++
83
83
  activeItems.push(
84
- <Flex align="center" key={icon} gap="xs">
85
- <Icon icon={icon} size="lg" />
84
+ <Flex align="center"
85
+ gap="xs"
86
+ key={icon}
87
+ >
88
+ <Icon icon={icon}
89
+ size="lg"
90
+ />
86
91
  <div>{text}</div>
87
- <Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
88
- <Icon fixedWidth icon="angle-down" margin-left="xs" />
92
+ <Flex className={showPopover ? "fa-flip-vertical" : ""}
93
+ display="inline_flex"
94
+ >
95
+ <Icon fixedWidth
96
+ icon="angle-down"
97
+ margin-left="xs"
98
+ />
89
99
  </Flex>
90
100
  </Flex>
91
101
  );
@@ -93,7 +103,10 @@ for (const { text, isActive, icon } of toolbarDropdownItems) {
93
103
  }
94
104
 
95
105
  const popoverReference = (
96
- <Button className="editor-dropdown-button" onClick={handleTogglePopover} variant="secondary">
106
+ <Button className="editor-dropdown-button"
107
+ onClick={handleTogglePopover}
108
+ variant="secondary"
109
+ >
97
110
  {
98
111
  activeCount === 2 ? (
99
112
  activeItems[1]
@@ -101,11 +114,21 @@ const popoverReference = (
101
114
  activeCount === 1 ? (
102
115
  activeItems[0] || null
103
116
  ) : (
104
- <Flex align="center" key="paragraph" gap="xs">
105
- <Icon icon="paragraph" size="lg" />
117
+ <Flex align="center"
118
+ gap="xs"
119
+ key="paragraph"
120
+ >
121
+ <Icon icon="paragraph"
122
+ size="lg"
123
+ />
106
124
  <div>Paragraph</div>
107
- <Flex className={showPopover ? "fa-flip-vertical" : ""} display="inline_flex">
108
- <Icon fixedWidth icon="angle-down" margin-left="xs" />
125
+ <Flex className={showPopover ? "fa-flip-vertical" : ""}
126
+ display="inline_flex"
127
+ >
128
+ <Icon fixedWidth
129
+ icon="angle-down"
130
+ margin-left="xs"
131
+ />
109
132
  </Flex>
110
133
  </Flex>
111
134
  )
@@ -124,21 +147,21 @@ const popoverReference = (
124
147
  show={showPopover}
125
148
  >
126
149
  <Nav
127
- paddingTop="xs"
128
- paddingBottom="xs"
129
- variant="subtle"
150
+ paddingBottom="xs"
151
+ paddingTop="xs"
152
+ variant="subtle"
130
153
  >
131
- {toolbarDropdownItems.map(({ icon, text, onclick, isActive}:ToolbarTypes, index:number) => (
154
+ {toolbarDropdownItems.map(({ icon, text, onclick, isActive}: ToolbarTypes, index: number) => (
132
155
  <NavItem
133
- cursor="pointer"
134
- className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
135
- iconLeft={icon}
136
- key={`${text}_${index}`}
137
- margin='none'
138
- onClick={()=> {onclick(); setShowPopover(false)}}
139
- text={text}
140
- paddingTop='xxs'
141
- paddingBottom='xxs'
156
+ className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
157
+ cursor="pointer"
158
+ iconLeft={icon}
159
+ key={`${text}_${index}`}
160
+ margin='none'
161
+ onClick={()=> {onclick(); setShowPopover(false)}}
162
+ paddingBottom='xxs'
163
+ paddingTop='xxs'
164
+ text={text}
142
165
  />
143
166
  ))}
144
167
  </Nav>
@@ -3,7 +3,7 @@ import FlexItem from "../../pb_flex/_flex_item";
3
3
  import EditorButton from "./EditorButton";
4
4
  import { ToolbarTypes } from "./EditorTypes";
5
5
 
6
- const ToolbarHistoryItems = ({editor}:any) => {
6
+ const ToolbarHistoryItems = ({editor}: any): React.ReactElement => {
7
7
 
8
8
  const toolbarHistoryItems = [
9
9
  {
@@ -26,14 +26,14 @@ const toolbarHistoryItems = [
26
26
  <>
27
27
  <FlexItem displayFlex>
28
28
  {toolbarHistoryItems.map(
29
- ({ onclick, classname, disable, icon, text }:ToolbarTypes, index:number) => (
29
+ ({ onclick, classname, disable, icon, text }: ToolbarTypes, index: number) => (
30
30
  <EditorButton
31
- classname={classname}
32
- onclick={onclick}
33
- disable={disable}
34
- icon={icon}
35
- key={index}
36
- text={text}
31
+ classname={classname}
32
+ disable={disable}
33
+ icon={icon}
34
+ key={index}
35
+ onclick={onclick}
36
+ text={text}
37
37
  />
38
38
  )
39
39
  )}
@@ -2,7 +2,7 @@ import React, {useCallback} from "react";
2
2
  import EditorButton from "./EditorButton";
3
3
  import { ToolbarTypes } from "./EditorTypes";
4
4
 
5
- const ToolbarNodes = ({editor}:any) => {
5
+ const ToolbarNodes = ({editor}: any): React.ReactElement => {
6
6
 
7
7
  // eslint-disable-next-line react-hooks/rules-of-hooks
8
8
  const setLink = useCallback(() => {
@@ -42,13 +42,13 @@ const toolbarNodesItems = [
42
42
 
43
43
  return (
44
44
  <>
45
- {toolbarNodesItems.map(({ onclick, icon, text, isActive }:ToolbarTypes, index:number) => (
45
+ {toolbarNodesItems.map(({ onclick, icon, text, isActive }: ToolbarTypes, index: number) => (
46
46
  <EditorButton
47
- classname={`toolbar_button ${isActive ? 'is-active' : ''}`}
48
- onclick={onclick}
49
- icon={icon}
50
- key={index}
51
- text={text}
47
+ classname={`toolbar_button ${isActive ? 'is-active' : ''}`}
48
+ icon={icon}
49
+ key={index}
50
+ onclick={onclick}
51
+ text={text}
52
52
  />
53
53
  ))}
54
54
  </>
@@ -17,27 +17,27 @@ import { TrixEditor } from "react-trix"
17
17
  import EditorToolbar from './TipTap/Toolbar'
18
18
 
19
19
  type Editor = {
20
- attributeIsActive?: Function,
20
+ attributeIsActive?: ([any]: string) => boolean,
21
21
  element?: HTMLElement,
22
- getSelectedDocument?: Function,
22
+ getSelectedDocument?: () => any,
23
23
  getSelectedRange?: () => Array<number>,
24
- insertHTML?: Function,
25
- loadHTML?: Function,
26
- setSelectedRange?: (range: Array<number>) => void,
24
+ insertHTML?: ([any]: string) => void,
25
+ loadHTML?: ([any]: string) => void,
26
+ setSelectedRange?: (range: Array<number>) => void,
27
27
  }
28
28
 
29
29
  type RichTextEditorProps = {
30
30
  aria?: { [key: string]: string },
31
31
  advancedEditor?: any,
32
32
  advancedEditorToolbar?: boolean,
33
- toolbarBottom?: Boolean,
33
+ toolbarBottom?: boolean,
34
34
  children?: React.ReactNode | React.ReactNode[]
35
35
  className?: string,
36
36
  data?: { [key: string]: string },
37
37
  focus?: boolean,
38
38
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
39
39
  id?: string,
40
- inline?: boolean,
40
+ inline?: boolean,
41
41
  extensions?: { [key: string]: string }[],
42
42
  name?: string,
43
43
  onChange: (html: string, text: string) => void,
@@ -49,7 +49,7 @@ type RichTextEditorProps = {
49
49
  maxWidth?: string
50
50
  } & GlobalProps
51
51
 
52
- const RichTextEditor = (props: RichTextEditorProps) => {
52
+ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
53
53
  const {
54
54
  aria = {},
55
55
  advancedEditor,
@@ -81,7 +81,6 @@ const RichTextEditor = (props: RichTextEditorProps) => {
81
81
  const handleOnEditorReady = (editorInstance: Editor) => setEditor(editorInstance),
82
82
  element = editor?.element
83
83
 
84
-
85
84
  // DOM manipulation must wait for editor to be ready
86
85
  if (editor) {
87
86
  const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
@@ -117,6 +116,7 @@ const RichTextEditor = (props: RichTextEditorProps) => {
117
116
  focus
118
117
  ? (document.addEventListener('trix-focus', useFocus),
119
118
  document.addEventListener('trix-blur', useFocus),
119
+ // eslint-disable-next-line react-hooks/rules-of-hooks
120
120
  useFocus())
121
121
  : null
122
122
 
@@ -164,10 +164,10 @@ const RichTextEditor = (props: RichTextEditorProps) => {
164
164
 
165
165
  return (
166
166
  <div
167
- {...ariaProps}
168
- {...dataProps}
169
- {...htmlProps}
170
- className={css}
167
+ {...ariaProps}
168
+ {...dataProps}
169
+ {...htmlProps}
170
+ className={css}
171
171
  >
172
172
  {
173
173
  advancedEditor ? (
@@ -175,9 +175,11 @@ const RichTextEditor = (props: RichTextEditorProps) => {
175
175
  className={classnames("pb_rich_text_editor_advanced_container", {
176
176
  ["toolbar-active"]: advancedEditorToolbar,
177
177
  })}
178
- >
178
+ >
179
179
  {advancedEditorToolbar && (
180
- <EditorToolbar extensions={extensions} editor={advancedEditor}/>
180
+ <EditorToolbar editor={advancedEditor}
181
+ extensions={extensions}
182
+ />
181
183
  )}
182
184
  { children }
183
185
  </div>
@@ -20,7 +20,7 @@ type SectionSeparatorProps = {
20
20
  variant?: "card" | "background",
21
21
  }
22
22
 
23
- const SectionSeparator = (props: SectionSeparatorProps) => {
23
+ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
24
24
  const {
25
25
  aria = {},
26
26
  children,
@@ -42,17 +42,19 @@ const SectionSeparator = (props: SectionSeparatorProps) => {
42
42
  return (
43
43
 
44
44
  <div
45
- {...ariaProps}
46
- {...dataProps}
47
- {...htmlProps}
48
- className={classes}
49
- id={id}
45
+ {...ariaProps}
46
+ {...dataProps}
47
+ {...htmlProps}
48
+ className={classes}
49
+ id={id}
50
50
  >
51
51
  {
52
52
  children && children ||
53
53
  text && (
54
54
  <span>
55
- <Caption text={text} dark={dark} />
55
+ <Caption dark={dark}
56
+ text={text}
57
+ />
56
58
  </span>
57
59
  )
58
60
  }
@@ -33,7 +33,7 @@ type SelectableCardIconProps = {
33
33
  onChange?: (event: React.FormEvent<HTMLInputElement>) => void,
34
34
  }
35
35
 
36
- const SelectableCardIcon = (props: SelectableCardIconProps) => {
36
+ const SelectableCardIcon = (props: SelectableCardIconProps): React.ReactElement => {
37
37
  const {
38
38
  aria = {},
39
39
  checkmark = false,
@@ -70,36 +70,37 @@ const SelectableCardIcon = (props: SelectableCardIconProps) => {
70
70
 
71
71
  return (
72
72
  <div
73
- {...ariaProps}
74
- {...dataProps}
75
- {...htmlProps}
76
- className={classes}
73
+ {...ariaProps}
74
+ {...dataProps}
75
+ {...htmlProps}
76
+ className={classes}
77
77
  >
78
78
  <SelectableCard
79
- checked={checked}
80
- customIcon={customIcon}
81
- dark={dark}
82
- disabled={disabled}
83
- icon={checkmark}
84
- inputId={inputId}
85
- multi={multi}
86
- name={name}
87
- onChange={onChange}
88
- value={value}
79
+ checked={checked}
80
+ customIcon={customIcon}
81
+ dark={dark}
82
+ disabled={disabled}
83
+ icon={checkmark}
84
+ inputId={inputId}
85
+ multi={multi}
86
+ name={name}
87
+ onChange={onChange}
88
+ value={value}
89
89
  >
90
90
  {
91
91
  <>
92
92
  <SelectableIcon
93
- customIcon={customIcon}
94
- icon={icon}
95
- inputId={''}
96
- inputs="disabled"
97
- name={''}
98
- text={titleText} />
93
+ customIcon={customIcon}
94
+ icon={icon}
95
+ inputId={''}
96
+ inputs="disabled"
97
+ name={''}
98
+ text={titleText}
99
+ />
99
100
  <Body
100
- color="light"
101
- dark={dark}
102
- text={bodyText}
101
+ color="light"
102
+ dark={dark}
103
+ text={bodyText}
103
104
  />
104
105
  </>
105
106
  }
@@ -6,10 +6,11 @@ import {
6
6
  buildAriaProps,
7
7
  buildCss,
8
8
  buildDataProps,
9
- buildHtmlProps
9
+ buildHtmlProps
10
10
  } from '../utilities/props'
11
11
  import Icon from '../pb_icon/_icon'
12
12
  import Title from '../pb_title/_title'
13
+ import { GenericObject } from '../types'
13
14
 
14
15
  type SelectableIconProps = {
15
16
  aria?: {[key: string]: string},
@@ -17,7 +18,7 @@ type SelectableIconProps = {
17
18
  className?: string,
18
19
  customIcon?: {[key: string] :SVGElement},
19
20
  disabled?: boolean,
20
- data?: Object,
21
+ data?: GenericObject,
21
22
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
22
23
  icon: string,
23
24
  inputId: string,
@@ -44,7 +45,7 @@ const SelectableIcon = ({
44
45
  text,
45
46
  value,
46
47
  ...props
47
- }: SelectableIconProps) => {
48
+ }: SelectableIconProps): React.ReactElement => {
48
49
  const ariaProps = buildAriaProps(aria)
49
50
  const dataProps = buildDataProps(data)
50
51
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -64,22 +65,22 @@ const SelectableIcon = ({
64
65
 
65
66
  return (
66
67
  <div
67
- {...ariaProps}
68
- {...dataProps}
69
- {...htmlProps}
70
- className={classes}
68
+ {...ariaProps}
69
+ {...dataProps}
70
+ {...htmlProps}
71
+ className={classes}
71
72
  >
72
73
  {inputs === 'disabled' && (
73
74
  <>
74
75
  <Icon
75
- customIcon={customIcon}
76
- icon={icon}
77
- size="2x"
76
+ customIcon={customIcon}
77
+ icon={icon}
78
+ size="2x"
78
79
  />
79
80
  <Title
80
- size={4}
81
- tag="h4"
82
- text={text}
81
+ size={4}
82
+ tag="h4"
83
+ text={text}
83
84
  />
84
85
  </>
85
86
  )}
@@ -87,24 +88,24 @@ const SelectableIcon = ({
87
88
  {inputs === 'enabled' && (
88
89
  <>
89
90
  <input
90
- {...props}
91
- checked={checked}
92
- disabled={disabled}
93
- id={inputIdPresent}
94
- name={name}
95
- type={inputType}
96
- value={value}
91
+ {...props}
92
+ checked={checked}
93
+ disabled={disabled}
94
+ id={inputIdPresent}
95
+ name={name}
96
+ type={inputType}
97
+ value={value}
97
98
  />
98
99
  <label htmlFor={inputIdPresent}>
99
100
  <Icon
100
- customIcon={customIcon}
101
- icon={icon}
102
- size="2x"
101
+ customIcon={customIcon}
102
+ icon={icon}
103
+ size="2x"
103
104
  />
104
105
  <Title
105
- size={4}
106
- tag="h4"
107
- text={text}
106
+ size={4}
107
+ tag="h4"
108
+ text={text}
108
109
  />
109
110
  </label>
110
111
  </>
@@ -7,12 +7,13 @@ import { SelectableListItemProps } from './_item.js'
7
7
 
8
8
  import List from '../pb_list/_list'
9
9
  import SelectableListItem from './_item'
10
+ import { GenericObject } from '../types'
10
11
 
11
12
  type SelectableListProps = {
12
13
  aria?: {[key: string]: string },
13
14
  children?: React.ReactElement[],
14
15
  className?: string,
15
- data?: object,
16
+ data?: GenericObject,
16
17
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
17
18
  id?: string,
18
19
  variant?: 'checkbox' | 'radio',
@@ -32,7 +32,7 @@ const Source = ({
32
32
  source,
33
33
  type = 'inbound',
34
34
  user = {},
35
- }: SourceProps) => {
35
+ }: SourceProps): React.ReactElement => {
36
36
  const dataProps = buildDataProps(data)
37
37
  const htmlProps = buildHtmlProps(htmlOptions)
38
38
  const ariaProps = buildAriaProps(aria)
@@ -72,11 +72,11 @@ const Source = ({
72
72
 
73
73
  return (
74
74
  <div
75
- {...ariaProps}
76
- {...dataProps}
77
- {...htmlProps}
78
- className={css}
79
- id={id}
75
+ {...ariaProps}
76
+ {...dataProps}
77
+ {...htmlProps}
78
+ className={css}
79
+ id={id}
80
80
  >
81
81
 
82
82
  <div className="pb__source_layout">
@@ -84,13 +84,13 @@ const Source = ({
84
84
  <>
85
85
  {showIcon() &&
86
86
  <IconCircle
87
- icon={typeIconNames[type]}
88
- size="sm"
87
+ icon={typeIconNames[type]}
88
+ size="sm"
89
89
  />
90
90
  }
91
91
  {!showIcon() &&
92
92
  <Avatar
93
- {...avatar()}
93
+ {...avatar()}
94
94
  />
95
95
  }
96
96
  </>
@@ -98,20 +98,20 @@ const Source = ({
98
98
 
99
99
  <div className="pb__source_content">
100
100
  <Title
101
- size={4}
102
- tag="h4"
103
- text={source}
101
+ size={4}
102
+ tag="h4"
103
+ text={source}
104
104
  />
105
105
 
106
106
  <div className="pb__source_value">
107
107
  <Body
108
- color="light"
109
- text={typeText()}
108
+ color="light"
109
+ text={typeText()}
110
110
  />
111
111
 
112
112
  {user.userId &&
113
113
  <Caption
114
- text={user.userId}
114
+ text={user.userId}
115
115
  />
116
116
  }
117
117
  </div>