playbook_ui 13.27.0.pre.alpha.PLAY11782916 → 13.27.0.pre.alpha.dropdowncustomoptionfix2924

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -0
  3. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +61 -0
  4. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +11 -0
  5. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +4 -1
  6. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold_swift.md +32 -0
  7. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +17 -0
  8. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +19 -0
  9. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +10 -0
  10. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +17 -0
  11. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +7 -0
  12. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +39 -0
  13. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +39 -0
  14. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +15 -0
  15. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +78 -0
  16. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +6 -0
  17. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default_swift.md +20 -0
  18. data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_props_swift.md +6 -0
  19. data/app/pb_kits/playbook/pb_date_year_stacked/docs/example.yml +4 -0
  20. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -0
  21. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -4
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -3
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +11 -6
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +5 -2
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.html.erb +13 -8
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -1
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +5 -2
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.html.erb +13 -8
  29. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
  30. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +2 -8
  31. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +1 -5
  32. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +2 -12
  33. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +23 -0
  34. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +7 -0
  35. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +9 -0
  36. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +22 -0
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +9 -0
  38. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +62 -0
  39. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +8 -0
  40. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
  41. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  43. data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
  44. data/app/pb_kits/playbook/pb_select/_select.tsx +1 -13
  45. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +19 -0
  46. data/dist/playbook-rails.js +4 -4
  47. data/lib/playbook/forms/builder/phone_number_field.rb +12 -0
  48. data/lib/playbook/forms/builder.rb +1 -0
  49. data/lib/playbook/version.rb +1 -1
  50. metadata +23 -2
@@ -10,18 +10,12 @@
10
10
  padding:"none",
11
11
  cursor: "pointer"
12
12
  }) do %>
13
- <%= pb_rails("flex", props: {
14
- align: "center",
15
- classname:"dropdown_option_wrapper",
16
- justify: "between",
17
- padding_x:"sm",
18
- padding_y:"xxs",
19
- }) do %>
13
+ <div class="dropdown_option_wrapper">
20
14
  <% if content.present? %>
21
15
  <%= content.presence %>
22
16
  <% else %>
23
17
  <%= pb_rails("body", props: {text: object.option[:label]}) %>
24
18
  <% end %>
25
- <% end %>
19
+ </div>
26
20
  <% end %>
27
21
  <% end %>
@@ -10,12 +10,8 @@ module Playbook
10
10
  Hash(prop(:data)).merge("dropdown_option_label": option)
11
11
  end
12
12
 
13
- def padding_helper
14
- " p_xs"
15
- end
16
-
17
13
  def classname
18
- generate_classname("pb_dropdown_option", "list") + padding_helper
14
+ generate_classname("pb_dropdown_option", "list")
19
15
  end
20
16
  end
21
17
  end
@@ -10,7 +10,6 @@ import { globalProps, GlobalProps } from "../../utilities/globalProps";
10
10
 
11
11
  import DropdownContext from "../context";
12
12
 
13
- import Flex from "../../pb_flex/_flex";
14
13
  import Body from "../../pb_body/_body";
15
14
  import ListItem from "../../pb_list/_list_item";
16
15
  import { GenericObject } from "../../types";
@@ -39,7 +38,6 @@ const DropdownOption = (props: DropdownOptionProps) => {
39
38
  id,
40
39
  key,
41
40
  option,
42
- padding = "xs",
43
41
  } = props;
44
42
 
45
43
  const {
@@ -77,7 +75,7 @@ const DropdownOption = (props: DropdownOptionProps) => {
77
75
  selectedClass,
78
76
  focusedClass,
79
77
  ),
80
- globalProps(props, {padding}),
78
+ globalProps(props),
81
79
  className
82
80
  );
83
81
 
@@ -98,20 +96,12 @@ const DropdownOption = (props: DropdownOptionProps) => {
98
96
  key={option.label}
99
97
  padding="none"
100
98
  >
101
- <Flex
102
- align="center"
103
- className="dropdown_option_wrapper"
104
- justify="between"
105
- paddingX="sm"
106
- paddingY="xxs"
107
- >
108
99
  {children ?
109
- children :
100
+ <div className="dropdown_option_wrapper">{children}</div> :
110
101
  <Body dark={dark}
111
102
  text={option.label}
112
103
  />
113
104
  }
114
- </Flex>
115
105
  </ListItem>
116
106
  </div>
117
107
  );
@@ -0,0 +1,23 @@
1
+ ![Children-Toast](https://github.com/powerhome/playbook-swift/assets/54749071/55aebd12-43c4-4061-92d3-6aebb07ff349)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading) {
5
+ PBToast(
6
+ text: message,
7
+ variant: .success,
8
+ actionView: .custom(AnyView(Text("Undo").pbFont(.title4, color: .white))),
9
+ dismissAction: closeToast
10
+ )
11
+ PBToast(
12
+ variant: .custom(nil, .pbPrimary),
13
+ actionView: .custom(
14
+ AnyView(
15
+ HStack {
16
+ Text("Undo action").pbFont(.caption, color: .white)
17
+ PBButton(variant: .primary, title: "Undo").disabled(true)
18
+ }
19
+ )),
20
+ dismissAction: closeToast
21
+ )
22
+ }
23
+ ```
@@ -0,0 +1,7 @@
1
+ ```swift
2
+ VStack(alignment: .leading) {
3
+ PBToast(text: "Error Message", variant: .error, actionView: .default, dismissAction: closeToast)
4
+ PBToast(text: "Items Successfully Moved", variant: .success, actionView: .default, dismissAction: closeToast)
5
+ PBToast(text: "Scan to Assign Selected Items", variant: .neutral, actionView: .default, dismissAction: closeToast)
6
+ }
7
+ ```
@@ -0,0 +1,9 @@
1
+ ![Default-Toast](https://github.com/powerhome/playbook-swift/assets/54749071/cc465b1b-85ba-4492-a832-b06b842a1555)
2
+
3
+ ```swift
4
+ VStack(alignment: .leading) {
5
+ PBToast(text: "Error Message", variant: .error, dismissAction: closeToast)
6
+ PBToast(text: "Items Successfully Moved", variant: .success, dismissAction: closeToast)
7
+ PBToast(text: "Scan to Assign Selected Items", variant: .neutral, dismissAction: closeToast)
8
+ }
9
+ ```
@@ -0,0 +1,22 @@
1
+ ```swift
2
+ HStack {
3
+ PBButton(variant: .secondary, title: "Top Center") {
4
+ position = .top
5
+ toastView = PBToast(
6
+ text: "Top Center",
7
+ variant: .neutral,
8
+ actionView: .withTimer(3),
9
+ dismissAction: closeToast
10
+ )
11
+ }
12
+ PBButton(variant: .secondary, title: "Bottom Center") {
13
+ position = .bottom
14
+ toastView = PBToast(
15
+ text: "Bottom Center",
16
+ variant: .neutral,
17
+ actionView: .withTimer(2),
18
+ dismissAction: closeToast
19
+ )
20
+ }
21
+ }
22
+ ```
@@ -0,0 +1,9 @@
1
+ ![Multiline-Toast](https://github.com/powerhome/playbook-swift/assets/54749071/df7bb8da-89ee-477e-8001-7262e48ce03a)
2
+
3
+ ```swift
4
+ PBToast(
5
+ text: message,
6
+ variant: .custom(.infoCircle, .pbPrimary),
7
+ dismissAction: closeToast
8
+ )
9
+ ```
@@ -0,0 +1,62 @@
1
+ ```swift
2
+ GridRow {
3
+ PBButton(variant: .secondary, title: "Top Left") {
4
+ position = .topLeft
5
+ toastView = PBToast(
6
+ text: "Top Left",
7
+ variant: .neutral,
8
+ actionView: .default,
9
+ dismissAction: closeToast
10
+ )
11
+ }
12
+ PBButton(variant: .secondary, title: "Top Right") {
13
+ position = .topRight
14
+ toastView = PBToast(
15
+ text: "Top Right",
16
+ variant: .neutral,
17
+ actionView: .default,
18
+ dismissAction: closeToast
19
+ )
20
+ }
21
+ }
22
+ GridRow {
23
+ PBButton(variant: .secondary, title: "Top Center") {
24
+ position = .top
25
+ toastView = PBToast(
26
+ text: "Top Center",
27
+ variant: .neutral,
28
+ actionView: .default,
29
+ dismissAction: closeToast
30
+ )
31
+ }
32
+ PBButton(variant: .secondary, title: "Bottom Center") {
33
+ position = .bottom
34
+ toastView = PBToast(
35
+ text: "Bottom Center",
36
+ variant: .custom(.user, .status(.neutral)),
37
+ actionView: .default,
38
+ dismissAction: closeToast
39
+ )
40
+ }
41
+ }
42
+ GridRow {
43
+ PBButton(variant: .secondary, title: "Bottom Left") {
44
+ position = .bottomLeft
45
+ toastView = PBToast(
46
+ text: "Bottom Left",
47
+ variant: .custom(.user, .status(.neutral)),
48
+ actionView: .default,
49
+ dismissAction: closeToast
50
+ )
51
+ }
52
+ PBButton(variant: .secondary, title: "Bottom Right") {
53
+ position = .bottomRight
54
+ toastView = PBToast(
55
+ text: "Bottom Right",
56
+ variant: .custom(.user, .status(.neutral)),
57
+ actionView: .default,
58
+ dismissAction: closeToast
59
+ )
60
+ }
61
+ }
62
+ ```
@@ -0,0 +1,8 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **text** | `String` |`Value for the toast message` | `nil` | |
5
+ | **variant** | `Variant` | `Determines the type pf toast message being displayed` | `.custom()` | `error`, `success`,
6
+ `neutral`, `custom()` |
7
+ | **actionView** | `dismissAction` | Dismisses the toast message | `.default` | `default` `custom()` `withTimer()` |
8
+ | **dismissAction** | `(() -> Void)` | `Triggers the dismiss action` | | |
@@ -14,3 +14,12 @@ examples:
14
14
  - fixed_confirmation_toast_positions: Click to Show Positions
15
15
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
16
16
  - fixed_confirmation_toast_children: Children
17
+
18
+ swift:
19
+ - fixed_confirmation_toast_default_swift: Default
20
+ - fixed_confirmation_toast_multi_line_swift: Multi Line
21
+ #- fixed_confirmation_toast_close_swift: Click to Close
22
+ #- fixed_confirmation_toast_positions_swift: Click to Show Positions
23
+ - fixed_confirmation_toast_children_swift: Children
24
+ #- fixed_confirmation_toast_dismiss_with_timer_swift: Timer
25
+ - fixed_confirmation_toast_props_swift: ""
@@ -16,7 +16,7 @@
16
16
  <%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
17
17
  <%= form.typeahead :example_user, props: { data: { typeahead_example1: true, user: {} }, placeholder: "Search for a user" } %>
18
18
  <%= form.text_field :example_text_field, props: { label: true } %>
19
- <%= form.telephone_field :example_phone_field, props: { label: true } %>
19
+ <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
20
20
  <%= form.email_field :example_email_field, props: { label: true } %>
21
21
  <%= form.number_field :example_number_field, props: { label: true } %>
22
22
  <%= form.search_field :example_search_field, props: { label: true } %>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
17
17
  <%= form.text_field :example_text_field, props: { label: true, required: true } %>
18
- <%= form.telephone_field :example_phone_field, props: { label: true, required: true, validation: { pattern: "[0-9]{3}-[0-9]{3}-[0-9]{4}", message: "Please enter a valid phone number (example: 888-888-8888)." } } %>
18
+ <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
19
19
  <%= form.email_field :example_email_field, props: { label: true, required: true } %>
20
20
  <%= form.number_field :example_number_field, props: { label: true, required: true } %>
21
21
  <%= form.search_field :example_project_number, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
@@ -19,7 +19,7 @@ export type IconSizes = "lg"
19
19
  | "10x"
20
20
  | ""
21
21
 
22
- export type IconProps = {
22
+ type IconProps = {
23
23
  aria?: {[key: string]: string},
24
24
  border?: string,
25
25
  className?: string,
@@ -7,7 +7,7 @@ import type { InputCallback } from '../types'
7
7
 
8
8
  import Body from '../pb_body/_body'
9
9
  import Caption from '../pb_caption/_caption'
10
- import Icon, { IconProps } from '../pb_icon/_icon'
10
+ import Icon from '../pb_icon/_icon'
11
11
 
12
12
  type SelectOption = {
13
13
  value: string,
@@ -25,7 +25,6 @@ type SelectProps = {
25
25
  disabled?: boolean,
26
26
  error?: string,
27
27
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
28
- iconProps?: IconProps,
29
28
  id?: string,
30
29
  includeBlank?: string,
31
30
  inline?: boolean,
@@ -37,7 +36,6 @@ type SelectProps = {
37
36
  onChange: InputCallback<HTMLSelectElement>,
38
37
  options: SelectOption[],
39
38
  required?: boolean,
40
- selectProps?: GlobalProps & { [key: string]: any },
41
39
  showArrow?: boolean,
42
40
  value?: string,
43
41
  } & GlobalProps
@@ -61,7 +59,6 @@ const Select = ({
61
59
  data = {},
62
60
  disabled = false,
63
61
  error,
64
- iconProps,
65
62
  label,
66
63
  htmlOptions = {},
67
64
  inline = false,
@@ -70,7 +67,6 @@ const Select = ({
70
67
  onChange = () => undefined,
71
68
  options = [],
72
69
  required = false,
73
- selectProps = {},
74
70
  showArrow = false,
75
71
  value,
76
72
  ...props
@@ -94,12 +90,6 @@ const Select = ({
94
90
  compactClass
95
91
  );
96
92
 
97
- const selectClasses = classnames(
98
- buildCss('pb_html_select'),
99
- globalProps(selectProps),
100
- selectProps.className
101
- )
102
-
103
93
  const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
104
94
  const selectBody =(() =>{
105
95
  if (children) return children
@@ -107,7 +97,6 @@ const Select = ({
107
97
  <select
108
98
  {...htmlOptions}
109
99
  {...domSafeProps(props)}
110
- className={selectClasses}
111
100
  disabled={disabled}
112
101
  id={name}
113
102
  multiple={multiple}
@@ -148,7 +137,6 @@ const Select = ({
148
137
  className="pb_select_kit_caret"
149
138
  fixedWidth
150
139
  icon="angle-down"
151
- {...iconProps}
152
140
  />
153
141
  :
154
142
  null
@@ -76,6 +76,25 @@
76
76
  .text_input {
77
77
  border-color: $error_dark;
78
78
  }
79
+ [class*=pb_body_kit_negative] {
80
+ color: $error_dark;
81
+ }
82
+ }
83
+ .text_input_wrapper_add_on {
84
+ .add-on {
85
+ &-right {
86
+ .add-on-card {
87
+ border: 1px solid $error_dark;
88
+ border-left: 0;
89
+ }
90
+ }
91
+ &-left {
92
+ .add-on-card {
93
+ border: 1px solid $error_dark;
94
+ border-right: 0;
95
+ }
96
+ }
97
+ }
79
98
  }
80
99
  }
81
100
  }