@yamatozhen/design_system 1.0.0
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/LICENSE +201 -0
- package/README.md +101 -0
- package/package.json +49 -0
- package/scripts/postinstall.js +105 -0
- package/template/app/ClientNav.tsx +310 -0
- package/template/app/globals.css +167 -0
- package/template/app/layout.tsx +128 -0
- package/template/app/themes/dark-mc.css +51 -0
- package/template/app/themes/dark.css +51 -0
- package/template/app/themes/light-mc.css +51 -0
- package/template/app/themes/light.css +51 -0
- package/template/app/themes/theme.css +82 -0
- package/template/components/layout/Lightbox/LightboxCard.tsx +100 -0
- package/template/components/layout/Lightbox/LightboxGallery.module.css +249 -0
- package/template/components/layout/Lightbox/LightboxGallery.tsx +72 -0
- package/template/components/layout/Lightbox/LightboxGrid.tsx +186 -0
- package/template/components/layout/Lightbox/LightboxModal.module.css +395 -0
- package/template/components/layout/Lightbox/LightboxModal.tsx +500 -0
- package/template/components/layout/Lightbox/demo.tsx +412 -0
- package/template/components/layout/Lightbox/index.ts +30 -0
- package/template/components/layout/Lightbox/types.ts +113 -0
- package/template/components/layout/Lightbox/useLightboxFilters.ts +140 -0
- package/template/components/layout/accordion/Accordion.module.css +149 -0
- package/template/components/layout/accordion/Accordion.tsx +114 -0
- package/template/components/layout/button/Button.module.css +305 -0
- package/template/components/layout/button/ButtonGroup.tsx +503 -0
- package/template/components/layout/button/FAB.tsx +118 -0
- package/template/components/layout/button/button.tsx +128 -0
- package/template/components/layout/button/drop.module.css +229 -0
- package/template/components/layout/button/drop.tsx +516 -0
- package/template/components/layout/hero/v1/heroSlideshow.module.css +107 -0
- package/template/components/layout/hero/v1/heroSlideshow.tsx +233 -0
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +126 -0
- package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +290 -0
- package/template/components/layout/modals/alert/Alert.tsx +188 -0
- package/template/components/layout/navigation/MioCard.module.css +88 -0
- package/template/components/layout/navigation/MioCard.tsx +266 -0
- package/template/components/layout/navigation/Wrap.tsx +41 -0
- package/template/components/layout/navigation/nav/Nav.module.css +508 -0
- package/template/components/layout/navigation/nav/Nav.tsx +167 -0
- package/template/components/layout/navigation/nav/NavBar.tsx +419 -0
- package/template/components/layout/navigation/nav/NavContext.tsx +259 -0
- package/template/components/layout/navigation/nav/NavItem.tsx +173 -0
- package/template/components/layout/navigation/nav/NavNew.module.css +373 -0
- package/template/components/layout/navigation/nav/NavRail.tsx +315 -0
- package/template/components/layout/navigation/nav/NavSection.tsx +102 -0
- package/template/components/layout/navigation/nav/NavTab.tsx +25 -0
- package/template/components/layout/navigation/nav/navftb/NavFTB.module.css +252 -0
- package/template/components/layout/navigation/nav/navftb/NavFTB.tsx +399 -0
- package/template/components/layout/navigation/nav/navftb/useTabIndicator.ts +484 -0
- package/template/components/layout/navigation/nav/navheader/NavHeader.module.css +59 -0
- package/template/components/layout/navigation/nav/navheader/NavHeader.tsx +478 -0
- package/template/components/layout/pages/loadingScreen.tsx +102 -0
- package/template/components/layout/pages/maintenance/Maintenance.tsx +53 -0
- package/template/components/layout/pages/maintenance/maintenance.module.css +163 -0
- package/template/components/layout/switch/Switch.module.css +102 -0
- package/template/components/layout/switch/Switch.tsx +48 -0
- package/template/components/tools/Divider.tsx +11 -0
- package/template/components/tools/ProgressiveBlur.tsx +73 -0
- package/template/components/tools/ReduceMotionContext.tsx +5 -0
- package/template/components/tools/Sinewave.tsx +199 -0
- package/template/components/tools/SinewaveProgress.tsx +135 -0
- package/template/components/tools/badge/Badge.tsx +28 -0
- package/template/components/tools/flubber.d.ts +7 -0
- package/template/components/tools/icon/SocialIcons.tsx +88 -0
- package/template/components/tools/icon/icon.module.css +0 -0
- package/template/components/tools/icon/icon.tsx +125 -0
- package/template/components/tools/mobileViewProvider.tsx +58 -0
- package/template/components/tools/react-bits/ClickSpark.tsx +177 -0
- package/template/components/tools/react-bits/FadeContent.tsx +90 -0
- package/template/components/tools/react-bits/GlareHover.tsx +73 -0
- package/template/components/tools/react-bits/GradientText/GradientText.css +70 -0
- package/template/components/tools/react-bits/GradientText/GradientText.tsx +44 -0
- package/template/components/tools/react-bits/Magnet.tsx +118 -0
- package/template/components/tools/react-bits/Stepper/Stepper.css +134 -0
- package/template/components/tools/react-bits/Stepper/Stepper.tsx +412 -0
- package/template/components/tools/ripple/ripple.css +41 -0
- package/template/components/tools/ripple/ripple.tsx +53 -0
- package/template/components/tools/shape/ShapeLoader.tsx +101 -0
- package/template/components/tools/shape/ShapeMorph.tsx +190 -0
- package/template/components/tools/shape/ShapePaths.ts +116 -0
- package/template/components/tools/switch/Switch.module.css +102 -0
- package/template/components/tools/switch/Switch.tsx +48 -0
- package/template/components/tools/useBodyScrollLock.tsx +27 -0
- package/template/components/tools/useImageColor.ts +47 -0
- package/template/components/tools/useNavSheetDrag.tsx +196 -0
- package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useRef } from "react";
|
|
4
|
+
import styles from "./Button.module.css";
|
|
5
|
+
import Ripple, { RippleHandle } from "@/components/tools/ripple/ripple";
|
|
6
|
+
import ButtonGroup from "./ButtonGroup";
|
|
7
|
+
|
|
8
|
+
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
// variant booleans — first truthy one wins; defaults to "primary"
|
|
10
|
+
primary?: boolean;
|
|
11
|
+
"primary-bold"?: boolean;
|
|
12
|
+
secondary?: boolean;
|
|
13
|
+
"secondary-bold"?: boolean;
|
|
14
|
+
tertiary?: boolean;
|
|
15
|
+
"tertiary-bold"?: boolean;
|
|
16
|
+
outlined?: boolean;
|
|
17
|
+
text?: boolean;
|
|
18
|
+
link?: boolean;
|
|
19
|
+
// mode booleans — first truthy one wins; defaults to "icon-label"
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
elevated?: boolean;
|
|
22
|
+
rippleColor?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
26
|
+
(
|
|
27
|
+
{
|
|
28
|
+
"primary-bold": primaryBold,
|
|
29
|
+
primary,
|
|
30
|
+
"secondary-bold": secondaryBold,
|
|
31
|
+
secondary,
|
|
32
|
+
"tertiary-bold": tertiaryBold,
|
|
33
|
+
tertiary,
|
|
34
|
+
outlined,
|
|
35
|
+
text,
|
|
36
|
+
link,
|
|
37
|
+
loading = false,
|
|
38
|
+
disabled,
|
|
39
|
+
onClick,
|
|
40
|
+
children,
|
|
41
|
+
elevated = false,
|
|
42
|
+
rippleColor,
|
|
43
|
+
...rest
|
|
44
|
+
},
|
|
45
|
+
ref,
|
|
46
|
+
) => {
|
|
47
|
+
const variant = primaryBold
|
|
48
|
+
? "primary-bold"
|
|
49
|
+
: primary
|
|
50
|
+
? "primary"
|
|
51
|
+
: secondaryBold
|
|
52
|
+
? "secondary-bold"
|
|
53
|
+
: secondary
|
|
54
|
+
? "secondary"
|
|
55
|
+
: tertiaryBold
|
|
56
|
+
? "tertiary-bold"
|
|
57
|
+
: tertiary
|
|
58
|
+
? "tertiary"
|
|
59
|
+
: outlined
|
|
60
|
+
? "outlined"
|
|
61
|
+
: text
|
|
62
|
+
? "text"
|
|
63
|
+
: link
|
|
64
|
+
? "link"
|
|
65
|
+
: "primary";
|
|
66
|
+
|
|
67
|
+
if (process.env.NODE_ENV !== "production") {
|
|
68
|
+
const variantCount = [
|
|
69
|
+
primaryBold,
|
|
70
|
+
primary,
|
|
71
|
+
secondaryBold,
|
|
72
|
+
secondary,
|
|
73
|
+
tertiaryBold,
|
|
74
|
+
tertiary,
|
|
75
|
+
outlined,
|
|
76
|
+
text,
|
|
77
|
+
link,
|
|
78
|
+
].filter(Boolean).length;
|
|
79
|
+
if (variantCount === 0) {
|
|
80
|
+
console.warn(
|
|
81
|
+
"<Button>: No variant prop provided. Specify one of: primary, primary-bold, secondary, secondary-bold, tertiary, tertiary-bold, outlined, text, link.",
|
|
82
|
+
);
|
|
83
|
+
} else if (variantCount > 1) {
|
|
84
|
+
console.warn(
|
|
85
|
+
"<Button>: Multiple variant props provided — only the first truthy one is used. Remove the extras.",
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const rippleRef = useRef<RippleHandle>(null);
|
|
91
|
+
|
|
92
|
+
const isDisabled = disabled || loading;
|
|
93
|
+
|
|
94
|
+
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
95
|
+
if (!isDisabled) {
|
|
96
|
+
rippleRef.current?.triggerRipple(e);
|
|
97
|
+
onClick?.(e);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<button
|
|
103
|
+
ref={ref}
|
|
104
|
+
disabled={isDisabled}
|
|
105
|
+
className={`${styles[variant]} ${styles.buttonStyle}`}
|
|
106
|
+
onClick={handleClick}
|
|
107
|
+
{...rest}
|
|
108
|
+
style={
|
|
109
|
+
elevated && !isDisabled
|
|
110
|
+
? {
|
|
111
|
+
boxShadow:
|
|
112
|
+
"0 1px 2px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1)",
|
|
113
|
+
...rest.style,
|
|
114
|
+
}
|
|
115
|
+
: rest.style
|
|
116
|
+
}
|
|
117
|
+
>
|
|
118
|
+
{children}
|
|
119
|
+
{/* Always render Ripple; handle disabled in trigger */}
|
|
120
|
+
<Ripple ref={rippleRef} rippleColor={rippleColor} />
|
|
121
|
+
</button>
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
Button.displayName = "Button";
|
|
127
|
+
|
|
128
|
+
export default Object.assign(Button, { group: ButtonGroup });
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/* ── Wrapper: holds the invisible spacer (in flow) + absolute layers ───────── */
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
max-width: max-content;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* ── Shared pill/card box (spacer + the real drop both use this) ───────────── */
|
|
9
|
+
.pillBox {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: stretch;
|
|
14
|
+
max-width: max-content;
|
|
15
|
+
padding: 6px;
|
|
16
|
+
|
|
17
|
+
font-size: var(--font-size-base);
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
border: 1px solid var(--globalUIBorderCard);
|
|
20
|
+
border-radius: 34px; /* radius is overridden by Framer on the live drop */
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
transform: translateY(0px);
|
|
23
|
+
|
|
24
|
+
-webkit-tap-highlight-color: transparent;
|
|
25
|
+
touch-action: manipulation;
|
|
26
|
+
user-select: none;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
filter: brightness(1);
|
|
29
|
+
|
|
30
|
+
transition:
|
|
31
|
+
background-color var(--transition-expressive-color),
|
|
32
|
+
color var(--transition-expressive-color),
|
|
33
|
+
box-shadow var(--transition-expressive),
|
|
34
|
+
border-color var(--transition-expressive-color),
|
|
35
|
+
filter var(--transition-expressive-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* The clone just holds space — never seen, never interactive. */
|
|
39
|
+
.spacer {
|
|
40
|
+
visibility: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Offscreen clone of the open card — measured for the expanded width only. */
|
|
44
|
+
.measure {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: -9999px;
|
|
48
|
+
visibility: hidden;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* The live element floats over the spacer and grows downward. */
|
|
53
|
+
.drop {
|
|
54
|
+
position: absolute;
|
|
55
|
+
top: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
z-index: 5;
|
|
58
|
+
transform-origin: top center;
|
|
59
|
+
}
|
|
60
|
+
.drop[data-open="false"]:hover {
|
|
61
|
+
filter: var(--filterBrightness);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* ── Variant surfaces (collapsed) — same names as button.tsx bools ─────────── */
|
|
65
|
+
.primary {
|
|
66
|
+
background: var(--md-sys-color-primary-container);
|
|
67
|
+
color: var(--md-sys-color-on-primary-container);
|
|
68
|
+
}
|
|
69
|
+
.secondary {
|
|
70
|
+
background: var(--md-sys-color-secondary-container);
|
|
71
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
72
|
+
}
|
|
73
|
+
.tertiary {
|
|
74
|
+
background: var(--md-sys-color-tertiary-container);
|
|
75
|
+
color: var(--md-sys-color-on-tertiary-container);
|
|
76
|
+
}
|
|
77
|
+
.outlined {
|
|
78
|
+
background: transparent;
|
|
79
|
+
color: var(--md-sys-color-secondary);
|
|
80
|
+
border-width: 2px;
|
|
81
|
+
border-color: var(--md-sys-color-outline-variant);
|
|
82
|
+
}
|
|
83
|
+
.text {
|
|
84
|
+
background: transparent;
|
|
85
|
+
color: var(--md-sys-color-primary);
|
|
86
|
+
border: 0;
|
|
87
|
+
}
|
|
88
|
+
.link {
|
|
89
|
+
background: transparent;
|
|
90
|
+
color: var(--md-sys-color-tertiary);
|
|
91
|
+
border: 0;
|
|
92
|
+
text-decoration: underline;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* ── Open state: becomes a surface-container-low card (any variant) ────────── */
|
|
96
|
+
.drop[data-open="true"] {
|
|
97
|
+
background: var(--md-sys-color-surface-container-lowest);
|
|
98
|
+
color: var(--md-sys-color-on-surface);
|
|
99
|
+
border: 1px solid var(--globalUIBorderCard);
|
|
100
|
+
box-shadow:
|
|
101
|
+
0 1px 1px rgba(0, 0, 0, 0.1),
|
|
102
|
+
0 2px 2px rgba(0, 0, 0, 0.1),
|
|
103
|
+
0 4px 4px rgba(0, 0, 0, 0.1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:global([data-show-borders="true"]) .drop,
|
|
107
|
+
:global([data-show-borders="true"]) .submenuCard {
|
|
108
|
+
border: var(--a11y-border) !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* ── Header: pill content closed, dimmed title open ───────────────────────── */
|
|
112
|
+
.header {
|
|
113
|
+
appearance: none;
|
|
114
|
+
-webkit-appearance: none;
|
|
115
|
+
background: transparent;
|
|
116
|
+
border: 0;
|
|
117
|
+
margin: 0;
|
|
118
|
+
color: inherit;
|
|
119
|
+
font: inherit;
|
|
120
|
+
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: flex-start;
|
|
124
|
+
gap: 8px;
|
|
125
|
+
min-height: 30px; /* + 6px padding × 2 + 1px border × 2 ≈ 44px collapsed */
|
|
126
|
+
padding: 0 8px;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
border-radius: inherit;
|
|
130
|
+
|
|
131
|
+
transition: opacity var(--transition-expressive-color);
|
|
132
|
+
}
|
|
133
|
+
.drop[data-open="true"] .header {
|
|
134
|
+
opacity: 0.62;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* ── Rows ─────────────────────────────────────────────────────────────────── */
|
|
138
|
+
.list,
|
|
139
|
+
.submenuList {
|
|
140
|
+
list-style: none;
|
|
141
|
+
margin: 0;
|
|
142
|
+
padding: 0;
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: column;
|
|
145
|
+
}
|
|
146
|
+
.list li,
|
|
147
|
+
.submenuList li {
|
|
148
|
+
list-style: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.row {
|
|
152
|
+
appearance: none;
|
|
153
|
+
-webkit-appearance: none;
|
|
154
|
+
width: 100%;
|
|
155
|
+
box-sizing: border-box;
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 8px;
|
|
159
|
+
padding: 8px 12px;
|
|
160
|
+
height: 44px;
|
|
161
|
+
margin: 0;
|
|
162
|
+
|
|
163
|
+
background: transparent;
|
|
164
|
+
border: 0;
|
|
165
|
+
border-radius: 34px;
|
|
166
|
+
color: inherit;
|
|
167
|
+
font: inherit;
|
|
168
|
+
text-align: start;
|
|
169
|
+
text-decoration: none;
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
|
|
173
|
+
transition:
|
|
174
|
+
background-color var(--transition-expressive-color),
|
|
175
|
+
color var(--transition-expressive-color);
|
|
176
|
+
}
|
|
177
|
+
.row:hover {
|
|
178
|
+
background: var(--globalUIBorderCard);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* ── Active / toggled row ─────────────────────────────────────────────────── */
|
|
182
|
+
.row[data-active] {
|
|
183
|
+
background: var(--md-sys-color-secondary-container);
|
|
184
|
+
color: var(--md-sys-color-on-secondary-container);
|
|
185
|
+
}
|
|
186
|
+
.row[data-active]:hover {
|
|
187
|
+
background: var(--md-sys-color-secondary-container);
|
|
188
|
+
filter: var(--filterBrightness);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* Text-only rows indent to line up with icon rows — tweak to your <Icon> box. */
|
|
192
|
+
.row[data-noicon] {
|
|
193
|
+
padding-inline-start: 34px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.chev {
|
|
197
|
+
margin-inline-start: auto;
|
|
198
|
+
display: inline-flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Passthrough rows (e.g. <Divider/>) — just breathing room; the component draws itself. */
|
|
203
|
+
.dividerRow {
|
|
204
|
+
list-style: none;
|
|
205
|
+
display: block;
|
|
206
|
+
padding: 6px;
|
|
207
|
+
max-height: 1px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* ── Submenu card ─────────────────────────────────────────────────────────── */
|
|
211
|
+
.submenuCard {
|
|
212
|
+
position: absolute;
|
|
213
|
+
left: 0;
|
|
214
|
+
z-index: 6;
|
|
215
|
+
box-sizing: border-box;
|
|
216
|
+
width: max-content;
|
|
217
|
+
padding: 6px;
|
|
218
|
+
|
|
219
|
+
background: var(--md-sys-color-surface-container-lowest);
|
|
220
|
+
color: var(--md-sys-color-on-surface);
|
|
221
|
+
border: 1px solid var(--globalUIBorderCard);
|
|
222
|
+
border-radius: 30px;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
box-shadow:
|
|
225
|
+
0 1px 1px rgba(0, 0, 0, 0.1),
|
|
226
|
+
0 2px 2px rgba(0, 0, 0, 0.1),
|
|
227
|
+
0 4px 4px rgba(0, 0, 0, 0.1);
|
|
228
|
+
transform-origin: top center;
|
|
229
|
+
}
|