playbook_ui_docs 14.3.0.pre.rc.4 → 14.3.0.pre.rc.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a65bfa1b752de080c76ab13a25e8755ebec7d0571fa7fe722ad45f90f090e92c
4
- data.tar.gz: 250f405c81fbe357c8fa9cce9048dfeacc152186ee734b6a9c193b30eb49bb36
3
+ metadata.gz: cf44a66b8e7898084910ad11f4f8e06fb9109c17845ba6c6e5585d7d7e7ed101
4
+ data.tar.gz: 952f28d3ccf5eb2962f059c9259f97911b4608a354dc637602c223cee586f365
5
5
  SHA512:
6
- metadata.gz: 8830144b3ab3546dfa22d80f196044a0f1b2386f9bfc75fb2b145f5f2ead9b71514f82700ada84aca16604f2b95df07298886ad3d7a7b4c29caf89f480d05f96
7
- data.tar.gz: a2a5e4a32d8f1aac709aa561043fd8a99b0dd072a50d0a7ebc321df34b9818763bd6dbc97e1bba8e4818eba2e59121c7322f8e6f148c87b97d368f15d7c69af9
6
+ metadata.gz: aec071c5dc3951beca0d5855f01e98e746c67e2cad04db8801cd9c1c0682751b4ee9142371c05ab5304c5f80b20b4b82913b6a5021cf1bf24f626b0fa5b461bb
7
+ data.tar.gz: c26441aecfbbf8e2fd32aacef10d6582e467e9653fc304c08dc682f3905f36f16334b69467de750404f82648ffbd5f977b4f70deff54582d0abacd270a76b8c9
@@ -0,0 +1,56 @@
1
+ import React from 'react'
2
+ import Radio from '../_radio'
3
+ import Select from '../../pb_select/_select'
4
+ import Typeahead from '../../pb_typeahead/_typeahead'
5
+ import Title from '../../pb_title/_title'
6
+
7
+ const RadioChildren = (props) => {
8
+
9
+
10
+ const options = [
11
+ { label: 'Orange', value: 'Orange' },
12
+ { label: 'Red', value: 'Red' },
13
+ { label: 'Green', value: 'Green' },
14
+ { label: 'Blue', value: 'Blue' },
15
+ ]
16
+
17
+ return (
18
+ <div>
19
+ <Radio
20
+ label="Select"
21
+ name="Group1"
22
+ tabIndex={0}
23
+ value="Select"
24
+ {...props}
25
+ >
26
+ <Select
27
+ minWidth="xs"
28
+ options={options}
29
+ />
30
+ </Radio>
31
+ <Radio
32
+ label="Typeahead"
33
+ name="Group1"
34
+ tabIndex={0}
35
+ value="Typeahead"
36
+ {...props}
37
+ >
38
+ <Typeahead
39
+ minWidth="xs"
40
+ options={options}
41
+ />
42
+ </Radio>
43
+ <br />
44
+ <Radio
45
+ defaultChecked={false}
46
+ label="Typography"
47
+ name="Group1"
48
+ value="Typography"
49
+ {...props}
50
+ >
51
+ <Title text="Custom Typography" />
52
+ </Radio>
53
+ </div>
54
+ )
55
+ }
56
+ export default RadioChildren
@@ -14,6 +14,7 @@ examples:
14
14
  - radio_error: With Error
15
15
  - radio_alignment: Alignment
16
16
  - radio_disabled: Disabled
17
+ - radio_children: Children
17
18
 
18
19
  swift:
19
20
  - radio_default_swift: Default
@@ -3,3 +3,4 @@ export { default as RadioCustom } from './_radio_custom.jsx'
3
3
  export { default as RadioError } from './_radio_error.jsx'
4
4
  export { default as RadioAlignment } from './_radio_alignment.jsx'
5
5
  export { default as RadioDisabled } from './_radio_disabled.jsx'
6
+ export { default as RadioChildren } from './_radio_children.jsx'
@@ -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>