@ab-demo-ui/demo-react 1.0.22 → 2.0.2
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/dist/hooks.cjs +1 -0
- package/dist/hooks.d.ts +33 -0
- package/dist/hooks.es.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +240 -0
- package/dist/index.es.js +1 -0
- package/dist/themes/default-theme.css +843 -0
- package/dist/themes/papyrus.css +901 -0
- package/dist/types.d.ts +2 -0
- package/package.json +5 -1
package/dist/hooks.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react");exports.useDomReady=()=>{const[t,r]=e.useState(!1);return e.useEffect(()=>r(!0),[]),t},exports.useOutsideClick=(t,r)=>{const n=e.useRef(null);return e.useEffect(()=>{const handleClickOutside=e=>{const u=n,s=e.target;!u.current||u.current.contains(s)||r?.some(e=>e.current?.contains(s))||t()};return document.addEventListener("mouseup",handleClickOutside),document.addEventListener("touchend",handleClickOutside),()=>{document.removeEventListener("mouseup",handleClickOutside),document.removeEventListener("touchend",handleClickOutside)}},[t,r]),n},exports.useScreenSize=()=>{const[t,r]=e.useState({width:0,height:0});return e.useEffect(()=>{if("undefined"!=typeof window){const resizeHandler=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",resizeHandler),()=>{window.removeEventListener("resize",resizeHandler)}}},[]),t},exports.useTimeout=(t,r)=>{const n=e.useRef(void 0),u=e.useRef(void 0),s=e.useRef(r),o=e.useRef(t);e.useEffect(()=>{o.current=t},[t]);const c=e.useCallback(()=>{clearTimeout(n.current),u.current&&(s.current-=(new Date).getTime()-u.current)},[]),i=e.useCallback(()=>{n.current&&clearTimeout(n.current),u.current=void 0,s.current=r},[r]),a=e.useCallback(()=>{n.current=setTimeout(()=>{o.current(),i()},s.current),u.current=(new Date).getTime()},[i]);return e.useMemo(()=>({start:a,pause:c,clear:i}),[a,c,i])},exports.useToggle=(t=!1,r)=>{const[n,u]=e.useState(t),[s,o]=e.useState(),c=e.useCallback(()=>{r?(o("showing"),setTimeout(()=>{o(void 0),u(!0)},r)):u(!0)},[r]),i=e.useCallback(()=>{r?(o("hiding"),setTimeout(()=>{o(void 0),u(!1)},r)):u(!1)},[r]),a=e.useCallback(e=>{(void 0===e?n:!e)?i():c()},[n,c,i]);return e.useMemo(()=>({visible:n,toggleState:s,show:c,hide:i,toggle:a}),[i,c,a,s,n])};
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const useDomReady: () => boolean;
|
|
4
|
+
//# sourceMappingURL=useDomReady.d.ts.map
|
|
5
|
+
|
|
6
|
+
declare const useOutsideClick: <R = unknown>(callback: () => void, excludedRefs?: RefObject<HTMLElement | null>[]) => RefObject<R | null>;
|
|
7
|
+
//# sourceMappingURL=useOutsideClick.d.ts.map
|
|
8
|
+
|
|
9
|
+
declare const useScreenSize: () => {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useScreenSize.d.ts.map
|
|
14
|
+
|
|
15
|
+
declare const useTimeout: (callback: () => void, delay: number) => {
|
|
16
|
+
start: () => void;
|
|
17
|
+
pause: () => void;
|
|
18
|
+
clear: () => void;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useTimeout.d.ts.map
|
|
21
|
+
|
|
22
|
+
type ToggleState = "showing" | "hiding";
|
|
23
|
+
type UseToggleReturn = {
|
|
24
|
+
visible: boolean;
|
|
25
|
+
toggleState?: ToggleState;
|
|
26
|
+
show: () => void;
|
|
27
|
+
hide: () => void;
|
|
28
|
+
toggle: (forceShow?: boolean) => void;
|
|
29
|
+
};
|
|
30
|
+
declare const useToggle: (initialVisible?: boolean, toggleTime?: number) => UseToggleReturn;
|
|
31
|
+
//# sourceMappingURL=useToggle.d.ts.map
|
|
32
|
+
|
|
33
|
+
export { useDomReady, useOutsideClick, useScreenSize, useTimeout, useToggle };
|
package/dist/hooks.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as e,useEffect as t,useRef as n,useCallback as r,useMemo as o}from"react";const useDomReady=()=>{const[n,r]=e(!1);return t(()=>r(!0),[]),n},useOutsideClick=(e,r)=>{const o=n(null);return t(()=>{const handleClickOutside=t=>{const n=o,i=t.target;!n.current||n.current.contains(i)||r?.some(e=>e.current?.contains(i))||e()};return document.addEventListener("mouseup",handleClickOutside),document.addEventListener("touchend",handleClickOutside),()=>{document.removeEventListener("mouseup",handleClickOutside),document.removeEventListener("touchend",handleClickOutside)}},[e,r]),o},useScreenSize=()=>{const[n,r]=e({width:0,height:0});return t(()=>{if("undefined"!=typeof window){const resizeHandler=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",resizeHandler),()=>{window.removeEventListener("resize",resizeHandler)}}},[]),n},useTimeout=(e,i)=>{const u=n(void 0),c=n(void 0),s=n(i),d=n(e);t(()=>{d.current=e},[e]);const m=r(()=>{clearTimeout(u.current),c.current&&(s.current-=(new Date).getTime()-c.current)},[]),v=r(()=>{u.current&&clearTimeout(u.current),c.current=void 0,s.current=i},[i]),w=r(()=>{u.current=setTimeout(()=>{d.current(),v()},s.current),c.current=(new Date).getTime()},[v]);return o(()=>({start:w,pause:m,clear:v}),[w,m,v])},useToggle=(t=!1,n)=>{const[i,u]=e(t),[c,s]=e(),d=r(()=>{n?(s("showing"),setTimeout(()=>{s(void 0),u(!0)},n)):u(!0)},[n]),m=r(()=>{n?(s("hiding"),setTimeout(()=>{s(void 0),u(!1)},n)):u(!1)},[n]),v=r(e=>{(void 0===e?i:!e)?m():d()},[i,d,m]);return o(()=>({visible:i,toggleState:c,show:d,hide:m,toggle:v}),[m,d,v,c,i])};export{useDomReady,useOutsideClick,useScreenSize,useTimeout,useToggle};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("react");const t="mtf-ui-icons",r={locale:"tr",baseIconClass:t,componentDefaults:{},setBaseIconClass:()=>{},setLocale:()=>{},setFont:()=>{},setComponentDefaults:()=>{},setTheme:()=>{}},camelToKebab=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),n=i.createContext(r);var a=[],o=[];var s={noScroll:"mtf-Divider--noScroll",Root:"mtf-Divider",horizontal:"mtf-Divider--horizontal",solid:"mtf-Divider--solid",dashed:"mtf-Divider--dashed",dotted:"mtf-Divider--dotted",vertical:"mtf-Divider--vertical",sm:"mtf-Divider--sm","gap-sm":"mtf-Divider--gap-sm",md:"mtf-Divider--md","gap-md":"mtf-Divider--gap-md",lg:"mtf-Divider--lg","gap-lg":"mtf-Divider--gap-lg"};!function(e,i){if(e&&"undefined"!=typeof document){var t,r=!0===i.prepend?"prepend":"append",n=!0===i.singleTag,s="string"==typeof i.container?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(n){var d=a.indexOf(s);-1===d&&(d=a.push(s)-1,o[d]={}),t=o[d]&&o[d][r]?o[d][r]:o[d][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),i.attributes)for(var t=Object.keys(i.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],i.attributes[t[n]]);var a="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(a,e),e}}('.mtf-Divider--noScroll {\n overflow: hidden;\n}\n\n.mtf-Divider::before {\n box-sizing: border-box;\n border-color: var(--theme-color-surface-base-base6);\n position: absolute;\n content: "";\n}\n.mtf-Divider.mtf-Divider--horizontal {\n min-width: 100%;\n position: relative;\n}\n.mtf-Divider.mtf-Divider--horizontal::before {\n width: 100%;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--solid::before {\n border-top-style: solid;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--dashed::before {\n border-top-style: dashed;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--dotted::before {\n border-top-style: dotted;\n}\n.mtf-Divider.mtf-Divider--vertical {\n min-height: 100%;\n position: relative;\n justify-content: center;\n}\n.mtf-Divider.mtf-Divider--vertical::before {\n height: 100%;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--solid::before {\n border-left-style: solid;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--dashed::before {\n border-left-style: dashed;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--dotted::before {\n border-left-style: dotted;\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--horizontal {\n height: var(--base-sizing-1x);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-1x);\n top: calc(50% - var(--base-sizing-1x) / 2);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--vertical {\n width: var(--base-sizing-1x);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-1x);\n left: calc(50% - var(--base-sizing-1x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-sm.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-6x);\n}\n.mtf-Divider.mtf-Divider--gap-sm.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-6x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--horizontal {\n height: var(--base-sizing-2x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-2x);\n top: calc(50% - var(--base-sizing-2x) / 2);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--vertical {\n width: var(--base-sizing-2x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-2x);\n left: calc(50% - var(--base-sizing-2x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-md.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-12x);\n}\n.mtf-Divider.mtf-Divider--gap-md.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-12x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--horizontal {\n height: var(--base-sizing-4x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-4x);\n top: calc(50% - var(--base-sizing-4x) / 2);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--vertical {\n width: var(--base-sizing-4x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-4x);\n left: calc(50% - var(--base-sizing-4x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-lg.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-18x);\n}\n.mtf-Divider.mtf-Divider--gap-lg.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-18x);\n}',{});const usePropsWithThemeDefaults=(e,t)=>{const r=i.useContext(n).componentDefaults[e],a=!!r?.className&&!!t.className&&`${r.className} ${t.className}`;return{...r,...t,...a&&{className:a}}},Divider=i=>{const{size:t="md",orientation:r="horizontal",gap:n="md",shape:a="solid",style:o,className:d,ref:m}=usePropsWithThemeDefaults("Divider",i),f=(l=d,D=[t,r,`gap-${n}`,a],[(v=s).Root,...(D||[]).flat().filter(e=>!!e&&!!v[e]).map(e=>v[e]),l??""].join(" ").trim()||void 0);var v,l,D;return e.jsx("div",{ref:m,className:f,"data-testid":"dividerItem",style:o})};Divider.displayName="Divider",exports.Divider=Divider,exports.EDKUIProvider=r=>{const[a,o]=i.useState(r.componentDefaults||{}),[s,d]=i.useState(r.baseIconClass||t),[m,f]=i.useState(r.locale||"tr"),[v,l]=i.useState(r.font),[D,b]=i.useState(r.theme),g=i.useMemo(()=>D?((e,i="--theme")=>{const t={},traverse=(e,i)=>{e&&"object"==typeof e&&Object.entries(e).forEach(([e,r])=>{const n=camelToKebab(e),a=`${i}-${n}`;r&&"object"==typeof r&&!Array.isArray(r)?Object.values(r).every(e=>"string"==typeof e||"number"==typeof e||null==e)?Object.entries(r).forEach(([e,i])=>{if(null!=i&&("string"==typeof i||"number"==typeof i)){const r=camelToKebab(e);t[`${a}-${r}`]=String(i)}}):traverse(r,a):"string"!=typeof r&&"number"!=typeof r||(t[a]=String(r))})};return traverse(e,i),t})(D):{},[D]);i.useInsertionEffect(()=>{const e=document.documentElement;return Object.entries(g).forEach(([i,t])=>{e.style.setProperty(i,t)}),v&&e.style.setProperty("--theme-typography-font-family",v),()=>{Object.keys(g).forEach(i=>{e.style.removeProperty(i)}),e.style.removeProperty("--theme-typography-font-family")}},[v,g]);const h=i.useMemo(()=>({componentDefaults:a,locale:m,baseIconClass:s,theme:D,setBaseIconClass:d,setComponentDefaults:o,setLocale:f,setFont:l,setTheme:b}),[s,a,m,D]);return e.jsx(n,{value:h,children:r.children})};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CSSProperties, Ref, PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
type Size3 = "sm" | "md" | "lg";
|
|
5
|
+
type StandardProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
type RefType<R> = {
|
|
10
|
+
ref?: Ref<R>;
|
|
11
|
+
};
|
|
12
|
+
type PropsWithRef<P = unknown, R = unknown> = P & StandardProps & RefType<R>;
|
|
13
|
+
|
|
14
|
+
type DividerProps = {
|
|
15
|
+
orientation?: "vertical" | "horizontal";
|
|
16
|
+
size?: Size3;
|
|
17
|
+
gap?: Size3;
|
|
18
|
+
shape?: "dotted" | "dashed" | "solid";
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type ComponentDefaultableProps = {
|
|
22
|
+
Divider?: DividerProps;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* COLORS
|
|
27
|
+
*/
|
|
28
|
+
type ColorSurface = {
|
|
29
|
+
primary?: ExtendedColorStateVariations;
|
|
30
|
+
secondary?: Partial<ColorStateVariations & {
|
|
31
|
+
negative?: string;
|
|
32
|
+
}>;
|
|
33
|
+
info?: ExtendedColorStateVariations;
|
|
34
|
+
danger?: ExtendedColorStateVariations;
|
|
35
|
+
success?: ExtendedColorStateVariations;
|
|
36
|
+
warning?: ExtendedColorStateVariations;
|
|
37
|
+
light?: ExtendedColorStateVariations;
|
|
38
|
+
base?: {
|
|
39
|
+
bgLight?: string;
|
|
40
|
+
bgDark?: string;
|
|
41
|
+
base1?: string;
|
|
42
|
+
base2?: string;
|
|
43
|
+
base3?: string;
|
|
44
|
+
base4?: string;
|
|
45
|
+
base5?: string;
|
|
46
|
+
base6?: string;
|
|
47
|
+
base7?: string;
|
|
48
|
+
base8?: string;
|
|
49
|
+
globalLight?: string;
|
|
50
|
+
lightOverlay50?: string;
|
|
51
|
+
lightOverlay75?: string;
|
|
52
|
+
lightOverlay90?: string;
|
|
53
|
+
lightOverlay25?: string;
|
|
54
|
+
darkOverlay15?: string;
|
|
55
|
+
darkOverlay50?: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type ColorBorder = {
|
|
59
|
+
light?: ColorStateVariations;
|
|
60
|
+
primary?: ColorStateVariations & {
|
|
61
|
+
focus?: string;
|
|
62
|
+
};
|
|
63
|
+
secondary?: ColorStateVariations;
|
|
64
|
+
info?: ColorStateVariations;
|
|
65
|
+
danger?: ColorStateVariations;
|
|
66
|
+
success?: ColorStateVariations;
|
|
67
|
+
warning?: ColorStateVariations;
|
|
68
|
+
};
|
|
69
|
+
type ColorText = {
|
|
70
|
+
base?: {
|
|
71
|
+
textDark?: string;
|
|
72
|
+
textLight?: string;
|
|
73
|
+
title?: string;
|
|
74
|
+
titleLight?: string;
|
|
75
|
+
subtitle?: string;
|
|
76
|
+
subtitleLight?: string;
|
|
77
|
+
caption?: string;
|
|
78
|
+
captionLight?: string;
|
|
79
|
+
disabled?: string;
|
|
80
|
+
disabledLight?: string;
|
|
81
|
+
globalDark?: string;
|
|
82
|
+
globalLight?: string;
|
|
83
|
+
darkOverlay25?: string;
|
|
84
|
+
darkOverlay40?: string;
|
|
85
|
+
darkOverlay50?: string;
|
|
86
|
+
darkOverlay75?: string;
|
|
87
|
+
lightOverlay50?: string;
|
|
88
|
+
lightOverlay75?: string;
|
|
89
|
+
lightOverlay90?: string;
|
|
90
|
+
defaultOverlay50?: string;
|
|
91
|
+
};
|
|
92
|
+
primary?: ColorStateVariations & {
|
|
93
|
+
opposite?: string;
|
|
94
|
+
};
|
|
95
|
+
secondary?: ColorStateVariations;
|
|
96
|
+
light?: ColorStateVariations;
|
|
97
|
+
info?: ColorStateVariations;
|
|
98
|
+
danger?: ColorStateVariations;
|
|
99
|
+
success?: ColorStateVariations;
|
|
100
|
+
warning?: ColorStateVariations;
|
|
101
|
+
};
|
|
102
|
+
type ColorSemantic = {
|
|
103
|
+
primary?: ColorScale<"primary">;
|
|
104
|
+
secondary?: ColorScale<"secondary">;
|
|
105
|
+
neutral?: ColorScale<"neutral">;
|
|
106
|
+
accent?: ColorScale<"accent">;
|
|
107
|
+
info?: ColorScale<"info">;
|
|
108
|
+
success?: ColorScale<"success">;
|
|
109
|
+
warning?: ColorScale<"warning">;
|
|
110
|
+
danger?: ColorScale<"danger">;
|
|
111
|
+
flag?: ColorScale<"flag">;
|
|
112
|
+
grayscale?: ColorScale<"grayscale">;
|
|
113
|
+
base?: ColorScale<"base">;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* TYPOGRAPHY
|
|
117
|
+
*/
|
|
118
|
+
type Typography = {
|
|
119
|
+
fontFamily?: string;
|
|
120
|
+
heading?: {
|
|
121
|
+
[K in `heading${1 | 2 | 3 | 4 | 5 | 6}`]?: TypographyStyle;
|
|
122
|
+
};
|
|
123
|
+
display?: {
|
|
124
|
+
[K in `${"lg" | "md" | "sm"}`]?: TypographyStyle;
|
|
125
|
+
};
|
|
126
|
+
body?: {
|
|
127
|
+
[K in `${"lg" | "md" | "sm" | "xs" | "xxs"}`]?: TypographyStyle;
|
|
128
|
+
};
|
|
129
|
+
base?: {
|
|
130
|
+
[K in "xl" | "lg" | "md" | "sm" | "xs" | "xxs"]?: {
|
|
131
|
+
[J in `${K}-${500 | 600 | 700}`]?: TypographyStyle;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* SIZING AND SPACING
|
|
137
|
+
*/
|
|
138
|
+
type Sizing = {
|
|
139
|
+
radius?: {
|
|
140
|
+
default?: string;
|
|
141
|
+
round?: string;
|
|
142
|
+
};
|
|
143
|
+
limit?: {
|
|
144
|
+
inputMinWidth?: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* ELEVATION AND SHADOW
|
|
149
|
+
*/
|
|
150
|
+
type Elevation = {
|
|
151
|
+
[K in `elevation${1 | 2 | 3 | 4 | 5 | 6}`]?: ElevationStyle;
|
|
152
|
+
} & {
|
|
153
|
+
focusring?: ElevationStyle;
|
|
154
|
+
focusringWhite?: ElevationStyle;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* GRID SYSTEM
|
|
158
|
+
*/
|
|
159
|
+
type Grid = {
|
|
160
|
+
gutter?: {
|
|
161
|
+
gutter?: string;
|
|
162
|
+
};
|
|
163
|
+
breakpoint?: GridBreakpoint;
|
|
164
|
+
container?: GridBreakpoint;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Helping types
|
|
168
|
+
*/
|
|
169
|
+
type ColorScale<T extends string> = {
|
|
170
|
+
[K in `${T}-${50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900}`]?: string;
|
|
171
|
+
};
|
|
172
|
+
type ElevationStyle = {
|
|
173
|
+
x?: string;
|
|
174
|
+
y?: string;
|
|
175
|
+
blur?: string;
|
|
176
|
+
spread?: string;
|
|
177
|
+
shadow?: string;
|
|
178
|
+
};
|
|
179
|
+
type GridBreakpoint = {
|
|
180
|
+
sm?: string;
|
|
181
|
+
md?: string;
|
|
182
|
+
lg?: string;
|
|
183
|
+
xl?: string;
|
|
184
|
+
};
|
|
185
|
+
type ColorStateVariations = {
|
|
186
|
+
default?: string;
|
|
187
|
+
hover?: string;
|
|
188
|
+
active?: string;
|
|
189
|
+
disabled?: string;
|
|
190
|
+
};
|
|
191
|
+
type ExtendedColorStateVariations = ColorStateVariations & {
|
|
192
|
+
negative?: string;
|
|
193
|
+
inverse?: string;
|
|
194
|
+
};
|
|
195
|
+
type TypographyStyle = {
|
|
196
|
+
fontSize?: string;
|
|
197
|
+
fontFamily?: string;
|
|
198
|
+
fontWeight?: string | number;
|
|
199
|
+
fontStyle?: string;
|
|
200
|
+
lineHeight?: string;
|
|
201
|
+
letterSpacing?: string;
|
|
202
|
+
textDecoration?: string;
|
|
203
|
+
textCase?: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type MotifProviderProps = {
|
|
207
|
+
locale?: Locale;
|
|
208
|
+
baseIconClass?: string;
|
|
209
|
+
componentDefaults?: ComponentDefaults;
|
|
210
|
+
font?: string;
|
|
211
|
+
theme?: Theme;
|
|
212
|
+
};
|
|
213
|
+
type Locale = "tr" | "en";
|
|
214
|
+
type Theme = {
|
|
215
|
+
color?: {
|
|
216
|
+
surface?: ColorSurface;
|
|
217
|
+
border?: ColorBorder;
|
|
218
|
+
text?: ColorText;
|
|
219
|
+
semantic?: ColorSemantic;
|
|
220
|
+
};
|
|
221
|
+
typography?: Typography;
|
|
222
|
+
sizing?: Sizing;
|
|
223
|
+
elevation?: Elevation;
|
|
224
|
+
grid?: Grid;
|
|
225
|
+
opacity?: Record<string, string | number>;
|
|
226
|
+
};
|
|
227
|
+
type ComponentDefaults = ComponentDefaultsWithStandardProps<ComponentDefaultableProps, StandardProps>;
|
|
228
|
+
type ComponentDefaultsWithStandardProps<T, TCommon> = {
|
|
229
|
+
[K in keyof T]: T[K] extends infer U ? U & TCommon : never;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
declare const MotifProvider: (props: PropsWithChildren<MotifProviderProps>) => react_jsx_runtime.JSX.Element;
|
|
233
|
+
|
|
234
|
+
declare const Divider: {
|
|
235
|
+
(props: PropsWithRef<DividerProps, HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
236
|
+
displayName: string;
|
|
237
|
+
};
|
|
238
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
239
|
+
|
|
240
|
+
export { Divider, MotifProvider as EDKUIProvider };
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createContext as i,useState as t,useMemo as r,useInsertionEffect as n,useContext as o}from"react";const a="mtf-ui-icons",camelToKebab=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),d=i({locale:"tr",baseIconClass:a,componentDefaults:{},setBaseIconClass:()=>{},setLocale:()=>{},setFont:()=>{},setComponentDefaults:()=>{},setTheme:()=>{}}),MotifProvider=i=>{const[o,s]=t(i.componentDefaults||{}),[m,f]=t(i.baseIconClass||a),[v,l]=t(i.locale||"tr"),[D,b]=t(i.font),[g,h]=t(i.theme),p=r(()=>g?((e,i="--theme")=>{const t={},traverse=(e,i)=>{e&&"object"==typeof e&&Object.entries(e).forEach(([e,r])=>{const n=camelToKebab(e),o=`${i}-${n}`;r&&"object"==typeof r&&!Array.isArray(r)?Object.values(r).every(e=>"string"==typeof e||"number"==typeof e||null==e)?Object.entries(r).forEach(([e,i])=>{if(null!=i&&("string"==typeof i||"number"==typeof i)){const r=camelToKebab(e);t[`${o}-${r}`]=String(i)}}):traverse(r,o):"string"!=typeof r&&"number"!=typeof r||(t[o]=String(r))})};return traverse(e,i),t})(g):{},[g]);n(()=>{const e=document.documentElement;return Object.entries(p).forEach(([i,t])=>{e.style.setProperty(i,t)}),D&&e.style.setProperty("--theme-typography-font-family",D),()=>{Object.keys(p).forEach(i=>{e.style.removeProperty(i)}),e.style.removeProperty("--theme-typography-font-family")}},[D,p]);const y=r(()=>({componentDefaults:o,locale:v,baseIconClass:m,theme:g,setBaseIconClass:f,setComponentDefaults:s,setLocale:l,setFont:b,setTheme:h}),[m,o,v,g]);return e(d,{value:y,children:i.children})};var s=[],m=[];var f={noScroll:"mtf-Divider--noScroll",Root:"mtf-Divider",horizontal:"mtf-Divider--horizontal",solid:"mtf-Divider--solid",dashed:"mtf-Divider--dashed",dotted:"mtf-Divider--dotted",vertical:"mtf-Divider--vertical",sm:"mtf-Divider--sm","gap-sm":"mtf-Divider--gap-sm",md:"mtf-Divider--md","gap-md":"mtf-Divider--gap-md",lg:"mtf-Divider--lg","gap-lg":"mtf-Divider--gap-lg"};!function(e,i){if(e&&"undefined"!=typeof document){var t,r=!0===i.prepend?"prepend":"append",n=!0===i.singleTag,o="string"==typeof i.container?document.querySelector(i.container):document.getElementsByTagName("head")[0];if(n){var a=s.indexOf(o);-1===a&&(a=s.push(o)-1,m[a]={}),t=m[a]&&m[a][r]?m[a][r]:m[a][r]=c()}else t=c();65279===e.charCodeAt(0)&&(e=e.substring(1)),t.styleSheet?t.styleSheet.cssText+=e:t.appendChild(document.createTextNode(e))}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),i.attributes)for(var t=Object.keys(i.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],i.attributes[t[n]]);var a="prepend"===r?"afterbegin":"beforeend";return o.insertAdjacentElement(a,e),e}}('.mtf-Divider--noScroll {\n overflow: hidden;\n}\n\n.mtf-Divider::before {\n box-sizing: border-box;\n border-color: var(--theme-color-surface-base-base6);\n position: absolute;\n content: "";\n}\n.mtf-Divider.mtf-Divider--horizontal {\n min-width: 100%;\n position: relative;\n}\n.mtf-Divider.mtf-Divider--horizontal::before {\n width: 100%;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--solid::before {\n border-top-style: solid;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--dashed::before {\n border-top-style: dashed;\n}\n.mtf-Divider.mtf-Divider--horizontal.mtf-Divider--dotted::before {\n border-top-style: dotted;\n}\n.mtf-Divider.mtf-Divider--vertical {\n min-height: 100%;\n position: relative;\n justify-content: center;\n}\n.mtf-Divider.mtf-Divider--vertical::before {\n height: 100%;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--solid::before {\n border-left-style: solid;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--dashed::before {\n border-left-style: dashed;\n}\n.mtf-Divider.mtf-Divider--vertical.mtf-Divider--dotted::before {\n border-left-style: dotted;\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--horizontal {\n height: var(--base-sizing-1x);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-1x);\n top: calc(50% - var(--base-sizing-1x) / 2);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--vertical {\n width: var(--base-sizing-1x);\n}\n.mtf-Divider.mtf-Divider--sm.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-1x);\n left: calc(50% - var(--base-sizing-1x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-sm.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-6x);\n}\n.mtf-Divider.mtf-Divider--gap-sm.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-6x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--horizontal {\n height: var(--base-sizing-2x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-2x);\n top: calc(50% - var(--base-sizing-2x) / 2);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--vertical {\n width: var(--base-sizing-2x);\n}\n.mtf-Divider.mtf-Divider--md.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-2x);\n left: calc(50% - var(--base-sizing-2x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-md.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-12x);\n}\n.mtf-Divider.mtf-Divider--gap-md.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-12x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--horizontal {\n height: var(--base-sizing-4x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--horizontal::before {\n border-top-width: var(--base-sizing-4x);\n top: calc(50% - var(--base-sizing-4x) / 2);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--vertical {\n width: var(--base-sizing-4x);\n}\n.mtf-Divider.mtf-Divider--lg.mtf-Divider--vertical::before {\n border-left-width: var(--base-sizing-4x);\n left: calc(50% - var(--base-sizing-4x) / 2);\n}\n.mtf-Divider.mtf-Divider--gap-lg.mtf-Divider--horizontal {\n margin-block: var(--base-sizing-18x);\n}\n.mtf-Divider.mtf-Divider--gap-lg.mtf-Divider--vertical {\n margin-inline: var(--base-sizing-18x);\n}',{});const usePropsWithThemeDefaults=(e,i)=>{const t=o(d).componentDefaults[e],r=!!t?.className&&!!i.className&&`${t.className} ${i.className}`;return{...t,...i,...r&&{className:r}}},Divider=i=>{const{size:t="md",orientation:r="horizontal",gap:n="md",shape:o="solid",style:a,className:d,ref:s}=usePropsWithThemeDefaults("Divider",i),m=(l=d,D=[t,r,`gap-${n}`,o],[(v=f).Root,...(D||[]).flat().filter(e=>!!e&&!!v[e]).map(e=>v[e]),l??""].join(" ").trim()||void 0);var v,l,D;return e("div",{ref:s,className:m,"data-testid":"dividerItem",style:a})};Divider.displayName="Divider";export{Divider,MotifProvider as EDKUIProvider};
|