playbook_ui_docs 16.11.0.pre.rc.2 → 16.11.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.
@@ -10,7 +10,10 @@
10
10
  "required": false,
11
11
  "requiredIndicator": false,
12
12
  "clearOnContextChange": true,
13
- "preserveSearchInput": false
13
+ "preserveSearchInput": false,
14
+ "enablePillReorder": false,
15
+ "showPillIndex": false,
16
+ "pillDragHandle": true
14
17
  },
15
18
  "groups": [
16
19
  {
@@ -58,13 +61,16 @@
58
61
  "props": [
59
62
  "components",
60
63
  "dark",
61
- "marginBottom"
64
+ "marginBottom",
65
+ "enablePillReorder",
66
+ "showPillIndex",
67
+ "pillDragHandle"
62
68
  ]
63
69
  }
64
70
  ],
65
71
  "presets": [
66
72
  {
67
- "name": "Basic list",
73
+ "name": "Default",
68
74
  "props": {
69
75
  "label": "Colors",
70
76
  "name": "color",
@@ -88,6 +94,32 @@
88
94
  ]
89
95
  }
90
96
  },
97
+ {
98
+ "name": "With Pills",
99
+ "props": {
100
+ "label": "With Pills",
101
+ "name": "with_pills",
102
+ "isMulti": true,
103
+ "options": [
104
+ {
105
+ "label": "Orange",
106
+ "value": "#FFA500"
107
+ },
108
+ {
109
+ "label": "Red",
110
+ "value": "#FF0000"
111
+ },
112
+ {
113
+ "label": "Green",
114
+ "value": "#00FF00"
115
+ },
116
+ {
117
+ "label": "Blue",
118
+ "value": "#0000FF"
119
+ }
120
+ ]
121
+ }
122
+ },
91
123
  {
92
124
  "name": "Count display",
93
125
  "props": {
@@ -223,12 +255,21 @@
223
255
  },
224
256
  "clearOnContextChange": {
225
257
  "requires": "searchContextSelector"
258
+ },
259
+ "enablePillReorder": {
260
+ "requires": "isMulti"
261
+ },
262
+ "showPillIndex": {
263
+ "requires": "isMulti"
264
+ },
265
+ "pillDragHandle": {
266
+ "requires": "isMulti"
226
267
  }
227
268
  },
228
269
  "hints": {
229
- "basic_list": {
230
- "presetName": "Basic list",
231
- "message": "Basic list uses a local options array with label and value keys.",
270
+ "default": {
271
+ "presetName": "Default",
272
+ "message": "Default uses a local options array with label and value keys.",
232
273
  "type": "info"
233
274
  },
234
275
  "count_display": {
@@ -255,6 +296,11 @@
255
296
  "presetName": "Creatable handler",
256
297
  "message": "Creatable handler shows custom option creation, preserved search input, and an onChange handler.",
257
298
  "type": "info"
299
+ },
300
+ "with_pills": {
301
+ "presetName": "With Pills",
302
+ "message": "With Pills uses multi-select with pills so selected values render as pills.",
303
+ "type": "info"
258
304
  }
259
305
  },
260
306
  "customProps": {
@@ -49,12 +49,12 @@
49
49
  },
50
50
  {
51
51
  "name": "Appearance",
52
- "props": ["components", "dark", "marginBottom"]
52
+ "props": ["components", "dark", "marginBottom", "enablePillReorder", "showPillIndex", "pillDragHandle"]
53
53
  }
54
54
  ],
55
55
  "presets": [
56
56
  {
57
- "name": "Basic list",
57
+ "name": "Default",
58
58
  "props": {
59
59
  "label": "Colors",
60
60
  "name": "color",
@@ -66,6 +66,20 @@
66
66
  ]
67
67
  }
68
68
  },
69
+ {
70
+ "name": "With Pills",
71
+ "props": {
72
+ "label": "With Pills",
73
+ "name": "with_pills",
74
+ "isMulti": true,
75
+ "options": [
76
+ { "label": "Orange", "value": "#FFA500" },
77
+ { "label": "Red", "value": "#FF0000" },
78
+ { "label": "Green", "value": "#00FF00" },
79
+ { "label": "Blue", "value": "#0000FF" }
80
+ ]
81
+ }
82
+ },
69
83
  {
70
84
  "name": "Count display",
71
85
  "props": {
@@ -145,12 +159,15 @@
145
159
  "requiredIndicator": { "requires": "label" },
146
160
  "validation": { "requires": { "required": true } },
147
161
  "optionsByContext": { "requires": "searchContextSelector" },
148
- "clearOnContextChange": { "requires": "searchContextSelector" }
162
+ "clearOnContextChange": { "requires": "searchContextSelector" },
163
+ "enablePillReorder": { "requires": "isMulti" },
164
+ "showPillIndex": { "requires": "isMulti" },
165
+ "pillDragHandle": { "requires": "isMulti" }
149
166
  },
150
167
  "hints": {
151
- "basic_list": {
152
- "presetName": "Basic list",
153
- "message": "Basic list uses a local options array with label and value keys.",
168
+ "default": {
169
+ "presetName": "Default",
170
+ "message": "Default uses a local options array with label and value keys.",
154
171
  "type": "info"
155
172
  },
156
173
  "count_display": {
@@ -177,6 +194,11 @@
177
194
  "presetName": "Creatable handler",
178
195
  "message": "Creatable handler shows custom option creation, preserved search input, and an onChange handler.",
179
196
  "type": "info"
197
+ },
198
+ "with_pills": {
199
+ "presetName": "With Pills",
200
+ "message": "With Pills uses multi-select with pills so selected values render as pills.",
201
+ "type": "info"
180
202
  }
181
203
  }
182
204
  }
@@ -0,0 +1,39 @@
1
+ <%
2
+ options = [
3
+ { label: 'Year', value: 'year' },
4
+ { label: 'Territory', value: 'territory' },
5
+ { label: 'Branch', value: 'branch' },
6
+ { label: 'Product', value: 'product' },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("body", props: { text: "Select services, then drag the pills to reorder them.", margin_bottom: "xs" }) %>
11
+
12
+ <%= pb_rails("typeahead", props: {
13
+ id: "typeahead-draggable-pills-example",
14
+ default_options: [options[0], options[1], options[2]],
15
+ enable_pill_reorder: true,
16
+ pill_drag_handle: false,
17
+ show_pill_index: true,
18
+ is_multi: true,
19
+ label: "Services",
20
+ name: :services,
21
+ options: options,
22
+ pills: true,
23
+ placeholder: "Add services...",
24
+ }) %>
25
+
26
+ <%= pb_rails("body", props: {
27
+ id: "typeahead-draggable-order",
28
+ color: "lighter",
29
+ margin_top: "xs",
30
+ text: "Current order: Year -> Territory -> Branch",
31
+ }) %>
32
+
33
+ <%= javascript_tag defer: "defer" do %>
34
+ document.addEventListener('pb-typeahead-kit-typeahead-draggable-pills-example-result-option-reorder', function(event) {
35
+ const orderText = event.detail.map((item) => item.label).join(' -> ');
36
+ const orderElement = document.querySelector('#typeahead-draggable-order');
37
+ if (orderElement) orderElement.textContent = `Current order: ${orderText}`;
38
+ });
39
+ <% end %>
@@ -0,0 +1,63 @@
1
+ import React, { useState } from 'react'
2
+ import { Body, Button, Flex, Typeahead } from 'playbook-ui'
3
+
4
+ const options = [
5
+ { label: 'Year', value: 'year' },
6
+ { label: 'Territory', value: 'territory' },
7
+ { label: 'Branch', value: 'branch' },
8
+ { label: 'Product', value: 'product' },
9
+ ]
10
+
11
+ const TypeaheadDraggablePills = (props) => {
12
+ const [value, setValue] = useState([
13
+ options[0],
14
+ options[1],
15
+ options[2],
16
+ ])
17
+
18
+ const currentOrder = value.map((item) => item.label).join(' -> ')
19
+
20
+ const handleReset = () => {
21
+ setValue([options[0], options[1], options[2]])
22
+ }
23
+
24
+ return (
25
+ <Flex
26
+ align="stretch"
27
+ gap="sm"
28
+ orientation="column"
29
+ >
30
+ <Flex
31
+ align="center"
32
+ justify="between"
33
+ >
34
+ <Body text="Select services, then drag the pills to reorder them." />
35
+ <Button
36
+ onClick={handleReset}
37
+ text="Reset"
38
+ variant="secondary"
39
+ />
40
+ </Flex>
41
+
42
+ <Typeahead
43
+ enablePillReorder
44
+ isMulti
45
+ label="Services"
46
+ onChange={setValue}
47
+ options={options}
48
+ placeholder="Add services..."
49
+ showPillIndex
50
+ value={value}
51
+ {...props}
52
+ pillDragHandle={false}
53
+ />
54
+
55
+ <Body
56
+ color="lighter"
57
+ text={`Current order: ${currentOrder}`}
58
+ />
59
+ </Flex>
60
+ )
61
+ }
62
+
63
+ export default TypeaheadDraggablePills
@@ -0,0 +1,7 @@
1
+ Use `enablePillReorder` to let users drag selected pills into a new order. Pair with `showPillIndex` to display numbered prefixes that update automatically after reorder.
2
+
3
+ Set `pillDragHandle` to `false` to hide the grip icon and drag the whole pill instead.
4
+
5
+ Order is committed on drop. The `onChange` callback and `pb-typeahead-kit-{id}-result-option-reorder` custom event both receive the reordered value array.
6
+
7
+ Keyboard reorder: focus a pill, then press Control+Shift+ArrowLeft or Control+Shift+ArrowRight to move it one position.
@@ -0,0 +1,7 @@
1
+ Use `enable_pill_reorder: true` with `show_pill_index: true` to let users drag selected pills into a new order. Set `pill_drag_handle: false` to hide the grip icon and drag the whole pill instead.
2
+
3
+ Order is committed on drop.
4
+
5
+ The `pb-typeahead-kit-{id}-result-option-reorder` custom event receives the reordered value array.
6
+
7
+ Keyboard reorder: focus a pill, then press Control+Shift+ArrowLeft or Control+Shift+ArrowRight to move it one position.
@@ -21,6 +21,7 @@ examples:
21
21
  - typeahead_disabled: Disabled
22
22
  - typeahead_preserve_input: Preserve Search Input
23
23
  - typeahead_required_indicator: Required Indicator
24
+ - typeahead_draggable_pills: Draggable Pills
24
25
 
25
26
  react:
26
27
  - typeahead_default: Default
@@ -45,3 +46,4 @@ examples:
45
46
  - typeahead_disabled: Disabled
46
47
  - typeahead_preserve_input: Preserve Search Input
47
48
  - typeahead_required_indicator: Required Indicator
49
+ - typeahead_draggable_pills: Draggable Pills
@@ -20,3 +20,4 @@ export {default as TypeaheadDefaultValue} from "./_typeahead_default_value.jsx"
20
20
  export {default as TypeaheadCustomOptions} from "./_typeahead_custom_options.jsx"
21
21
  export {default as TypeaheadInputDisplay} from "./_typeahead_input_display.jsx"
22
22
  export {default as TypeaheadRequiredIndicator} from "./_typeahead_required_indicator.jsx"
23
+ export {default as TypeaheadDraggablePills} from "./_typeahead_draggable_pills.jsx"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.11.0.pre.rc.2
4
+ version: 16.11.0
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: 2026-07-08 00:00:00.000000000 Z
12
+ date: 2026-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: playbook_ui
@@ -2910,6 +2910,10 @@ files:
2910
2910
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.md
2911
2911
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb
2912
2912
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx
2913
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.html.erb
2914
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.jsx
2915
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.md
2916
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills_rails.md
2913
2917
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb
2914
2918
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md
2915
2919
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb