playbook_ui 14.1.0.pre.alpha.PBNTR417addcolorsupdatedefaultcolor3608 → 14.1.0.pre.alpha.PBNTR449rtepreviewerrails3605

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +23 -245
  3. data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +5 -5
  4. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +2 -2
  5. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
  6. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
  7. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +2 -2
  8. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -5
  9. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -2
  10. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
  11. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -4
  12. data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +49 -13
  13. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +0 -12
  14. data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +23 -23
  15. data/app/pb_kits/playbook/pb_rich_text_editor/_trix_styles.scss +19 -27
  16. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +21 -11
  17. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +2 -18
  18. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +0 -4
  19. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +18 -26
  20. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  21. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
  22. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
  23. data/app/pb_kits/playbook/tokens/_colors.scss +0 -2
  24. data/dist/chunks/{_typeahead-BbHBDL7C.js → _typeahead-Cq7RLPBA.js} +2 -2
  25. data/dist/chunks/{_weekday_stacked-DEfI42pf.js → _weekday_stacked-Cykj5kLZ.js} +1 -1
  26. data/dist/chunks/{lib-u02fp5X7.js → lib-DErGXNy3.js} +1 -1
  27. data/dist/chunks/{pb_form_validation-iGj5wwU2.js → pb_form_validation-BC6kh7Hu.js} +1 -1
  28. data/dist/chunks/vendor.js +1 -1
  29. data/dist/playbook-doc.js +1 -1
  30. data/dist/playbook-rails-react-bindings.js +1 -1
  31. data/dist/playbook-rails.js +1 -1
  32. data/dist/playbook.css +1 -1
  33. data/lib/playbook/version.rb +1 -1
  34. metadata +6 -17
  35. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +0 -117
  36. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +0 -227
  37. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +0 -1
  38. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +0 -72
  39. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +0 -91
  40. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +0 -1
  41. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +0 -1
  42. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +0 -31
  43. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +0 -26
  44. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +0 -1
  45. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +0 -1
@@ -86,44 +86,44 @@
86
86
  }
87
87
 
88
88
  code {
89
- @include preview_code;
89
+ @include preview_tiptap_code;
90
90
  }
91
91
 
92
92
  pre {
93
- @include preview_pre_codeblock;
93
+ @include preview_tiptap_pre_codeblock;
94
94
  }
95
95
  a {
96
- @include preview_a;
96
+ @include preview_tiptap_a;
97
97
  }
98
98
  blockquote {
99
- @include preview_blockquote;
99
+ @include preview_tiptap_blockquote;
100
100
  }
101
101
  &:focus-visible {
102
102
  outline: unset;
103
103
  @include transition_default;
104
104
  }
105
105
  h1 {
106
- @include preview_h1;
106
+ @include preview_tiptap_h1;
107
107
  }
108
108
  h2 {
109
- @include preview_h2;
109
+ @include preview_tiptap_h2;
110
110
  }
111
111
  h3 {
112
- @include preview_h3;
112
+ @include preview_tiptap_h3;
113
113
  }
114
114
  h4,
115
115
  h5,
116
116
  h6 {
117
- @include preview_smaller_headings;
117
+ @include preview_tiptap_smaller_headings;
118
118
  }
119
119
  hr {
120
- @include preview_hr;
120
+ @include preview_tiptap_hr;
121
121
  }
122
122
  ol {
123
- @include preview_ol;
123
+ @include preview_tiptap_ol;
124
124
  }
125
125
  ul {
126
- @include preview_ul;
126
+ @include preview_tiptap_ul;
127
127
  }
128
128
  }
129
129
  }
@@ -170,40 +170,40 @@
170
170
  }
171
171
  }
172
172
  .tiptap-content {
173
- @include preview_first_child;
173
+ @include preview_tiptap_first_child;
174
174
  a {
175
- @include preview_a;
175
+ @include preview_tiptap_a;
176
176
  }
177
177
  blockquote {
178
- @include preview_blockquote;
178
+ @include preview_tiptap_blockquote;
179
179
  }
180
180
  h1 {
181
- @include preview_h1;
181
+ @include preview_tiptap_h1;
182
182
  }
183
183
  h2 {
184
- @include preview_h2;
184
+ @include preview_tiptap_h2;
185
185
  }
186
186
  h3 {
187
- @include preview_h3;
187
+ @include preview_tiptap_h3;
188
188
  }
189
189
  h4,
190
190
  h5,
191
191
  h6 {
192
- @include preview_smaller_headings;
192
+ @include preview_tiptap_smaller_headings;
193
193
  }
194
194
  hr {
195
- @include preview_hr;
195
+ @include preview_tiptap_hr;
196
196
  }
197
197
  ol {
198
- @include preview_ol;
198
+ @include preview_tiptap_ol;
199
199
  }
200
200
  p {
201
- @include preview_p;
201
+ @include preview_tiptap_p;
202
202
  }
203
203
  pre {
204
- @include preview_pre_codeblock;
204
+ @include preview_tiptap_pre_codeblock;
205
205
  }
206
206
  ul {
207
- @include preview_ul;
207
+ @include preview_tiptap_ul;
208
208
  }
209
209
  }
@@ -1,3 +1,5 @@
1
+ @import "previewer_mixin";
2
+
1
3
  @charset "UTF-8";
2
4
  /*
3
5
  Trix 1.3.0
@@ -297,41 +299,31 @@ trix-editor .attachment__metadata {
297
299
  trix-editor .attachment__metadata .attachment__size {
298
300
  margin-left: 0.2em;
299
301
  white-space: nowrap; }
302
+ trix-editor blockquote {
303
+ @include preview_trix_blockquote; }
304
+ trix-editor [dir=rtl] blockquote,
305
+ trix-editor blockquote[dir=rtl] {
306
+ @include preview_trix_blockquote }
300
307
  @charset "UTF-8";
301
- .trix-content {
302
- line-height: 1.5; }
303
- .trix-content * {
304
- box-sizing: border-box;
305
- margin: 0;
306
- padding: 0; }
308
+ .trix-content * {
309
+ box-sizing: border-box;
310
+ margin: 0;
311
+ padding: 0; }
312
+ .trix-content#content-preview div {
313
+ @include preview_trix_div; }
307
314
  .trix-content h1 {
308
- font-size: 1.2em;
309
- line-height: 1.2; }
315
+ @include preview_trix_h1; }
310
316
  .trix-content blockquote {
311
- border: 0 solid #ccc;
312
- border-left-width: 0.3em;
313
- margin-left: 0.3em;
314
- padding-left: 0.6em; }
317
+ @include preview_trix_blockquote; }
315
318
  .trix-content [dir=rtl] blockquote,
316
319
  .trix-content blockquote[dir=rtl] {
317
- border-width: 0;
318
- border-right-width: 0.3em;
319
- margin-right: 0.3em;
320
- padding-right: 0.6em; }
320
+ @include preview_trix_blockquote; }
321
321
  .trix-content li {
322
- margin-left: 1em; }
322
+ @include preview_trix_li; }
323
323
  .trix-content [dir=rtl] li {
324
- margin-right: 1em; }
324
+ @include preview_trix_li; }
325
325
  .trix-content pre {
326
- display: inline-block;
327
- width: 100%;
328
- vertical-align: top;
329
- font-family: monospace;
330
- font-size: 0.9em;
331
- padding: 0.5em;
332
- white-space: pre;
333
- background-color: #eee;
334
- overflow-x: auto; }
326
+ @include preview_trix_pre; }
335
327
  .trix-content img {
336
328
  max-width: 100%;
337
329
  height: auto; }
@@ -1,7 +1,7 @@
1
1
 
2
2
  <%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
3
3
  <div id="card-obfuscation" style="display:none">
4
- <%= pb_rails("card", props: { margin_top: "md" }) do %>
4
+ <%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
5
5
  <div id="content-preview" class="trix-content">
6
6
  </div>
7
7
  <% end %>
@@ -11,15 +11,25 @@
11
11
  <% end %>
12
12
 
13
13
  <script>
14
- // Button event handler
15
- const button = document.getElementById('preview-button');
16
- button.addEventListener('click', function() {
17
- const content = document.getElementById('content-preview-editor');
18
- const previewArea = document.getElementById('content-preview');
19
- const cardDiv = document.getElementById('card-obfuscation');
14
+ document.addEventListener('DOMContentLoaded', () => {
15
+ function handleButtonClick() {
16
+ const editorContainer = [...document.querySelectorAll('[data-react-props]')]
17
+ .find(element => element.getAttribute('data-react-props')?.includes('"id":"content-preview-editor"'))
20
18
 
21
- previewArea.innerHTML = content.value;
22
- cardDiv.classList.add('mt_md');
23
- cardDiv.style.display = 'block';
24
- });
19
+ const editorElement = editorContainer?.querySelector('trix-editor')
20
+ const inputId = editorElement?.getAttribute('input')
21
+ const inputElement = inputId && document.getElementById(inputId)
22
+
23
+ const editorContent = inputElement?.value || ''
24
+ const previewArea = document.getElementById('content-preview')
25
+ const cardDiv = document.getElementById('card-obfuscation')
26
+
27
+ if (previewArea && cardDiv) {
28
+ previewArea.innerHTML = editorContent
29
+ cardDiv.style.display = 'block'
30
+ }
31
+ }
32
+
33
+ document.getElementById('preview-button')?.addEventListener('click', handleButtonClick)
34
+ })
25
35
  </script>
@@ -63,7 +63,7 @@ test('typeahead with pills', () => {
63
63
  )
64
64
 
65
65
  const kit = screen.getByTestId('pills-test')
66
- const pill = kit.querySelector(".pb_form_pill_kit_neutral")
66
+ const pill = kit.querySelector(".pb_form_pill_kit_primary")
67
67
  expect(pill).toBeInTheDocument()
68
68
  })
69
69
 
@@ -89,7 +89,7 @@ test('typeahead multi select with badges and small pills', () => {
89
89
  )
90
90
 
91
91
  const kit = screen.getByTestId('small-pill-test')
92
- const badge = kit.querySelector(".pb_form_pill_kit_neutral.mr_xs.small")
92
+ const badge = kit.querySelector(".pb_form_pill_kit_primary.mr_xs.small")
93
93
  expect(badge).toBeInTheDocument()
94
94
  })
95
95
 
@@ -107,20 +107,4 @@ test('should pass className prop', () => {
107
107
 
108
108
  const kit = screen.getByTestId('typeahead-test')
109
109
  expect(kit).toHaveClass(className)
110
- })
111
-
112
- test('typeahead with colored pills', () => {
113
- render(
114
- <Typeahead
115
- color="primary"
116
- data={{ testid: 'pills-color-test' }}
117
- defaultValue={[options[0]]}
118
- isMulti
119
- options={options}
120
- />
121
- )
122
-
123
- const kit = screen.getByTestId('pills-color-test')
124
- const pill = kit.querySelector(".pb_form_pill_kit_primary")
125
- expect(pill).toBeInTheDocument()
126
110
  })
@@ -45,14 +45,12 @@ type TypeaheadProps = {
45
45
  getOptionLabel?: string | (() => any),
46
46
  getOptionValue?: string | (() => any),
47
47
  name?: string,
48
- color?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
49
48
  } & GlobalProps
50
49
 
51
50
  export type SelectValueType = {
52
51
  label: string,
53
52
  value: string,
54
53
  imageUrl?: string,
55
- pillColor?: string,
56
54
  }
57
55
 
58
56
  type TagOnChangeValues = {
@@ -78,7 +76,6 @@ const Typeahead = ({
78
76
  htmlOptions = {},
79
77
  id,
80
78
  loadOptions = noop,
81
- color,
82
79
  ...props
83
80
  }: TypeaheadProps) => {
84
81
  const selectProps = {
@@ -108,7 +105,6 @@ const Typeahead = ({
108
105
  onCreateOption: null as null,
109
106
  plusIcon: false,
110
107
  onMultiValueClick: (_option: SelectValueType): any => undefined,
111
- pillColor: color,
112
108
  ...props,
113
109
  }
114
110
 
@@ -8,7 +8,6 @@ import { SelectValueType } from '../_typeahead'
8
8
  type Props = {
9
9
  data: SelectValueType,
10
10
  multiValueTemplate: any,
11
- pillColor?: "neutral" | "primary" | "neutral" | "success" | "warning" | "error",
12
11
  removeProps: any,
13
12
  selectProps: any,
14
13
  }
@@ -16,55 +15,48 @@ type Props = {
16
15
  const MultiValue = (props: Props) => {
17
16
  const { removeProps } = props
18
17
  const { imageUrl, label } = props.data
19
- const { dark, multiKit, pillColor } = props.selectProps
18
+ const { multiKit } = props.selectProps
20
19
 
21
20
  const formPillProps = {
22
21
  marginRight: 'xs',
23
22
  name: label,
24
23
  avatarUrl: '',
25
- dark,
26
24
  }
27
25
 
28
26
  if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl
29
27
 
30
28
  return (
31
29
  <components.MultiValueContainer
32
- className="text_input_multivalue_container"
33
- {...props}
30
+ className="text_input_multivalue_container"
31
+ {...props}
34
32
  >
35
33
  {multiKit === 'badge' &&
36
34
  <Badge
37
- closeProps={removeProps}
38
- removeIcon
39
- text={label}
40
- variant="primary"
35
+ closeProps={removeProps}
36
+ removeIcon
37
+ text={label}
38
+ variant="primary"
41
39
  />
42
40
  }
43
41
 
44
42
  {multiKit !== 'badge' && imageUrl &&
45
43
  <FormPill
46
- avatarUrl={imageUrl}
47
- closeProps={removeProps}
48
- color={pillColor}
49
- dark={dark}
50
- marginRight="xs"
51
- name={label}
52
- size={multiKit === 'smallPill' ? 'small' : ''}
53
- text=''
54
- {...props}
44
+ avatarUrl={imageUrl}
45
+ closeProps={removeProps}
46
+ marginRight="xs"
47
+ name={label}
48
+ size={multiKit === 'smallPill' ? 'small' : ''}
49
+ text=''
55
50
  />
56
51
  }
57
52
 
58
53
  {multiKit !== 'badge' && !imageUrl &&
59
54
  <FormPill
60
- closeProps={removeProps}
61
- color={pillColor}
62
- dark={dark}
63
- marginRight="xs"
64
- name=''
65
- size={multiKit === 'smallPill' ? 'small' : ''}
66
- text={label}
67
- {...props}
55
+ closeProps={removeProps}
56
+ marginRight="xs"
57
+ name=''
58
+ size={multiKit === 'smallPill' ? 'small' : ''}
59
+ text={label}
68
60
  />
69
61
  }
70
62
  </components.MultiValueContainer>
@@ -9,7 +9,6 @@ examples:
9
9
  - typeahead_inline: Inline
10
10
  - typeahead_multi_kit: Multi Kit Options
11
11
  - typeahead_error_state: Error State
12
- - typeahead_with_pills_color: With Pills (Custom Color)
13
12
 
14
13
  react:
15
14
  - typeahead_default: Default
@@ -24,4 +23,3 @@ examples:
24
23
  - typeahead_async_createable: Createable (+ Async Data)
25
24
  - typeahead_error_state: Error State
26
25
  - typeahead_custom_menu_list: Custom MenuList
27
- - typeahead_with_pills_color: With Pills (Custom Color)
@@ -10,4 +10,3 @@ export { default as TypeaheadCreateable } from './_typeahead_createable.jsx'
10
10
  export { default as TypeaheadAsyncCreateable } from './_typeahead_async_createable.jsx'
11
11
  export { default as TypeaheadErrorState } from './_typeahead_error_state.jsx'
12
12
  export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
13
- export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
@@ -34,9 +34,6 @@ module Playbook
34
34
  prop :search_term_minimum_length, default: 3
35
35
  prop :search_debounce_timeout, default: 250
36
36
  prop :value
37
- prop :color, type: Playbook::Props::Enum,
38
- values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
39
- default: "neutral"
40
37
 
41
38
  def classname
42
39
  generate_classname("pb_typeahead_kit")
@@ -61,7 +58,6 @@ module Playbook
61
58
  def typeahead_react_options
62
59
  base_options = {
63
60
  className: classname,
64
- color: color,
65
61
  dark: dark,
66
62
  defaultValue: default_options,
67
63
  error: error,
@@ -259,7 +259,6 @@ $solar: $product_4_background !default; // deprecated
259
259
  $roofing: $product_5_background !default; // deprecated
260
260
  $gutters: $product_6_background !default; // deprecated
261
261
  $insulation: $product_7_background !default; // deprecated
262
- $accessories: $product_8_background !default; // added specifically for form_pill product map
263
262
  $product_colors: (
264
263
  windows: $windows,
265
264
  siding: $siding,
@@ -268,7 +267,6 @@ $product_colors: (
268
267
  roofing: $roofing,
269
268
  gutters: $gutters,
270
269
  insulation: $insulation,
271
- accessories: $accessories,
272
270
  product_1_background: $product_1_background,
273
271
  product_1_highlight: $product_1_highlight,
274
272
  product_2_background: $product_2_background,