playbook_ui 14.6.0.pre.rc.21 → 14.6.0.pre.rc.22

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: e05fd264b4977a51ad94911511cf1a10fc062530a46ecd437bfa0c8fe977099b
4
- data.tar.gz: 1099dd1c29b4f7fe79c5a1bec488036fea5bae872ef5fb83c1cd4ff820319a4e
3
+ metadata.gz: 1de106da16b0280d3d1808a79b74e2ac4244320da229c66f50899eb9730ef8c7
4
+ data.tar.gz: 5fa46d5ee75df55b6c2752eca2f2b37796d8eafa79a2fca1c5914ef6068d135c
5
5
  SHA512:
6
- metadata.gz: ab871f97c735e0ca94c973a098e6ab1a0d16a4e1bb449c450744a6de0a95c02d0daec4ce1a70581e26114193102522c479cca8253c306dbd2d84434b93f92a2b
7
- data.tar.gz: 5e96fc933c9e981dc64f42b2b274eed0660c684cbd7130fbdad00cd7e643352de15de4d19ed3045ba8ea4fbff93c20c953f62636b8f384f719d123a0f7edaa34
6
+ metadata.gz: '0820774134793841703651be09c4e988ccaecd363bb4d31b6620cccc990ae25b023ceb6b496be786f414b08760c47b6a64e2433cef4c3eea050d7ef1b3c3f3ca'
7
+ data.tar.gz: 1657f7149c67a664f3097df64462ccb08704c534b9046dfb421c8a325ad1fab699ac3416fcbca692472ccd133558f9934372c43092d5cdbaa15dab2f9756e993
@@ -69,15 +69,21 @@
69
69
  padding-bottom: $space_xs;
70
70
  cursor: pointer;
71
71
  &:hover {
72
- background-color: $border_light;
72
+ background-color: $bg_light;
73
73
  }
74
74
 
75
75
  &[class*="_focused"] {
76
- background-color: $border_light;
76
+ background-color: $bg_light;
77
77
  }
78
78
 
79
79
  &[class*="_list"] {
80
80
  border-bottom: 1px solid $border_light;
81
+
82
+ &:hover, &:focus {
83
+ .pb_body_kit {
84
+ color: $primary;
85
+ }
86
+ }
81
87
  }
82
88
  &[class*="selected"] {
83
89
  background-color: $primary;
@@ -87,7 +93,7 @@
87
93
  color: $white !important;
88
94
  }
89
95
  &:hover {
90
- background-color: $primary !important;
96
+ background-color: $product_1_background !important;
91
97
  }
92
98
  }
93
99
  }
@@ -125,6 +131,81 @@
125
131
  }
126
132
  }
127
133
 
134
+ &.separators_hidden {
135
+ .dropdown_wrapper {
136
+ .pb_dropdown_container {
137
+
138
+ [class*="pb_dropdown_option"] {
139
+ border: none;
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ &.subtle {
146
+ .dropdown_wrapper {
147
+ .pb_dropdown_container {
148
+
149
+ [class*="pb_dropdown_option"]:first-child {
150
+ margin-top: $space_xs;
151
+ }
152
+
153
+ [class*="pb_dropdown_option"]:last-child {
154
+ margin-bottom: $space_xs;
155
+ }
156
+
157
+ [class*="pb_dropdown_option"] {
158
+ margin: $space_xs;
159
+ padding: $space_xs;
160
+ border-radius: $border_radius_md;
161
+ border-bottom: none;
162
+ position: relative;
163
+
164
+ &::after {
165
+ content: "";
166
+ position: absolute;
167
+ left: -$space_xs;
168
+ right: -$space_xs;
169
+ bottom: -4.5px;
170
+ height: 1px;
171
+ background: $border_light;
172
+ }
173
+ }
174
+
175
+ [class*="pb_dropdown_option"]:last-child::after {
176
+ display: none;
177
+ }
178
+ }
179
+ }
180
+
181
+ &.separators_hidden {
182
+ .dropdown_wrapper {
183
+ .pb_dropdown_container {
184
+ [class*="pb_dropdown_option"]:first-child {
185
+ margin-top: $space_xs;
186
+ }
187
+
188
+ [class*="pb_dropdown_option"]:last-child {
189
+ margin-bottom: $space_xs;
190
+ }
191
+
192
+ [class*="pb_dropdown_option"] {
193
+ padding: $space_xxs $space_xs;
194
+ margin: $space_xxs $space_xs;
195
+
196
+ &::after {
197
+ height: 0px;
198
+ }
199
+
200
+ &[class*="selected"] {
201
+ border-bottom: none;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+ }
208
+
128
209
  &.dark {
129
210
  .dropdown_wrapper {
130
211
  [class*="dropdown_trigger_wrapper"] {
@@ -35,7 +35,9 @@ type DropdownProps = {
35
35
  label?: string;
36
36
  onSelect?: (arg: GenericObject) => null;
37
37
  options: GenericObject;
38
+ separators: boolean;
38
39
  triggerRef?: any;
40
+ variant?: "default" | "subtle";
39
41
  };
40
42
 
41
43
  interface DropdownComponent
@@ -62,15 +64,20 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
62
64
  label,
63
65
  onSelect,
64
66
  options,
65
- triggerRef
67
+ separators = true,
68
+ triggerRef,
69
+ variant = "default",
66
70
  } = props;
67
71
 
68
72
  const ariaProps = buildAriaProps(aria);
69
73
  const dataProps = buildDataProps(data);
70
74
  const htmlProps = buildHtmlProps(htmlOptions);
75
+ const separatorsClass = separators ? '' : 'separators_hidden'
71
76
  const classes = classnames(
72
77
  buildCss("pb_dropdown"),
73
78
  globalProps(props),
79
+ variant,
80
+ separatorsClass,
74
81
  className
75
82
  );
76
83
 
@@ -0,0 +1,9 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
+ ]
7
+
8
+ %>
9
+ <%= pb_rails("dropdown", props: {options: options, separators: false}) %>
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import { Dropdown } from 'playbook-ui'
3
+
4
+ const DropdownSeparatorsHidden = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "United States",
10
+ },
11
+ {
12
+ label: "Canada",
13
+ value: "Canada",
14
+ },
15
+ {
16
+ label: "Pakistan",
17
+ value: "Pakistan",
18
+ }
19
+ ];
20
+
21
+
22
+ return (
23
+ <div>
24
+ <Dropdown
25
+ options={options}
26
+ separators={false}
27
+ {...props}
28
+ />
29
+ </div>
30
+ )
31
+ }
32
+
33
+ export default DropdownSeparatorsHidden
@@ -0,0 +1,10 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'United States', id: 'us' },
4
+ { label: 'Canada', value: 'Canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'Pakistan', id: 'pk' },
6
+ ]
7
+
8
+ %>
9
+
10
+ <%= pb_rails("dropdown", props: { options: options, variant: "subtle", separators: false }) %>
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { Dropdown } from 'playbook-ui'
3
+
4
+ const DropdownSubtleVariant = (props) => {
5
+
6
+ const options = [
7
+ {
8
+ label: "United States",
9
+ value: "United States",
10
+ },
11
+ {
12
+ label: "Canada",
13
+ value: "Canada",
14
+ },
15
+ {
16
+ label: "Pakistan",
17
+ value: "Pakistan",
18
+ }
19
+ ];
20
+
21
+
22
+ return (
23
+ <>
24
+ <Dropdown
25
+ options={options}
26
+ separators={false}
27
+ variant="subtle"
28
+ {...props}
29
+ />
30
+ </>
31
+ )
32
+ }
33
+
34
+ export default DropdownSubtleVariant
@@ -0,0 +1 @@
1
+ For the `subtle` variant, it is recommended that you set the `Separators` prop to `false` to remove the separator lines between the options for a more cleaner look.
@@ -1,6 +1,7 @@
1
1
  examples:
2
2
  rails:
3
3
  - dropdown_default: Default
4
+ - dropdown_subtle_variant: Subtle Variant
4
5
  - dropdown_subcomponent_structure_rails: Subcomponent Structure
5
6
  - dropdown_with_label: With Label
6
7
  - dropdown_with_custom_options_rails: Custom Options
@@ -10,9 +11,11 @@ examples:
10
11
  - dropdown_error: Dropdown with Error
11
12
  - dropdown_default_value: Default Value
12
13
  - dropdown_blank_selection: Blank Selection
14
+ - dropdown_separators_hidden: Separators Hidden
13
15
 
14
16
  react:
15
17
  - dropdown_default: Default
18
+ - dropdown_subtle_variant: Subtle Variant
16
19
  - dropdown_subcomponent_structure: Subcomponent Structure
17
20
  - dropdown_with_label: With Label
18
21
  - dropdown_with_custom_options: Custom Options
@@ -23,6 +26,7 @@ examples:
23
26
  - dropdown_default_value: Default Value
24
27
  - dropdown_blank_selection: Blank Selection
25
28
  - dropdown_clear_selection: Clear Selection
29
+ - dropdown_separators_hidden: Separators Hidden
26
30
  # - dropdown_with_autocomplete: Autocomplete
27
31
  # - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
28
32
  # - dropdown_with_external_control: useDropdown Hook
@@ -13,3 +13,5 @@ export { default as DropdownError } from './_dropdown_error.jsx'
13
13
  export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
14
14
  export { default as DropdownBlankSelection } from './_dropdown_blank_selection.jsx'
15
15
  export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
16
+ export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
17
+ export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
@@ -13,13 +13,18 @@ module Playbook
13
13
  prop :default_value
14
14
  prop :blank_selection, type: Playbook::Props::String,
15
15
  default: ""
16
+ prop :variant, type: Playbook::Props::Enum,
17
+ values: %w[default subtle],
18
+ default: "default"
19
+ prop :separators, type: Playbook::Props::Boolean,
20
+ default: true
16
21
 
17
22
  def data
18
23
  Hash(prop(:data)).merge(pb_dropdown: true)
19
24
  end
20
25
 
21
26
  def classname
22
- generate_classname("pb_dropdown")
27
+ generate_classname("pb_dropdown", variant, separators_class, separator: " ")
23
28
  end
24
29
 
25
30
  private
@@ -32,6 +37,10 @@ module Playbook
32
37
  default_value.present? ? default_value.transform_keys(&:to_s)["id"] : ""
33
38
  end
34
39
 
40
+ def separators_class
41
+ separators ? "" : "separators_hidden"
42
+ end
43
+
35
44
  def options_with_blank
36
45
  blank_selection.present? ? [{ id: "", value: "", label: blank_selection }] + options : options
37
46
  end