@yamatozhen/design_system 1.3.7 → 1.3.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as I,useId as Se,useMemo as ve,useRef as i,useState as me}from"react";import{interpolate as Re}from"flubber";import{useReduceMotion as Ie}from"../../../providers/ReduceMotionProvider.js";import xe from"../../(primitives)/icon/Icon.js";import{shapePaths as de,resolveShapePath as x}from"./ShapePaths.js";import z from"./Shape.styles.js";import{springPulse as ke,springStep as ae,springDuration as V}from"./springCurves.js";import{cubicBezier as Me}from"../../../lib/easing.js";import{align as Pe,isSampleable as pe,lerpRing as Te,pointCount as we,ringToPath as Ce,segmentLength as Ee,toRing as le}from"./shapeGeometry.js";import{startTick as $e,stopTick as fe}from"./shapeTicker.js";import{jsx as f,jsxs as he}from"react/jsx-runtime";function Ae(n=Object.keys(de),r){let u=n.filter(o=>o!==r),a=u.length?u:n;return a[Math.floor(Math.random()*a.length)]}var k={scale:{speed:8,amp:.25,decay:6},morph:{speed:8,amp:.8,decay:8},rotation:{speed:4,amp:0,decay:2}},De=[.2,0,0,1],Oe=500,_e={xs:48,s:60,m:72,l:96,xl:118},w=new Map,ze=32;function He(n,r,u){let a=`${u}|${n}|${r}`,o=w.get(a);return o||(o=Re(n,r,{maxSegmentLength:u}),w.size>=ze&&w.delete(w.keys().next().value),w.set(a,o)),o}function Ne({shape:n,size:r=200,color:u="currentColor",image:a,hovered:o=!1,hoverShape:C,swapRotation:E=0,continuousRotation:$=!1,spinDuration:H=6,stroke:A,strokeWidth:D=0,strokeOffset:N=0,pulse:M=k.scale.amp,morphDuration:g,morphEase:v,style:b}){let m=`shape-morph-${Se().replace(/[^a-zA-Z0-9]/g,"")}`,B=(r+2*N+D)/r,L=i(null),U=i(null),K=i(o),Z=i(x(n)),p=i(x(n)),y=i(null),l=i(null),R=i({from:0,to:0,start:0}),P=i(null),j=i(!0),W=i(null),F=Ie(),X=i(F),Y=i(r),q=v!==void 0||g!==void 0,[J,Q,ee,te]=v??De,ne=ve(()=>q?{ease:Me(J,Q,ee,te),duration:(g??Oe)/1e3}:null,[q,g,J,Q,ee,te]),re=i(ne);I(()=>{X.current=F,Y.current=r,re.current=ne});let oe=$&&!F,se=t=>{let e=R.current;if(e.from===e.to)return e.to;let s=(t-e.start)/1e3;return s>=V(k.rotation)?(e.from=e.to,e.to):e.from+(e.to-e.from)*ae(s,k.rotation)},ge=t=>{let e=P.current;if(!e)return 1;let s={...k.scale,amp:e.amp},c=(t-e.start)/1e3;return c>=V(s)?(P.current=null,1):1+ke(c,s)},ie=t=>{let e=L.current;e&&(e.style.transform=`rotate(${se(t)}deg) scale(${ge(t)})`)},T=t=>U.current?.setAttribute("d",t),ce=()=>{let t=l.current;t&&T(t.toD),t&&(p.current=t.toD),l.current=null,y.current=null,P.current=null,R.current.from=R.current.to,ie(performance.now())},be=t=>{if(!j.current)return ce(),!1;let e=l.current;if(e){let c=(t-e.start)/1e3,d=re.current;if(d?c>=d.duration:c>=V(k.morph))T(e.toD),p.current=e.toD,l.current=null,y.current=null;else{let S=d?d.ease(c/d.duration):ae(c,k.morph),h=Math.min(Math.max(S,0),1);if(e.kind==="ring"){let _=y.current??new Float32Array(e.from.length);y.current=Te(e.from,e.to,h,_),T(Ce(_))}else T(e.interp(h))}}ie(t);let s=R.current;return l.current!==null||P.current!==null||s.from!==s.to};I(()=>{W.current=be});let[O]=me(()=>t=>W.current?.(t)??!1),ye=()=>$e(O);I(()=>()=>fe(O),[O]),I(()=>{let t=L.current;if(!t||typeof IntersectionObserver>"u")return;let e=new IntersectionObserver(([s])=>{j.current=s.isIntersecting,t.dataset.offscreen=s.isIntersecting?"":"true",s.isIntersecting||(fe(O),ce())});return e.observe(t),()=>e.disconnect()},[]);let G=t=>{let e=l.current,s=e?e.toD:p.current;if(t===s)return;if(X.current||!j.current){l.current=null,y.current=null,T(t),p.current=t;return}let c=performance.now(),d=Y.current,ue=we(d),S=e?.kind==="ring"?y.current?.slice()??e.from:e?null:pe(p.current)?le(p.current,ue):null;if(S&&pe(t)){let h=le(t,S.length/2),_=e?void 0:`${S.length}|${p.current}|${t}`;l.current={kind:"ring",from:S,to:Pe(S,h,_),toD:t,start:c}}else{let h=e?U.current?.getAttribute("d")??p.current:p.current;l.current={kind:"flubber",interp:He(h,t,Ee(d)),toD:t,start:c}}if(y.current=null,E>0){let h=se(c);R.current={from:h,to:R.current.to+E,start:c}}M!==0&&(P.current={start:c,amp:M}),ye()};return I(()=>{let t=o!==K.current;K.current=o,t&&G(o?C!==void 0?x(C):de[Ae(void 0,n)]:x(n))},[o,n]),I(()=>{let t=x(n),e=t!==Z.current;Z.current=t,e&&G(t)},[n]),he("svg",{ref:L,width:r,height:r,viewBox:"0 0 380 380",className:oe?z.spin:void 0,style:{overflow:"visible",willChange:"transform",...oe&&{"--shape-spin-duration":`${H}s`},...b},children:[a&&f("defs",{children:f("pattern",{id:`${m}-image`,patternUnits:"userSpaceOnUse",x:0,y:0,width:380,height:380,children:f("image",{href:a,x:0,y:0,width:380,height:380,preserveAspectRatio:"xMidYMid slice"})})}),f("path",{className:z.shapePath,ref:U,id:m,d:x(n),fill:a?`url(#${m}-image)`:u,style:{transition:"fill var(--transition-expressive-color)"}}),A&&f("use",{href:`#${m}`,fill:"none",stroke:A,strokeLinejoin:"round",style:{strokeWidth:D*380/r/B,transform:`scale(${B})`,transformOrigin:"190px 190px",transition:"stroke var(--transition-expressive-color), stroke-width var(--transition-expressive-fast), transform var(--transition-expressive-fast)"}})]})}function Le({background:n="var(--yz-palette-primary)",color:r="var(--yz-palette-on-primary)",onClick:u,shape:a,systemImage:o,size:C="m",hovered:E=!1,onHover:$,swapRotation:H,continuousRotation:A,spinDuration:D}){let[N,M]=me(!1),g=_e[C],v=$!==void 0,b=u!==void 0;return he("div",{onClick:u,role:b?"button":void 0,tabIndex:b?0:void 0,onKeyDown:b?m=>{m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),u())}:void 0,onMouseEnter:v?()=>M(!0):void 0,onMouseLeave:v?()=>M(!1):void 0,className:z.shapeOuter,style:{position:"relative",width:g,height:g,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:b?"pointer":"default"},children:[f("div",{className:z.shapeInner,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:f(Ne,{shape:a,size:g,color:n,hovered:E||v&&N,hoverShape:$?.shape,swapRotation:H,continuousRotation:A,spinDuration:D})}),f("span",{style:{position:"absolute",color:r,display:"inline-flex",padding:"calc(var(--padding-s) + 4px)",alignItems:"center",justifyContent:"center",cursor:b?"pointer":"default"},children:f(xe,{systemImage:o})})]})}export{k as SHAPE_MOTION,Ne as ShapeMorph,Le as default,Ae as randomShape};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.field_field{display:block;width:100%;box-sizing:border-box;border-radius:var(--borderRadius-l);box-shadow:inset 0 0 0 1px var(--yz-palette-border),0 0 0 0 transparent;background:var(--yz-palette-border);color:var(--yz-palette-on-surface);padding:calc(var(--padding-xs) + 2px) calc(var(--padding-s) + var(--padding-s) / 2);min-height:42px;font-size:16px;font-family:inherit;overflow:hidden;transition:border-color var(--transition-expressive-color),background-color var(--transition-expressive-color),box-shadow var(--transition-expressive-color)}.field_field::placeholder{color:var(--yz-palette-outline)}.field_field:hover:not(:disabled){background:var(--yz-palette-border)}.field_field[data-open],.field_field:focus-visible{outline:none;border-color:var(--field-color, var(--yz-palette-primary));box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--field-color, var(--yz-palette-primary))}.field_field[data-invalid=true]{border-color:var(--yz-palette-error);box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--yz-palette-error)}.field_field[data-invalid=true]:focus-visible{box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--yz-palette-error)}.field_field:disabled,.field_field[data-disabled]{box-shadow:inset 0 0 0 1px transparent,0 0 0 0 transparent;opacity:.5;cursor:not-allowed}[data-show-borders=true] .field_field{box-shadow:var(--a11y-border)!important}[data-in-group=true] .field_field{border:none;background:transparent!important;padding:calc(var(--padding-xs) + 2px) var(--padding-s);width:calc(100% + 24px);margin-inline:-12px;box-shadow:none!important}.field_field::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;cursor:none;opacity:0}
|
|
1
|
+
.field_field{display:block;width:100%;box-sizing:border-box;border:0;border-radius:var(--borderRadius-l);box-shadow:inset 0 0 0 1px var(--yz-palette-border),0 0 0 0 transparent;background:var(--yz-palette-border);color:var(--yz-palette-on-surface);padding:calc(var(--padding-xs) + 2px) calc(var(--padding-s) + var(--padding-s) / 2);min-height:42px;font-size:16px;font-family:inherit;overflow:hidden;transition:border-color var(--transition-expressive-color),background-color var(--transition-expressive-color),box-shadow var(--transition-expressive-color)}.field_field::placeholder{color:var(--yz-palette-outline)}.field_field:hover:not(:disabled){background:var(--yz-palette-border)}.field_field[data-open],.field_field:focus-visible{outline:none;border-color:var(--field-color, var(--yz-palette-primary));box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--field-color, var(--yz-palette-primary))}.field_field[data-invalid=true]{border-color:var(--yz-palette-error);box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--yz-palette-error)}.field_field[data-invalid=true]:focus-visible{box-shadow:inset 0 0 0 1px transparent,0 0 0 2px var(--yz-palette-error)}.field_field:disabled,.field_field[data-disabled]{box-shadow:inset 0 0 0 1px transparent,0 0 0 0 transparent;opacity:.5;cursor:not-allowed}[data-show-borders=true] .field_field{box-shadow:var(--a11y-border)!important}[data-in-group=true] .field_field{border:none;background:transparent!important;padding:calc(var(--padding-xs) + 2px) var(--padding-s);width:calc(100% + 24px);margin-inline:-12px;box-shadow:none!important}.field_field::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none;cursor:none;opacity:0}
|
package/dist/themes/theme.css
CHANGED
|
@@ -391,6 +391,14 @@ html {
|
|
|
391
391
|
0 2px 6px rgba(0, 0, 0, 0.1);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
+
.elevated-bold {
|
|
395
|
+
box-shadow:
|
|
396
|
+
0 1px 1px rgba(0, 0, 0, 0.1),
|
|
397
|
+
0 1px 3px rgba(0, 0, 0, 0.1),
|
|
398
|
+
0 2px 6px rgba(0, 0, 0, 0.1),
|
|
399
|
+
0 0 48px var(--yz-palette-border);
|
|
400
|
+
}
|
|
401
|
+
|
|
394
402
|
* {
|
|
395
403
|
scrollbar-width: none;
|
|
396
404
|
}
|
|
@@ -20,6 +20,7 @@ export declare const SHAPE_MOTION: {
|
|
|
20
20
|
decay: number;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
export type MorphEase = [number, number, number, number];
|
|
23
24
|
interface ShapeMorphProps {
|
|
24
25
|
shape: ShapeInput;
|
|
25
26
|
size?: number;
|
|
@@ -34,9 +35,11 @@ interface ShapeMorphProps {
|
|
|
34
35
|
strokeWidth?: number;
|
|
35
36
|
strokeOffset?: number;
|
|
36
37
|
pulse?: number;
|
|
38
|
+
morphDuration?: number;
|
|
39
|
+
morphEase?: MorphEase;
|
|
37
40
|
style?: React.CSSProperties;
|
|
38
41
|
}
|
|
39
|
-
export declare function ShapeMorph({ shape, size, color, image, hovered, hoverShape, swapRotation, continuousRotation, spinDuration, stroke, strokeWidth, strokeOffset, pulse: pulseAmp, style, }: ShapeMorphProps): React.JSX.Element;
|
|
42
|
+
export declare function ShapeMorph({ shape, size, color, image, hovered, hoverShape, swapRotation, continuousRotation, spinDuration, stroke, strokeWidth, strokeOffset, pulse: pulseAmp, morphDuration, morphEase, style, }: ShapeMorphProps): React.JSX.Element;
|
|
40
43
|
type ShapeProps = {
|
|
41
44
|
background?: string;
|
|
42
45
|
color?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamatozhen/design_system",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "Yamato Zhen design system — Material Design 3 components for React / Next.js, imported from the package (no files are copied into your project).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -441,5 +441,10 @@
|
|
|
441
441
|
"import": "./dist/components/(buttons)/toggleButton/index.js",
|
|
442
442
|
"default": "./dist/components/(buttons)/toggleButton/index.js"
|
|
443
443
|
}
|
|
444
|
+
},
|
|
445
|
+
"peerDependenciesMeta": {
|
|
446
|
+
"colorthief": {
|
|
447
|
+
"optional": true
|
|
448
|
+
}
|
|
444
449
|
}
|
|
445
450
|
}
|