tintora 1.1.0 → 1.3.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/README.md +16 -0
- package/dist/Alert/Alert2.cjs +1 -0
- package/dist/Alert/Alert2.js +73 -0
- package/dist/Avatar/Avatar2.cjs +1 -0
- package/dist/Avatar/Avatar2.js +23 -0
- package/dist/Avatar/utils.cjs +1 -0
- package/dist/Avatar/utils.js +8 -0
- package/dist/BottomSheet/BottomSheet2.cjs +1 -0
- package/dist/BottomSheet/BottomSheet2.js +51 -0
- package/dist/Button/Button2.cjs +1 -0
- package/dist/Button/Button2.js +42 -0
- package/dist/Card/Card2.cjs +1 -0
- package/dist/Card/Card2.js +20 -0
- package/dist/Checkbox/Checkbox2.cjs +1 -0
- package/dist/Checkbox/Checkbox2.js +52 -0
- package/dist/Chip/Chip2.cjs +1 -0
- package/dist/Chip/Chip2.js +15 -0
- package/dist/Dot/Dot2.cjs +1 -0
- package/dist/Dot/Dot2.js +15 -0
- package/dist/Drawer/Drawer2.cjs +1 -0
- package/dist/Drawer/Drawer2.js +33 -0
- package/dist/IconButton/IconButton2.cjs +1 -0
- package/dist/IconButton/IconButton2.js +27 -0
- package/dist/Link/Link.d.ts +23 -0
- package/dist/Link/Link2.cjs +1 -0
- package/dist/Link/Link2.js +12 -0
- package/dist/Modal/Modal2.cjs +1 -0
- package/dist/Modal/Modal2.js +71 -0
- package/dist/Popover/Popover2.cjs +1 -0
- package/dist/Popover/Popover2.js +70 -0
- package/dist/ProgressBar/ProgressBar2.cjs +1 -0
- package/dist/ProgressBar/ProgressBar2.js +40 -0
- package/dist/Radio/Radio2.cjs +1 -0
- package/dist/Radio/Radio2.js +27 -0
- package/dist/Radio/RadioContext.cjs +1 -0
- package/dist/Radio/RadioContext.js +11 -0
- package/dist/Radio/RadioGroup.cjs +1 -0
- package/dist/Radio/RadioGroup.js +26 -0
- package/dist/SearchInput/SearchInput2.cjs +1 -0
- package/dist/SearchInput/SearchInput2.js +30 -0
- package/dist/Select/Select2.cjs +1 -0
- package/dist/Select/Select2.js +128 -0
- package/dist/Select/SelectContext.cjs +1 -0
- package/dist/Select/SelectContext.js +10 -0
- package/dist/Select/SelectOption.cjs +1 -0
- package/dist/Select/SelectOption.js +20 -0
- package/dist/SettingsRow/SettingsRow2.cjs +1 -0
- package/dist/SettingsRow/SettingsRow2.js +22 -0
- package/dist/Skeleton/Skeleton2.cjs +1 -0
- package/dist/Skeleton/Skeleton2.js +21 -0
- package/dist/Spinner/Spinner2.cjs +1 -0
- package/dist/Spinner/Spinner2.js +47 -0
- package/dist/Switch/Switch2.cjs +1 -0
- package/dist/Switch/Switch2.js +29 -0
- package/dist/Tabs/Tab.cjs +1 -0
- package/dist/Tabs/Tab.js +22 -0
- package/dist/Tabs/Tabs2.cjs +1 -0
- package/dist/Tabs/Tabs2.js +40 -0
- package/dist/Tabs/TabsContext.cjs +1 -0
- package/dist/Tabs/TabsContext.js +11 -0
- package/dist/Tag/Tag2.cjs +1 -0
- package/dist/Tag/Tag2.js +13 -0
- package/dist/TextField/TextField2.cjs +1 -0
- package/dist/TextField/TextField2.js +34 -0
- package/dist/Toast/Toast2.cjs +1 -0
- package/dist/Toast/Toast2.js +74 -0
- package/dist/Toast/ToastIcons.cjs +1 -0
- package/dist/Toast/ToastIcons.js +77 -0
- package/dist/Toggle/Toggle2.cjs +1 -0
- package/dist/Toggle/Toggle2.js +57 -0
- package/dist/Toggle/ToggleContext.cjs +1 -0
- package/dist/Toggle/ToggleContext.js +11 -0
- package/dist/Toggle/ToggleItem.cjs +1 -0
- package/dist/Toggle/ToggleItem.js +21 -0
- package/dist/Tooltip/Tooltip2.cjs +1 -0
- package/dist/Tooltip/Tooltip2.js +66 -0
- package/dist/hooks/useCheckedState.cjs +1 -0
- package/dist/hooks/useCheckedState.js +13 -0
- package/dist/hooks/useEscapeKey.cjs +1 -0
- package/dist/hooks/useEscapeKey.js +15 -0
- package/dist/hooks/useLatest.cjs +1 -0
- package/dist/hooks/useLatest.js +10 -0
- package/dist/hooks/useOutsidePress.cjs +1 -0
- package/dist/hooks/useOutsidePress.js +19 -0
- package/dist/hooks/useTopLayerPosition.cjs +1 -0
- package/dist/hooks/useTopLayerPosition.js +25 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +32 -1294
- package/dist/tintora.css +1 -1
- package/dist/utils/clsx.cjs +1 -0
- package/dist/utils/clsx.d.ts +9 -0
- package/dist/utils/clsx.js +6 -0
- package/dist/utils/outside.cjs +1 -0
- package/dist/utils/outside.js +8 -0
- package/dist/utils/placement.cjs +1 -0
- package/dist/utils/placement.js +53 -0
- package/package.json +5 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime"),n=require("react");function r({title:r,progress:i,indeterminate:a,valueLabel:o,className:s,"aria-label":c}){let l=(0,n.useId)(),u=a?void 0:Math.min(100,Math.max(0,Number.isFinite(i)?i:0)),d=u===100,f=o??(a?`Indeterminate`:`${u}%`);return(0,t.jsxs)(`div`,{className:e.clsx(`tintora-progress-bar`,s),children:[r&&(0,t.jsxs)(`div`,{className:`tintora-progress-bar__header`,children:[(0,t.jsx)(`span`,{id:l,children:r}),(0,t.jsx)(`span`,{className:`tintora-progress-bar__value`,children:f})]}),(0,t.jsx)(`div`,{role:`progressbar`,"aria-label":c,"aria-labelledby":r?l:void 0,"aria-valuemin":a?void 0:0,"aria-valuemax":a?void 0:100,"aria-valuenow":u,"aria-valuetext":o,className:`tintora-progress-bar__track`,children:(0,t.jsx)(`div`,{className:e.clsx(`tintora-progress-bar__fill`,{"tintora-progress-bar__fill--indeterminate":a,"tintora-progress-bar__fill--complete":d}),style:u===void 0?void 0:{width:`${u}%`}})})]})}exports.ProgressBar=r;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
import { useId as r } from "react";
|
|
6
|
+
//#region src/ProgressBar/ProgressBar.tsx
|
|
7
|
+
function i({ title: i, progress: a, indeterminate: o, valueLabel: s, className: c, "aria-label": l }) {
|
|
8
|
+
let u = r(), d = o ? void 0 : Math.min(100, Math.max(0, Number.isFinite(a) ? a : 0)), f = d === 100, p = s ?? (o ? "Indeterminate" : `${d}%`);
|
|
9
|
+
return /* @__PURE__ */ n("div", {
|
|
10
|
+
className: e("tintora-progress-bar", c),
|
|
11
|
+
children: [i && /* @__PURE__ */ n("div", {
|
|
12
|
+
className: "tintora-progress-bar__header",
|
|
13
|
+
children: [/* @__PURE__ */ t("span", {
|
|
14
|
+
id: u,
|
|
15
|
+
children: i
|
|
16
|
+
}), /* @__PURE__ */ t("span", {
|
|
17
|
+
className: "tintora-progress-bar__value",
|
|
18
|
+
children: p
|
|
19
|
+
})]
|
|
20
|
+
}), /* @__PURE__ */ t("div", {
|
|
21
|
+
role: "progressbar",
|
|
22
|
+
"aria-label": l,
|
|
23
|
+
"aria-labelledby": i ? u : void 0,
|
|
24
|
+
"aria-valuemin": o ? void 0 : 0,
|
|
25
|
+
"aria-valuemax": o ? void 0 : 100,
|
|
26
|
+
"aria-valuenow": d,
|
|
27
|
+
"aria-valuetext": s,
|
|
28
|
+
className: "tintora-progress-bar__track",
|
|
29
|
+
children: /* @__PURE__ */ t("div", {
|
|
30
|
+
className: e("tintora-progress-bar__fill", {
|
|
31
|
+
"tintora-progress-bar__fill--indeterminate": o,
|
|
32
|
+
"tintora-progress-bar__fill--complete": f
|
|
33
|
+
}),
|
|
34
|
+
style: d === void 0 ? void 0 : { width: `${d}%` }
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { i as ProgressBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("./RadioContext.cjs");;/* empty css */let n=require("react/jsx-runtime");function r({value:r,className:i,disabled:a,...o}){let s=t.useRadioContext();return(0,n.jsxs)(`span`,{className:e.clsx(`tintora-radio`,i),children:[(0,n.jsx)(`input`,{...o,type:`radio`,className:`tintora-radio__input`,name:s.name,value:r,checked:s.value===r,disabled:a||s.disabled,onChange:()=>s.select(r)}),(0,n.jsx)(`span`,{className:`tintora-radio__circle`,"aria-hidden":`true`})]})}exports.Radio=r;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { useRadioContext as t } from "./RadioContext.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
//#region src/Radio/Radio.tsx
|
|
7
|
+
function i({ value: i, className: a, disabled: o, ...s }) {
|
|
8
|
+
let c = t();
|
|
9
|
+
return /* @__PURE__ */ r("span", {
|
|
10
|
+
className: e("tintora-radio", a),
|
|
11
|
+
children: [/* @__PURE__ */ n("input", {
|
|
12
|
+
...s,
|
|
13
|
+
type: "radio",
|
|
14
|
+
className: "tintora-radio__input",
|
|
15
|
+
name: c.name,
|
|
16
|
+
value: i,
|
|
17
|
+
checked: c.value === i,
|
|
18
|
+
disabled: o || c.disabled,
|
|
19
|
+
onChange: () => c.select(i)
|
|
20
|
+
}), /* @__PURE__ */ n("span", {
|
|
21
|
+
className: "tintora-radio__circle",
|
|
22
|
+
"aria-hidden": "true"
|
|
23
|
+
})]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as Radio };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";let e=require("react");var t=(0,e.createContext)(null);function n(){let n=(0,e.useContext)(t);if(!n)throw Error(`Radio must be rendered inside a RadioGroup`);return n}exports.RadioContext=t,exports.useRadioContext=n;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as t } from "react";
|
|
3
|
+
//#region src/Radio/RadioContext.ts
|
|
4
|
+
var n = e(null);
|
|
5
|
+
function r() {
|
|
6
|
+
let e = t(n);
|
|
7
|
+
if (!e) throw Error("Radio must be rendered inside a RadioGroup");
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as RadioContext, r as useRadioContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("./RadioContext.cjs");let n=require("react/jsx-runtime"),r=require("react");function i({value:i,defaultValue:a,onValueChange:o,disabled:s=!1,name:c,className:l,...u}){let d=(0,r.useId)(),[f,p]=(0,r.useState)(a??null),m=i!==void 0,h=m?i:f;return(0,n.jsx)(t.RadioContext.Provider,{value:{name:c??d,value:h,select:e=>{e!==h&&(m||p(e),o?.(e))},disabled:s},children:(0,n.jsx)(`div`,{...u,role:`radiogroup`,className:e.clsx(`tintora-radio-group`,l)})})}exports.RadioGroup=i;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { RadioContext as t } from "./RadioContext.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { useId as r, useState as i } from "react";
|
|
6
|
+
//#region src/Radio/RadioGroup.tsx
|
|
7
|
+
function a({ value: a, defaultValue: o, onValueChange: s, disabled: c = !1, name: l, className: u, ...d }) {
|
|
8
|
+
let f = r(), [p, m] = i(o ?? null), h = a !== void 0, g = h ? a : p;
|
|
9
|
+
return /* @__PURE__ */ n(t.Provider, {
|
|
10
|
+
value: {
|
|
11
|
+
name: l ?? f,
|
|
12
|
+
value: g,
|
|
13
|
+
select: (e) => {
|
|
14
|
+
e !== g && (h || m(e), s?.(e));
|
|
15
|
+
},
|
|
16
|
+
disabled: c
|
|
17
|
+
},
|
|
18
|
+
children: /* @__PURE__ */ n("div", {
|
|
19
|
+
...d,
|
|
20
|
+
role: "radiogroup",
|
|
21
|
+
className: e("tintora-radio-group", u)
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { a as RadioGroup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime");function n({className:n,disabled:r,...i}){return(0,t.jsxs)(`label`,{className:e.clsx(`tintora-search-input`,r&&`tintora-search-input--disabled`,n),children:[(0,t.jsxs)(`svg`,{className:`tintora-search-input__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,t.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,t.jsx)(`path`,{d:`M20 20l-3.5-3.5`})]}),(0,t.jsx)(`input`,{...i,type:`search`,disabled:r,className:`tintora-search-input__input`})]})}exports.SearchInput=n;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/SearchInput/SearchInput.tsx
|
|
5
|
+
function r({ className: r, disabled: i, ...a }) {
|
|
6
|
+
return /* @__PURE__ */ n("label", {
|
|
7
|
+
className: e("tintora-search-input", i && "tintora-search-input--disabled", r),
|
|
8
|
+
children: [/* @__PURE__ */ n("svg", {
|
|
9
|
+
className: "tintora-search-input__icon",
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "2",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: [/* @__PURE__ */ t("circle", {
|
|
17
|
+
cx: "11",
|
|
18
|
+
cy: "11",
|
|
19
|
+
r: "7"
|
|
20
|
+
}), /* @__PURE__ */ t("path", { d: "M20 20l-3.5-3.5" })]
|
|
21
|
+
}), /* @__PURE__ */ t("input", {
|
|
22
|
+
...a,
|
|
23
|
+
type: "search",
|
|
24
|
+
disabled: i,
|
|
25
|
+
className: "tintora-search-input__input"
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as SearchInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("../hooks/useOutsidePress.cjs"),n=require("../hooks/useTopLayerPosition.cjs");;/* empty css */const r=require("./SelectContext.cjs"),i=require("./SelectOption.cjs");let a=require("react/jsx-runtime"),o=require("react");var s=4;function c({defaultValue:c,options:l,disabled:u,value:d,placeholder:f,onValueChange:p,name:m,className:h,onClick:g,onKeyDown:_,onKeyUp:v,"aria-label":y,...b}){let x=(0,o.useId)(),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),[T,E]=(0,o.useState)(c??null),[D,O]=(0,o.useState)(!1),[k,A]=(0,o.useState)(-1),j=d!==void 0,M=j?d:T,N=l.findIndex(e=>e.value===M),P=e=>l[e]?.disabled!==!0,F=()=>l.findIndex((e,t)=>P(t)),I=(e,t)=>{for(let n=e+t;n>=0&&n<l.length;n+=t)if(P(n))return n;return e},L=()=>{let e=I(l.length,-1);return e===l.length?-1:e},R=e=>l.findIndex(t=>t.value===e),z=()=>{A(N>=0&&P(N)?N:F()),O(!0)},B=()=>O(!1),V=e=>{let t=R(e);t<0||!P(t)||(B(),e!==M&&(j||E(e),p?.(e)))},H=e=>{if(_?.(e),e.defaultPrevented)return;let{key:t}=e;if(t===`Tab`)return B();if(!D){[`Enter`,` `,`ArrowDown`,`ArrowUp`].includes(t)&&(e.preventDefault(),z());return}let n={ArrowDown:()=>k<0?F():I(k,1),ArrowUp:()=>k<0?F():I(k,-1),Home:F,End:L};t in n?(e.preventDefault(),A(n[t]())):t===`Enter`||t===` `?(e.preventDefault(),k>=0?V(l[k].value):B()):t===`Escape`&&(e.preventDefault(),B())},U=e=>{v?.(e),e.key===` `&&e.preventDefault()},W=n.useTopLayerPosition(D,w,()=>{let e=w.current,t=C.current;if(!e||!t)return null;let n=t.getBoundingClientRect(),r=e.offsetHeight,i=n.bottom+s+r<=window.innerHeight,a=n.top-s-r>=0;return{top:i||!a?n.bottom+s:n.top-s-r,left:n.left,minWidth:n.width}},[]),G=e=>{g?.(e),!e.defaultPrevented&&(D?B():z())};t.useOutsidePress(D,S,B),(0,o.useEffect)(()=>{D&&k>=0&&w.current?.children.item(k)?.scrollIntoView?.({block:`nearest`})},[D,k]);let K=e=>`${x}-option-${R(e)}`,q=D?l[k]?.value??null:null,J=l[N]?.label;return(0,a.jsx)(r.SelectContext.Provider,{value:{value:M,activeValue:q,select:V,optionId:K,activate:e=>A(R(e))},children:(0,a.jsxs)(`div`,{ref:S,className:`tintora-select`,children:[(0,a.jsxs)(`button`,{...b,ref:C,type:`button`,role:`combobox`,"aria-label":y,"aria-haspopup":`listbox`,"aria-expanded":D,"aria-controls":D?x:void 0,"aria-activedescendant":q===null?void 0:K(q),disabled:u,className:e.clsx(`tintora-select__trigger`,h),onClick:G,onKeyDown:H,onKeyUp:U,children:[(0,a.jsx)(`span`,{className:e.clsx(`tintora-select__value`,J===void 0&&`tintora-select__value--placeholder`),children:J??f}),(0,a.jsx)(`svg`,{className:`tintora-select__chevron`,width:`10`,height:`10`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{d:`M6 9l6 6 6-6`})})]}),D&&(0,a.jsx)(`div`,{ref:w,id:x,role:`listbox`,"aria-label":y,popover:`manual`,className:`tintora-select__menu`,style:W??{},onMouseDown:e=>e.preventDefault(),children:l.map(e=>(0,a.jsx)(i.SelectOption,{...e},e.value))}),m&&(0,a.jsx)(`input`,{type:`hidden`,name:m,value:M??``,disabled:u})]})})}exports.Select=c;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { useOutsidePress as t } from "../hooks/useOutsidePress.js";
|
|
4
|
+
import { useTopLayerPosition as n } from "../hooks/useTopLayerPosition.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { SelectContext as r } from "./SelectContext.js";
|
|
7
|
+
import { SelectOption as i } from "./SelectOption.js";
|
|
8
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
9
|
+
import { useEffect as s, useId as c, useRef as l, useState as u } from "react";
|
|
10
|
+
//#region src/Select/Select.tsx
|
|
11
|
+
var d = 4;
|
|
12
|
+
function f({ defaultValue: f, options: p, disabled: m, value: h, placeholder: g, onValueChange: _, name: v, className: y, onClick: b, onKeyDown: x, onKeyUp: S, "aria-label": C, ...w }) {
|
|
13
|
+
let T = c(), E = l(null), D = l(null), O = l(null), [k, A] = u(f ?? null), [j, M] = u(!1), [N, P] = u(-1), F = h !== void 0, I = F ? h : k, L = p.findIndex((e) => e.value === I), R = (e) => p[e]?.disabled !== !0, z = () => p.findIndex((e, t) => R(t)), B = (e, t) => {
|
|
14
|
+
for (let n = e + t; n >= 0 && n < p.length; n += t) if (R(n)) return n;
|
|
15
|
+
return e;
|
|
16
|
+
}, V = () => {
|
|
17
|
+
let e = B(p.length, -1);
|
|
18
|
+
return e === p.length ? -1 : e;
|
|
19
|
+
}, H = (e) => p.findIndex((t) => t.value === e), U = () => {
|
|
20
|
+
P(L >= 0 && R(L) ? L : z()), M(!0);
|
|
21
|
+
}, W = () => M(!1), G = (e) => {
|
|
22
|
+
let t = H(e);
|
|
23
|
+
t < 0 || !R(t) || (W(), e !== I && (F || A(e), _?.(e)));
|
|
24
|
+
}, K = (e) => {
|
|
25
|
+
if (x?.(e), e.defaultPrevented) return;
|
|
26
|
+
let { key: t } = e;
|
|
27
|
+
if (t === "Tab") return W();
|
|
28
|
+
if (!j) {
|
|
29
|
+
[
|
|
30
|
+
"Enter",
|
|
31
|
+
" ",
|
|
32
|
+
"ArrowDown",
|
|
33
|
+
"ArrowUp"
|
|
34
|
+
].includes(t) && (e.preventDefault(), U());
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let n = {
|
|
38
|
+
ArrowDown: () => N < 0 ? z() : B(N, 1),
|
|
39
|
+
ArrowUp: () => N < 0 ? z() : B(N, -1),
|
|
40
|
+
Home: z,
|
|
41
|
+
End: V
|
|
42
|
+
};
|
|
43
|
+
t in n ? (e.preventDefault(), P(n[t]())) : t === "Enter" || t === " " ? (e.preventDefault(), N >= 0 ? G(p[N].value) : W()) : t === "Escape" && (e.preventDefault(), W());
|
|
44
|
+
}, q = (e) => {
|
|
45
|
+
S?.(e), e.key === " " && e.preventDefault();
|
|
46
|
+
}, J = n(j, O, () => {
|
|
47
|
+
let e = O.current, t = D.current;
|
|
48
|
+
if (!e || !t) return null;
|
|
49
|
+
let n = t.getBoundingClientRect(), r = e.offsetHeight, i = n.bottom + d + r <= window.innerHeight, a = n.top - d - r >= 0;
|
|
50
|
+
return {
|
|
51
|
+
top: i || !a ? n.bottom + d : n.top - d - r,
|
|
52
|
+
left: n.left,
|
|
53
|
+
minWidth: n.width
|
|
54
|
+
};
|
|
55
|
+
}, []), Y = (e) => {
|
|
56
|
+
b?.(e), !e.defaultPrevented && (j ? W() : U());
|
|
57
|
+
};
|
|
58
|
+
t(j, E, W), s(() => {
|
|
59
|
+
j && N >= 0 && O.current?.children.item(N)?.scrollIntoView?.({ block: "nearest" });
|
|
60
|
+
}, [j, N]);
|
|
61
|
+
let X = (e) => `${T}-option-${H(e)}`, Z = j ? p[N]?.value ?? null : null, Q = p[L]?.label;
|
|
62
|
+
return /* @__PURE__ */ a(r.Provider, {
|
|
63
|
+
value: {
|
|
64
|
+
value: I,
|
|
65
|
+
activeValue: Z,
|
|
66
|
+
select: G,
|
|
67
|
+
optionId: X,
|
|
68
|
+
activate: (e) => P(H(e))
|
|
69
|
+
},
|
|
70
|
+
children: /* @__PURE__ */ o("div", {
|
|
71
|
+
ref: E,
|
|
72
|
+
className: "tintora-select",
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ o("button", {
|
|
75
|
+
...w,
|
|
76
|
+
ref: D,
|
|
77
|
+
type: "button",
|
|
78
|
+
role: "combobox",
|
|
79
|
+
"aria-label": C,
|
|
80
|
+
"aria-haspopup": "listbox",
|
|
81
|
+
"aria-expanded": j,
|
|
82
|
+
"aria-controls": j ? T : void 0,
|
|
83
|
+
"aria-activedescendant": Z === null ? void 0 : X(Z),
|
|
84
|
+
disabled: m,
|
|
85
|
+
className: e("tintora-select__trigger", y),
|
|
86
|
+
onClick: Y,
|
|
87
|
+
onKeyDown: K,
|
|
88
|
+
onKeyUp: q,
|
|
89
|
+
children: [/* @__PURE__ */ a("span", {
|
|
90
|
+
className: e("tintora-select__value", Q === void 0 && "tintora-select__value--placeholder"),
|
|
91
|
+
children: Q ?? g
|
|
92
|
+
}), /* @__PURE__ */ a("svg", {
|
|
93
|
+
className: "tintora-select__chevron",
|
|
94
|
+
width: "10",
|
|
95
|
+
height: "10",
|
|
96
|
+
viewBox: "0 0 24 24",
|
|
97
|
+
fill: "none",
|
|
98
|
+
stroke: "currentColor",
|
|
99
|
+
strokeWidth: "3",
|
|
100
|
+
strokeLinecap: "round",
|
|
101
|
+
strokeLinejoin: "round",
|
|
102
|
+
"aria-hidden": "true",
|
|
103
|
+
children: /* @__PURE__ */ a("path", { d: "M6 9l6 6 6-6" })
|
|
104
|
+
})]
|
|
105
|
+
}),
|
|
106
|
+
j && /* @__PURE__ */ a("div", {
|
|
107
|
+
ref: O,
|
|
108
|
+
id: T,
|
|
109
|
+
role: "listbox",
|
|
110
|
+
"aria-label": C,
|
|
111
|
+
popover: "manual",
|
|
112
|
+
className: "tintora-select__menu",
|
|
113
|
+
style: J ?? {},
|
|
114
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
115
|
+
children: p.map((e) => /* @__PURE__ */ a(i, { ...e }, e.value))
|
|
116
|
+
}),
|
|
117
|
+
v && /* @__PURE__ */ a("input", {
|
|
118
|
+
type: "hidden",
|
|
119
|
+
name: v,
|
|
120
|
+
value: I ?? "",
|
|
121
|
+
disabled: m
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { f as Select };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";let e=require("react");var t=(0,e.createContext)(null),n=()=>{let n=(0,e.useContext)(t);if(!n)throw Error(`SelectOption must be rendered inside a Select`);return n};exports.SelectContext=t,exports.useSelectContext=n;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as t } from "react";
|
|
3
|
+
//#region src/Select/SelectContext.ts
|
|
4
|
+
var n = e(null), r = () => {
|
|
5
|
+
let e = t(n);
|
|
6
|
+
if (!e) throw Error("SelectOption must be rendered inside a Select");
|
|
7
|
+
return e;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as SelectContext, r as useSelectContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("./SelectContext.cjs");let n=require("react/jsx-runtime");function r({label:r,value:i,disabled:a}){let{select:o,activate:s,optionId:c,value:l,activeValue:u}=t.useSelectContext();return(0,n.jsx)(`div`,{id:c(i),role:`option`,"aria-selected":l===i,"aria-disabled":a||void 0,className:e.clsx(`tintora-select__option`,u===i&&`tintora-select__option--active`),onClick:()=>o(i),onMouseMove:()=>!a&&s(i),children:r})}exports.SelectOption=r;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { useSelectContext as t } from "./SelectContext.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/Select/SelectOption.tsx
|
|
6
|
+
function r({ label: r, value: i, disabled: a }) {
|
|
7
|
+
let { select: o, activate: s, optionId: c, value: l, activeValue: u } = t();
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
id: c(i),
|
|
10
|
+
role: "option",
|
|
11
|
+
"aria-selected": l === i,
|
|
12
|
+
"aria-disabled": a || void 0,
|
|
13
|
+
className: e("tintora-select__option", u === i && "tintora-select__option--active"),
|
|
14
|
+
onClick: () => o(i),
|
|
15
|
+
onMouseMove: () => !a && s(i),
|
|
16
|
+
children: r
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { r as SelectOption };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime");function n({title:n,description:r,children:i,controlPosition:a=`end`,className:o,...s}){return(0,t.jsxs)(`div`,{...s,className:e.clsx(`tintora-settings-row`,`tintora-settings-row--control-${a}`,r&&`tintora-settings-row--described`,o),children:[(0,t.jsxs)(`div`,{className:`tintora-settings-row__text`,children:[(0,t.jsx)(`div`,{className:`tintora-settings-row__title`,children:n}),r&&(0,t.jsx)(`div`,{className:`tintora-settings-row__description`,children:r})]}),i]})}exports.SettingsRow=n;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/SettingsRow/SettingsRow.tsx
|
|
5
|
+
function r({ title: r, description: i, children: a, controlPosition: o = "end", className: s, ...c }) {
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
...c,
|
|
8
|
+
className: e("tintora-settings-row", `tintora-settings-row--control-${o}`, i && "tintora-settings-row--described", s),
|
|
9
|
+
children: [/* @__PURE__ */ n("div", {
|
|
10
|
+
className: "tintora-settings-row__text",
|
|
11
|
+
children: [/* @__PURE__ */ t("div", {
|
|
12
|
+
className: "tintora-settings-row__title",
|
|
13
|
+
children: r
|
|
14
|
+
}), i && /* @__PURE__ */ t("div", {
|
|
15
|
+
className: "tintora-settings-row__description",
|
|
16
|
+
children: i
|
|
17
|
+
})]
|
|
18
|
+
}), a]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { r as SettingsRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime");function n({width:n,height:r,className:i,style:a,...o}){let s={...n!==void 0&&{width:n},...r!==void 0&&{height:r}};return(0,t.jsx)(`span`,{...o,"aria-hidden":`true`,className:e.clsx(`tintora-skeleton`,i),style:{...s,...a}})}exports.Skeleton=n;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/Skeleton/Skeleton.tsx
|
|
5
|
+
function n({ width: n, height: r, className: i, style: a, ...o }) {
|
|
6
|
+
let s = {
|
|
7
|
+
...n !== void 0 && { width: n },
|
|
8
|
+
...r !== void 0 && { height: r }
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ t("span", {
|
|
11
|
+
...o,
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
className: e("tintora-skeleton", i),
|
|
14
|
+
style: {
|
|
15
|
+
...s,
|
|
16
|
+
...a
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { n as Skeleton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
;/* empty css */let e=require("react/jsx-runtime");var t={small:{width:16,height:16,strokeWidth:3.5},medium:{width:24,height:24,strokeWidth:3},large:{width:40,height:40,strokeWidth:2.4}};function n({size:n=`medium`,color:r=`accent`}){let{width:i,height:a,strokeWidth:o}=t[n];return(0,e.jsxs)(`svg`,{className:`tintora-spinner`,width:i,height:a,viewBox:`0 0 24 24`,fill:`none`,role:`img`,"aria-label":`Loading`,children:[(0,e.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:r===`accent`?.25:.35,strokeWidth:o}),(0,e.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,stroke:r===`accent`?`var(--tintora-control-fill)`:`currentColor`,strokeWidth:o,strokeLinecap:`round`})]})}exports.SPINNER_SIZE_MAP=t,exports.Spinner=n;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/Spinner/Spinner.tsx
|
|
4
|
+
var n = {
|
|
5
|
+
small: {
|
|
6
|
+
width: 16,
|
|
7
|
+
height: 16,
|
|
8
|
+
strokeWidth: 3.5
|
|
9
|
+
},
|
|
10
|
+
medium: {
|
|
11
|
+
width: 24,
|
|
12
|
+
height: 24,
|
|
13
|
+
strokeWidth: 3
|
|
14
|
+
},
|
|
15
|
+
large: {
|
|
16
|
+
width: 40,
|
|
17
|
+
height: 40,
|
|
18
|
+
strokeWidth: 2.4
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function r({ size: r = "medium", color: i = "accent" }) {
|
|
22
|
+
let { width: a, height: o, strokeWidth: s } = n[r];
|
|
23
|
+
return /* @__PURE__ */ t("svg", {
|
|
24
|
+
className: "tintora-spinner",
|
|
25
|
+
width: a,
|
|
26
|
+
height: o,
|
|
27
|
+
viewBox: "0 0 24 24",
|
|
28
|
+
fill: "none",
|
|
29
|
+
role: "img",
|
|
30
|
+
"aria-label": "Loading",
|
|
31
|
+
children: [/* @__PURE__ */ e("circle", {
|
|
32
|
+
cx: "12",
|
|
33
|
+
cy: "12",
|
|
34
|
+
r: "9",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeOpacity: i === "accent" ? .25 : .35,
|
|
37
|
+
strokeWidth: s
|
|
38
|
+
}), /* @__PURE__ */ e("path", {
|
|
39
|
+
d: "M21 12a9 9 0 0 0-9-9",
|
|
40
|
+
stroke: i === "accent" ? "var(--tintora-control-fill)" : "currentColor",
|
|
41
|
+
strokeWidth: s,
|
|
42
|
+
strokeLinecap: "round"
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { n as SPINNER_SIZE_MAP, r as Spinner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("../hooks/useCheckedState.cjs");;/* empty css */let n=require("react/jsx-runtime");function r({checked:r,defaultChecked:i,onCheckedChange:a,className:o,...s}){let c=t.useCheckedState({checked:r,defaultChecked:i,onCheckedChange:a});return(0,n.jsxs)(`span`,{className:e.clsx(`tintora-switch`,o),children:[(0,n.jsx)(`input`,{...s,type:`checkbox`,role:`switch`,className:`tintora-switch__input`,checked:c.checked,onChange:c.onChange}),(0,n.jsx)(`span`,{className:`tintora-switch__track`,"aria-hidden":`true`})]})}exports.Switch=r;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { useCheckedState as t } from "../hooks/useCheckedState.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
//#region src/Switch/Switch.tsx
|
|
7
|
+
function i({ checked: i, defaultChecked: a, onCheckedChange: o, className: s, ...c }) {
|
|
8
|
+
let l = t({
|
|
9
|
+
checked: i,
|
|
10
|
+
defaultChecked: a,
|
|
11
|
+
onCheckedChange: o
|
|
12
|
+
});
|
|
13
|
+
return /* @__PURE__ */ r("span", {
|
|
14
|
+
className: e("tintora-switch", s),
|
|
15
|
+
children: [/* @__PURE__ */ n("input", {
|
|
16
|
+
...c,
|
|
17
|
+
type: "checkbox",
|
|
18
|
+
role: "switch",
|
|
19
|
+
className: "tintora-switch__input",
|
|
20
|
+
checked: l.checked,
|
|
21
|
+
onChange: l.onChange
|
|
22
|
+
}), /* @__PURE__ */ n("span", {
|
|
23
|
+
className: "tintora-switch__track",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { i as Switch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("./TabsContext.cjs");let n=require("react/jsx-runtime");function r({value:r,className:i,onClick:a,children:o,...s}){let c=t.useTabsContext(),l=c.value===r,u=e=>{a?.(e),e.defaultPrevented||c.select(r)};return(0,n.jsx)(`button`,{...s,type:`button`,role:`tab`,"aria-selected":l,tabIndex:l?0:-1,className:e.clsx(`tintora-tab`,i),onClick:u,children:o})}exports.Tab=r;
|
package/dist/Tabs/Tab.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { useTabsContext as t } from "./TabsContext.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/Tabs/Tab.tsx
|
|
6
|
+
function r({ value: r, className: i, onClick: a, children: o, ...s }) {
|
|
7
|
+
let c = t(), l = c.value === r, u = (e) => {
|
|
8
|
+
a?.(e), e.defaultPrevented || c.select(r);
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ n("button", {
|
|
11
|
+
...s,
|
|
12
|
+
type: "button",
|
|
13
|
+
role: "tab",
|
|
14
|
+
"aria-selected": l,
|
|
15
|
+
tabIndex: l ? 0 : -1,
|
|
16
|
+
className: e("tintora-tab", i),
|
|
17
|
+
onClick: u,
|
|
18
|
+
children: o
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { r as Tab };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("./TabsContext.cjs");;/* empty css */let n=require("react/jsx-runtime"),r=require("react");var i=[`ArrowLeft`,`ArrowRight`,`Home`,`End`];function a({value:a,defaultValue:o,onValueChange:s,variant:c=`segmented`,className:l,children:u,onKeyDown:d,...f}){let[p,m]=(0,r.useState)(o),h=a!==void 0,g=h?a:p,_=e=>{e!==g&&(h||m(e),s?.(e))},v=e=>{if(d?.(e),e.defaultPrevented||!i.includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`)),n=t.indexOf(e.target);if(n<0)return;e.preventDefault();let r=t.length-1,a=e.key===`Home`?0:e.key===`End`?r:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length;t[a].focus(),t[a].click()};return(0,n.jsx)(t.TabsContext.Provider,{value:{value:g,select:_},children:(0,n.jsx)(`div`,{...f,role:`tablist`,className:e.clsx(`tintora-tabs`,`tintora-tabs--${c}`,l),onKeyDown:v,children:u})})}exports.Tabs=a;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
import { TabsContext as t } from "./TabsContext.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { useState as r } from "react";
|
|
7
|
+
//#region src/Tabs/Tabs.tsx
|
|
8
|
+
var i = [
|
|
9
|
+
"ArrowLeft",
|
|
10
|
+
"ArrowRight",
|
|
11
|
+
"Home",
|
|
12
|
+
"End"
|
|
13
|
+
];
|
|
14
|
+
function a({ value: a, defaultValue: o, onValueChange: s, variant: c = "segmented", className: l, children: u, onKeyDown: d, ...f }) {
|
|
15
|
+
let [p, m] = r(o), h = a !== void 0, g = h ? a : p, _ = (e) => {
|
|
16
|
+
e !== g && (h || m(e), s?.(e));
|
|
17
|
+
}, v = (e) => {
|
|
18
|
+
if (d?.(e), e.defaultPrevented || !i.includes(e.key)) return;
|
|
19
|
+
let t = Array.from(e.currentTarget.querySelectorAll("[role=\"tab\"]:not(:disabled)")), n = t.indexOf(e.target);
|
|
20
|
+
if (n < 0) return;
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
let r = t.length - 1, a = e.key === "Home" ? 0 : e.key === "End" ? r : (n + (e.key === "ArrowRight" ? 1 : -1) + t.length) % t.length;
|
|
23
|
+
t[a].focus(), t[a].click();
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ n(t.Provider, {
|
|
26
|
+
value: {
|
|
27
|
+
value: g,
|
|
28
|
+
select: _
|
|
29
|
+
},
|
|
30
|
+
children: /* @__PURE__ */ n("div", {
|
|
31
|
+
...f,
|
|
32
|
+
role: "tablist",
|
|
33
|
+
className: e("tintora-tabs", `tintora-tabs--${c}`, l),
|
|
34
|
+
onKeyDown: v,
|
|
35
|
+
children: u
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as Tabs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";let e=require("react");var t=(0,e.createContext)(null);function n(){let n=(0,e.useContext)(t);if(!n)throw Error(`Tab must be rendered inside Tabs`);return n}exports.TabsContext=t,exports.useTabsContext=n;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as t } from "react";
|
|
3
|
+
//#region src/Tabs/TabsContext.ts
|
|
4
|
+
var n = e(null);
|
|
5
|
+
function r() {
|
|
6
|
+
let e = t(n);
|
|
7
|
+
if (!e) throw Error("Tab must be rendered inside Tabs");
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as TabsContext, r as useTabsContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime");function n({children:n,className:r,variant:i=`neutral`,size:a=`medium`,...o}){return(0,t.jsx)(`span`,{...o,className:e.clsx(`tintora-tag`,`tintora-tag--${i}`,`tintora-tag--${a}`,r),children:n})}exports.Tag=n;
|
package/dist/Tag/Tag2.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/Tag/Tag.tsx
|
|
5
|
+
function n({ children: n, className: r, variant: i = "neutral", size: a = "medium", ...o }) {
|
|
6
|
+
return /* @__PURE__ */ t("span", {
|
|
7
|
+
...o,
|
|
8
|
+
className: e("tintora-tag", `tintora-tag--${i}`, `tintora-tag--${a}`, r),
|
|
9
|
+
children: n
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as Tag };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs");;/* empty css */let t=require("react/jsx-runtime"),n=require("react");function r({label:r,hint:i,error:a,id:o,className:s,disabled:c,"aria-describedby":l,"aria-invalid":u,...d}){let f=(0,n.useId)(),p=o??f,m=`${p}-message`,h=a??i;return(0,t.jsxs)(`div`,{className:e.clsx(`tintora-textfield`,c&&`tintora-textfield--disabled`,s),children:[(0,t.jsx)(`label`,{htmlFor:p,className:`tintora-textfield__label`,children:r}),(0,t.jsx)(`input`,{...d,id:p,disabled:c,className:`tintora-textfield__input`,"aria-invalid":a?!0:u,"aria-describedby":e.clsx(h&&m,l)||void 0}),h&&(0,t.jsx)(`span`,{id:m,className:e.clsx(`tintora-textfield__hint`,a&&`tintora-textfield__hint--error`),children:h})]})}exports.TextField=r;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx as e } from "../utils/clsx.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
5
|
+
import { useId as r } from "react";
|
|
6
|
+
//#region src/TextField/TextField.tsx
|
|
7
|
+
function i({ label: i, hint: a, error: o, id: s, className: c, disabled: l, "aria-describedby": u, "aria-invalid": d, ...f }) {
|
|
8
|
+
let p = r(), m = s ?? p, h = `${m}-message`, g = o ?? a;
|
|
9
|
+
return /* @__PURE__ */ n("div", {
|
|
10
|
+
className: e("tintora-textfield", l && "tintora-textfield--disabled", c),
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ t("label", {
|
|
13
|
+
htmlFor: m,
|
|
14
|
+
className: "tintora-textfield__label",
|
|
15
|
+
children: i
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ t("input", {
|
|
18
|
+
...f,
|
|
19
|
+
id: m,
|
|
20
|
+
disabled: l,
|
|
21
|
+
className: "tintora-textfield__input",
|
|
22
|
+
"aria-invalid": o ? !0 : d,
|
|
23
|
+
"aria-describedby": e(g && h, u) || void 0
|
|
24
|
+
}),
|
|
25
|
+
g && /* @__PURE__ */ t("span", {
|
|
26
|
+
id: h,
|
|
27
|
+
className: e("tintora-textfield__hint", o && "tintora-textfield__hint--error"),
|
|
28
|
+
children: g
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as TextField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const e=require("../utils/clsx.cjs"),t=require("../hooks/useLatest.cjs");;/* empty css */const n=require("./ToastIcons.cjs");let r=require("react/jsx-runtime"),i=require("react");var a={success:(0,r.jsx)(n.SuccessIcon,{}),error:(0,r.jsx)(n.ErrorIcon,{}),info:(0,r.jsx)(n.InfoIcon,{}),warning:(0,r.jsx)(n.WarningIcon,{})};function o({status:o,children:s,action:c,onDismiss:l,duration:u=5e3,timerBar:d=!1,className:f,...p}){let[m,h]=(0,i.useState)(!1),[g,_]=(0,i.useState)(!1),v=m||g,y=t.useLatest(l),b=(0,i.useRef)(u);(0,i.useEffect)(()=>{b.current=u},[u]),(0,i.useEffect)(()=>{if(u<=0||v)return;let e=Date.now(),t=setTimeout(()=>y.current(),b.current);return()=>{clearTimeout(t),b.current-=Date.now()-e}},[u,v,y]);let x=d&&u>0,S={"--tintora-toast-animation-duration":`${u}ms`};return(0,r.jsxs)(`div`,{...p,role:`status`,className:e.clsx(`tintora-toast`,x&&`tintora-toast--timer`,v&&`tintora-toast--paused`,f),onMouseEnter:e=>{p.onMouseEnter?.(e),h(!0)},onMouseLeave:e=>{p.onMouseLeave?.(e),h(!1)},onFocus:e=>{p.onFocus?.(e),_(!0)},onBlur:e=>{p.onBlur?.(e),e.currentTarget.contains(e.relatedTarget)||_(!1)},children:[o&&a[o],(0,r.jsx)(`span`,{className:`tintora-toast__message`,children:s}),c&&(0,r.jsx)(`button`,{type:`button`,className:`tintora-toast__action`,onClick:c.onClick,children:c.label}),(0,r.jsx)(`button`,{type:`button`,className:`tintora-toast__close`,"aria-label":`Dismiss`,onClick:l,children:(0,r.jsx)(n.CloseIcon,{})}),x&&(0,r.jsx)(`span`,{className:`tintora-toast__progress`,style:S})]})}exports.Toast=o;
|