@semiont/react-ui 0.2.30 → 0.2.31
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/README.md +34 -1
- package/dist/{ar-TQSFB35U.mjs → ar-6QTTYSKD.mjs} +44 -2
- package/dist/ar-6QTTYSKD.mjs.map +1 -0
- package/dist/{bn-525U24T3.mjs → bn-AHD2VP4T.mjs} +44 -2
- package/dist/bn-AHD2VP4T.mjs.map +1 -0
- package/dist/{chunk-BHAP6MVA.mjs → chunk-GDEHLKCO.mjs} +44 -2
- package/dist/chunk-GDEHLKCO.mjs.map +1 -0
- package/dist/{chunk-W6E2UESX.mjs → chunk-WHI4ECK4.mjs} +89 -47
- package/dist/chunk-WHI4ECK4.mjs.map +1 -0
- package/dist/{cs-OYWTGLFM.mjs → cs-WKZ5PTM3.mjs} +44 -2
- package/dist/cs-WKZ5PTM3.mjs.map +1 -0
- package/dist/{da-BDXG2ITK.mjs → da-JLWQLEH2.mjs} +44 -2
- package/dist/da-JLWQLEH2.mjs.map +1 -0
- package/dist/{de-NB5JLMES.mjs → de-TOCT63PC.mjs} +44 -2
- package/dist/de-TOCT63PC.mjs.map +1 -0
- package/dist/{el-3SVXEAJI.mjs → el-2XXDPBHO.mjs} +44 -2
- package/dist/el-2XXDPBHO.mjs.map +1 -0
- package/dist/{en-DVB4OE2R.mjs → en-OAKDUA6C.mjs} +10 -2
- package/dist/{es-YBOFA3W5.mjs → es-VQZSZSKB.mjs} +44 -2
- package/dist/es-VQZSZSKB.mjs.map +1 -0
- package/dist/{fa-7MU36AMY.mjs → fa-HFYV6XFA.mjs} +44 -2
- package/dist/fa-HFYV6XFA.mjs.map +1 -0
- package/dist/{fi-PQKJB32G.mjs → fi-GYTT42QN.mjs} +44 -2
- package/dist/fi-GYTT42QN.mjs.map +1 -0
- package/dist/{fr-U4HK5GM6.mjs → fr-RBOM5A35.mjs} +44 -2
- package/dist/fr-RBOM5A35.mjs.map +1 -0
- package/dist/{he-F5MNZHAL.mjs → he-KNB7K2AV.mjs} +44 -2
- package/dist/he-KNB7K2AV.mjs.map +1 -0
- package/dist/{hi-2PHI37ZX.mjs → hi-QJ6E72XH.mjs} +44 -2
- package/dist/hi-QJ6E72XH.mjs.map +1 -0
- package/dist/{id-JPRBNCGS.mjs → id-EKQVDHC7.mjs} +44 -2
- package/dist/id-EKQVDHC7.mjs.map +1 -0
- package/dist/index.d.mts +775 -127
- package/dist/index.mjs +8786 -2892
- package/dist/index.mjs.map +1 -1
- package/dist/{it-MRLWI5OS.mjs → it-43QKJZRF.mjs} +44 -2
- package/dist/it-43QKJZRF.mjs.map +1 -0
- package/dist/{ja-YQ6RPI2T.mjs → ja-SZUXDDO5.mjs} +44 -2
- package/dist/ja-SZUXDDO5.mjs.map +1 -0
- package/dist/{ko-DUAVCEXX.mjs → ko-HIR2TG2Q.mjs} +44 -2
- package/dist/ko-HIR2TG2Q.mjs.map +1 -0
- package/dist/{ms-FBHSR4PG.mjs → ms-6EJXSDHO.mjs} +44 -2
- package/dist/ms-6EJXSDHO.mjs.map +1 -0
- package/dist/{nl-IC2MPZXN.mjs → nl-AAAXD3KD.mjs} +44 -2
- package/dist/nl-AAAXD3KD.mjs.map +1 -0
- package/dist/{no-LLD43NRM.mjs → no-CEBS75VU.mjs} +44 -2
- package/dist/no-CEBS75VU.mjs.map +1 -0
- package/dist/{pl-DDOJBR4D.mjs → pl-SIB6PH3I.mjs} +44 -2
- package/dist/pl-SIB6PH3I.mjs.map +1 -0
- package/dist/{pt-7TFHQRRN.mjs → pt-6BMNSQTQ.mjs} +44 -2
- package/dist/pt-6BMNSQTQ.mjs.map +1 -0
- package/dist/{ro-P4PJEGDU.mjs → ro-63CZRSZ7.mjs} +44 -2
- package/dist/ro-63CZRSZ7.mjs.map +1 -0
- package/dist/{sv-LF3VEQD2.mjs → sv-BRAAQGIC.mjs} +44 -2
- package/dist/sv-BRAAQGIC.mjs.map +1 -0
- package/dist/test-utils.mjs +2 -2
- package/dist/{th-YUQAOFXF.mjs → th-DQEDBNDR.mjs} +44 -2
- package/dist/th-DQEDBNDR.mjs.map +1 -0
- package/dist/{tr-CSIGLMJC.mjs → tr-IR5MEUEU.mjs} +44 -2
- package/dist/tr-IR5MEUEU.mjs.map +1 -0
- package/dist/{uk-LW3QBKSR.mjs → uk-BVRTOFAO.mjs} +44 -2
- package/dist/uk-BVRTOFAO.mjs.map +1 -0
- package/dist/{vi-W464Y6ZC.mjs → vi-QRBKNVJA.mjs} +44 -2
- package/dist/vi-QRBKNVJA.mjs.map +1 -0
- package/dist/{zh-R5XLM3EI.mjs → zh-VQVBROMT.mjs} +44 -2
- package/dist/zh-VQVBROMT.mjs.map +1 -0
- package/package.json +44 -6
- package/public/favicons/android-chrome-192x192.png +0 -0
- package/public/favicons/android-chrome-512x512.png +0 -0
- package/public/favicons/apple-touch-icon.png +0 -0
- package/public/favicons/favicon-128x128.png +0 -0
- package/public/favicons/favicon-16x16.png +0 -0
- package/public/favicons/favicon-32x32.png +0 -0
- package/public/favicons/favicon-48x48.png +0 -0
- package/public/favicons/favicon-64x64.png +0 -0
- package/public/favicons/favicon-96x96.png +0 -0
- package/public/favicons/favicon.ico +0 -0
- package/public/favicons/favicon.svg +47 -0
- package/public/favicons/site.webmanifest +19 -0
- package/src/examples/ButtonUsageExample.tsx +242 -0
- package/src/examples/button-css-modules.module.css +164 -0
- package/src/examples/button-styled-components.tsx +215 -0
- package/src/examples/button-tailwind.css +51 -0
- package/src/integrations/css-modules-helper.tsx +223 -0
- package/src/integrations/styled-components-theme.ts +405 -0
- package/src/integrations/tailwind-plugin.js +224 -0
- package/src/styles/base/reset.css +105 -0
- package/src/styles/base/utilities.css +465 -0
- package/src/styles/components/annotation-entries.css +138 -0
- package/src/styles/components/annotations.css +51 -0
- package/src/styles/components/auth.css +309 -0
- package/src/styles/components/branding.css +131 -0
- package/src/styles/components/cards.css +136 -0
- package/src/styles/components/collapsible-resource-navigation.css +161 -0
- package/src/styles/components/detection-widget.css +499 -0
- package/src/styles/components/footer.css +98 -0
- package/src/styles/components/header.css +109 -0
- package/src/styles/components/left-sidebar.css +138 -0
- package/src/styles/components/modals.css +672 -0
- package/src/styles/components/navigation-menu.css +59 -0
- package/src/styles/components/navigation-tabs.css +474 -0
- package/src/styles/components/panel-sections.css +440 -0
- package/src/styles/components/panels-base.css +404 -0
- package/src/styles/components/panels.css +100 -0
- package/src/styles/components/references.css +430 -0
- package/src/styles/components/resize-handle.css +110 -0
- package/src/styles/components/search-modal.css +463 -0
- package/src/styles/components/skip-links.css +101 -0
- package/src/styles/components/status-display.css +409 -0
- package/src/styles/components/tables.css +199 -0
- package/src/styles/components/toast.css +130 -0
- package/src/styles/components/toolbar.css +201 -0
- package/src/styles/core/badges.css +209 -0
- package/src/styles/core/buttons.css +781 -0
- package/src/styles/core/checkboxes.css +92 -0
- package/src/styles/core/forms.css +254 -0
- package/src/styles/core/index.css +43 -0
- package/src/styles/core/indicators.css +225 -0
- package/src/styles/core/inputs.css +117 -0
- package/src/styles/core/progress.css +170 -0
- package/src/styles/core/selects.css +135 -0
- package/src/styles/core/sliders.css +236 -0
- package/src/styles/core/tags.css +203 -0
- package/src/styles/core/textareas.css +134 -0
- package/src/styles/core/toggles.css +86 -0
- package/src/styles/features/admin.css +293 -0
- package/src/styles/features/compose.css +192 -0
- package/src/styles/features/devops.css +154 -0
- package/src/styles/features/entity-tags.css +140 -0
- package/src/styles/features/recent-docs.css +97 -0
- package/src/styles/features/resource-discovery.css +387 -0
- package/src/styles/features/resource-viewer.css +508 -0
- package/src/styles/features/resource.css +506 -0
- package/src/styles/features/schemas.css +222 -0
- package/src/styles/features/static-pages.css +589 -0
- package/src/styles/features/welcome.css +81 -0
- package/src/styles/index.css +93 -0
- package/src/styles/layout/layout.css +85 -0
- package/src/styles/motivations/motivation-assessment.css +234 -0
- package/src/styles/motivations/motivation-comment.css +245 -0
- package/src/styles/motivations/motivation-highlight.css +195 -0
- package/src/styles/motivations/motivation-reference.css +210 -0
- package/src/styles/motivations/motivation-tag.css +254 -0
- package/src/styles/panels/assessment-panel.css +91 -0
- package/src/styles/panels/collaboration-panel.css +222 -0
- package/src/styles/panels/comments-panel.css +130 -0
- package/src/styles/panels/highlight-panel.css +63 -0
- package/src/styles/panels/history-panel.css +301 -0
- package/src/styles/panels/jsonld-panel.css +41 -0
- package/src/styles/panels/references-panel.css +85 -0
- package/src/styles/panels/resource-info-panel.css +230 -0
- package/src/styles/panels/settings-panel.css +58 -0
- package/src/styles/panels/statistics-panel.css +147 -0
- package/src/styles/panels/tagging-panel.css +59 -0
- package/src/styles/panels/unified-annotations-panel.css +133 -0
- package/src/styles/panels/user-panel.css +24 -0
- package/src/styles/patterns/errors.css +24 -0
- package/src/styles/patterns/loading.css +26 -0
- package/src/styles/utilities/contrast.css +443 -0
- package/src/styles/utilities/focus-extended.css +539 -0
- package/src/styles/utilities/focus.css +108 -0
- package/src/styles/utilities/motion-overrides.css +378 -0
- package/src/styles/utilities/motion.css +370 -0
- package/src/styles/utilities/semantic-indicators.css +321 -0
- package/src/styles/variables.css +354 -0
- package/translations/ar.json +35 -1
- package/translations/bn.json +35 -1
- package/translations/cs.json +35 -1
- package/translations/da.json +35 -1
- package/translations/de.json +35 -1
- package/translations/el.json +35 -1
- package/translations/en.json +35 -1
- package/translations/es.json +35 -1
- package/translations/fa.json +35 -1
- package/translations/fi.json +35 -1
- package/translations/fr.json +35 -1
- package/translations/he.json +35 -1
- package/translations/hi.json +35 -1
- package/translations/id.json +35 -1
- package/translations/it.json +35 -1
- package/translations/ja.json +35 -1
- package/translations/ko.json +35 -1
- package/translations/ms.json +35 -1
- package/translations/nl.json +35 -1
- package/translations/no.json +35 -1
- package/translations/pl.json +35 -1
- package/translations/pt.json +35 -1
- package/translations/ro.json +35 -1
- package/translations/sv.json +35 -1
- package/translations/th.json +35 -1
- package/translations/tr.json +35 -1
- package/translations/uk.json +35 -1
- package/translations/vi.json +35 -1
- package/translations/zh.json +35 -1
- package/dist/ar-TQSFB35U.mjs.map +0 -1
- package/dist/bn-525U24T3.mjs.map +0 -1
- package/dist/chunk-BHAP6MVA.mjs.map +0 -1
- package/dist/chunk-W6E2UESX.mjs.map +0 -1
- package/dist/cs-OYWTGLFM.mjs.map +0 -1
- package/dist/da-BDXG2ITK.mjs.map +0 -1
- package/dist/de-NB5JLMES.mjs.map +0 -1
- package/dist/el-3SVXEAJI.mjs.map +0 -1
- package/dist/es-YBOFA3W5.mjs.map +0 -1
- package/dist/fa-7MU36AMY.mjs.map +0 -1
- package/dist/fi-PQKJB32G.mjs.map +0 -1
- package/dist/fr-U4HK5GM6.mjs.map +0 -1
- package/dist/he-F5MNZHAL.mjs.map +0 -1
- package/dist/hi-2PHI37ZX.mjs.map +0 -1
- package/dist/id-JPRBNCGS.mjs.map +0 -1
- package/dist/it-MRLWI5OS.mjs.map +0 -1
- package/dist/ja-YQ6RPI2T.mjs.map +0 -1
- package/dist/ko-DUAVCEXX.mjs.map +0 -1
- package/dist/ms-FBHSR4PG.mjs.map +0 -1
- package/dist/nl-IC2MPZXN.mjs.map +0 -1
- package/dist/no-LLD43NRM.mjs.map +0 -1
- package/dist/pl-DDOJBR4D.mjs.map +0 -1
- package/dist/pt-7TFHQRRN.mjs.map +0 -1
- package/dist/ro-P4PJEGDU.mjs.map +0 -1
- package/dist/sv-LF3VEQD2.mjs.map +0 -1
- package/dist/th-YUQAOFXF.mjs.map +0 -1
- package/dist/tr-CSIGLMJC.mjs.map +0 -1
- package/dist/uk-LW3QBKSR.mjs.map +0 -1
- package/dist/vi-W464Y6ZC.mjs.map +0 -1
- package/dist/zh-R5XLM3EI.mjs.map +0 -1
- /package/dist/{en-DVB4OE2R.mjs.map → en-OAKDUA6C.mjs.map} +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Using the CSS-agnostic Button component
|
|
3
|
+
*
|
|
4
|
+
* This demonstrates how to use the Button component with different
|
|
5
|
+
* styling approaches and all its features.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Button, ButtonGroup } from '../components/Button/Button';
|
|
10
|
+
|
|
11
|
+
// Import styles (users can replace this with their own styles)
|
|
12
|
+
import '../styles/index.css';
|
|
13
|
+
|
|
14
|
+
export function ButtonUsageExample() {
|
|
15
|
+
const [loading, setLoading] = React.useState(false);
|
|
16
|
+
|
|
17
|
+
const handleClick = () => {
|
|
18
|
+
setLoading(true);
|
|
19
|
+
// Simulate async operation
|
|
20
|
+
setTimeout(() => setLoading(false), 2000);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="button-examples">
|
|
25
|
+
<h2>Button Component Examples</h2>
|
|
26
|
+
|
|
27
|
+
{/* Variants */}
|
|
28
|
+
<section>
|
|
29
|
+
<h3>Variants</h3>
|
|
30
|
+
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
31
|
+
<Button variant="primary">Primary</Button>
|
|
32
|
+
<Button variant="secondary">Secondary</Button>
|
|
33
|
+
<Button variant="tertiary">Tertiary</Button>
|
|
34
|
+
<Button variant="danger">Danger</Button>
|
|
35
|
+
<Button variant="warning">Warning</Button>
|
|
36
|
+
<Button variant="ghost">Ghost</Button>
|
|
37
|
+
</div>
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
{/* Sizes */}
|
|
41
|
+
<section>
|
|
42
|
+
<h3>Sizes</h3>
|
|
43
|
+
<div style={{ display: 'flex', gap: '1rem', alignItems: 'center', flexWrap: 'wrap' }}>
|
|
44
|
+
<Button size="xs">Extra Small</Button>
|
|
45
|
+
<Button size="sm">Small</Button>
|
|
46
|
+
<Button size="md">Medium</Button>
|
|
47
|
+
<Button size="lg">Large</Button>
|
|
48
|
+
<Button size="xl">Extra Large</Button>
|
|
49
|
+
</div>
|
|
50
|
+
</section>
|
|
51
|
+
|
|
52
|
+
{/* With Icons */}
|
|
53
|
+
<section>
|
|
54
|
+
<h3>With Icons</h3>
|
|
55
|
+
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
56
|
+
<Button
|
|
57
|
+
variant="primary"
|
|
58
|
+
leftIcon={
|
|
59
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
|
|
60
|
+
<path d="M10 2a8 8 0 100 16 8 8 0 000-16zM8 7a1 1 0 012 0v4a1 1 0 11-2 0V7zm2 8a1 1 0 100-2 1 1 0 000 2z"/>
|
|
61
|
+
</svg>
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
With Left Icon
|
|
65
|
+
</Button>
|
|
66
|
+
|
|
67
|
+
<Button
|
|
68
|
+
variant="secondary"
|
|
69
|
+
rightIcon={
|
|
70
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
|
|
71
|
+
<path fillRule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clipRule="evenodd"/>
|
|
72
|
+
</svg>
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
With Right Icon
|
|
76
|
+
</Button>
|
|
77
|
+
|
|
78
|
+
<Button
|
|
79
|
+
variant="tertiary"
|
|
80
|
+
leftIcon={
|
|
81
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
|
|
82
|
+
<path d="M8 2a1 1 0 000 2h2a1 1 0 100-2H8z"/>
|
|
83
|
+
<path d="M3 5a2 2 0 012-2 1 1 0 000 2H5a2 2 0 00-2 2v6h2V7h10v6h2V7a2 2 0 00-2-2h-.5a1 1 0 000-2H15a2 2 0 012 2v8a2 2 0 01-2 2h-2v3a1 1 0 11-2 0v-3H9v3a1 1 0 11-2 0v-3H5a2 2 0 01-2-2V5z"/>
|
|
84
|
+
</svg>
|
|
85
|
+
}
|
|
86
|
+
rightIcon={
|
|
87
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
|
|
88
|
+
<path fillRule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clipRule="evenodd"/>
|
|
89
|
+
</svg>
|
|
90
|
+
}
|
|
91
|
+
>
|
|
92
|
+
Both Icons
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</section>
|
|
96
|
+
|
|
97
|
+
{/* Icon Only */}
|
|
98
|
+
<section>
|
|
99
|
+
<h3>Icon Only Buttons</h3>
|
|
100
|
+
<div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
|
|
101
|
+
<Button variant="primary" size="sm" iconOnly>
|
|
102
|
+
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor">
|
|
103
|
+
<path d="M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z"/>
|
|
104
|
+
</svg>
|
|
105
|
+
</Button>
|
|
106
|
+
|
|
107
|
+
<Button variant="secondary" size="md" iconOnly>
|
|
108
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
109
|
+
<path fillRule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clipRule="evenodd"/>
|
|
110
|
+
</svg>
|
|
111
|
+
</Button>
|
|
112
|
+
|
|
113
|
+
<Button variant="ghost" size="lg" iconOnly>
|
|
114
|
+
<svg width="24" height="24" viewBox="0 0 20 20" fill="currentColor">
|
|
115
|
+
<path fillRule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clipRule="evenodd"/>
|
|
116
|
+
</svg>
|
|
117
|
+
</Button>
|
|
118
|
+
</div>
|
|
119
|
+
</section>
|
|
120
|
+
|
|
121
|
+
{/* States */}
|
|
122
|
+
<section>
|
|
123
|
+
<h3>States</h3>
|
|
124
|
+
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
125
|
+
<Button variant="primary">Normal</Button>
|
|
126
|
+
<Button variant="primary" active>Active/Pressed</Button>
|
|
127
|
+
<Button variant="primary" disabled>Disabled</Button>
|
|
128
|
+
<Button variant="primary" loading onClick={handleClick}>
|
|
129
|
+
{loading ? 'Loading...' : 'Click to Load'}
|
|
130
|
+
</Button>
|
|
131
|
+
</div>
|
|
132
|
+
</section>
|
|
133
|
+
|
|
134
|
+
{/* Full Width */}
|
|
135
|
+
<section>
|
|
136
|
+
<h3>Full Width</h3>
|
|
137
|
+
<div style={{ maxWidth: '400px' }}>
|
|
138
|
+
<Button variant="primary" fullWidth>
|
|
139
|
+
Full Width Button
|
|
140
|
+
</Button>
|
|
141
|
+
</div>
|
|
142
|
+
</section>
|
|
143
|
+
|
|
144
|
+
{/* Button Groups */}
|
|
145
|
+
<section>
|
|
146
|
+
<h3>Button Groups</h3>
|
|
147
|
+
|
|
148
|
+
<div style={{ marginBottom: '1rem' }}>
|
|
149
|
+
<h4>Horizontal Group</h4>
|
|
150
|
+
<ButtonGroup orientation="horizontal" spacing="sm">
|
|
151
|
+
<Button variant="secondary" size="sm">First</Button>
|
|
152
|
+
<Button variant="secondary" size="sm">Second</Button>
|
|
153
|
+
<Button variant="secondary" size="sm">Third</Button>
|
|
154
|
+
</ButtonGroup>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div style={{ marginBottom: '1rem' }}>
|
|
158
|
+
<h4>Attached Group</h4>
|
|
159
|
+
<ButtonGroup orientation="horizontal" attached>
|
|
160
|
+
<Button variant="primary">Previous</Button>
|
|
161
|
+
<Button variant="primary" active>Current</Button>
|
|
162
|
+
<Button variant="primary">Next</Button>
|
|
163
|
+
</ButtonGroup>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div style={{ marginBottom: '1rem' }}>
|
|
167
|
+
<h4>Vertical Group</h4>
|
|
168
|
+
<ButtonGroup orientation="vertical" spacing="xs">
|
|
169
|
+
<Button variant="ghost" fullWidth>Option 1</Button>
|
|
170
|
+
<Button variant="ghost" fullWidth>Option 2</Button>
|
|
171
|
+
<Button variant="ghost" fullWidth>Option 3</Button>
|
|
172
|
+
</ButtonGroup>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div>
|
|
176
|
+
<h4>Mixed Variants Group</h4>
|
|
177
|
+
<ButtonGroup orientation="horizontal" spacing="md">
|
|
178
|
+
<Button variant="danger">Delete</Button>
|
|
179
|
+
<Button variant="warning">Archive</Button>
|
|
180
|
+
<Button variant="primary">Save</Button>
|
|
181
|
+
</ButtonGroup>
|
|
182
|
+
</div>
|
|
183
|
+
</section>
|
|
184
|
+
|
|
185
|
+
{/* Custom Styling */}
|
|
186
|
+
<section>
|
|
187
|
+
<h3>Custom Styling</h3>
|
|
188
|
+
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
189
|
+
{/* Example with inline styles */}
|
|
190
|
+
<Button
|
|
191
|
+
variant="primary"
|
|
192
|
+
style={{
|
|
193
|
+
backgroundColor: '#8b5cf6',
|
|
194
|
+
borderRadius: '9999px',
|
|
195
|
+
textTransform: 'uppercase',
|
|
196
|
+
letterSpacing: '0.05em'
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
Custom Inline Styles
|
|
200
|
+
</Button>
|
|
201
|
+
|
|
202
|
+
{/* Example with custom className */}
|
|
203
|
+
<Button
|
|
204
|
+
variant="secondary"
|
|
205
|
+
className="custom-button-class"
|
|
206
|
+
>
|
|
207
|
+
Custom Class
|
|
208
|
+
</Button>
|
|
209
|
+
</div>
|
|
210
|
+
</section>
|
|
211
|
+
|
|
212
|
+
{/* Accessibility Example */}
|
|
213
|
+
<section>
|
|
214
|
+
<h3>Accessibility</h3>
|
|
215
|
+
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
216
|
+
<Button
|
|
217
|
+
variant="primary"
|
|
218
|
+
aria-label="Save document"
|
|
219
|
+
aria-describedby="save-description"
|
|
220
|
+
>
|
|
221
|
+
Save
|
|
222
|
+
</Button>
|
|
223
|
+
<span id="save-description" style={{ fontSize: '0.875rem', color: '#6b7280' }}>
|
|
224
|
+
Saves the current document to your drafts
|
|
225
|
+
</span>
|
|
226
|
+
</div>
|
|
227
|
+
</section>
|
|
228
|
+
|
|
229
|
+
{/* Form Integration */}
|
|
230
|
+
<section>
|
|
231
|
+
<h3>Form Integration</h3>
|
|
232
|
+
<form onSubmit={(e) => { e.preventDefault(); alert('Form submitted!'); }}>
|
|
233
|
+
<div style={{ display: 'flex', gap: '1rem' }}>
|
|
234
|
+
<Button type="button" variant="ghost">Cancel</Button>
|
|
235
|
+
<Button type="reset" variant="secondary">Reset</Button>
|
|
236
|
+
<Button type="submit" variant="primary">Submit</Button>
|
|
237
|
+
</div>
|
|
238
|
+
</form>
|
|
239
|
+
</section>
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Button styling with CSS Modules
|
|
3
|
+
*
|
|
4
|
+
* This shows how to style the Button component using CSS Modules
|
|
5
|
+
* by targeting the data attributes with module-scoped styles.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Base button styles */
|
|
9
|
+
.button {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
border: none;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
transition: all 0.2s ease;
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Primary variant */
|
|
23
|
+
.button[data-variant="primary"] {
|
|
24
|
+
background-color: #0080ff;
|
|
25
|
+
color: #ffffff;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.button[data-variant="primary"]:hover:not(:disabled) {
|
|
29
|
+
background-color: #0066cc;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.button[data-variant="primary"]:active:not(:disabled) {
|
|
33
|
+
background-color: #0052a3;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Secondary variant */
|
|
37
|
+
.button[data-variant="secondary"] {
|
|
38
|
+
background-color: #f3f4f6;
|
|
39
|
+
color: #111827;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.button[data-variant="secondary"]:hover:not(:disabled) {
|
|
43
|
+
background-color: #e5e7eb;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.button[data-variant="secondary"]:active:not(:disabled) {
|
|
47
|
+
background-color: #d1d5db;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Ghost variant */
|
|
51
|
+
.button[data-variant="ghost"] {
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
color: currentColor;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.button[data-variant="ghost"]:hover:not(:disabled) {
|
|
57
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Size variants */
|
|
61
|
+
.button[data-size="sm"] {
|
|
62
|
+
padding: 0.375rem 0.75rem;
|
|
63
|
+
font-size: 0.875rem;
|
|
64
|
+
border-radius: 0.25rem;
|
|
65
|
+
min-height: 2rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.button[data-size="md"] {
|
|
69
|
+
padding: 0.5rem 1rem;
|
|
70
|
+
font-size: 1rem;
|
|
71
|
+
border-radius: 0.375rem;
|
|
72
|
+
min-height: 2.5rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.button[data-size="lg"] {
|
|
76
|
+
padding: 0.75rem 1.5rem;
|
|
77
|
+
font-size: 1.125rem;
|
|
78
|
+
border-radius: 0.375rem;
|
|
79
|
+
min-height: 3rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Icon-only styles */
|
|
83
|
+
.button[data-icon-only="true"][data-size="sm"] {
|
|
84
|
+
padding: 0.375rem;
|
|
85
|
+
width: 2rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.button[data-icon-only="true"][data-size="md"] {
|
|
89
|
+
padding: 0.5rem;
|
|
90
|
+
width: 2.5rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.button[data-icon-only="true"][data-size="lg"] {
|
|
94
|
+
padding: 0.75rem;
|
|
95
|
+
width: 3rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Full width */
|
|
99
|
+
.button[data-full-width="true"] {
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Loading state */
|
|
104
|
+
.button[data-loading="true"] {
|
|
105
|
+
color: transparent;
|
|
106
|
+
pointer-events: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.spinner {
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: 50%;
|
|
112
|
+
left: 50%;
|
|
113
|
+
transform: translate(-50%, -50%);
|
|
114
|
+
animation: spin 1s linear infinite;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes spin {
|
|
118
|
+
from {
|
|
119
|
+
transform: translate(-50%, -50%) rotate(0deg);
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
transform: translate(-50%, -50%) rotate(360deg);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Focus styles */
|
|
127
|
+
.button:focus-visible {
|
|
128
|
+
outline: 2px solid #0080ff;
|
|
129
|
+
outline-offset: 2px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Disabled state */
|
|
133
|
+
.button:disabled,
|
|
134
|
+
.button[data-disabled="true"] {
|
|
135
|
+
opacity: 0.5;
|
|
136
|
+
cursor: not-allowed;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Icon spacing */
|
|
140
|
+
.iconLeft {
|
|
141
|
+
margin-right: 0.5rem;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.iconRight {
|
|
145
|
+
margin-left: 0.5rem;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* Reduced motion support */
|
|
149
|
+
@media (prefers-reduced-motion: reduce) {
|
|
150
|
+
.button {
|
|
151
|
+
transition: none !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.spinner {
|
|
155
|
+
animation: none !important;
|
|
156
|
+
transform: translate(-50%, -50%) !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@keyframes spin {
|
|
160
|
+
from, to {
|
|
161
|
+
transform: translate(-50%, -50%);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Button styling with Styled Components (CSS-in-JS)
|
|
3
|
+
*
|
|
4
|
+
* This shows how to style the Button component using styled-components
|
|
5
|
+
* by wrapping it and styling based on data attributes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { Button as SemiontButton } from '../components/Button/Button';
|
|
10
|
+
|
|
11
|
+
// Styled wrapper for the Button component
|
|
12
|
+
export const StyledButton = styled(SemiontButton)`
|
|
13
|
+
/* Base styles */
|
|
14
|
+
position: relative;
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
font-family: ${props => props.theme?.typography?.fontFamily?.sans || 'system-ui, -apple-system, sans-serif'};
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
border: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
transition: all 0.2s ease;
|
|
23
|
+
outline: none;
|
|
24
|
+
|
|
25
|
+
/* Primary variant */
|
|
26
|
+
&[data-variant="primary"] {
|
|
27
|
+
background-color: ${props => props.theme?.colors?.primary?.[500] || '#0080ff'};
|
|
28
|
+
color: white;
|
|
29
|
+
|
|
30
|
+
&:hover:not(:disabled) {
|
|
31
|
+
background-color: ${props => props.theme?.colors?.primary?.[600] || '#0066cc'};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:active:not(:disabled) {
|
|
35
|
+
background-color: ${props => props.theme?.colors?.primary?.[700] || '#0052a3'};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Secondary variant */
|
|
40
|
+
&[data-variant="secondary"] {
|
|
41
|
+
background-color: ${props => props.theme?.colors?.neutral?.[100] || '#f3f4f6'};
|
|
42
|
+
color: ${props => props.theme?.colors?.neutral?.[900] || '#111827'};
|
|
43
|
+
|
|
44
|
+
&:hover:not(:disabled) {
|
|
45
|
+
background-color: ${props => props.theme?.colors?.neutral?.[200] || '#e5e7eb'};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:active:not(:disabled) {
|
|
49
|
+
background-color: ${props => props.theme?.colors?.neutral?.[300] || '#d1d5db'};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Tertiary variant */
|
|
54
|
+
&[data-variant="tertiary"] {
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
color: ${props => props.theme?.colors?.primary?.[500] || '#0080ff'};
|
|
57
|
+
box-shadow: inset 0 0 0 1px ${props => (props.theme?.colors?.primary?.[500] || '#0080ff') + '33'};
|
|
58
|
+
|
|
59
|
+
&:hover:not(:disabled) {
|
|
60
|
+
background-color: ${props => (props.theme?.colors?.primary?.[500] || '#0080ff') + '0a'};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Ghost variant */
|
|
65
|
+
&[data-variant="ghost"] {
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
color: inherit;
|
|
68
|
+
|
|
69
|
+
&:hover:not(:disabled) {
|
|
70
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:active:not(:disabled) {
|
|
74
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Danger variant */
|
|
79
|
+
&[data-variant="danger"] {
|
|
80
|
+
background-color: ${props => props.theme?.colors?.error || '#ef4444'};
|
|
81
|
+
color: white;
|
|
82
|
+
|
|
83
|
+
&:hover:not(:disabled) {
|
|
84
|
+
background-color: ${props => props.theme?.colors?.errorDark || '#dc2626'};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Warning variant */
|
|
89
|
+
&[data-variant="warning"] {
|
|
90
|
+
background-color: ${props => props.theme?.colors?.warning || '#f59e0b'};
|
|
91
|
+
color: ${props => props.theme?.colors?.neutral?.[900] || '#111827'};
|
|
92
|
+
|
|
93
|
+
&:hover:not(:disabled) {
|
|
94
|
+
background-color: ${props => props.theme?.colors?.warningDark || '#d97706'};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Size variants */
|
|
99
|
+
&[data-size="xs"] {
|
|
100
|
+
padding: 0.25rem 0.5rem;
|
|
101
|
+
font-size: 0.75rem;
|
|
102
|
+
border-radius: 0.125rem;
|
|
103
|
+
min-height: 1.75rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&[data-size="sm"] {
|
|
107
|
+
padding: 0.375rem 0.75rem;
|
|
108
|
+
font-size: 0.875rem;
|
|
109
|
+
border-radius: 0.25rem;
|
|
110
|
+
min-height: 2rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&[data-size="md"] {
|
|
114
|
+
padding: 0.5rem 1rem;
|
|
115
|
+
font-size: 1rem;
|
|
116
|
+
border-radius: 0.375rem;
|
|
117
|
+
min-height: 2.5rem;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&[data-size="lg"] {
|
|
121
|
+
padding: 0.625rem 1.5rem;
|
|
122
|
+
font-size: 1.125rem;
|
|
123
|
+
border-radius: 0.375rem;
|
|
124
|
+
min-height: 3rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&[data-size="xl"] {
|
|
128
|
+
padding: 0.75rem 2rem;
|
|
129
|
+
font-size: 1.25rem;
|
|
130
|
+
border-radius: 0.5rem;
|
|
131
|
+
min-height: 3.5rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Icon-only buttons */
|
|
135
|
+
&[data-icon-only="true"] {
|
|
136
|
+
&[data-size="xs"] {
|
|
137
|
+
padding: 0.25rem;
|
|
138
|
+
width: 1.75rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&[data-size="sm"] {
|
|
142
|
+
padding: 0.375rem;
|
|
143
|
+
width: 2rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&[data-size="md"] {
|
|
147
|
+
padding: 0.5rem;
|
|
148
|
+
width: 2.5rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&[data-size="lg"] {
|
|
152
|
+
padding: 0.625rem;
|
|
153
|
+
width: 3rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&[data-size="xl"] {
|
|
157
|
+
padding: 0.75rem;
|
|
158
|
+
width: 3.5rem;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Full width */
|
|
163
|
+
&[data-full-width="true"] {
|
|
164
|
+
width: 100%;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* Loading state */
|
|
168
|
+
&[data-loading="true"] {
|
|
169
|
+
pointer-events: none;
|
|
170
|
+
opacity: 0.75;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Focus styles */
|
|
174
|
+
&:focus-visible {
|
|
175
|
+
outline: 2px solid ${props => props.theme?.colors?.primary?.[500] || '#0080ff'};
|
|
176
|
+
outline-offset: 2px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Disabled state */
|
|
180
|
+
&:disabled,
|
|
181
|
+
&[data-disabled="true"] {
|
|
182
|
+
opacity: 0.5;
|
|
183
|
+
cursor: not-allowed;
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
// Example usage with theme
|
|
188
|
+
const theme = {
|
|
189
|
+
colors: {
|
|
190
|
+
primary: '#0080ff',
|
|
191
|
+
primaryDark: '#0066cc',
|
|
192
|
+
primaryDarker: '#0052a3',
|
|
193
|
+
secondary: '#00ffff',
|
|
194
|
+
danger: '#ef4444',
|
|
195
|
+
dangerDark: '#dc2626',
|
|
196
|
+
warning: '#f59e0b',
|
|
197
|
+
warningDark: '#d97706',
|
|
198
|
+
gray100: '#f3f4f6',
|
|
199
|
+
gray200: '#e5e7eb',
|
|
200
|
+
gray300: '#d1d5db',
|
|
201
|
+
gray900: '#111827',
|
|
202
|
+
},
|
|
203
|
+
fonts: {
|
|
204
|
+
sans: 'Inter, system-ui, -apple-system, sans-serif',
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// Example component using styled button
|
|
209
|
+
export function ExampleStyledButton() {
|
|
210
|
+
return (
|
|
211
|
+
<StyledButton variant="primary" size="md">
|
|
212
|
+
Styled Components Button
|
|
213
|
+
</StyledButton>
|
|
214
|
+
);
|
|
215
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Button styling with Tailwind CSS
|
|
3
|
+
*
|
|
4
|
+
* This shows how to style the Button component using Tailwind utilities
|
|
5
|
+
* by targeting the data attributes.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Primary button with Tailwind */
|
|
9
|
+
.semiont-button[data-variant="primary"] {
|
|
10
|
+
@apply bg-blue-500 text-white hover:bg-blue-600 active:bg-blue-700;
|
|
11
|
+
@apply transition-colors duration-200;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* Size variants with Tailwind */
|
|
15
|
+
.semiont-button[data-size="sm"] {
|
|
16
|
+
@apply px-3 py-1.5 text-sm rounded;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.semiont-button[data-size="md"] {
|
|
20
|
+
@apply px-4 py-2 text-base rounded-md;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.semiont-button[data-size="lg"] {
|
|
24
|
+
@apply px-6 py-3 text-lg rounded-md;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Loading state */
|
|
28
|
+
.semiont-button[data-loading="true"] {
|
|
29
|
+
@apply pointer-events-none opacity-75;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Full width */
|
|
33
|
+
.semiont-button[data-full-width="true"] {
|
|
34
|
+
@apply w-full;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Icon-only button */
|
|
38
|
+
.semiont-button[data-icon-only="true"] {
|
|
39
|
+
@apply p-2 aspect-square;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Focus styles */
|
|
43
|
+
.semiont-button {
|
|
44
|
+
@apply focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Disabled state */
|
|
48
|
+
.semiont-button:disabled,
|
|
49
|
+
.semiont-button[data-disabled="true"] {
|
|
50
|
+
@apply opacity-50 cursor-not-allowed;
|
|
51
|
+
}
|