playbook_ui 12.32.0 → 12.33.0.pre.alpha.PLAY905reactionbuttons979
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 +4 -4
- data/app/pb_kits/playbook/index.js +1 -1
- data/app/pb_kits/playbook/pb_background/_background.tsx +10 -1
- data/app/pb_kits/playbook/pb_background/background.html.erb +2 -1
- data/app/pb_kits/playbook/pb_background/background.rb +4 -2
- data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +33 -0
- data/app/pb_kits/playbook/pb_button/_button.tsx +65 -26
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +6 -6
- data/app/pb_kits/playbook/pb_button/button.html.erb +13 -0
- data/app/pb_kits/playbook/pb_button/button.rb +13 -2
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +3 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +38 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +1 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
- data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +4 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
- data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
- data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
- data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +321 -316
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +12 -9
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +8 -8
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +16 -15
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +4 -2
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +1 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +21 -0
- data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +7 -0
- data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +14 -4
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +12 -1
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +6 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +9 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +16 -12
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -2
- data/app/pb_kits/playbook/pb_kit/dateTime.ts +139 -67
- data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
- data/app/pb_kits/playbook/pb_map/_map.scss +4 -0
- data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
- data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
- data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
- data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
- data/app/pb_kits/playbook/tokens/_colors.scss +4 -2
- data/app/pb_kits/playbook/utilities/_border_radius.scss +11 -1
- data/app/pb_kits/playbook/utilities/_line_height.scss +1 -2
- data/app/pb_kits/playbook/utilities/_shadow.scss +0 -1
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +2 -2
- metadata +12 -8
- data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa8d82bf0d62f5bc3d999c73377126bcdc6ac414183c6753274c9fbee02fb61
|
4
|
+
data.tar.gz: 1d197fe5c96073b458bea5753d2433029ab42d0d3ef41b3df2b42ae7751b0412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49dbcc86fcabc6c775e95c181a96c336e53b4f1ff4c7439f911538eb431816a0b9c5bb3990774ef4cb4c36f05b9be53fcfbcdc9020fe1735d082d0f96d85017e
|
7
|
+
data.tar.gz: 7767190809b235af1b110735cb2e4df306726fa7c6ecfceb0fa31b9a4fb5f6ae0f4c99f0286cf7c50583d8764ba48063bb19f88720b3dd64174e2c0b7a416bcf
|
@@ -129,4 +129,4 @@ export { default as PbTypeahead } from './pb_typeahead'
|
|
129
129
|
export { default as dialogHelper } from './pb_dialog/dialogHelper'
|
130
130
|
|
131
131
|
//Theming
|
132
|
-
export {default as mapTheme} from './pb_map/pbMapTheme'
|
132
|
+
export {default as mapTheme} from './pb_map/pbMapTheme'
|
@@ -15,6 +15,7 @@ type BackgroundProps = {
|
|
15
15
|
'card_light' | 'card_dark' | 'data_1' | 'data_2' | 'data_3' | 'data_4' | 'data_5' | 'data_6' | 'data_7' | 'data_8' |
|
16
16
|
'border_light' | 'border_dark' | 'success_secondary' | 'error_secondary' | 'info_secondary' | 'warning_secondary' |
|
17
17
|
'neutral_secondary' | 'primary_secondary' | 'success_subtle' | 'warning_subtle' | 'error_subtle' | 'info_subtle' | 'neutral_subtle',
|
18
|
+
backgroundPosition?: string,
|
18
19
|
backgroundRepeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'space' | 'round' | 'initial' | 'inherit',
|
19
20
|
backgroundSize?: 'auto' | 'cover' | 'contain',
|
20
21
|
children?: React.ReactChild[] | React.ReactNode,
|
@@ -33,6 +34,7 @@ const Background = (props: BackgroundProps) => {
|
|
33
34
|
alt = '',
|
34
35
|
aria = {},
|
35
36
|
backgroundColor = 'light',
|
37
|
+
backgroundPosition = '',
|
36
38
|
backgroundRepeat = 'initial',
|
37
39
|
backgroundSize = 'cover',
|
38
40
|
children,
|
@@ -52,7 +54,14 @@ const Background = (props: BackgroundProps) => {
|
|
52
54
|
backgroundImage: `url(${imageUrl})`,
|
53
55
|
backgroundRepeat: `${backgroundRepeat}`,
|
54
56
|
backgroundSize: `${backgroundSize}`,
|
57
|
+
backgroundPosition: backgroundPosition
|
55
58
|
}
|
59
|
+
|
60
|
+
const backgroundPositionStyle = {
|
61
|
+
backgroundColor: customColor? customColor: null,
|
62
|
+
backgroundPosition: `${backgroundPosition}`
|
63
|
+
}
|
64
|
+
|
56
65
|
const getBackgroundColor = customColor ? 'pb_background_custom_color' : `pb_background_color_${backgroundColor}`
|
57
66
|
const classes = classnames(buildCss('pb_background_kit'), 'lazyload', backgroundStyle, transition, globalProps(props), getBackgroundColor, className)
|
58
67
|
|
@@ -80,7 +89,7 @@ const Background = (props: BackgroundProps) => {
|
|
80
89
|
{...dataProps}
|
81
90
|
className={classes}
|
82
91
|
id={id}
|
83
|
-
style={
|
92
|
+
style={backgroundPositionStyle}
|
84
93
|
>
|
85
94
|
{ children }
|
86
95
|
</Tag>
|
@@ -6,7 +6,8 @@
|
|
6
6
|
class: object.classname,
|
7
7
|
style: "background-image: url('#{object.image_url}');
|
8
8
|
background-repeat: #{object.background_repeat};
|
9
|
-
background-size: #{object.background_size};
|
9
|
+
background-size: #{object.background_size};
|
10
|
+
background-position: #{object.background_position};"
|
10
11
|
) do %>
|
11
12
|
<%= content.presence %>
|
12
13
|
<% end %>
|
@@ -70,7 +70,8 @@ module Playbook
|
|
70
70
|
neutral_subtle
|
71
71
|
],
|
72
72
|
default: "light"
|
73
|
-
|
73
|
+
prop :background_position, type: Playbook::Props::String,
|
74
|
+
default: nil
|
74
75
|
prop :background_repeat, type: Playbook::Props::Enum,
|
75
76
|
values: %w[
|
76
77
|
repeat
|
@@ -106,7 +107,8 @@ module Playbook
|
|
106
107
|
end
|
107
108
|
|
108
109
|
def custom_background_color
|
109
|
-
"background-color: #{custom_color};
|
110
|
+
"background-color: #{custom_color};
|
111
|
+
background-position: #{background_position}"
|
110
112
|
end
|
111
113
|
|
112
114
|
private
|
@@ -1,5 +1,9 @@
|
|
1
1
|
@import "./button_mixins";
|
2
2
|
@import "../tokens/colors";
|
3
|
+
@import "../tokens/border_radius";
|
4
|
+
@import "../tokens/colors";
|
5
|
+
@import "../tokens/spacing";
|
6
|
+
@import "../tokens/typography";
|
3
7
|
|
4
8
|
$pb_button_sizes: (
|
5
9
|
"sm": 0.75rem,
|
@@ -30,6 +34,35 @@ $pb_button_sizes: (
|
|
30
34
|
&[class*=_link] {
|
31
35
|
@include pb_button_link;
|
32
36
|
}
|
37
|
+
&[class*=_reaction] {
|
38
|
+
background-color: $card_light;
|
39
|
+
min-width: 40px;
|
40
|
+
border-radius: $border_radius_rounded;
|
41
|
+
border: 1px solid $border_light;
|
42
|
+
color: $text_lt_light;
|
43
|
+
padding: ($space_xxs - 2) $space_xs;
|
44
|
+
min-height: $space_md + 2;
|
45
|
+
|
46
|
+
.icon_circle_emoji {
|
47
|
+
height: $space_sm - 1;
|
48
|
+
}
|
49
|
+
&:hover {
|
50
|
+
background-color: $bg_light;
|
51
|
+
}
|
52
|
+
&.active {
|
53
|
+
border-color: $primary_action;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
&.reaction_default {
|
58
|
+
padding: ($space_xxs + 1) ($space_sm - 4);
|
59
|
+
color: $text_lt_lighter;
|
60
|
+
}
|
61
|
+
|
62
|
+
.reaction_button_icon_wrapper {
|
63
|
+
display: flex;
|
64
|
+
height: $space_sm + 1;
|
65
|
+
}
|
33
66
|
|
34
67
|
// Disabled =================
|
35
68
|
&[class*=_disabled] {
|
@@ -4,6 +4,7 @@ import { buildAriaProps, buildDataProps } from '../utilities/props'
|
|
4
4
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
5
5
|
|
6
6
|
import Icon from '../pb_icon/_icon'
|
7
|
+
import Caption from "../pb_caption/_caption"
|
7
8
|
|
8
9
|
type EventHandler = (React.MouseEventHandler<HTMLElement>)
|
9
10
|
|
@@ -11,11 +12,13 @@ type ButtonPropTypes = {
|
|
11
12
|
aria?: { [key: string]: string },
|
12
13
|
children?: React.ReactChild[] | React.ReactChild,
|
13
14
|
className?: string | string[],
|
15
|
+
count?: number,
|
14
16
|
data?: { [key: string]: string },
|
15
17
|
disabled?: boolean,
|
16
18
|
fixedWidth?: boolean,
|
17
19
|
form?: string,
|
18
20
|
fullWidth?: boolean,
|
21
|
+
highlight?: boolean,
|
19
22
|
icon?: string,
|
20
23
|
iconRight?: boolean,
|
21
24
|
id?: string,
|
@@ -30,7 +33,7 @@ type ButtonPropTypes = {
|
|
30
33
|
type?: 'inline' | null,
|
31
34
|
htmlType?: 'submit' | 'reset' | 'button' | undefined,
|
32
35
|
value?: string | null,
|
33
|
-
variant?: 'primary' | 'secondary' | 'link',
|
36
|
+
variant?: 'primary' | 'secondary' | 'link'| 'reaction',
|
34
37
|
wrapperClass?: string,
|
35
38
|
} & GlobalProps
|
36
39
|
|
@@ -38,6 +41,8 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
38
41
|
const {
|
39
42
|
disabled = false,
|
40
43
|
fullWidth = false,
|
44
|
+
highlight,
|
45
|
+
icon,
|
41
46
|
loading = false,
|
42
47
|
type = 'inline',
|
43
48
|
variant = 'primary',
|
@@ -52,6 +57,8 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
52
57
|
className += disabled ? '_disabled' : '_enabled'
|
53
58
|
className += loading ? '_loading' : ''
|
54
59
|
className += `${size !== null ? ` size_${size}` : ''}`
|
60
|
+
className += `${variant === 'reaction' && !icon ? ` reaction_default` : ''}`
|
61
|
+
className += `${variant === 'reaction' && highlight ? ` active` : ''}`
|
55
62
|
|
56
63
|
return className
|
57
64
|
}
|
@@ -61,6 +68,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
61
68
|
aria = {},
|
62
69
|
children,
|
63
70
|
className,
|
71
|
+
count,
|
64
72
|
data = {},
|
65
73
|
disabled,
|
66
74
|
icon = null,
|
@@ -75,6 +83,7 @@ const Button = (props: ButtonPropTypes) => {
|
|
75
83
|
text,
|
76
84
|
htmlType = 'button',
|
77
85
|
value,
|
86
|
+
variant,
|
78
87
|
form = null
|
79
88
|
} = props
|
80
89
|
|
@@ -131,41 +140,71 @@ const Button = (props: ButtonPropTypes) => {
|
|
131
140
|
return null
|
132
141
|
}
|
133
142
|
|
134
|
-
const displayButton = () => {
|
135
|
-
if (link)
|
143
|
+
const displayButton = () => {
|
144
|
+
if (link) {
|
136
145
|
return (
|
137
146
|
<a
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
+
{...ariaProps}
|
148
|
+
{...dataProps}
|
149
|
+
className={css}
|
150
|
+
href={link}
|
151
|
+
id={id}
|
152
|
+
rel={target !== "child" ? "noreferrer" : null}
|
153
|
+
role="link"
|
154
|
+
tabIndex={tabIndex}
|
155
|
+
target={getTargetAttribute()}
|
147
156
|
>
|
148
157
|
{ifLoading()}
|
149
158
|
</a>
|
150
|
-
)
|
151
|
-
else
|
159
|
+
);
|
160
|
+
} else if (variant === "reaction") {
|
161
|
+
return (
|
162
|
+
<button
|
163
|
+
{...ariaProps}
|
164
|
+
{...dataProps}
|
165
|
+
className={css}
|
166
|
+
disabled={disabled}
|
167
|
+
form={form}
|
168
|
+
id={id}
|
169
|
+
onClick={onClick}
|
170
|
+
role="button"
|
171
|
+
tabIndex={tabIndex}
|
172
|
+
type={htmlType}
|
173
|
+
value={value}
|
174
|
+
>
|
175
|
+
{icon ? (
|
176
|
+
<div className='reaction_button_icon_wrapper'>
|
177
|
+
<Icon icon={icon} />
|
178
|
+
{count && (
|
179
|
+
<Caption paddingLeft="xxs" size="xs">
|
180
|
+
{count}
|
181
|
+
</Caption>
|
182
|
+
)}
|
183
|
+
</div>
|
184
|
+
) : (
|
185
|
+
<Icon icon="face-smile-plus" />
|
186
|
+
)}
|
187
|
+
</button>
|
188
|
+
);
|
189
|
+
} else {
|
152
190
|
return (
|
153
191
|
<button
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
192
|
+
{...ariaProps}
|
193
|
+
{...dataProps}
|
194
|
+
className={css}
|
195
|
+
disabled={disabled}
|
196
|
+
form={form}
|
197
|
+
id={id}
|
198
|
+
onClick={onClick}
|
199
|
+
role="button"
|
200
|
+
tabIndex={tabIndex}
|
201
|
+
type={htmlType}
|
202
|
+
value={value}
|
165
203
|
>
|
166
204
|
{ifLoading()}
|
167
205
|
</button>
|
168
|
-
)
|
206
|
+
);
|
207
|
+
}
|
169
208
|
}
|
170
209
|
|
171
210
|
return (
|
@@ -47,9 +47,9 @@ $pb_button_border_width: 0px;
|
|
47
47
|
width: fit-content;
|
48
48
|
font-family: $font_family_base;
|
49
49
|
white-space: nowrap;
|
50
|
-
|
50
|
+
|
51
51
|
@include focus;
|
52
|
-
|
52
|
+
|
53
53
|
&[class*=dark] {
|
54
54
|
@include focus-dark
|
55
55
|
}
|
@@ -77,7 +77,7 @@ $pb_button_border_width: 0px;
|
|
77
77
|
outline: none;
|
78
78
|
border-width: $pb_button_border_width;
|
79
79
|
}
|
80
|
-
|
80
|
+
|
81
81
|
};
|
82
82
|
|
83
83
|
@mixin pb_button_hover($bg: darken($primary_action, $pb_button_hover_darken)){
|
@@ -101,7 +101,7 @@ $pb_button_border_width: 0px;
|
|
101
101
|
|
102
102
|
// Secondary ====================
|
103
103
|
@mixin pb_button_secondary {
|
104
|
-
@include pb_button_variant($
|
104
|
+
@include pb_button_variant($secondary_action, $primary_action);
|
105
105
|
|
106
106
|
@media (hover:hover) {
|
107
107
|
&:hover {
|
@@ -109,9 +109,9 @@ $pb_button_border_width: 0px;
|
|
109
109
|
}
|
110
110
|
&:active {
|
111
111
|
transition: none;
|
112
|
-
@include pb_button_variant($
|
112
|
+
@include pb_button_variant($secondary_action, $primary_action);
|
113
113
|
}
|
114
|
-
}
|
114
|
+
}
|
115
115
|
}
|
116
116
|
|
117
117
|
// Link =========================
|
@@ -1,5 +1,17 @@
|
|
1
1
|
<%= content_tag(object.tag,
|
2
2
|
object.tag == "button" ? object.options : object.link_options) do %>
|
3
|
+
<% if object.variant === "reaction" %>
|
4
|
+
<% if object.icon %>
|
5
|
+
<div class="reaction_button_icon_wrapper">
|
6
|
+
<%= pb_rails("icon", props: { icon: "#{icon}"}) %>
|
7
|
+
<% if object.count %>
|
8
|
+
<%= pb_rails("caption", props: { text: "#{count}", size: "xs", padding_left:"xxs" }) %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
<% else %>
|
12
|
+
<%= pb_rails("icon", props: { icon: "face-smile-plus" }) %>
|
13
|
+
<% end %>
|
14
|
+
<% else %>
|
3
15
|
<% if object.icon && !object.icon_right %>
|
4
16
|
<span>
|
5
17
|
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, margin_right: "xs" }) %>
|
@@ -12,5 +24,6 @@
|
|
12
24
|
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, margin_left: "xs" }) %>
|
13
25
|
</span>
|
14
26
|
<% end %>
|
27
|
+
<% end %>
|
15
28
|
|
16
29
|
<% end %>
|
@@ -16,8 +16,11 @@ module Playbook
|
|
16
16
|
prop :new_window, type: Playbook::Props::Boolean,
|
17
17
|
default: false
|
18
18
|
prop :variant, type: Playbook::Props::Enum,
|
19
|
-
values: %w[primary secondary link],
|
19
|
+
values: %w[primary secondary link reaction],
|
20
20
|
default: "primary"
|
21
|
+
prop :count, type: Playbook::Props::Number
|
22
|
+
prop :highlight, type: Playbook::Props::Boolean,
|
23
|
+
default: false
|
21
24
|
prop :target
|
22
25
|
prop :text
|
23
26
|
prop :type
|
@@ -65,7 +68,7 @@ module Playbook
|
|
65
68
|
|
66
69
|
def classname
|
67
70
|
button_class = generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
68
|
-
button_class + size_class
|
71
|
+
button_class + size_class + default_reaction_class + highlight_active
|
69
72
|
end
|
70
73
|
|
71
74
|
private
|
@@ -85,6 +88,14 @@ module Playbook
|
|
85
88
|
def size_class
|
86
89
|
size ? " size_#{size}" : ""
|
87
90
|
end
|
91
|
+
|
92
|
+
def default_reaction_class
|
93
|
+
variant === "reaction" && !object.icon ? " reaction_default" : ""
|
94
|
+
end
|
95
|
+
|
96
|
+
def highlight_active
|
97
|
+
variant === "reaction" && object.highlight ? " active" : ""
|
98
|
+
end
|
88
99
|
end
|
89
100
|
end
|
90
101
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import React, {useState} from "react"
|
2
|
+
import { Button } from "../../"
|
3
|
+
|
4
|
+
const ButtonReaction = (props) => {
|
5
|
+
|
6
|
+
const [highlightActive, setHighlightActive] =useState(false)
|
7
|
+
|
8
|
+
return (
|
9
|
+
<div>
|
10
|
+
<Button
|
11
|
+
count={5}
|
12
|
+
icon="😍"
|
13
|
+
tabIndex={0}
|
14
|
+
variant="reaction"
|
15
|
+
{...props}
|
16
|
+
/>
|
17
|
+
<Button
|
18
|
+
count={153}
|
19
|
+
highlight = {highlightActive}
|
20
|
+
icon="🎉"
|
21
|
+
marginLeft='lg'
|
22
|
+
onClick={()=> setHighlightActive(!highlightActive)}
|
23
|
+
tabIndex={0}
|
24
|
+
variant="reaction"
|
25
|
+
{...props}
|
26
|
+
/>
|
27
|
+
<Button
|
28
|
+
marginLeft='lg'
|
29
|
+
tabIndex={0}
|
30
|
+
variant="reaction"
|
31
|
+
{...props}
|
32
|
+
/>
|
33
|
+
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
}
|
37
|
+
|
38
|
+
export default ButtonReaction
|
@@ -1,6 +1,7 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- button_default: Button Variants
|
4
|
+
- button_reaction: Reaction Button
|
4
5
|
- button_full_width: Button Full Width
|
5
6
|
- button_link: Button Links
|
6
7
|
- button_loading: Button Loading
|
@@ -13,6 +14,7 @@ examples:
|
|
13
14
|
|
14
15
|
react:
|
15
16
|
- button_default: Button Variants
|
17
|
+
- button_reaction: Reaction Button
|
16
18
|
- button_full_width: Button Full Width
|
17
19
|
- button_link: Button Links
|
18
20
|
- button_loading: Button Loading
|
@@ -8,4 +8,5 @@ export { default as ButtonAccessibility } from './_button_accessibility.jsx'
|
|
8
8
|
export { default as ButtonOptions } from './_button_options.jsx'
|
9
9
|
export { default as ButtonSize } from './_button_size.jsx'
|
10
10
|
export { default as ButtonForm } from './_button_form.jsx'
|
11
|
-
export { default as ButtonHover } from './_button_hover.jsx'
|
11
|
+
export { default as ButtonHover } from './_button_hover.jsx'
|
12
|
+
export {default as ButtonReaction } from './_button_reaction.jsx'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
|
-
import DateTime from "../pb_kit/dateTime";
|
5
4
|
import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
6
5
|
import { globalProps } from "../utilities/globalProps";
|
6
|
+
import DateTime from '../pb_kit/dateTime';
|
7
7
|
|
8
8
|
import Body from "../pb_body/_body";
|
9
9
|
import Caption from "../pb_caption/_caption";
|
@@ -20,7 +20,7 @@ type PbDateProps = {
|
|
20
20
|
showIcon?: boolean;
|
21
21
|
size?: "sm" | "md" | "lg";
|
22
22
|
unstyled?: boolean;
|
23
|
-
value:
|
23
|
+
value: Date;
|
24
24
|
};
|
25
25
|
|
26
26
|
const PbDate = (props: PbDateProps) => {
|
@@ -37,12 +37,11 @@ const PbDate = (props: PbDateProps) => {
|
|
37
37
|
value,
|
38
38
|
} = props;
|
39
39
|
|
40
|
-
const
|
41
|
-
const
|
42
|
-
const
|
43
|
-
const
|
44
|
-
const
|
45
|
-
const currentYear = new Date().getFullYear().toString();
|
40
|
+
const weekday = DateTime.toWeekday(value);
|
41
|
+
const month = DateTime.toMonth(value);
|
42
|
+
const day = DateTime.toDay(value);
|
43
|
+
const year = DateTime.toYear(value);
|
44
|
+
const currentYear = new Date().getFullYear();
|
46
45
|
|
47
46
|
const ariaProps = buildAriaProps(aria);
|
48
47
|
const dataProps = buildDataProps(data);
|
@@ -7,7 +7,7 @@ const DateAlignment = (props) => {
|
|
7
7
|
<FormattedDate
|
8
8
|
dayOfWeek
|
9
9
|
icon
|
10
|
-
value=
|
10
|
+
value={new Date('25 Dec 1995')}
|
11
11
|
{...props}
|
12
12
|
/>
|
13
13
|
|
@@ -17,7 +17,7 @@ const DateAlignment = (props) => {
|
|
17
17
|
alignment="center"
|
18
18
|
dayOfWeek
|
19
19
|
icon
|
20
|
-
value=
|
20
|
+
value={new Date('25 Dec 2020')}
|
21
21
|
{...props}
|
22
22
|
/>
|
23
23
|
|
@@ -14,7 +14,7 @@ const DateDefault = (props) => {
|
|
14
14
|
|
15
15
|
<FormattedDate
|
16
16
|
size="sm"
|
17
|
-
value=
|
17
|
+
value={new Date('03 Aug 2012')}
|
18
18
|
{...props}
|
19
19
|
/>
|
20
20
|
|
@@ -23,7 +23,7 @@ const DateDefault = (props) => {
|
|
23
23
|
<FormattedDate
|
24
24
|
showDayOfWeek
|
25
25
|
size="sm"
|
26
|
-
value=
|
26
|
+
value={new Date('03 Dec 2017')}
|
27
27
|
{...props}
|
28
28
|
/>
|
29
29
|
|
@@ -38,7 +38,7 @@ const DateDefault = (props) => {
|
|
38
38
|
<br />
|
39
39
|
|
40
40
|
<FormattedDate
|
41
|
-
value=
|
41
|
+
value={new Date('03 Aug 2012')}
|
42
42
|
{...props}
|
43
43
|
/>
|
44
44
|
|
@@ -46,7 +46,7 @@ const DateDefault = (props) => {
|
|
46
46
|
|
47
47
|
<FormattedDate
|
48
48
|
showDayOfWeek
|
49
|
-
value=
|
49
|
+
value={new Date('03 Dec 2017')}
|
50
50
|
{...props}
|
51
51
|
/>
|
52
52
|
</>
|
@@ -21,7 +21,7 @@ const DateUnstyled = (props) => {
|
|
21
21
|
<Title size={1}>
|
22
22
|
<FormattedDate
|
23
23
|
unstyled
|
24
|
-
value=
|
24
|
+
value={new Date('25 Dec 1995')}
|
25
25
|
{...props}
|
26
26
|
/>
|
27
27
|
</Title>
|
@@ -36,7 +36,7 @@ const DateUnstyled = (props) => {
|
|
36
36
|
showDayOfWeek
|
37
37
|
showIcon
|
38
38
|
unstyled
|
39
|
-
value=
|
39
|
+
value={new Date('25 Dec 1995')}
|
40
40
|
{...props}
|
41
41
|
/>
|
42
42
|
</Caption>
|
@@ -7,7 +7,7 @@ const DateVariants = (props) => {
|
|
7
7
|
<FormattedDate
|
8
8
|
showIcon
|
9
9
|
size="sm"
|
10
|
-
value=
|
10
|
+
value={new Date('25 Dec 1995')}
|
11
11
|
{...props}
|
12
12
|
/>
|
13
13
|
|
@@ -15,7 +15,7 @@ const DateVariants = (props) => {
|
|
15
15
|
<br />
|
16
16
|
|
17
17
|
<FormattedDate
|
18
|
-
value=
|
18
|
+
value={new Date('25 Dec 1995')}
|
19
19
|
{...props}
|
20
20
|
/>
|
21
21
|
|
@@ -24,7 +24,7 @@ const DateVariants = (props) => {
|
|
24
24
|
|
25
25
|
<FormattedDate
|
26
26
|
showIcon
|
27
|
-
value=
|
27
|
+
value={new Date('25 Dec 1995')}
|
28
28
|
{...props}
|
29
29
|
/>
|
30
30
|
|
@@ -33,7 +33,7 @@ const DateVariants = (props) => {
|
|
33
33
|
|
34
34
|
<FormattedDate
|
35
35
|
showDayOfWeek
|
36
|
-
value=
|
36
|
+
value={new Date('25 Dec 1995')}
|
37
37
|
{...props}
|
38
38
|
/>
|
39
39
|
|
@@ -43,7 +43,7 @@ const DateVariants = (props) => {
|
|
43
43
|
<FormattedDate
|
44
44
|
showDayOfWeek
|
45
45
|
showIcon
|
46
|
-
value=
|
46
|
+
value={new Date('25 Dec 1995')}
|
47
47
|
{...props}
|
48
48
|
/>
|
49
49
|
</div>
|