playbook_ui 14.6.1 → 14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4303
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/_playbook.scss +2 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +11 -11
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
- data/app/pb_kits/playbook/pb_link/_link.scss +66 -0
- data/app/pb_kits/playbook/pb_link/_link.tsx +107 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.html.erb +30 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_color.jsx +40 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_disabled.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.html.erb +15 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_icon.jsx +25 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.html.erb +35 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_tag.jsx +45 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.html.erb +5 -0
- data/app/pb_kits/playbook/pb_link/docs/_link_underline.jsx +15 -0
- data/app/pb_kits/playbook/pb_link/docs/example.yml +16 -0
- data/app/pb_kits/playbook/pb_link/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_link/link.html.erb +21 -0
- data/app/pb_kits/playbook/pb_link/link.rb +44 -0
- data/app/pb_kits/playbook/pb_link/link.test.jsx +92 -0
- data/app/pb_kits/playbook/tokens/_typography.scss +35 -0
- data/dist/chunks/_weekday_stacked-BeZ0h2P0.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +3 -0
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +23 -6
- data/dist/chunks/_weekday_stacked-BR99DW9T.js +0 -45
@@ -0,0 +1,92 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { ensureAccessible, renderKit, render, screen } from '../utilities/test-utils'
|
3
|
+
|
4
|
+
import { Link } from 'playbook-ui'
|
5
|
+
|
6
|
+
const link = 'https://www.google.com'
|
7
|
+
|
8
|
+
const props = {
|
9
|
+
data: { testid: 'default' },
|
10
|
+
href: link,
|
11
|
+
}
|
12
|
+
|
13
|
+
test('returns namespaced class name', () => {
|
14
|
+
const kit = renderKit(Link , props)
|
15
|
+
expect(kit).toBeInTheDocument()
|
16
|
+
expect(kit).toHaveClass('pb_link_kit')
|
17
|
+
expect(kit).toHaveAttribute('href', link)
|
18
|
+
})
|
19
|
+
|
20
|
+
it("should be accessible", async () => {
|
21
|
+
ensureAccessible(Link, props)
|
22
|
+
})
|
23
|
+
|
24
|
+
test('with colors', () => {
|
25
|
+
['default', 'body', 'muted', 'destructive'].forEach((color) => {
|
26
|
+
const testId = `colors-test-${color}`
|
27
|
+
render(
|
28
|
+
<Link
|
29
|
+
color={color}
|
30
|
+
data={{ testid: testId }}
|
31
|
+
text="Test colors"
|
32
|
+
/>
|
33
|
+
)
|
34
|
+
|
35
|
+
const kit = screen.getByTestId(testId)
|
36
|
+
expect(kit).toHaveClass(`pb_link_kit_${color}`)
|
37
|
+
})
|
38
|
+
})
|
39
|
+
|
40
|
+
test('disable prop', () => {
|
41
|
+
render(
|
42
|
+
<Link
|
43
|
+
data={{ testid: 'disable-test' }}
|
44
|
+
disabled
|
45
|
+
/>
|
46
|
+
)
|
47
|
+
|
48
|
+
const kit = screen.getByTestId('disable-test')
|
49
|
+
|
50
|
+
expect(kit).toHaveClass('pb_link_kit_disabled')
|
51
|
+
})
|
52
|
+
|
53
|
+
test('underline prop', () => {
|
54
|
+
render(
|
55
|
+
<Link
|
56
|
+
data={{ testid: 'underline-test' }}
|
57
|
+
underline
|
58
|
+
/>
|
59
|
+
)
|
60
|
+
|
61
|
+
const kit = screen.getByTestId('underline-test')
|
62
|
+
|
63
|
+
expect(kit).toHaveClass('pb_link_kit_underline')
|
64
|
+
})
|
65
|
+
|
66
|
+
test('adds icon', () => {
|
67
|
+
render(
|
68
|
+
<Link
|
69
|
+
data={{ testid: 'icon-test' }}
|
70
|
+
icon="arrow-up-right-from-square"
|
71
|
+
/>
|
72
|
+
)
|
73
|
+
|
74
|
+
const kit = screen.getByTestId('icon-test')
|
75
|
+
|
76
|
+
const icon = kit.querySelector('.pb_icon_kit')
|
77
|
+
expect(icon).toBeInTheDocument();
|
78
|
+
})
|
79
|
+
|
80
|
+
test('adds icon right', () => {
|
81
|
+
render(
|
82
|
+
<Link
|
83
|
+
data={{ testid: 'icon-right-test' }}
|
84
|
+
iconRight="chevron-right"
|
85
|
+
/>
|
86
|
+
)
|
87
|
+
|
88
|
+
const kit = screen.getByTestId('icon-right-test')
|
89
|
+
|
90
|
+
const icon = kit.querySelector('.pb_icon_kit')
|
91
|
+
expect(icon).toBeInTheDocument();
|
92
|
+
})
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@import "../tokens/colors";
|
2
|
+
|
1
3
|
$font_family_base: "Power Centra", "Helvetica Neue", Helvetica, Arial, sans_serif !default;
|
2
4
|
|
3
5
|
/* CLEAN UP AND REMOVE */
|
@@ -51,3 +53,36 @@ $boldest: 700 !default;
|
|
51
53
|
$bolder: 700 !default;
|
52
54
|
$light: 300 !default;
|
53
55
|
$lighter: 300 !default;
|
56
|
+
|
57
|
+
/* Link Colors */
|
58
|
+
$pb_link_colors: (
|
59
|
+
default: $primary_action,
|
60
|
+
body: $text_lt_default,
|
61
|
+
muted: $text_lt_light,
|
62
|
+
destructive: $error,
|
63
|
+
);
|
64
|
+
|
65
|
+
$pb_link_hover_colors: (
|
66
|
+
default: $text_lt_default,
|
67
|
+
body: $primary_action,
|
68
|
+
muted: $text_lt_default,
|
69
|
+
destructive: $text_lt_default,
|
70
|
+
);
|
71
|
+
|
72
|
+
$pb_dark_link_colors: (
|
73
|
+
default: $active_dark,
|
74
|
+
body: $text_dk_default,
|
75
|
+
muted: $text_dk_light,
|
76
|
+
destructive: $error_dark,
|
77
|
+
);
|
78
|
+
|
79
|
+
$pb_dark_link_hover_colors: (
|
80
|
+
default: $text_dk_default,
|
81
|
+
body: $active_dark,
|
82
|
+
muted: $text_dk_default,
|
83
|
+
destructive: $text_dk_default,
|
84
|
+
);
|
85
|
+
|
86
|
+
@mixin pb_link($color: $primary_action) {
|
87
|
+
color: $color;
|
88
|
+
}
|