playbook_ui 14.9.0.pre.alpha.PLAY1731inputmasking4868 → 14.9.0.pre.alpha.PLAY16264818
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +3 -5
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -0
- data/app/pb_kits/playbook/pb_body/_body.scss +13 -14
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +16 -22
- data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +0 -6
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -2
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +0 -5
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +2 -7
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +2 -8
- data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +1 -11
- data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +2 -16
- data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_select/_select.tsx +19 -14
- data/app/pb_kits/playbook/pb_select/docs/_select_form.jsx +108 -0
- data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +36 -44
- data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -35
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.test.js +2 -139
- data/app/pb_kits/playbook/pb_title/_title.scss +5 -6
- data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -13
- data/app/pb_kits/playbook/tokens/_titles.scss +8 -0
- data/app/pb_kits/playbook/utilities/_hover.scss +2 -11
- data/app/pb_kits/playbook/utilities/globalProps.ts +0 -2
- data/app/pb_kits/playbook/utilities/hookFormProps.ts +16 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -15
- data/dist/chunks/_typeahead-B8fkIeXA.js +22 -0
- data/dist/chunks/_weekday_stacked-DxlPBh55.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/hover.rb +1 -7
- data/lib/playbook/version.rb +1 -1
- metadata +6 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +0 -88
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +0 -64
- data/dist/chunks/_typeahead-Cx7J1O_I.js +0 -22
- data/dist/chunks/_weekday_stacked-Z6CSak-K.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd75b9e4b0f7ce117dbd06fd2a726c2c365b6e5bf64cb203f030ba83659ae448
|
4
|
+
data.tar.gz: 4973b4425fac4133d09a37743f38638af91d63ac3a720555846ca286b0358635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdd757f0e267dede1c878c35a04a53cc26fb39568a802ae979477d938c6fc3e23f4e48150ec4d549717febb1daf69ae8d60285582c1ef58cd539b819ac47ab08
|
7
|
+
data.tar.gz: 9a2776ad808a0e04c2f152e64975d48b02911c3edd4cda0be6d317571fd92553d29cd6e8159444d392d2a48815e4ee1318b4eaabaf5c17bdba9c9c89ff22538b
|
@@ -4,10 +4,8 @@
|
|
4
4
|
<%= pb_rails("table/table_header", props: { tag: "div", id: item[:accessor], classname: object.th_classname, sort_menu: item[:sort_menu] }) do %>
|
5
5
|
<%= pb_rails("flex", props:{ align: "center", justify: index.zero? ? "start" : "end", text_align: "end" }) do %>
|
6
6
|
<% if index.zero? && (object.enable_toggle_expansion == "header" || object.enable_toggle_expansion == "all") %>
|
7
|
-
<button
|
8
|
-
|
9
|
-
onclick="expandAllRows(this); event.preventDefault();">
|
10
|
-
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
|
7
|
+
<button class="gray-icon toggle-all-icon" onclick="expandAllRows(this)">
|
8
|
+
<%= pb_rails("icon", props: { icon: "arrows-from-line", cursor: "pointer", fixed_width: true, padding_right: "xs" }) %>
|
11
9
|
</button>
|
12
10
|
<% end %>
|
13
11
|
<%= item[:label] %>
|
@@ -15,4 +13,4 @@
|
|
15
13
|
<% end %>
|
16
14
|
<% end %>
|
17
15
|
<% end %>
|
18
|
-
<% end %>
|
16
|
+
<% end %>
|
@@ -31,12 +31,14 @@ $avatar-sizes: (
|
|
31
31
|
[class^=pb_card_kit].overlay_top_center {
|
32
32
|
left: 50%;
|
33
33
|
transform: translateX(-50%);
|
34
|
+
padding: 2px !important;
|
34
35
|
}
|
35
36
|
|
36
37
|
[class^=pb_card_kit].overlay_left_center,
|
37
38
|
[class^=pb_card_kit].overlay_right_center {
|
38
39
|
top: 50%;
|
39
40
|
transform: translateY(-50%);
|
41
|
+
padding: 2px !important;
|
40
42
|
}
|
41
43
|
}
|
42
44
|
|
@@ -1,25 +1,24 @@
|
|
1
1
|
@import "./body_mixins";
|
2
2
|
@import "../tokens/titles";
|
3
3
|
|
4
|
-
[class^=
|
4
|
+
[class^=pb_body_kit]{
|
5
5
|
@include pb_body($text_lt_default);
|
6
6
|
@each $color_name, $color_value in $pb_body_colors {
|
7
7
|
&[class*=_#{"" + $color_name}] {
|
8
8
|
@include pb_body($color_value);
|
9
9
|
}
|
10
10
|
@each $status_name, $status_value in $pb_body_status {
|
11
|
-
&[class*=
|
11
|
+
&[class*=_default_#{$status_name}] {
|
12
12
|
@include pb_body($status_value);
|
13
13
|
}
|
14
14
|
}
|
15
15
|
}
|
16
|
-
@each $dark_color_name, $dark_color_value in $pb_dark_body_colors
|
17
|
-
&[class*=
|
16
|
+
@each $dark_color_name, $dark_color_value in $pb_dark_body_colors{
|
17
|
+
&[class*=_#{$dark_color_name}][class*=dark]{
|
18
18
|
@include pb_body($dark_color_value);
|
19
19
|
}
|
20
20
|
}
|
21
|
-
b,
|
22
|
-
strong {
|
21
|
+
b, strong {
|
23
22
|
font-weight: $bold;
|
24
23
|
}
|
25
24
|
|
@@ -30,8 +29,7 @@
|
|
30
29
|
}
|
31
30
|
}
|
32
31
|
|
33
|
-
em,
|
34
|
-
i {
|
32
|
+
em, i {
|
35
33
|
font-style: italic;
|
36
34
|
}
|
37
35
|
|
@@ -41,25 +39,26 @@
|
|
41
39
|
}
|
42
40
|
|
43
41
|
@each $status_name, $status_value in $pb_body_status {
|
44
|
-
&[class
|
42
|
+
&[class*=#{$status_name}] {
|
45
43
|
@include pb_body($status_value);
|
46
44
|
}
|
47
45
|
}
|
48
46
|
|
49
|
-
&[class*=
|
47
|
+
&[class*=dark] {
|
50
48
|
a {
|
51
49
|
color: $active_dark;
|
52
50
|
}
|
53
51
|
@include pb_body_dark();
|
54
|
-
@each $dark_color_name, $dark_color_value in $pb_dark_body_colors
|
55
|
-
&[class*=
|
52
|
+
@each $dark_color_name, $dark_color_value in $pb_dark_body_colors{
|
53
|
+
&[class*=_#{$dark_color_name}][class*=dark]{
|
56
54
|
@include pb_body($dark_color_value);
|
57
55
|
}
|
58
56
|
}
|
59
|
-
@each $status_name, $status_value in $
|
60
|
-
&[class*=
|
57
|
+
@each $status_name, $status_value in $pb_body_status {
|
58
|
+
&[class*=_#{$status_name}] {
|
61
59
|
@include pb_body($status_value);
|
62
60
|
}
|
63
61
|
}
|
64
62
|
}
|
63
|
+
|
65
64
|
}
|
@@ -3,35 +3,29 @@
|
|
3
3
|
@import "../tokens/typography";
|
4
4
|
|
5
5
|
$pb_body_colors: (
|
6
|
-
default:
|
7
|
-
light:
|
8
|
-
lighter:
|
9
|
-
link:
|
10
|
-
error:
|
11
|
-
success:
|
6
|
+
default: $text_lt_default,
|
7
|
+
light: $text_lt_light,
|
8
|
+
lighter: $text_lt_lighter,
|
9
|
+
link: $primary,
|
10
|
+
error: $error,
|
11
|
+
success: $text_lt_success_sm,
|
12
12
|
);
|
13
13
|
|
14
14
|
$pb_dark_body_colors: (
|
15
|
-
default:
|
16
|
-
light:
|
17
|
-
lighter:
|
18
|
-
link:
|
19
|
-
error:
|
20
|
-
success:
|
15
|
+
default: $text_dk_default,
|
16
|
+
light: $text_dk_light,
|
17
|
+
lighter: $text_dk_lighter,
|
18
|
+
link: $active_dark,
|
19
|
+
error: $error,
|
20
|
+
success: $text_dk_success_sm,
|
21
21
|
);
|
22
22
|
|
23
23
|
// Order is important here!
|
24
24
|
$pb_body_status: (
|
25
|
-
default:
|
26
|
-
negative:
|
27
|
-
dark_error:
|
28
|
-
positive:
|
29
|
-
);
|
30
|
-
|
31
|
-
$pb_dark_body_status: (
|
32
|
-
default: $text_dk_default,
|
33
|
-
negative: $error_dark,
|
34
|
-
positive: $text_dk_success_sm,
|
25
|
+
default: $text_lt_default,
|
26
|
+
negative: $error,
|
27
|
+
dark_error: $error_dark_body,
|
28
|
+
positive: $text_lt_success_sm,
|
35
29
|
);
|
36
30
|
|
37
31
|
@mixin pb_body($color: $text_lt_default) {
|
@@ -13,7 +13,6 @@ const BreadCrumbsDefault = (props) => {
|
|
13
13
|
<Icon
|
14
14
|
icon="home"
|
15
15
|
size="1x"
|
16
|
-
{...props}
|
17
16
|
/>
|
18
17
|
<BreadCrumbItem
|
19
18
|
{...props}
|
@@ -23,13 +22,11 @@ const BreadCrumbsDefault = (props) => {
|
|
23
22
|
size="4"
|
24
23
|
tag="span"
|
25
24
|
text="Home"
|
26
|
-
{...props}
|
27
25
|
/>
|
28
26
|
</BreadCrumbItem>
|
29
27
|
<Icon
|
30
28
|
icon="users"
|
31
29
|
size="1x"
|
32
|
-
{...props}
|
33
30
|
/>
|
34
31
|
<Link
|
35
32
|
{...props}
|
@@ -39,20 +36,17 @@ const BreadCrumbsDefault = (props) => {
|
|
39
36
|
size="4"
|
40
37
|
tag="span"
|
41
38
|
text="Users"
|
42
|
-
{...props}
|
43
39
|
/>
|
44
40
|
</Link>
|
45
41
|
<Icon
|
46
42
|
icon="user"
|
47
43
|
size="1x"
|
48
|
-
{...props}
|
49
44
|
/>
|
50
45
|
<Link {...props}>
|
51
46
|
<Title
|
52
47
|
size="4"
|
53
48
|
tag="span"
|
54
49
|
text="User"
|
55
|
-
{...props}
|
56
50
|
/>
|
57
51
|
</Link>
|
58
52
|
</BreadCrumbs>
|
@@ -32,7 +32,7 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
|
|
32
32
|
}
|
33
33
|
|
34
34
|
@mixin pb_card_selected_dark {
|
35
|
-
@include pb_card_selected($
|
35
|
+
@include pb_card_selected($primary_action);
|
36
36
|
}
|
37
37
|
|
38
38
|
@mixin pb_card($background: $card_light, $border_color: $border_light) {
|
@@ -13,7 +13,6 @@ type FileUploadProps = {
|
|
13
13
|
accept?: string[],
|
14
14
|
className?: string,
|
15
15
|
customMessage?: string,
|
16
|
-
dark?: boolean,
|
17
16
|
data?: {[key: string]: string | number},
|
18
17
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
19
18
|
acceptedFilesDescription?: string,
|
@@ -32,7 +31,6 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
32
31
|
acceptedFilesDescription = '',
|
33
32
|
className,
|
34
33
|
customMessage,
|
35
|
-
dark = false,
|
36
34
|
data = {},
|
37
35
|
htmlOptions = {},
|
38
36
|
maxSize,
|
@@ -96,12 +94,9 @@ const FileUpload = (props: FileUploadProps): React.ReactElement => {
|
|
96
94
|
{...htmlProps}
|
97
95
|
{...getRootProps()}
|
98
96
|
>
|
99
|
-
<Card
|
97
|
+
<Card>
|
100
98
|
<input {...getInputProps()} />
|
101
|
-
<Body
|
102
|
-
color="light"
|
103
|
-
dark={dark}
|
104
|
-
>
|
99
|
+
<Body color="light">
|
105
100
|
{isDragActive ?
|
106
101
|
<p>{'Drop the files here ...'}</p>
|
107
102
|
:
|
@@ -5,17 +5,11 @@
|
|
5
5
|
id: object.id,
|
6
6
|
**combined_html_options) do %>
|
7
7
|
<%= pb_rails("form_group", props: {cursor: "pointer", full_width: object.full_width}) do %>
|
8
|
-
<label
|
9
|
-
for="upload-<%= object.id %>"
|
10
|
-
class="pb_button_kit_secondary_inline_enabled <%= 'dark' if object.dark %>"
|
11
|
-
>
|
12
|
-
<%= "#{object.label}" %>
|
13
|
-
</label>
|
8
|
+
<label for="upload-<%= object.id %>" class="pb_button_kit_secondary_inline_enabled"><%= "#{object.label}" %></label>
|
14
9
|
<%= pb_rails("text_input", props: {
|
15
10
|
type: "file",
|
16
|
-
dark: object.dark,
|
17
11
|
input_options: {
|
18
|
-
id: "upload-#{object.id}",
|
12
|
+
id: "upload-#{object.id}",
|
19
13
|
classname: "cursor_pointer",
|
20
14
|
}.merge(object.input_options)
|
21
15
|
}) %>
|
@@ -223,7 +223,6 @@
|
|
223
223
|
}
|
224
224
|
}
|
225
225
|
[class*="pb_collapsible_nav_item"][class*="pb_nav_list_item_link_collapsible"][class*="pb_nav_list_kit_item"] {
|
226
|
-
box-shadow: unset !important;
|
227
226
|
.pb_nav_list_item_text_collapsible {
|
228
227
|
color: $white !important;
|
229
228
|
}
|
@@ -241,17 +240,11 @@
|
|
241
240
|
|
242
241
|
.pb_collapsible_main_kit:hover {
|
243
242
|
background-color: mix($white, $card_dark, 20%);
|
244
|
-
.pb_nav_list_item_text_collapsible
|
245
|
-
color: $white !important;
|
246
|
-
}
|
247
|
-
}
|
248
|
-
|
249
|
-
.pb_collapsible_main_kit {
|
243
|
+
.pb_nav_list_item_text_collapsible,
|
250
244
|
svg {
|
251
|
-
color: $
|
245
|
+
color: $white !important;
|
252
246
|
}
|
253
247
|
}
|
254
|
-
|
255
248
|
.icon_wrapper:hover {
|
256
249
|
background-color: mix($white, $card_dark, 40%);
|
257
250
|
}
|
@@ -263,13 +256,6 @@
|
|
263
256
|
}
|
264
257
|
}
|
265
258
|
}
|
266
|
-
|
267
|
-
&[class*="_active"] {
|
268
|
-
> .pb_collapsible_main_kit {
|
269
|
-
background-color: $primary;
|
270
|
-
box-shadow: 0 2px 10px 0 $shadow_dark;
|
271
|
-
}
|
272
|
-
}
|
273
259
|
}
|
274
260
|
}
|
275
261
|
}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import React, { forwardRef } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
|
+
import { FieldValues } from 'react-hook-form'
|
3
4
|
|
4
5
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
5
6
|
import { globalProps, GlobalProps, domSafeProps } from '../utilities/globalProps'
|
7
|
+
import { HookFormProps, withHookForm } from '../utilities/hookFormProps'
|
6
8
|
import type { InputCallback } from '../types'
|
7
9
|
import { getAllIcons } from "../utilities/icons/allicons"
|
8
10
|
|
@@ -16,7 +18,7 @@ type SelectOption = {
|
|
16
18
|
disabled?: boolean,
|
17
19
|
}
|
18
20
|
|
19
|
-
type SelectProps = {
|
21
|
+
type SelectProps<T extends FieldValues = FieldValues> = {
|
20
22
|
aria?: { [key: string]: string },
|
21
23
|
blankSelection?: string,
|
22
24
|
children?: Node,
|
@@ -30,16 +32,17 @@ type SelectProps = {
|
|
30
32
|
includeBlank?: string,
|
31
33
|
inline?: boolean,
|
32
34
|
label?: string,
|
33
|
-
margin
|
35
|
+
margin?: string,
|
34
36
|
marginBottom: string,
|
37
|
+
marginTop: string,
|
35
38
|
multiple?: boolean,
|
36
39
|
name?: string,
|
37
|
-
onChange
|
40
|
+
onChange?: InputCallback<HTMLSelectElement>,
|
38
41
|
options: SelectOption[],
|
39
42
|
required?: boolean,
|
40
43
|
showArrow?: boolean,
|
41
44
|
value?: string,
|
42
|
-
} & GlobalProps
|
45
|
+
} & GlobalProps & Partial<HookFormProps<T>>
|
43
46
|
|
44
47
|
const createOptions = (options: SelectOption[]) => options.map((option, index) => (
|
45
48
|
<option
|
@@ -51,7 +54,7 @@ const createOptions = (options: SelectOption[]) => options.map((option, index) =
|
|
51
54
|
</option>
|
52
55
|
))
|
53
56
|
|
54
|
-
const Select = ({
|
57
|
+
const Select = <T extends FieldValues = FieldValues>({
|
55
58
|
aria = {},
|
56
59
|
blankSelection,
|
57
60
|
children,
|
@@ -65,17 +68,20 @@ const Select = ({
|
|
65
68
|
inline = false,
|
66
69
|
multiple = false,
|
67
70
|
name,
|
68
|
-
onChange
|
71
|
+
onChange,
|
69
72
|
options = [],
|
73
|
+
register,
|
70
74
|
required = false,
|
75
|
+
rules,
|
71
76
|
showArrow = false,
|
72
77
|
value,
|
73
78
|
...props
|
74
|
-
}: SelectProps
|
79
|
+
}: SelectProps<T>, ref: React.LegacyRef<HTMLSelectElement>) => {
|
75
80
|
const ariaProps = buildAriaProps(aria)
|
76
81
|
const dataProps = buildDataProps(data)
|
77
82
|
const htmlProps = buildHtmlProps(htmlOptions)
|
78
83
|
const optionsList = createOptions(options)
|
84
|
+
const hookFormProps = name ? withHookForm({ register, name, rules }) : {}
|
79
85
|
|
80
86
|
const inlineClass = inline ? 'inline' : null
|
81
87
|
const compactClass = compact ? 'compact' : null
|
@@ -91,21 +97,22 @@ const Select = ({
|
|
91
97
|
compactClass
|
92
98
|
);
|
93
99
|
|
94
|
-
const
|
100
|
+
const icons = getAllIcons()
|
101
|
+
const angleDown = icons?.angleDown?.icon as { [key: string]: SVGElement }
|
95
102
|
|
96
103
|
const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
|
97
104
|
const selectBody =(() =>{
|
98
105
|
if (children) return children
|
99
106
|
return (
|
100
107
|
<select
|
101
|
-
{...htmlOptions}
|
102
108
|
{...domSafeProps(props)}
|
109
|
+
{...hookFormProps}
|
103
110
|
disabled={disabled}
|
104
111
|
id={name}
|
105
112
|
multiple={multiple}
|
106
113
|
name={name}
|
107
|
-
onChange={onChange}
|
108
|
-
ref={ref}
|
114
|
+
onChange={onChange || hookFormProps.onChange}
|
115
|
+
ref={ref || hookFormProps.ref}
|
109
116
|
required={required}
|
110
117
|
value={value}
|
111
118
|
>
|
@@ -135,14 +142,12 @@ const Select = ({
|
|
135
142
|
htmlFor={name}
|
136
143
|
>
|
137
144
|
{selectBody}
|
138
|
-
{ multiple !== true
|
145
|
+
{ multiple !== true && angleDown &&
|
139
146
|
<Icon
|
140
147
|
className="pb_select_kit_caret svg-inline--fa"
|
141
148
|
customIcon={angleDown}
|
142
149
|
fixedWidth
|
143
150
|
/>
|
144
|
-
:
|
145
|
-
null
|
146
151
|
}
|
147
152
|
{error &&
|
148
153
|
<Body
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { useForm } from 'react-hook-form'
|
3
|
+
import { Select, Card, Body, Button } from 'playbook-ui'
|
4
|
+
|
5
|
+
const SelectForm = (props) => {
|
6
|
+
const {
|
7
|
+
register,
|
8
|
+
handleSubmit,
|
9
|
+
formState: { errors },
|
10
|
+
watch,
|
11
|
+
} = useForm({
|
12
|
+
defaultValues: {
|
13
|
+
favoriteFood: '',
|
14
|
+
mealType: '',
|
15
|
+
dietaryRestrictions: '',
|
16
|
+
}
|
17
|
+
})
|
18
|
+
|
19
|
+
const onSubmit = (data) => {
|
20
|
+
console.log('Form submitted:', data)
|
21
|
+
}
|
22
|
+
|
23
|
+
// Watch form values for real-time display
|
24
|
+
const formValues = watch()
|
25
|
+
|
26
|
+
const foodOptions = [
|
27
|
+
{ value: 'pizza', text: 'Pizza' },
|
28
|
+
{ value: 'burger', text: 'Burger' },
|
29
|
+
{ value: 'sushi', text: 'Sushi' },
|
30
|
+
{ value: 'salad', text: 'Salad' },
|
31
|
+
]
|
32
|
+
|
33
|
+
const mealTypes = [
|
34
|
+
{ value: 'breakfast', text: 'Breakfast' },
|
35
|
+
{ value: 'lunch', text: 'Lunch' },
|
36
|
+
{ value: 'dinner', text: 'Dinner' },
|
37
|
+
]
|
38
|
+
|
39
|
+
const dietaryOptions = [
|
40
|
+
{ value: 'none', text: 'No Restrictions' },
|
41
|
+
{ value: 'vegetarian', text: 'Vegetarian' },
|
42
|
+
{ value: 'vegan', text: 'Vegan' },
|
43
|
+
{ value: 'glutenFree', text: 'Gluten Free' },
|
44
|
+
]
|
45
|
+
|
46
|
+
return (
|
47
|
+
<div>
|
48
|
+
<Card>
|
49
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
50
|
+
<Select
|
51
|
+
error={errors.favoriteFood?.message}
|
52
|
+
label="What's your favorite food?"
|
53
|
+
name="favoriteFood"
|
54
|
+
options={foodOptions}
|
55
|
+
register={register}
|
56
|
+
rules={{
|
57
|
+
required: 'Please select your favorite food',
|
58
|
+
}}
|
59
|
+
{...props}
|
60
|
+
/>
|
61
|
+
<Select
|
62
|
+
blankSelection="Choose a meal type..."
|
63
|
+
error={errors.mealType?.message}
|
64
|
+
label="Preferred meal time"
|
65
|
+
marginTop="md"
|
66
|
+
name="mealType"
|
67
|
+
options={mealTypes}
|
68
|
+
register={register}
|
69
|
+
rules={{
|
70
|
+
required: 'Please select a meal type',
|
71
|
+
}}
|
72
|
+
{...props}
|
73
|
+
/>
|
74
|
+
<Select
|
75
|
+
label="Dietary Restrictions"
|
76
|
+
marginTop="md"
|
77
|
+
name="dietaryRestrictions"
|
78
|
+
options={dietaryOptions}
|
79
|
+
register={register}
|
80
|
+
{...props}
|
81
|
+
/>
|
82
|
+
|
83
|
+
<Button
|
84
|
+
marginTop="lg"
|
85
|
+
text="Submit"
|
86
|
+
type="submit"
|
87
|
+
variant="primary"
|
88
|
+
|
89
|
+
/>
|
90
|
+
</form>
|
91
|
+
<Card marginTop="lg">
|
92
|
+
<Body
|
93
|
+
text="Current Form Values:"
|
94
|
+
variant="bold"
|
95
|
+
/>
|
96
|
+
<pre style={{ marginTop: '8px', color: "white" }}>
|
97
|
+
{JSON.stringify(formValues, null, 2)}
|
98
|
+
</pre>
|
99
|
+
</Card>
|
100
|
+
</Card>
|
101
|
+
</div>
|
102
|
+
)
|
103
|
+
}
|
104
|
+
|
105
|
+
export default SelectForm
|
106
|
+
|
107
|
+
|
108
|
+
|
@@ -10,3 +10,4 @@ export { default as SelectInline } from './_select_inline.jsx'
|
|
10
10
|
export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.jsx'
|
11
11
|
export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
|
12
12
|
export { default as SelectMultiple } from './_select_multiple.jsx'
|
13
|
+
export { default as SelectForm } from './_select_form.jsx'
|
@@ -151,7 +151,7 @@ $pb_selectable_paddings: (
|
|
151
151
|
input[type="radio"] {
|
152
152
|
&:checked ~ label {
|
153
153
|
border-width: $pb_card_border_width;
|
154
|
-
outline: 1px solid $
|
154
|
+
outline: 1px solid $primary;
|
155
155
|
}
|
156
156
|
}
|
157
157
|
}
|
@@ -161,11 +161,11 @@ $pb_selectable_paddings: (
|
|
161
161
|
color: $white;
|
162
162
|
> label {
|
163
163
|
@include pb_card_dark;
|
164
|
-
background:
|
164
|
+
background: transparent;
|
165
165
|
|
166
166
|
.pb_selectable_card_circle {
|
167
167
|
border-color: $bg_dark;
|
168
|
-
background: $
|
168
|
+
background: $primary-action;
|
169
169
|
}
|
170
170
|
}
|
171
171
|
|
@@ -173,7 +173,7 @@ $pb_selectable_paddings: (
|
|
173
173
|
input[type="radio"] {
|
174
174
|
&:checked ~ label {
|
175
175
|
@include pb_card_selected_dark;
|
176
|
-
background:
|
176
|
+
background: transparent;
|
177
177
|
}
|
178
178
|
}
|
179
179
|
|