playbook_ui_docs 14.14.0.pre.alpha.play1852reacthookformsupportradio6318 → 14.14.0.pre.alpha.play1853typeaheadreacthookform6373

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: 4071d9d47bfa6226f74365c564f070e6329f147e4739c73710e9bb3078acf22a
4
- data.tar.gz: eadb0cc748ba73de5c262b8caf6c15cba150c8b4572d58dfe9bcbc2d4c0a020d
3
+ metadata.gz: 69e167614dc6979147993f0aca179416464a0dcf5041e49f1fb1bba2d850c608
4
+ data.tar.gz: 5efe6838dc0280186e139e6063666bbe932377f8a4eba745174328a5fd413220
5
5
  SHA512:
6
- metadata.gz: 1f0f8c531ba88210e337bb874204bc177f5525f177cd555ecfa7a8442356693ba80749c00448e3f82057856b26c737497bf498e7f9bea03eb1d14e5374559b09
7
- data.tar.gz: f861f78d5b7278725bd6d91b73ac375a4377c1ac870242c35462c89146c8b7de13365d3a7e7024e5154cb755cf0f1abf1141e773deadea8ab94c756f6bac5cdc
6
+ metadata.gz: 75dcba3659690199acce6ef5089146adbac805c32a4740f71450fbe859d551bb3c68a42e6a53855e5c5316b7211e31ff1167c686dab773f35e0ac7b3adcb8b9c
7
+ data.tar.gz: 111c76c52106f396099e90219702955c9046fe4fc17b43b84a7785feaa859e6607a85978d05ca6982900c3fec5be0ca25e6a4a2cded8d43595f6b1325489be1e
@@ -0,0 +1,22 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: "",
3
+ label: "Nil",
4
+ margin_bottom: "md",
5
+ null_display: "--",
6
+ size: "sm"
7
+ }) %>
8
+
9
+ <%= pb_rails("currency", props: {
10
+ amount: "",
11
+ label: "Nil",
12
+ margin_bottom: "md",
13
+ null_display: "$0.00",
14
+ size: "sm"
15
+ }) %>
16
+
17
+ <%= pb_rails("currency", props: {
18
+ amount: "",
19
+ label: "Nil",
20
+ null_display: " ",
21
+ size: "sm"
22
+ }) %>
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { Currency } from 'playbook-ui'
3
+
4
+ const CurrencyNullDisplay = (props) => {
5
+ return (
6
+ <>
7
+ <Currency
8
+ amount=""
9
+ label="Null"
10
+ marginBottom="md"
11
+ nullDisplay="--"
12
+ {...props}
13
+ />
14
+
15
+ <Currency
16
+ amount=""
17
+ label="Null"
18
+ marginBottom="md"
19
+ nullDisplay="$0.00"
20
+ {...props}
21
+ />
22
+
23
+ <Currency
24
+ amount=""
25
+ label="Null"
26
+ marginBottom="md"
27
+ nullDisplay=" "
28
+ {...props}
29
+ />
30
+ </>
31
+ )
32
+ }
33
+
34
+ export default CurrencyNullDisplay
@@ -0,0 +1 @@
1
+ To customize how the `amount` field appears when it is empty, use the `null_display` prop and set it to the desired value you want to display.
@@ -0,0 +1 @@
1
+ To customize how the `amount` field appears when it is empty, use the `nullDisplay` prop and set it to the desired value you want to display.
@@ -10,6 +10,7 @@ examples:
10
10
  - currency_unstyled: Unstyled
11
11
  - currency_comma_separator: Comma Separator
12
12
  - currency_negative: Negative
13
+ - currency_null_display: Null Display
13
14
 
14
15
  react:
15
16
  - currency_variants: Variants
@@ -21,6 +22,7 @@ examples:
21
22
  - currency_unstyled: Unstyled
22
23
  - currency_comma_separator: Comma Separator
23
24
  - currency_negative: Negative
25
+ - currency_null_display: Null Display
24
26
 
25
27
  swift:
26
28
  - currency_size_swift: Size
@@ -6,4 +6,5 @@ export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
8
  export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
9
- export { default as CurrencyNegative } from './_currency_negative.jsx'
9
+ export { default as CurrencyNegative } from './_currency_negative.jsx'
10
+ export { default as CurrencyNullDisplay } from './_currency_null_display.jsx'
@@ -16,7 +16,6 @@ examples:
16
16
  - radio_alignment: Alignment
17
17
  - radio_disabled: Disabled
18
18
  - radio_custom_children: Custom Children
19
- - radio_react_hook: React Hook Form
20
19
 
21
20
  swift:
22
21
  - radio_default_swift: Default
@@ -27,4 +26,4 @@ examples:
27
26
  - radio_spacing_swift: Spacing
28
27
  - radio_padding_swift: Padding
29
28
  - radio_subtitle_swift: Subtitle
30
- - radio_props_swift: ""
29
+ - radio_props_swift: ""
@@ -4,4 +4,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
6
  export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
7
- export { default as RadioReactHook } from './_radio_react_hook.jsx'
@@ -0,0 +1,66 @@
1
+ import React from 'react'
2
+
3
+ import { Typeahead, Title } from 'playbook-ui'
4
+ import { useForm } from 'react-hook-form'
5
+
6
+ const languages = [
7
+ { label: 'JavaScript', value: '1995', category: 'Web Development' },
8
+ { label: 'Python', value: '1991', category: 'General Purpose' },
9
+ { label: 'Java', value: '1995', category: 'Enterprise' },
10
+ { label: 'C++', value: '1985', category: 'Systems Programming' },
11
+ { label: 'Go', value: '2009', category: 'Systems Programming' },
12
+ { label: 'Rust', value: '2010', category: 'Systems Programming' },
13
+ { label: 'Swift', value: '2014', category: 'Mobile Development' },
14
+ { label: 'Kotlin', value: '2011', category: 'Mobile Development' },
15
+ { label: 'Ruby', value: '1995', category: 'Web Development' },
16
+ { label: 'PHP', value: '1995', category: 'Web Development' },
17
+ ]
18
+
19
+ const colors = [
20
+ { label: 'Orange', value: '#FFA500' },
21
+ { label: 'Red', value: '#FF0000' },
22
+ { label: 'Green', value: '#00FF00' },
23
+ { label: 'Blue', value: '#0000FF' },
24
+ ]
25
+
26
+ const TypeaheadReactHook = (props) => {
27
+ const { register, watch } = useForm()
28
+
29
+ const selectedLanguages = watch('languages')
30
+ const selectedColor = watch('color')
31
+
32
+ return (
33
+ <>
34
+ <Typeahead
35
+ isMulti
36
+ label="Multi Select Languages"
37
+ multiKit="language"
38
+ options={languages}
39
+ {...props}
40
+ {...register('languages')}
41
+ />
42
+ <Title
43
+ size={4}
44
+ text='Selected Languages'
45
+ />
46
+ {selectedLanguages && selectedLanguages.map(language => (
47
+ <p key={language.label}>{`${language.label} - ${language.value} - ${language.category}`}</p>
48
+ ))}
49
+
50
+ <Typeahead
51
+ label="Colors"
52
+ marginTop="lg"
53
+ options={colors}
54
+ {...props}
55
+ {...register('color')}
56
+ />
57
+ <Title
58
+ size={4}
59
+ text='Selected Color'
60
+ />
61
+ <p>{ selectedColor && `${selectedColor.label} - ${selectedColor.value}`}</p>
62
+ </>
63
+ )
64
+ }
65
+
66
+ export default TypeaheadReactHook
@@ -0,0 +1 @@
1
+ You can pass `react-hook-form` props to the Typeahead kit.
@@ -15,6 +15,7 @@ examples:
15
15
 
16
16
  react:
17
17
  - typeahead_default: Default
18
+ - typeahead_react_hook: React Hook
18
19
  - typeahead_with_highlight: With Highlight
19
20
  - typeahead_with_pills: With Pills
20
21
  - typeahead_with_pills_async: With Pills (Async Data)
@@ -13,3 +13,4 @@ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_lis
13
13
  export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
14
14
  export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
15
15
  export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
16
+ export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'