@ivds/core 0.1.1
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.
- package/CHANGELOG.md +45 -0
- package/README.md +215 -0
- package/lib/all.css +6802 -0
- package/lib/all.min.css +1 -0
- package/lib/base/base.css +215 -0
- package/lib/base/base.min.css +1 -0
- package/lib/components/_breadcrumb-mixins.scss +173 -0
- package/lib/components/_button-mixin.scss +120 -0
- package/lib/components/_card-mixin.scss +196 -0
- package/lib/components/_checkbox-mixin.scss +208 -0
- package/lib/components/_footer-mixin.scss +385 -0
- package/lib/components/_header-mixin.scss +275 -0
- package/lib/components/_navigation-mixins.scss +270 -0
- package/lib/components/_notification-mixin.scss +239 -0
- package/lib/components/_pagination-mixins.scss +280 -0
- package/lib/components/_radio-button-mixin.scss +207 -0
- package/lib/components/_tag-mixin.scss +261 -0
- package/lib/components/_text-input-mixin.scss +203 -0
- package/lib/components/all.css +3005 -0
- package/lib/components/all.min.css +1 -0
- package/lib/components/breadcrumb/breadcrumb.css +141 -0
- package/lib/components/breadcrumb/breadcrumb.min.css +1 -0
- package/lib/components/button/button.css +221 -0
- package/lib/components/button/button.min.css +1 -0
- package/lib/components/card/card.css +236 -0
- package/lib/components/card/card.min.css +1 -0
- package/lib/components/checkbox/checkbox.css +305 -0
- package/lib/components/checkbox/checkbox.min.css +1 -0
- package/lib/components/footer/footer.css +466 -0
- package/lib/components/footer/footer.min.css +1 -0
- package/lib/components/header/header.css +274 -0
- package/lib/components/header/header.min.css +1 -0
- package/lib/components/navigation/navigation.css +214 -0
- package/lib/components/navigation/navigation.min.css +1 -0
- package/lib/components/notification/notification.css +253 -0
- package/lib/components/notification/notification.min.css +1 -0
- package/lib/components/pagination/pagination.css +221 -0
- package/lib/components/pagination/pagination.min.css +1 -0
- package/lib/components/radio-button/radio-button.css +326 -0
- package/lib/components/radio-button/radio-button.min.css +1 -0
- package/lib/components/tag/tag.css +367 -0
- package/lib/components/tag/tag.min.css +1 -0
- package/lib/components/text-input/text-input.css +243 -0
- package/lib/components/text-input/text-input.min.css +1 -0
- package/lib/icons/icon-arrow-left.css +139 -0
- package/lib/icons/icon-arrow-left.min.css +1 -0
- package/lib/icons/icon-arrow-right.css +139 -0
- package/lib/icons/icon-arrow-right.min.css +1 -0
- package/lib/icons/icon-check.css +139 -0
- package/lib/icons/icon-check.min.css +1 -0
- package/lib/icons/icon-close.css +140 -0
- package/lib/icons/icon-close.min.css +1 -0
- package/lib/icons/icon-error.css +140 -0
- package/lib/icons/icon-error.min.css +1 -0
- package/lib/icons/icon-info.css +140 -0
- package/lib/icons/icon-info.min.css +1 -0
- package/lib/icons/icon-success.css +139 -0
- package/lib/icons/icon-success.min.css +1 -0
- package/lib/icons/icon-warning.css +139 -0
- package/lib/icons/icon-warning.min.css +1 -0
- package/lib/icons/icons.css +1158 -0
- package/lib/icons/icons.min.css +1 -0
- package/lib/utils/_flex.scss +200 -0
- package/lib/utils/_grid.scss +211 -0
- package/lib/utils/_layout.scss +253 -0
- package/lib/utils/_spacing.scss +260 -0
- package/lib/utils/_typography.scss +111 -0
- package/lib/utils/utils.css +2434 -0
- package/lib/utils/utils.min.css +1 -0
- package/lib/utils-only.css +2801 -0
- package/lib/utils-only.min.css +1 -0
- package/lib/variables/variables.css +2 -0
- package/lib/variables/variables.min.css +0 -0
- package/package.json +194 -0
- package/src/__tests__/example.test.scss +12 -0
- package/src/accessibility.stories.js +416 -0
- package/src/all.scss +9 -0
- package/src/base/_layout.scss +97 -0
- package/src/base/_reset.scss +85 -0
- package/src/base/_typography.scss +105 -0
- package/src/base/base.scss +6 -0
- package/src/components/all.scss +22 -0
- package/src/components/breadcrumb/_breadcrumb-mixins.scss +173 -0
- package/src/components/breadcrumb/breadcrumb.scss +68 -0
- package/src/components/breadcrumb/breadcrumb.stories.js +483 -0
- package/src/components/button/__tests__/button-mixins.test.scss +35 -0
- package/src/components/button/_button-mixin.scss +120 -0
- package/src/components/button/button.scss +126 -0
- package/src/components/button/button.stories.js +364 -0
- package/src/components/card/__tests__/card-mixins.test.scss +36 -0
- package/src/components/card/_card-mixin.scss +196 -0
- package/src/components/card/card.scss +193 -0
- package/src/components/card/card.stories.js +635 -0
- package/src/components/checkbox/_checkbox-mixin.scss +208 -0
- package/src/components/checkbox/checkbox.scss +141 -0
- package/src/components/checkbox/checkbox.stories.js +303 -0
- package/src/components/footer/_footer-mixin.scss +385 -0
- package/src/components/footer/footer.scss +86 -0
- package/src/components/footer/footer.stories.js +740 -0
- package/src/components/header/_header-mixin.scss +275 -0
- package/src/components/header/header.scss +84 -0
- package/src/components/header/header.stories.js +450 -0
- package/src/components/navigation/_navigation-mixins.scss +270 -0
- package/src/components/navigation/navigation.scss +64 -0
- package/src/components/navigation/navigation.stories.js +410 -0
- package/src/components/notification/_notification-mixin.scss +239 -0
- package/src/components/notification/notification.scss +118 -0
- package/src/components/notification/notification.stories.js +378 -0
- package/src/components/overview.stories.js +473 -0
- package/src/components/pagination/_pagination-mixins.scss +280 -0
- package/src/components/pagination/pagination.scss +76 -0
- package/src/components/pagination/pagination.stories.js +729 -0
- package/src/components/radio-button/_radio-button-mixin.scss +207 -0
- package/src/components/radio-button/radio-button.scss +178 -0
- package/src/components/radio-button/radio-button.stories.js +379 -0
- package/src/components/tag/_tag-mixin.scss +261 -0
- package/src/components/tag/tag.scss +244 -0
- package/src/components/tag/tag.stories.js +482 -0
- package/src/components/text-input/_text-input-mixin.scss +203 -0
- package/src/components/text-input/text-input.scss +150 -0
- package/src/components/text-input/text-input.stories.js +723 -0
- package/src/icons/_icon.scss +121 -0
- package/src/icons/icon-arrow-left.scss +23 -0
- package/src/icons/icon-arrow-right.scss +23 -0
- package/src/icons/icon-check.scss +23 -0
- package/src/icons/icon-close.scss +24 -0
- package/src/icons/icon-error.scss +24 -0
- package/src/icons/icon-info.scss +24 -0
- package/src/icons/icon-success.scss +23 -0
- package/src/icons/icon-warning.scss +23 -0
- package/src/icons/icons.scss +12 -0
- package/src/icons/icons.stories.js +249 -0
- package/src/icons/svg/arrow-left.svg +3 -0
- package/src/icons/svg/arrow-right.svg +3 -0
- package/src/icons/svg/check.svg +3 -0
- package/src/icons/svg/close.svg +4 -0
- package/src/icons/svg/error.svg +5 -0
- package/src/icons/svg/info.svg +5 -0
- package/src/icons/svg/success.svg +4 -0
- package/src/icons/svg/warning.svg +5 -0
- package/src/utils/__tests__/utilities.test.scss +37 -0
- package/src/utils/_flex.scss +200 -0
- package/src/utils/_grid.scss +211 -0
- package/src/utils/_layout.scss +253 -0
- package/src/utils/_spacing.scss +260 -0
- package/src/utils/_typography.scss +111 -0
- package/src/utils/utils.scss +8 -0
- package/src/variables/_borders.scss +15 -0
- package/src/variables/_breakpoints.scss +11 -0
- package/src/variables/_colors.scss +97 -0
- package/src/variables/_shadows.scss +14 -0
- package/src/variables/_spacing.scss +24 -0
- package/src/variables/_typography.scss +47 -0
- package/src/variables/variables.scss +9 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Button component styles
|
|
2
|
+
// Provides styling for the IVDS button component with all variants, sizes, and states
|
|
3
|
+
|
|
4
|
+
@use 'button-mixin' as btn;
|
|
5
|
+
|
|
6
|
+
.ivds-button {
|
|
7
|
+
@include btn.button-base;
|
|
8
|
+
@include btn.button-size(var(--spacing-3, 0.75rem), var(--spacing-6, 1.5rem), var(--fontSize-base, 1rem), 44px);
|
|
9
|
+
@include btn.button-icon-spacing;
|
|
10
|
+
|
|
11
|
+
// Icon support
|
|
12
|
+
&__icon {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
width: 1em;
|
|
20
|
+
height: 1em;
|
|
21
|
+
fill: currentcolor;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Text content
|
|
26
|
+
&__text {
|
|
27
|
+
flex: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Loading state
|
|
31
|
+
&--loading {
|
|
32
|
+
@include btn.button-loading;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Full width
|
|
36
|
+
&--full-width {
|
|
37
|
+
@include btn.button-full-width;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Icon only
|
|
41
|
+
&--icon-only {
|
|
42
|
+
@include btn.button-icon-only;
|
|
43
|
+
|
|
44
|
+
&.ivds-button--small {
|
|
45
|
+
@include btn.button-icon-only(32px);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.ivds-button--large {
|
|
49
|
+
@include btn.button-icon-only(56px);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Button Variants
|
|
55
|
+
.ivds-button--primary {
|
|
56
|
+
@include btn.button-variant(var(--color-brand-primary-500, #f97316),
|
|
57
|
+
var(--color-semantic-neutral-50, #fafafa),
|
|
58
|
+
var(--color-brand-primary-500, #f97316),
|
|
59
|
+
var(--color-brand-primary-600, #ea580c),
|
|
60
|
+
var(--color-brand-primary-600, #ea580c));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ivds-button--secondary {
|
|
64
|
+
@include btn.button-variant(transparent,
|
|
65
|
+
var(--color-brand-primary-500, #f97316),
|
|
66
|
+
var(--color-brand-primary-500, #f97316),
|
|
67
|
+
var(--color-brand-primary-50, #fff7ed),
|
|
68
|
+
var(--color-brand-primary-500, #f97316));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ivds-button--tertiary {
|
|
72
|
+
@include btn.button-variant(transparent,
|
|
73
|
+
var(--color-brand-primary-500, #f97316),
|
|
74
|
+
transparent,
|
|
75
|
+
var(--color-brand-primary-50, #fff7ed));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ivds-button--success {
|
|
79
|
+
@include btn.button-variant(var(--color-semantic-success-500, #10b981),
|
|
80
|
+
var(--color-semantic-neutral-50, #fcfcfd),
|
|
81
|
+
var(--color-semantic-success-500, #10b981),
|
|
82
|
+
var(--color-semantic-success-600, #059669),
|
|
83
|
+
var(--color-semantic-success-600, #059669));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ivds-button--warning {
|
|
87
|
+
@include btn.button-variant(var(--color-semantic-warning-500, #f59e0b),
|
|
88
|
+
var(--color-semantic-neutral-50, #fcfcfd),
|
|
89
|
+
var(--color-semantic-warning-500, #f59e0b),
|
|
90
|
+
var(--color-semantic-warning-600, #d97706),
|
|
91
|
+
var(--color-semantic-warning-600, #d97706));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ivds-button--danger {
|
|
95
|
+
@include btn.button-variant(var(--color-semantic-error-500, #ef4444),
|
|
96
|
+
var(--color-semantic-neutral-50, #fcfcfd),
|
|
97
|
+
var(--color-semantic-error-500, #ef4444),
|
|
98
|
+
var(--color-semantic-error-600, #dc2626),
|
|
99
|
+
var(--color-semantic-error-600, #dc2626));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ivds-button--info {
|
|
103
|
+
@include btn.button-variant(var(--color-semantic-info-500, #3b82f6),
|
|
104
|
+
var(--color-semantic-neutral-50, #fcfcfd),
|
|
105
|
+
var(--color-semantic-info-500, #3b82f6),
|
|
106
|
+
var(--color-semantic-info-600, #2563eb),
|
|
107
|
+
var(--color-semantic-info-600, #2563eb));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Button Sizes
|
|
111
|
+
.ivds-button--small {
|
|
112
|
+
@include btn.button-size(var(--spacing-2, 0.5rem), var(--spacing-4, 1rem), var(--fontSize-sm, 0.875rem), 32px);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ivds-button--large {
|
|
116
|
+
@include btn.button-size(var(--spacing-4, 1rem), var(--spacing-8, 2rem), var(--fontSize-lg, 1.125rem), 56px);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Button Groups - Simplified to avoid specificity issues
|
|
120
|
+
.ivds-button-group {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
|
|
123
|
+
&--vertical {
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
// Button component stories for Storybook
|
|
2
|
+
// Showcases all button variants, sizes, and states
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Core/Button',
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: 'CSS-only button component using IVDS design tokens. Provides multiple variants, sizes, and states for different use cases.'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
a11y: {
|
|
13
|
+
config: {
|
|
14
|
+
rules: [
|
|
15
|
+
{
|
|
16
|
+
id: 'color-contrast',
|
|
17
|
+
enabled: true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'focus-order-semantics',
|
|
21
|
+
enabled: true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Basic button variants
|
|
30
|
+
export const Primary = () => `
|
|
31
|
+
<button class="ivds-button ivds-button--primary">
|
|
32
|
+
Primary Button
|
|
33
|
+
</button>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const Secondary = () => `
|
|
37
|
+
<button class="ivds-button ivds-button--secondary">
|
|
38
|
+
Secondary Button
|
|
39
|
+
</button>
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const Tertiary = () => `
|
|
43
|
+
<button class="ivds-button ivds-button--tertiary">
|
|
44
|
+
Tertiary Button
|
|
45
|
+
</button>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
// Semantic variants
|
|
49
|
+
export const Success = () => `
|
|
50
|
+
<button class="ivds-button ivds-button--success">
|
|
51
|
+
Success Button
|
|
52
|
+
</button>
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export const Warning = () => `
|
|
56
|
+
<button class="ivds-button ivds-button--warning">
|
|
57
|
+
Warning Button
|
|
58
|
+
</button>
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
export const Danger = () => `
|
|
62
|
+
<button class="ivds-button ivds-button--danger">
|
|
63
|
+
Danger Button
|
|
64
|
+
</button>
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const Info = () => `
|
|
68
|
+
<button class="ivds-button ivds-button--info">
|
|
69
|
+
Info Button
|
|
70
|
+
</button>
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
// Button sizes
|
|
74
|
+
export const Sizes = () => `
|
|
75
|
+
<div style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;">
|
|
76
|
+
<button class="ivds-button ivds-button--primary ivds-button--small">
|
|
77
|
+
Small Button
|
|
78
|
+
</button>
|
|
79
|
+
<button class="ivds-button ivds-button--primary">
|
|
80
|
+
Default Button
|
|
81
|
+
</button>
|
|
82
|
+
<button class="ivds-button ivds-button--primary ivds-button--large">
|
|
83
|
+
Large Button
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
// Button with icons
|
|
89
|
+
export const WithIcons = () => `
|
|
90
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap;">
|
|
91
|
+
<button class="ivds-button ivds-button--primary">
|
|
92
|
+
<span class="ivds-button__icon">
|
|
93
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
94
|
+
<path d="M12 5V19M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
95
|
+
</svg>
|
|
96
|
+
</span>
|
|
97
|
+
<span class="ivds-button__text">Add Item</span>
|
|
98
|
+
</button>
|
|
99
|
+
|
|
100
|
+
<button class="ivds-button ivds-button--secondary">
|
|
101
|
+
<span class="ivds-button__text">Download</span>
|
|
102
|
+
<span class="ivds-button__icon">
|
|
103
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
104
|
+
<path d="M21 15V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V15M7 10L12 15L17 10M12 15V3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
105
|
+
</svg>
|
|
106
|
+
</span>
|
|
107
|
+
</button>
|
|
108
|
+
</div>
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
// Icon-only buttons
|
|
112
|
+
export const IconOnly = () => `
|
|
113
|
+
<div style="display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;">
|
|
114
|
+
<button class="ivds-button ivds-button--primary ivds-button--icon-only ivds-button--small" aria-label="Add item">
|
|
115
|
+
<span class="ivds-button__icon">
|
|
116
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
117
|
+
<path d="M12 5V19M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
118
|
+
</svg>
|
|
119
|
+
</span>
|
|
120
|
+
</button>
|
|
121
|
+
|
|
122
|
+
<button class="ivds-button ivds-button--primary ivds-button--icon-only" aria-label="Edit item">
|
|
123
|
+
<span class="ivds-button__icon">
|
|
124
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
125
|
+
<path d="M11 4H4A2 2 0 0 0 2 6V20A2 2 0 0 0 4 22H18A2 2 0 0 0 20 20V13M18.5 2.5A2.121 2.121 0 0 1 21 5L12 14L8 15L9 11L18.5 2.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
126
|
+
</svg>
|
|
127
|
+
</span>
|
|
128
|
+
</button>
|
|
129
|
+
|
|
130
|
+
<button class="ivds-button ivds-button--danger ivds-button--icon-only ivds-button--large" aria-label="Delete item">
|
|
131
|
+
<span class="ivds-button__icon">
|
|
132
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
133
|
+
<path d="M3 6H5H21M8 6V4A2 2 0 0 1 10 2H14A2 2 0 0 1 16 4V6M19 6V20A2 2 0 0 1 17 22H7A2 2 0 0 1 5 20V6H19ZM10 11V17M14 11V17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
134
|
+
</svg>
|
|
135
|
+
</span>
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
// Loading states
|
|
141
|
+
export const LoadingStates = () => `
|
|
142
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap;">
|
|
143
|
+
<button class="ivds-button ivds-button--primary ivds-button--loading">
|
|
144
|
+
Loading...
|
|
145
|
+
</button>
|
|
146
|
+
|
|
147
|
+
<button class="ivds-button ivds-button--secondary ivds-button--loading">
|
|
148
|
+
Processing
|
|
149
|
+
</button>
|
|
150
|
+
|
|
151
|
+
<button class="ivds-button ivds-button--success ivds-button--loading ivds-button--small">
|
|
152
|
+
Saving
|
|
153
|
+
</button>
|
|
154
|
+
</div>
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
// Disabled states
|
|
158
|
+
export const DisabledStates = () => `
|
|
159
|
+
<div style="display: flex; gap: 1rem; flex-wrap: wrap;">
|
|
160
|
+
<button class="ivds-button ivds-button--primary" disabled>
|
|
161
|
+
Disabled Primary
|
|
162
|
+
</button>
|
|
163
|
+
|
|
164
|
+
<button class="ivds-button ivds-button--secondary" disabled>
|
|
165
|
+
Disabled Secondary
|
|
166
|
+
</button>
|
|
167
|
+
|
|
168
|
+
<button class="ivds-button ivds-button--tertiary" aria-disabled="true">
|
|
169
|
+
Aria Disabled
|
|
170
|
+
</button>
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
// Full width button
|
|
175
|
+
export const FullWidth = () => `
|
|
176
|
+
<div style="max-width: 400px;">
|
|
177
|
+
<button class="ivds-button ivds-button--primary ivds-button--full-width">
|
|
178
|
+
<span class="ivds-button__icon">
|
|
179
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
180
|
+
<path d="M16 21V5A2 2 0 0 0 14 3H10A2 2 0 0 0 8 5V21L12 19L16 21Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
181
|
+
</svg>
|
|
182
|
+
</span>
|
|
183
|
+
<span class="ivds-button__text">Save to Bookmarks</span>
|
|
184
|
+
</button>
|
|
185
|
+
</div>
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
// Button groups - simplified layout containers
|
|
189
|
+
export const ButtonGroups = () => `
|
|
190
|
+
<div style="display: flex; flex-direction: column; gap: 2rem;">
|
|
191
|
+
<div>
|
|
192
|
+
<h4 style="margin-bottom: 1rem;">Horizontal Button Layout</h4>
|
|
193
|
+
<div class="ivds-button-group" style="gap: 0.5rem;">
|
|
194
|
+
<button class="ivds-button ivds-button--secondary">Left</button>
|
|
195
|
+
<button class="ivds-button ivds-button--secondary">Center</button>
|
|
196
|
+
<button class="ivds-button ivds-button--secondary">Right</button>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div>
|
|
201
|
+
<h4 style="margin-bottom: 1rem;">Vertical Button Layout</h4>
|
|
202
|
+
<div class="ivds-button-group ivds-button-group--vertical" style="gap: 0.5rem;">
|
|
203
|
+
<button class="ivds-button ivds-button--secondary">Top</button>
|
|
204
|
+
<button class="ivds-button ivds-button--secondary">Middle</button>
|
|
205
|
+
<button class="ivds-button ivds-button--secondary">Bottom</button>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
`;
|
|
210
|
+
|
|
211
|
+
// All variants showcase
|
|
212
|
+
export const AllVariants = () => `
|
|
213
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem;">
|
|
214
|
+
<button class="ivds-button ivds-button--primary">Primary</button>
|
|
215
|
+
<button class="ivds-button ivds-button--secondary">Secondary</button>
|
|
216
|
+
<button class="ivds-button ivds-button--tertiary">Tertiary</button>
|
|
217
|
+
<button class="ivds-button ivds-button--success">Success</button>
|
|
218
|
+
<button class="ivds-button ivds-button--warning">Warning</button>
|
|
219
|
+
<button class="ivds-button ivds-button--danger">Danger</button>
|
|
220
|
+
<button class="ivds-button ivds-button--info">Info</button>
|
|
221
|
+
</div>
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
// Accessibility example
|
|
225
|
+
export const AccessibilityFeatures = () => `
|
|
226
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 400px;">
|
|
227
|
+
<button class="ivds-button ivds-button--primary" aria-describedby="button-help">
|
|
228
|
+
Submit Form
|
|
229
|
+
</button>
|
|
230
|
+
<p id="button-help" style="font-size: 0.875rem; color: #6b7280;">
|
|
231
|
+
This button will submit the form and redirect you to the confirmation page.
|
|
232
|
+
</p>
|
|
233
|
+
|
|
234
|
+
<button class="ivds-button ivds-button--danger" aria-label="Delete user account permanently">
|
|
235
|
+
<span class="ivds-button__icon">
|
|
236
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
237
|
+
<path d="M3 6H5H21M8 6V4A2 2 0 0 1 10 2H14A2 2 0 0 1 16 4V6M19 6V20A2 2 0 0 1 17 22H7A2 2 0 0 1 5 20V6H19ZM10 11V17M14 11V17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
238
|
+
</svg>
|
|
239
|
+
</span>
|
|
240
|
+
<span class="ivds-button__text">Delete Account</span>
|
|
241
|
+
</button>
|
|
242
|
+
</div>
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
// HTML code examples
|
|
246
|
+
export const HTMLCodeExamples = () => `
|
|
247
|
+
<div style="display: flex; flex-direction: column; gap: 2rem; max-width: 800px;">
|
|
248
|
+
<div>
|
|
249
|
+
<h3 style="margin-bottom: 1rem;">Basic Button HTML</h3>
|
|
250
|
+
<div style="margin-bottom: 1rem;">
|
|
251
|
+
<button class="ivds-button ivds-button--primary">Primary Button</button>
|
|
252
|
+
</div>
|
|
253
|
+
<pre style="background: #f8fafc; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem;"><code><button class="ivds-button ivds-button--primary">
|
|
254
|
+
Primary Button
|
|
255
|
+
</button></code></pre>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
<div>
|
|
259
|
+
<h3 style="margin-bottom: 1rem;">Button with Icon HTML</h3>
|
|
260
|
+
<div style="margin-bottom: 1rem;">
|
|
261
|
+
<button class="ivds-button ivds-button--secondary">
|
|
262
|
+
<span class="ivds-button__icon">
|
|
263
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
264
|
+
<path d="M12 5V19M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
265
|
+
</svg>
|
|
266
|
+
</span>
|
|
267
|
+
<span class="ivds-button__text">Add Item</span>
|
|
268
|
+
</button>
|
|
269
|
+
</div>
|
|
270
|
+
<pre style="background: #f8fafc; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem;"><code><button class="ivds-button ivds-button--secondary">
|
|
271
|
+
<span class="ivds-button__icon">
|
|
272
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
|
273
|
+
<path d="M12 5V19M5 12H19" stroke="currentColor" stroke-width="2"/>
|
|
274
|
+
</svg>
|
|
275
|
+
</span>
|
|
276
|
+
<span class="ivds-button__text">Add Item</span>
|
|
277
|
+
</button></code></pre>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<div>
|
|
281
|
+
<h3 style="margin-bottom: 1rem;">Loading Button HTML</h3>
|
|
282
|
+
<div style="margin-bottom: 1rem;">
|
|
283
|
+
<button class="ivds-button ivds-button--primary ivds-button--loading">
|
|
284
|
+
Loading...
|
|
285
|
+
</button>
|
|
286
|
+
</div>
|
|
287
|
+
<pre style="background: #f8fafc; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem;"><code><button class="ivds-button ivds-button--primary ivds-button--loading">
|
|
288
|
+
Loading...
|
|
289
|
+
</button></code></pre>
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div>
|
|
293
|
+
<h3 style="margin-bottom: 1rem;">Button Group HTML</h3>
|
|
294
|
+
<div style="margin-bottom: 1rem;">
|
|
295
|
+
<div class="ivds-button-group" style="gap: 0.5rem;">
|
|
296
|
+
<button class="ivds-button ivds-button--secondary">Cancel</button>
|
|
297
|
+
<button class="ivds-button ivds-button--primary">Save</button>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
<pre style="background: #f8fafc; padding: 1rem; border-radius: 0.5rem; overflow-x: auto; font-size: 0.875rem;"><code><div class="ivds-button-group" style="gap: 0.5rem;">
|
|
301
|
+
<button class="ivds-button ivds-button--secondary">Cancel</button>
|
|
302
|
+
<button class="ivds-button ivds-button--primary">Save</button>
|
|
303
|
+
</div></code></pre>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
`;
|
|
307
|
+
|
|
308
|
+
// Usage guidelines
|
|
309
|
+
export const UsageGuidelines = () => `
|
|
310
|
+
<div style="max-width: 800px; display: flex; flex-direction: column; gap: 2rem;">
|
|
311
|
+
<div class="ivds-card">
|
|
312
|
+
<div class="ivds-card__header">
|
|
313
|
+
<h3 class="ivds-card__title">Button Usage Guidelines</h3>
|
|
314
|
+
</div>
|
|
315
|
+
<div class="ivds-card__body">
|
|
316
|
+
<div style="display: flex; flex-direction: column; gap: 1.5rem;">
|
|
317
|
+
<div>
|
|
318
|
+
<h4 style="margin-bottom: 0.5rem; color: #059669;">✓ Do</h4>
|
|
319
|
+
<ul style="margin: 0; padding-left: 1.5rem; line-height: 1.6;">
|
|
320
|
+
<li>Use primary buttons for the main action on a page</li>
|
|
321
|
+
<li>Use secondary buttons for secondary actions</li>
|
|
322
|
+
<li>Provide clear, action-oriented button text</li>
|
|
323
|
+
<li>Use loading states for async operations</li>
|
|
324
|
+
<li>Include proper ARIA labels for icon-only buttons</li>
|
|
325
|
+
</ul>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<div>
|
|
329
|
+
<h4 style="margin-bottom: 0.5rem; color: #dc2626;">✗ Don't</h4>
|
|
330
|
+
<ul style="margin: 0; padding-left: 1.5rem; line-height: 1.6;">
|
|
331
|
+
<li>Use multiple primary buttons in the same context</li>
|
|
332
|
+
<li>Use vague button text like "Click here" or "Submit"</li>
|
|
333
|
+
<li>Make buttons too small for touch targets (minimum 44px)</li>
|
|
334
|
+
<li>Use disabled buttons without explanation</li>
|
|
335
|
+
<li>Overuse danger buttons - reserve for destructive actions</li>
|
|
336
|
+
</ul>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<div class="ivds-card">
|
|
343
|
+
<div class="ivds-card__header">
|
|
344
|
+
<h3 class="ivds-card__title">Button Hierarchy</h3>
|
|
345
|
+
</div>
|
|
346
|
+
<div class="ivds-card__body">
|
|
347
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
348
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
349
|
+
<button class="ivds-button ivds-button--primary">Primary</button>
|
|
350
|
+
<span>Main call-to-action, use sparingly (1 per page/section)</span>
|
|
351
|
+
</div>
|
|
352
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
353
|
+
<button class="ivds-button ivds-button--secondary">Secondary</button>
|
|
354
|
+
<span>Secondary actions, can be used multiple times</span>
|
|
355
|
+
</div>
|
|
356
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
357
|
+
<button class="ivds-button ivds-button--tertiary">Tertiary</button>
|
|
358
|
+
<span>Subtle actions, minimal visual weight</span>
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SCSS compilation test for card mixins
|
|
2
|
+
|
|
3
|
+
// Base card mixin with common styles
|
|
4
|
+
@mixin card-base {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background-color: var(--color-semantic-neutral-50, #fafafa);
|
|
8
|
+
border-radius: var(--borderRadius-xl, 0.75rem);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
|
|
11
|
+
box-shadow: var(--shadow-sm, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Test compilation by using the mixins
|
|
15
|
+
.test-card-base {
|
|
16
|
+
@include card-base;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.test-card-variant {
|
|
20
|
+
background-color: #ffffff;
|
|
21
|
+
border: var(--borderWidth-1, 1px) solid #e2e8f0;
|
|
22
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.test-card-section {
|
|
26
|
+
padding: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.test-card-interactive {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
transform: translateY(-2px);
|
|
34
|
+
box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05));
|
|
35
|
+
}
|
|
36
|
+
}
|