playbook_ui_docs 13.25.0.pre.alpha.PLAY761globalpaddingpropsbuttons2713 β†’ 13.25.0.pre.alpha.PLAY1249fixTooltipswrappingformelementscausingmisalignment2783

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_currency/docs/_currency_alignment_swift.md +43 -0
  3. data/app/pb_kits/playbook/pb_currency/docs/_currency_props_swift.md +12 -0
  4. data/app/pb_kits/playbook/pb_currency/docs/_currency_size_swift.md +31 -0
  5. data/app/pb_kits/playbook/pb_currency/docs/example.yml +5 -0
  6. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_date_range_stacked_default_swift.md +14 -0
  7. data/app/pb_kits/playbook/pb_date_range_stacked/docs/_date_range_stacked_props_swift.md +9 -0
  8. data/app/pb_kits/playbook/pb_date_range_stacked/docs/example.yml +4 -0
  9. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +5 -5
  10. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +0 -0
  11. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.jsx +87 -0
  12. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete.md +1 -0
  13. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.jsx +102 -0
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_autocomplete_and_custom_display.md +1 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +4 -2
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +5 -5
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.jsx +51 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +5 -5
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +1 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +3 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -0
  25. data/dist/playbook-doc.js +6 -6
  26. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79167a3d16d25909c9f4110866ef74784797313510baf6574c8a9dcc7f145e5d
4
- data.tar.gz: b3adb21e79b1da5706208b838fc26fb04e29444fdd2b341fed054ec9e27d5d8d
3
+ metadata.gz: b07b838aabd7b19f577118c1cbfb8de1d9c7c26b67f5bc697a74aac343904d3f
4
+ data.tar.gz: 59ac0f44d520597e6d321c7976a570fbfd091bc75658720e8c149cef39118e01
5
5
  SHA512:
6
- metadata.gz: fb61c3f801e0ccebb9fe280a588095cd14499955d22de09030a3bd8449d810a273d1ac1498e8a8e2a8f3d39907d817c1c675f54254a0e31e3c99ef4f74eea90b
7
- data.tar.gz: a2ce5f891a1340dfed230be9b76e61fd91f3f71e96566921a27dcb958012bf0ed3916b23a050f38de9bd8bea8e194fd2d3806ed85e16c38ccd3e7b73c419dcfa
6
+ metadata.gz: 4c19279fda183a6c4f8e7561feec01930dd9fc215f5fbb744dd3ebc37009e091299e5c834c6b75e073f2b7551a81fc5f74f9bb8192fb17c50f873e43f1e63c76
7
+ data.tar.gz: ed187a5f2790a74e6b2604f80f63d2960b5b9fd12df44e35ec6506bab02ec5ab4590cd960aad0b8351787c18e31296ce0d65c09124f5e30261565f73fb515605
@@ -0,0 +1,43 @@
1
+ [!Currency-Alignment](https://github.com/powerhome/playbook-swift/assets/112719604/d74a9c5a-c606-4cd0-bf70-20e9297ec246)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ HStack {
6
+ PBCurrency(
7
+ amount: "2,000",
8
+ decimalAmount: ".50",
9
+ label: "left",
10
+ size: .title4,
11
+ symbol: "en_US",
12
+ isEmphasized: true,
13
+ alignment: .leading
14
+ )
15
+ }
16
+ .frame(maxWidth: .infinity, alignment: .leading)
17
+ HStack {
18
+ PBCurrency(
19
+ amount: "342",
20
+ decimalAmount: ".00",
21
+ label: "center",
22
+ size: .title4,
23
+ symbol: "en_EU",
24
+ isEmphasized: true,
25
+ alignment: .center
26
+ )
27
+ }
28
+ .frame(maxWidth: .infinity, alignment: .center)
29
+ HStack {
30
+ PBCurrency(
31
+ amount: "45",
32
+ label: "right",
33
+ size: .title4,
34
+ symbol: "en_US",
35
+ unit: "/mo",
36
+ isEmphasized: true,
37
+ hasUnit: true,
38
+ alignment: .trailing
39
+ )
40
+ }
41
+ .frame(maxWidth: .infinity, alignment: .trailing)
42
+ }
43
+ ```
@@ -0,0 +1,12 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **amount** | `String` | Allows user to enter a currency amount | | |
5
+ | **decimalAmount** | `String` | Allows user to enter a decimal amount | | |
6
+ | **label** | `String` | Allows user to a descriptive label value | | |
7
+ | **size** | `PBFont` | Allows user to choose the size of the amount that is being displayed | `.title4` | `title4` `title3` `title4` |
8
+ | **symbol** | `String` | A string value used to produce the desired currency symbol | | |
9
+ | **unit** | `String` | Allows user to add a unit of measure instead of a decimal amount | | |
10
+ | **alignment** | `Alignment` | Sets alignment of content | `.leading` | `leading` `center` `trailing` |
11
+ | **isEmphasized** | `Bool` | Determines whether or not the currency that is being displayed is emphasized | `false` | `true` `false` |
12
+ | **hasUnit** | `Bool` | Determines whether or not the currency has a decimal value or a unit of measure | `false` | `true` `false` |
@@ -0,0 +1,31 @@
1
+ ![Currency-Default](https://github.com/powerhome/playbook-swift/assets/54749071/bf3810f9-6dd2-4bdd-b32a-14109f3a0b9a)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ PBCurrency(
6
+ amount: "2,000",
7
+ decimalAmount: ".50",
8
+ label: "small",
9
+ size: .title4,
10
+ symbol: "en_US",
11
+ isEmphasized: true
12
+ )
13
+ PBCurrency(
14
+ amount: "342",
15
+ decimalAmount: ".00",
16
+ label: "medium",
17
+ size: .title3,
18
+ symbol: "en_EU",
19
+ isEmphasized: true
20
+ )
21
+ PBCurrency(
22
+ amount: "45",
23
+ label: "large",
24
+ size: .title1,
25
+ symbol: "en_US",
26
+ unit: "/mo",
27
+ isEmphasized: true,
28
+ hasUnit: true
29
+ )
30
+ }
31
+ ```
@@ -17,3 +17,8 @@ examples:
17
17
  - currency_abbreviated: Abbreviate Larger Amounts
18
18
  - currency_matching_decimals: Matching Decimals
19
19
  - currency_unstyled: Unstyled
20
+
21
+ swift:
22
+ - currency_size_swift: Size
23
+ - currency_alignment_swift: Alignment
24
+ - currency_props_swift: ""
@@ -0,0 +1,14 @@
1
+ ![Date-Range-Stacked-Default](https://github.com/powerhome/playbook-swift/assets/54749071/ccb85e5d-0f6d-4ced-8154-aa9dfa72a131)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading, spacing: Spacing.small) {
5
+ PBDateRangeStacked(
6
+ startDate: Date().makeDate(year: 2019, month: 6, day: 18),
7
+ endDate: Date().makeDate(year: 2020, month: 3, day: 20),
8
+ startAlignment: .trailing,
9
+ endAlignment: .leading,
10
+ startVariant: .short(showIcon: false),
11
+ endVariant: .short(showIcon: false)
12
+ )
13
+ }
14
+ ```
@@ -0,0 +1,9 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **startDate** | `Date()` | Takes a string value to set the starting date range value | `Date()` | |
5
+ | **endDate** | `Date()` | Takes a string value to set the ending date range value | `Date()` | |
6
+ | **startAlignment** | `Alignment` | Changes the alignment of the starting date | `.leading` | `.leading` `.trailing` |
7
+ | **endAlignment** | `Alignment` | Changes the alignment of the ending date | `.leading` | `.leading` `.trailing` |
8
+ | **startVariant** | `PBDate.Variant` | Changes the style of the starting date | `.short(showIcon: false)` | `.short(showIcon: false)` `.dayDate` `.standard` `.withIcon(isStandard: true)` `withIcon(isStandard: false)` |
9
+ | **endVariant** | `PBDate.Variant` | Changes the style of the ending date | `.short(showIcon: false)` | `.short(showIcon: false)` `.dayDate` `.standard` `.withIcon(isStandard: true)` `withIcon(isStandard: false)` |
@@ -5,3 +5,7 @@ examples:
5
5
 
6
6
  react:
7
7
  - date_range_stacked_default: Default
8
+
9
+ swift:
10
+ - date_range_stacked_default_swift: Default
11
+ - date_range_stacked_props_swift: ""
@@ -14,11 +14,11 @@ const [selectedOption, setSelectedOption] = useState();
14
14
  id: "United-states"
15
15
  },
16
16
  {
17
- label: "Ukraine",
18
- value: "Ukraine",
19
- areaCode: "+380",
20
- icon: "πŸ‡ΊπŸ‡¦",
21
- id: "ukraine"
17
+ label: "Canada",
18
+ value: "Canada",
19
+ areaCode: "+1",
20
+ icon: "πŸ‡¨πŸ‡¦",
21
+ id: "canada"
22
22
  },
23
23
  {
24
24
  label: "Pakistan",
@@ -0,0 +1,87 @@
1
+ import React, { useState } from 'react'
2
+ import { Dropdown, User, Badge, FlexItem } from '../..'
3
+
4
+ const DropdownWithAutocomplete = (props) => {
5
+ // eslint-disable-next-line no-unused-vars
6
+ const [selectedOption, setSelectedOption] = useState();
7
+
8
+ const options = [
9
+ {
10
+ label: "Jasper Furniss",
11
+ value: "Jasper Furniss",
12
+ territory: "PHL",
13
+ title: "Senior UX Engineer",
14
+ id: "jasper-furniss",
15
+ status: "Offline"
16
+ },
17
+ {
18
+ label: "Ramon Ruiz",
19
+ value: "Ramon Ruiz",
20
+ territory: "PHL",
21
+ title: "Senior UX Desinger",
22
+ id: "ramon-ruiz",
23
+ status: "Away"
24
+ },
25
+ {
26
+ label: "Jason Cypret",
27
+ value: "Jason Cypret",
28
+ territory: "PHL",
29
+ title: "VP of User Experience",
30
+ id: "jason-cypret",
31
+ status: "Online"
32
+ },
33
+ {
34
+ label: "Courtney Long",
35
+ value: "Courtney Long",
36
+ territory: "PHL",
37
+ title: "UX Design Mentor",
38
+ id: "courtney-long",
39
+ status: "Online"
40
+ }
41
+ ];
42
+
43
+
44
+ return (
45
+ <div>
46
+ <Dropdown autocomplete
47
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
48
+ options={options}
49
+ {...props}
50
+ >
51
+ {options.map((option) => (
52
+ <Dropdown.Option key={option.id}
53
+ option={option}
54
+ >
55
+ <>
56
+ <FlexItem>
57
+ <User
58
+ align="left"
59
+ avatar
60
+ name={option.label}
61
+ orientation="horizontal"
62
+ territory={option.territory}
63
+ title={option.title}
64
+ />
65
+ </FlexItem>
66
+ <FlexItem>
67
+ <Badge
68
+ rounded
69
+ text={option.status}
70
+ variant={`${
71
+ option.status === "Offline"
72
+ ? "neutral"
73
+ : option.status === "Online"
74
+ ? "success"
75
+ : "warning"
76
+ }`}
77
+ />
78
+ </FlexItem>
79
+ </>
80
+ </Dropdown.Option>
81
+ ))}
82
+ </Dropdown>
83
+ </div>
84
+ )
85
+ }
86
+
87
+ export default DropdownWithAutocomplete
@@ -0,0 +1 @@
1
+ The `autocomplete` prop can be used to add autocomplete or typeahead functionality to the Dropdown's default Trigger. This prop is set to 'false' by default.
@@ -0,0 +1,102 @@
1
+ import React, { useState } from 'react'
2
+ import { Dropdown, User, Badge, FlexItem, Avatar } from '../..'
3
+
4
+ const DropdownWithAutocompleteAndCustomDisplay = (props) => {
5
+ // eslint-disable-next-line no-unused-vars
6
+ const [selectedOption, setSelectedOption] = useState();
7
+
8
+ const options = [
9
+ {
10
+ label: "Jasper Furniss",
11
+ value: "Jasper Furniss",
12
+ territory: "PHL",
13
+ title: "Senior UX Engineer",
14
+ id: "jasper-furniss",
15
+ status: "Offline"
16
+ },
17
+ {
18
+ label: "Ramon Ruiz",
19
+ value: "Ramon Ruiz",
20
+ territory: "PHL",
21
+ title: "Senior UX Desinger",
22
+ id: "ramon-ruiz",
23
+ status: "Away"
24
+ },
25
+ {
26
+ label: "Jason Cypret",
27
+ value: "Jason Cypret",
28
+ territory: "PHL",
29
+ title: "VP of User Experience",
30
+ id: "jason-cypret",
31
+ status: "Online"
32
+ },
33
+ {
34
+ label: "Courtney Long",
35
+ value: "Courtney Long",
36
+ territory: "PHL",
37
+ title: "UX Design Mentor",
38
+ id: "courtney-long",
39
+ status: "Online"
40
+ }
41
+ ];
42
+
43
+ const CustomDisplay = () => {
44
+ return (
45
+ <>
46
+ {
47
+ selectedOption && (
48
+ <Avatar
49
+ name={selectedOption.label}
50
+ size="xs"
51
+ />
52
+ )
53
+ }
54
+ </>
55
+ )
56
+ };
57
+
58
+ return (
59
+ <div>
60
+ <Dropdown autocomplete
61
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
62
+ options={options}
63
+ {...props}
64
+ >
65
+ <Dropdown.Trigger customDisplay={<CustomDisplay/>} />
66
+ {options.map((option) => (
67
+ <Dropdown.Option key={option.id}
68
+ option={option}
69
+ >
70
+ <>
71
+ <FlexItem>
72
+ <User
73
+ align="left"
74
+ avatar
75
+ name={option.label}
76
+ orientation="horizontal"
77
+ territory={option.territory}
78
+ title={option.title}
79
+ />
80
+ </FlexItem>
81
+ <FlexItem>
82
+ <Badge
83
+ rounded
84
+ text={option.status}
85
+ variant={`${
86
+ option.status === "Offline"
87
+ ? "neutral"
88
+ : option.status === "Online"
89
+ ? "success"
90
+ : "warning"
91
+ }`}
92
+ />
93
+ </FlexItem>
94
+ </>
95
+ </Dropdown.Option>
96
+ ))}
97
+ </Dropdown>
98
+ </div>
99
+ )
100
+ }
101
+
102
+ export default DropdownWithAutocompleteAndCustomDisplay
@@ -0,0 +1 @@
1
+ `autocomplete` prop can also be used in conjunction with the `customDisplay` prop.
@@ -39,7 +39,7 @@ const DropdownWithCustomDisplay = (props) => {
39
39
  }
40
40
  ];
41
41
 
42
- const customDisplay = () => {
42
+ const CustomDisplay = () => {
43
43
  return (
44
44
  <>
45
45
  {
@@ -62,7 +62,9 @@ const DropdownWithCustomDisplay = (props) => {
62
62
  options={options}
63
63
  {...props}
64
64
  >
65
- <Dropdown.Trigger customDisplay={customDisplay()}/>
65
+ <Dropdown.Trigger customDisplay={<CustomDisplay/>}
66
+ placeholder="Select a User"
67
+ />
66
68
  {options.map((option) => (
67
69
  <Dropdown.Option key={option.id}
68
70
  option={option}
@@ -0,0 +1,3 @@
1
+ The `customDisplay` prop can be used to customize the display of the selected item by allowing devs to pass in a component that will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
2
+
3
+ The `placeholder` prop can also be used to customize the placeholder text for the default Trigger.
@@ -14,11 +14,11 @@ const DropdownWithCustomOptions = (props) => {
14
14
  id: "United-states"
15
15
  },
16
16
  {
17
- label: "Ukraine",
18
- value: "Ukraine",
19
- areaCode: "+380",
20
- icon: "πŸ‡ΊπŸ‡¦",
21
- id: "ukraine"
17
+ label: "Canada",
18
+ value: "Canada",
19
+ areaCode: "+1",
20
+ icon: "πŸ‡¨πŸ‡¦",
21
+ id: "canada"
22
22
  },
23
23
  {
24
24
  label: "Pakistan",
@@ -0,0 +1 @@
1
+ The Dropdown also allows for custom options that can be passed in as children to the `Dropdown.Option` subcomponent. If no children are passed in the `Dropdown.Option`, the kit will render each option as text by default.
@@ -0,0 +1,51 @@
1
+ import React, { useState } from 'react'
2
+ import { Dropdown } from '../..'
3
+
4
+ const DropdownWithCustomPadding = (props) => {
5
+ // eslint-disable-next-line no-unused-vars
6
+ const [selectedOption, setSelectedOption] = useState();
7
+
8
+ const options = [
9
+ {
10
+ label: "United States",
11
+ value: "United States",
12
+ areaCode: "+1",
13
+ icon: "πŸ‡ΊπŸ‡Έ",
14
+ id: "United-states"
15
+ },
16
+ {
17
+ label: "Canada",
18
+ value: "Canada",
19
+ areaCode: "+1",
20
+ icon: "πŸ‡¨πŸ‡¦",
21
+ id: "canada"
22
+ },
23
+ {
24
+ label: "Pakistan",
25
+ value: "Pakistan",
26
+ areaCode: "+92",
27
+ icon: "πŸ‡΅πŸ‡°",
28
+ id: "pakistan"
29
+ }
30
+ ];
31
+
32
+
33
+ return (
34
+ <div>
35
+ <Dropdown
36
+ onSelect={(selectedItem) => setSelectedOption(selectedItem)}
37
+ options={options}
38
+ {...props}
39
+ >
40
+ {options.map((option) => (
41
+ <Dropdown.Option key={option.id}
42
+ option={option}
43
+ padding="sm"
44
+ />
45
+ ))}
46
+ </Dropdown>
47
+ </div>
48
+ )
49
+ }
50
+
51
+ export default DropdownWithCustomPadding
@@ -0,0 +1 @@
1
+ By default, the padding on each option in the dropdown is set to `xs`. The `padding` Global Props however can be used to override this default. In this example, we are setting padding to `sm`.
@@ -14,11 +14,11 @@ const [selectedOption, setSelectedOption] = useState();
14
14
  id: "United-states"
15
15
  },
16
16
  {
17
- label: "Ukraine",
18
- value: "Ukraine",
19
- areaCode: "+380",
20
- icon: "πŸ‡ΊπŸ‡¦",
21
- id: "ukraine"
17
+ label: "Canada",
18
+ value: "Canada",
19
+ areaCode: "+1",
20
+ icon: "πŸ‡¨πŸ‡¦",
21
+ id: "canada"
22
22
  },
23
23
  {
24
24
  label: "Pakistan",
@@ -0,0 +1 @@
1
+ The Dropdown can also be given a custom Trigger by passing children to the `Dropdown.Trigger` subcomponent as shown in this example. Here we are using the IconCircle kit.
@@ -6,4 +6,7 @@ examples:
6
6
  - dropdown_with_custom_options: Custom Options
7
7
  - dropdown_with_custom_display: Custom Display
8
8
  - dropdown_with_custom_trigger: Custom Trigger
9
+ - dropdown_with_autocomplete: Autocomplete
10
+ - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
11
+ - dropdown_with_custom_padding: Custom Padding for Dropdown Options
9
12
 
@@ -2,3 +2,6 @@ export { default as DropdownDefault } from './_dropdown_default.jsx'
2
2
  export { default as DropdownWithCustomDisplay } from './_dropdown_with_custom_display.jsx'
3
3
  export { default as DropdownWithCustomOptions } from './_dropdown_with_custom_options.jsx'
4
4
  export { default as DropdownWithCustomTrigger } from './_dropdown_with_custom_trigger.jsx'
5
+ export { default as DropdownWithAutocomplete } from './_dropdown_with_autocomplete.jsx'
6
+ export { default as DropdownWithAutocompleteAndCustomDisplay } from './_dropdown_with_autocomplete_and_custom_display.jsx'
7
+ export { default as DropdownWithCustomPadding } from './_dropdown_with_custom_padding.jsx'