playbook_ui 18.0.1.pre.rc.0 → 18.1.0.pre.rc.0

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_form/docs/example.yml +0 -1
  3. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +1 -12
  4. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +3 -2
  5. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +0 -26
  6. data/app/pb_kits/playbook/pb_multi_level_select/tree_helpers.js +4 -10
  7. data/app/pb_kits/playbook/pb_pill/_pill.test.jsx +0 -43
  8. data/app/pb_kits/playbook/pb_pill/_pill.tsx +6 -12
  9. data/app/pb_kits/playbook/pb_pill/docs/_playground.json +1 -14
  10. data/app/pb_kits/playbook/pb_pill/docs/_playground.overrides.json +0 -17
  11. data/app/pb_kits/playbook/pb_pill/docs/example.yml +0 -2
  12. data/app/pb_kits/playbook/pb_pill/docs/index.js +0 -1
  13. data/app/pb_kits/playbook/pb_pill/pill.html.erb +1 -5
  14. data/dist/ai/all-schemas.json +153 -166
  15. data/dist/ai/forms.json +99 -101
  16. data/dist/ai/index.json +2 -2
  17. data/dist/ai/kits/button.schema.json +3 -4
  18. data/dist/ai/kits/checkbox.schema.json +6 -7
  19. data/dist/ai/kits/date_picker.schema.json +10 -12
  20. data/dist/ai/kits/dropdown.schema.json +13 -14
  21. data/dist/ai/kits/multi_level_select.schema.json +12 -13
  22. data/dist/ai/kits/phone_number_input.schema.json +17 -18
  23. data/dist/ai/kits/select.schema.json +17 -18
  24. data/dist/ai/kits/star_rating.schema.json +9 -10
  25. data/dist/ai/kits/text_input.schema.json +34 -35
  26. data/dist/ai/kits/textarea.schema.json +9 -10
  27. data/dist/ai/kits/time_picker.schema.json +11 -12
  28. data/dist/ai/kits/typeahead.schema.json +12 -13
  29. data/dist/ai/playgrounds/index.json +1 -1
  30. data/dist/ai/playgrounds/pill.json +1 -1
  31. data/dist/ai/visual-index.json +1 -1
  32. data/dist/chunks/vendor.js +1 -1
  33. data/dist/playbook-rails.js +1 -1
  34. data/lib/playbook/changelog_generator.rb +3 -33
  35. data/lib/playbook/forms/builder/collection_select_field.rb +0 -3
  36. data/lib/playbook/forms/builder/date_picker_field.rb +7 -22
  37. data/lib/playbook/forms/builder/dropdown_field.rb +0 -12
  38. data/lib/playbook/forms/builder/form_field_builder.rb +0 -2
  39. data/lib/playbook/forms/builder/intl_telephone_field.rb +0 -8
  40. data/lib/playbook/forms/builder/multi_level_select_field.rb +0 -10
  41. data/lib/playbook/forms/builder/phone_number_field.rb +0 -8
  42. data/lib/playbook/forms/builder/select_field.rb +0 -3
  43. data/lib/playbook/forms/builder/star_rating_field.rb +0 -7
  44. data/lib/playbook/forms/builder/time_picker_field.rb +0 -8
  45. data/lib/playbook/forms/builder/typeahead_field.rb +0 -15
  46. data/lib/playbook/forms/builder.rb +0 -3
  47. data/lib/playbook/version.rb +1 -1
  48. metadata +2 -8
  49. data/app/pb_kits/playbook/pb_form/docs/_form_model_values.html.erb +0 -43
  50. data/app/pb_kits/playbook/pb_form/docs/_form_model_values.md +0 -22
  51. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.html.erb +0 -9
  52. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.jsx +0 -45
  53. data/app/pb_kits/playbook/pb_pill/docs/_pill_children.md +0 -1
  54. data/lib/playbook/forms/builder/attribute_defaults.rb +0 -118
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f7783b8463c90951131604bdf5eac75eb7fff9767a5c356de003e2eec536569
4
- data.tar.gz: 99211c843243aa798424571effdacca18bc2a7bb5aab3bd3fb0f7934dd58a4b8
3
+ metadata.gz: 73aa2379cffe56b84ee997cf41ef0b64612bfe0d9759f98dc44b2ced32b2ec10
4
+ data.tar.gz: 3b9a750583ef9058572ea2490712624b6cd1a69ece3435388fd55bcd88259820
5
5
  SHA512:
6
- metadata.gz: a19623f9af10397c92244acd88d1e80773655bb988c7b7ed8a9472ee0b018ab53514430911f3b6a0ea3a146ba54534a28704f9d13b010746445591d6f46c941f
7
- data.tar.gz: c3ef61f6dadfcfcf8c07f757596816573834536e757bab91a2f85e886692e3cf3db7b8633e957b032c776b2422fd20d3a7245f0b6b58fc4be14f4a60c5c43e42
6
+ metadata.gz: 76deee8035672747d6d959b378ab0f04f6c10bbf4eb7029ad346977b1d1b687b3560ebd6707e4daf978a2c4b8069834f9017842da346afb92ca258232d68230b
7
+ data.tar.gz: 8f1d3ea325d14bd6fdb3f179d818c44fe016535608370bb838620ed958ad8a0d7b26b5319e9021416b2e6eb4b08414bf933dd634a957543556b1254467a75c85
@@ -4,6 +4,5 @@ examples:
4
4
  - form_defaults: Defaults
5
5
  - form_validation: Validation and Error Messages
6
6
  - form_default_values: Default Values
7
- - form_model_values: Model Values + Errors
8
7
  - form_loading: Loading
9
8
  - form_multi_column: Multi-Column Layout
@@ -1,14 +1,3 @@
1
- // selected_ids / tree_data ids may be strings or numbers; includes() is strict.
2
- export const selectedIdsInclude = (
3
- selectedIds: Array<string | number> | null | undefined,
4
- id: string | number
5
- ): boolean => {
6
- if (!selectedIds || !selectedIds.length) return false
7
-
8
- const target = String(id)
9
- return selectedIds.some((selectedId) => String(selectedId) === target)
10
- };
11
-
12
1
  // Function is going over formattedData and returning all objects that match the
13
2
  // ID of the clicked item from the dropdown
14
3
  export const filterFormattedDataById = (
@@ -171,7 +160,7 @@ export const getExpandedItems = (
171
160
 
172
161
  // Only expand based on selected items if showCheckedChildren is true
173
162
  if (showCheckedChildren) {
174
- if (selectedIdsInclude(selectedIds, item.id)) {
163
+ if (selectedIds && selectedIds.length && selectedIds.includes(item.id)) {
175
164
  expandedItems.push(...itemAncestors.map((ancestor: any) => ancestor.id));
176
165
  }
177
166
  if (Array.isArray(item.children)) {
@@ -32,7 +32,6 @@ import {
32
32
  getDefaultCheckedItems,
33
33
  recursiveCheckParent,
34
34
  getExpandedItems,
35
- selectedIdsInclude,
36
35
  } from "./_helper_functions";
37
36
 
38
37
  import { DialogContext } from "../pb_dialog/_dialog_context";
@@ -249,7 +248,9 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>(
249
248
  const isDisabled =
250
249
  item.disabled || (parentDisabled && !returnAllSelected);
251
250
 
252
- const explicitlySelected = selectedIdsInclude(selectedIds, item.id);
251
+ const explicitlySelected = Boolean(
252
+ selectedIds && selectedIds?.length && selectedIds.includes(item.id)
253
+ );
253
254
 
254
255
  const checked =
255
256
  !isDisabled &&
@@ -546,32 +546,6 @@ describe('MultiLevelSelect tree_helpers', () => {
546
546
  expect(formatted[0].children[1].checked).toBe(false)
547
547
  })
548
548
 
549
- test('matches selected ids when selected_ids are numbers and tree ids are strings', () => {
550
- const numericTree = [
551
- {
552
- id: '101',
553
- label: 'Parent',
554
- children: [{ id: '102', label: 'Child' }],
555
- },
556
- ]
557
- const formatted = addCheckedAndParentProperty(cloneTree(numericTree), [102])
558
- expect(formatted[0].children[0].checked).toBe(true)
559
- expect(formatted[0].checked).toBe(false)
560
- })
561
-
562
- test('matches selected ids when selected_ids are strings and tree ids are numbers', () => {
563
- const numericTree = [
564
- {
565
- id: 101,
566
- label: 'Parent',
567
- children: [{ id: 102, label: 'Child' }],
568
- },
569
- ]
570
- const formatted = addCheckedAndParentProperty(cloneTree(numericTree), ['102'])
571
- expect(formatted[0].children[0].checked).toBe(true)
572
- expect(formatted[0].checked).toBe(false)
573
- })
574
-
575
549
  test('cascades checked state to children in default multi mode', () => {
576
550
  const formatted = addCheckedAndParentProperty(cloneTree(helperTree), ['parent'])
577
551
  expect(formatted[0].checked).toBe(true)
@@ -1,13 +1,5 @@
1
1
  export const cloneTree = (value) => JSON.parse(JSON.stringify(value))
2
2
 
3
- // selected_ids / tree_data ids may be strings or numbers; includes() is strict.
4
- export const selectedIdsInclude = (selectedIds, id) => {
5
- if (!selectedIds || !selectedIds.length) return false
6
-
7
- const target = String(id)
8
- return selectedIds.some((selectedId) => String(selectedId) === target)
9
- }
10
-
11
3
  export const filterFormattedDataById = (formattedData, id) => {
12
4
  const matched = []
13
5
  const recursiveSearch = (data, term) => {
@@ -146,7 +138,7 @@ export const getExpandedItems = (
146
138
  }
147
139
 
148
140
  if (showCheckedChildren) {
149
- if (selectedIdsInclude(selectedIds, item.id)) {
141
+ if (selectedIds && selectedIds.length && selectedIds.includes(item.id)) {
150
142
  expandedItems.push(...itemAncestors.map((ancestor) => ancestor.id))
151
143
  }
152
144
  if (Array.isArray(item.children)) {
@@ -201,7 +193,9 @@ export const addCheckedAndParentProperty = (
201
193
  const isDisabled =
202
194
  item.disabled || (parentDisabled && !returnAllSelected)
203
195
 
204
- const explicitlySelected = selectedIdsInclude(selectedIds, item.id)
196
+ const explicitlySelected = Boolean(
197
+ selectedIds && selectedIds.length && selectedIds.includes(item.id)
198
+ )
205
199
 
206
200
  const checked =
207
201
  !isDisabled &&
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import { render, screen } from '../utilities/test-utils'
3
3
  import Pill from './_pill'
4
- import Icon from '../pb_icon/_icon'
5
4
 
6
5
  const testId = 'pill'
7
6
 
@@ -17,48 +16,6 @@ test('should render classname', () => {
17
16
  expect(kit).toHaveClass('pb_pill_kit_neutral_lowercase')
18
17
  })
19
18
 
20
- test('displays children when text is omitted', () => {
21
- render(
22
- <Pill data={{ testid: testId }}>
23
- <span>icon</span>
24
- </Pill>
25
- )
26
-
27
- expect(screen.getByText('icon')).toBeInTheDocument()
28
- })
29
-
30
- test('displays an icon passed as children', () => {
31
- render(
32
- <Pill
33
- data={{ testid: testId }}
34
- variant="success"
35
- >
36
- <Icon
37
- data={{ testid: 'pill-icon' }}
38
- icon="check"
39
- />
40
- </Pill>
41
- )
42
-
43
- const kit = screen.getByTestId(testId)
44
- expect(kit).toContainElement(screen.getByTestId('pill-icon'))
45
- expect(kit.querySelector('.pb_pill_text')).not.toBeInTheDocument()
46
- })
47
-
48
- test('text takes precedence over children', () => {
49
- render(
50
- <Pill
51
- data={{ testid: testId }}
52
- text="label"
53
- >
54
- <span>icon</span>
55
- </Pill>
56
- )
57
-
58
- expect(screen.getByText('label')).toBeInTheDocument()
59
- expect(screen.queryByText('icon')).not.toBeInTheDocument()
60
- })
61
-
62
19
  test('displays text content', () => {
63
20
  render(
64
21
  <Pill
@@ -8,7 +8,6 @@ import { GlobalProps, globalProps } from '../utilities/globalProps'
8
8
  type PillProps = {
9
9
  aria?: {[key: string]: string},
10
10
  className?: string,
11
- children?: React.ReactNode,
12
11
  data?: {[key: string]: string},
13
12
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
14
13
  id?: string,
@@ -23,7 +22,6 @@ const Pill = (props: PillProps) => {
23
22
  const {
24
23
  aria = {},
25
24
  className,
26
- children,
27
25
  data = {},
28
26
  htmlOptions = {},
29
27
  id,
@@ -48,16 +46,12 @@ const Pill = (props: PillProps) => {
48
46
  className={classes}
49
47
  id={id}
50
48
  >
51
- {
52
- text ?
53
- <Title
54
- className="pb_pill_text"
55
- size={4}
56
- tag="div"
57
- text={text}
58
- />
59
- : children
60
- }
49
+ <Title
50
+ className="pb_pill_text"
51
+ size={4}
52
+ tag="div"
53
+ text={text}
54
+ />
61
55
  </div>
62
56
  )
63
57
  }
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "children": {
11
11
  "editable": true,
12
- "default": "<Flex alignItems=\"center\">\n <Title color=\"success\" size={4} tag=\"div\" text=\"Complete\" />\n <Icon color=\"success\" icon=\"check\" size=\"sm\" />\n</Flex>",
12
+ "default": "Pill content",
13
13
  "hideWhenPropSet": [
14
14
  "text"
15
15
  ]
@@ -87,14 +87,6 @@
87
87
  "textTransform": "none"
88
88
  },
89
89
  "children": ""
90
- },
91
- {
92
- "name": "Children",
93
- "props": {
94
- "variant": "success",
95
- "textTransform": "none"
96
- },
97
- "children": "<Flex alignItems=\"center\">\n <Title color=\"success\" size={4} tag=\"div\" text=\"Complete\" />\n <Icon color=\"success\" icon=\"check\" size=\"sm\" />\n</Flex>"
98
90
  }
99
91
  ],
100
92
  "conditionals": {},
@@ -109,11 +101,6 @@
109
101
  "message": "notification uses a solid primary fill by default. set variant to error for the red treatment.",
110
102
  "type": "info"
111
103
  },
112
- "text": {
113
- "presetName": "Children",
114
- "message": "Clear text to render children. Passing text replaces children.",
115
- "type": "info"
116
- },
117
104
  "text_transform": {
118
105
  "presetName": "Preserve Casing",
119
106
  "message": "Set textTransform to none when the label includes meaningful casing, versions, or abbreviations.",
@@ -1,8 +1,4 @@
1
1
  {
2
- "children": {
3
- "editable": true,
4
- "default": "<Flex alignItems=\"center\">\n <Title color=\"success\" size={4} tag=\"div\" text=\"Complete\" />\n <Icon color=\"success\" icon=\"check\" size=\"sm\" />\n</Flex>"
5
- },
6
2
  "defaults": {
7
3
  "text": "neutral",
8
4
  "variant": "neutral",
@@ -74,14 +70,6 @@
74
70
  "textTransform": "none"
75
71
  },
76
72
  "children": ""
77
- },
78
- {
79
- "name": "Children",
80
- "props": {
81
- "variant": "success",
82
- "textTransform": "none"
83
- },
84
- "children": "<Flex alignItems=\"center\">\n <Title color=\"success\" size={4} tag=\"div\" text=\"Complete\" />\n <Icon color=\"success\" icon=\"check\" size=\"sm\" />\n</Flex>"
85
73
  }
86
74
  ],
87
75
  "conditionals": {},
@@ -96,11 +84,6 @@
96
84
  "message": "notification uses a solid primary fill by default. set variant to error for the red treatment.",
97
85
  "type": "info"
98
86
  },
99
- "text": {
100
- "presetName": "Children",
101
- "message": "Clear text to render children. Passing text replaces children.",
102
- "type": "info"
103
- },
104
87
  "text_transform": {
105
88
  "presetName": "Preserve Casing",
106
89
  "message": "Set textTransform to none when the label includes meaningful casing, versions, or abbreviations.",
@@ -5,7 +5,6 @@ examples:
5
5
  - pill_variants: Variants
6
6
  - pill_size: Size
7
7
  - pill_notification: Notification
8
- - pill_children: Children
9
8
  - pill_example: Example
10
9
 
11
10
 
@@ -15,7 +14,6 @@ examples:
15
14
  - pill_variants: Variants
16
15
  - pill_size: Size
17
16
  - pill_notification: Notification
18
- - pill_children: Children
19
17
  - pill_example: Example
20
18
 
21
19
  swift:
@@ -3,4 +3,3 @@ export { default as PillVariants } from './_pill_variants.jsx'
3
3
  export { default as PillExample } from './_pill_example.jsx'
4
4
  export { default as PillSize } from './_pill_size.jsx'
5
5
  export { default as PillNotification } from './_pill_notification.jsx'
6
- export { default as PillChildren } from './_pill_children.jsx'
@@ -1,7 +1,3 @@
1
1
  <%= pb_content_tag do %>
2
- <% if object.text %>
3
- <%= pb_rails("title", props: { text: object.display_text, tag: "div", size: 4, classname: "pb_pill_text" }) %>
4
- <% else %>
5
- <%= content.presence %>
6
- <% end %>
2
+ <%= pb_rails("title", props: { text: object.display_text, tag: "div", size: 4, classname: "pb_pill_text" }) %>
7
3
  <% end %>