playbook_ui_docs 16.10.0.pre.alpha.play300617429 → 16.10.0.pre.alpha.typeaheaddraggablepills17453

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 133ff911357d072d2952e8190ed22a121d52c014c83b0d2307c2b0c5c5125ec1
4
- data.tar.gz: 62c06fb5268dba6166a658949c85d98ea3ce5998d9b6fc1a1a0e520bbe174fa4
3
+ metadata.gz: bcd2df77ad2ade21904f5a4d6e502213b8651180b556cac9f54b20da328db651
4
+ data.tar.gz: 4ab0319cb9cae9e28a5781e657521cf51b2b39922c8fd0217f07e5f06356677a
5
5
  SHA512:
6
- metadata.gz: d7a1fdb1623cf57ca2dcb3006a26590e4c451eea4abdf8758cd03489b3f3087cca1b7d326a3674bf627bec1063a407879fbfcce68f0644b912541a77edc5737d
7
- data.tar.gz: 63ec7f8068cc5b2a0c274696f1a4c17ef8ea779454cfa918d0c7f892d8590a3b369f50bddacca0ca68f29d5fbdeae6d9e8fbcdf50ca2545c5e9768d4e7c7c7f2
6
+ metadata.gz: 3d687856944c4239ef22a934c182f7cfb2c425b2f0ed341d300a42f339b42cc186896e40ec94f32048adf41728295d3ebbd81e0e8f1d78e4a81e0504167d4b2c
7
+ data.tar.gz: 8f5dd2e1127fb5870419d93457ac187cad555a5a88a5ab822952bf27fb21a83e3b73d6a7504fd057a94e258765b982e47bde3b0aa263b12b6fd90bccbb7a4f3e
@@ -28,9 +28,9 @@
28
28
  popoverButton.onclick = () => {
29
29
  buttonClicked = !buttonClicked
30
30
  if (buttonClicked) {
31
- arrowDiv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 25" fill="none" class="pb_custom_icon svg-inline--fa pb_icon_kit svg_fw" id="" data="{}" aria="{}" tabindex=""><path d="M14.2031 5.70312C14.625 5.28125 15.3281 5.28125 15.75 5.70312L24.7969 14.7031C25.2188 15.1719 25.2188 15.875 24.7969 16.2969C24.3281 16.7656 23.625 16.7656 23.2031 16.2969L15 8.09375L6.79688 16.2969C6.32812 16.7656 5.625 16.7656 5.20312 16.2969C4.73438 15.875 4.73438 15.1719 5.20312 14.75L14.2031 5.70312Z" fill="currentColor"/></svg>'
31
+ arrowDiv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 31 25" fill="none" class="pb_custom_icon svg-inline--fa pb_icon_kit svg_fw" id="" data="{}" aria="{}" tabindex=""><path d="M14.2031 5.70312C14.625 5.28125 15.3281 5.28125 15.75 5.70312L24.7969 14.7031C25.2188 15.1719 25.2188 15.875 24.7969 16.2969C24.3281 16.7656 23.625 16.7656 23.2031 16.2969L15 8.09375L6.79688 16.2969C6.32812 16.7656 5.625 16.7656 5.20312 16.2969C4.73438 15.875 4.73438 15.1719 5.20312 14.75L14.2031 5.70312Z" fill="currentColor"/></svg>'
32
32
  } else {
33
- arrowDiv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31 25" fill="none" class="pb_custom_icon svg-inline--fa pb_icon_kit svg_fw" id="" data="{}" aria="{}" tabindex=""><path d="M14.2031 19.2969L5.20312 10.2969C4.73438 9.875 4.73438 9.17188 5.20312 8.70312C5.625 8.28125 6.32812 8.28125 6.79688 8.70312L15 16.9531L23.2031 8.75C23.625 8.28125 24.3281 8.28125 24.7969 8.75C25.2188 9.17188 25.2188 9.875 24.7969 10.2969L15.75 19.2969C15.3281 19.7656 14.625 19.7656 14.2031 19.2969Z" fill="currentColor"/></svg>'
33
+ arrowDiv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 31 25" fill="none" class="pb_custom_icon svg-inline--fa pb_icon_kit svg_fw" id="" data="{}" aria="{}" tabindex=""><path d="M14.2031 19.2969L5.20312 10.2969C4.73438 9.875 4.73438 9.17188 5.20312 8.70312C5.625 8.28125 6.32812 8.28125 6.79688 8.70312L15 16.9531L23.2031 8.75C23.625 8.28125 24.3281 8.28125 24.7969 8.75C25.2188 9.17188 25.2188 9.875 24.7969 10.2969L15.75 19.2969C15.3281 19.7656 14.625 19.7656 14.2031 19.2969Z" fill="currentColor"/></svg>'
34
34
  }
35
35
  }
36
36
  </script>
@@ -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,7 +61,10 @@
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
  ],
@@ -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.10.0.pre.alpha.play300617429
4
+ version: 16.10.0.pre.alpha.typeaheaddraggablepills17453
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-02 00:00:00.000000000 Z
12
+ date: 2026-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: playbook_ui
@@ -2903,6 +2903,10 @@ files:
2903
2903
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default_value.md
2904
2904
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.html.erb
2905
2905
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_disabled.jsx
2906
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.html.erb
2907
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.jsx
2908
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills.md
2909
+ - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_draggable_pills_rails.md
2906
2910
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb
2907
2911
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md
2908
2912
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb