@tedi-design-system/react 15.0.0-rc.3 → 15.0.0-rc.4
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/bundle-stats.html +1 -1
- package/community.cjs.js +1 -1
- package/community.es.js +221 -225
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/package.json +1 -1
- package/src/community/components/accordion/accordion-item-header/accordion-item-header.cjs.js +1 -1
- package/src/community/components/accordion/accordion-item-header/accordion-item-header.es.js +2 -2
- package/src/community/components/form/select/select.cjs.js +1 -1
- package/src/community/components/form/select/select.d.ts +1 -1
- package/src/community/components/form/select/select.es.js +11 -11
- package/src/community/components/icon/icon.d.ts +1 -1
- package/src/community/components/layout/breadcrumbs/crumb/crumb.cjs.js +1 -1
- package/src/community/components/layout/breadcrumbs/crumb/crumb.es.js +9 -9
- package/src/community/components/layout/footer/footer.cjs.js +1 -1
- package/src/community/components/layout/footer/footer.es.js +17 -17
- package/src/community/components/layout/header/components/header-language/header-language.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-language/header-language.es.js +8 -8
- package/src/community/components/layout/header/components/header-modal/header-modal.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-modal/header-modal.es.js +6 -6
- package/src/community/components/layout/header/components/header-role/header-role.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-role/header-role.es.js +19 -19
- package/src/community/components/layout/header/components/header-settings/header-settings.cjs.js +1 -1
- package/src/community/components/layout/header/components/header-settings/header-settings.es.js +1 -1
- package/src/community/components/placeholder/placeholder.cjs.js +1 -1
- package/src/community/components/placeholder/placeholder.es.js +10 -10
- package/src/community/components/table/components/pagination/pagination.cjs.js +1 -1
- package/src/community/components/table/components/pagination/pagination.es.js +4 -4
- package/src/community/components/table/components/table-filter/components/table-date-filter.cjs.js +1 -1
- package/src/community/components/table/components/table-filter/components/table-date-filter.es.js +1 -1
- package/src/community/components/table/components/table-filter/components/table-select-filter.cjs.js +1 -1
- package/src/community/components/table/components/table-filter/components/table-select-filter.es.js +5 -5
- package/src/community/components/table-of-contents/table-of-contents-item.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents-item.es.js +14 -14
- package/src/community/components/table-of-contents/table-of-contents-items.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents-items.es.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents-modal.cjs.js +1 -1
- package/src/community/components/table-of-contents/table-of-contents-modal.es.js +12 -12
- package/src/community/index.d.ts +0 -2
- package/src/tedi/components/content/label/label.d.ts +1 -1
- package/src/community/components/typography/heading/heading.cjs.js +0 -1
- package/src/community/components/typography/heading/heading.d.ts +0 -11
- package/src/community/components/typography/heading/heading.es.js +0 -10
- package/src/community/components/typography/text/text.cjs.js +0 -1
- package/src/community/components/typography/text/text.d.ts +0 -43
- package/src/community/components/typography/text/text.es.js +0 -26
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as N } from "react/jsx-runtime";
|
|
2
2
|
import i from "../../../../external/classnames/index.es.js";
|
|
3
3
|
import P from "react";
|
|
4
|
+
import { Text as y } from "../../../tedi/components/base/typography/text/text.es.js";
|
|
4
5
|
import { Print as I } from "../../../tedi/components/misc/print/print.es.js";
|
|
5
6
|
import { useLayout as w } from "../../helpers/hooks/use-layout.es.js";
|
|
6
7
|
import { Icon as x } from "../icon/icon.es.js";
|
|
7
|
-
import { Text as y } from "../typography/text/text.es.js";
|
|
8
8
|
import { Card as C } from "../card/card.es.js";
|
|
9
9
|
import { CardContent as v } from "../card/card-content/card-content.es.js";
|
|
10
10
|
import { Row as j } from "../../../tedi/components/layout/grid/row.es.js";
|
|
@@ -15,7 +15,7 @@ const D = (l) => {
|
|
|
15
15
|
background: b = t ? void 0 : a ? "bg-subtle" : "white",
|
|
16
16
|
...g
|
|
17
17
|
} = p ?? {};
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ e(I, { breakInside: "avoid", children: /* @__PURE__ */ e(
|
|
19
19
|
C,
|
|
20
20
|
{
|
|
21
21
|
"data-name": "placeholder",
|
|
@@ -25,16 +25,16 @@ const D = (l) => {
|
|
|
25
25
|
padding: h,
|
|
26
26
|
background: b,
|
|
27
27
|
...g,
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
s && /* @__PURE__ */
|
|
30
|
-
const o = { size: 36, className: i("text-primary") }, m = typeof
|
|
28
|
+
children: /* @__PURE__ */ e(v, { children: /* @__PURE__ */ N(j, { direction: "column", alignItems: "center", gutter: 2, ...f, children: [
|
|
29
|
+
s && /* @__PURE__ */ e(d, { width: "auto", children: ((r) => {
|
|
30
|
+
const o = { size: 36, className: i("text-primary") }, m = typeof r == "string" ? { ...o, name: r } : typeof r == "object" && !P.isValidElement(r) ? {
|
|
31
31
|
...o,
|
|
32
|
-
...
|
|
33
|
-
className: i(o.className,
|
|
32
|
+
...r,
|
|
33
|
+
className: i(o.className, r == null ? void 0 : r.className)
|
|
34
34
|
} : void 0;
|
|
35
|
-
return m ? /* @__PURE__ */
|
|
35
|
+
return m ? /* @__PURE__ */ e(x, { ...m }) : r;
|
|
36
36
|
})(s) }),
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ e(d, { width: "auto", children: /* @__PURE__ */ e(y, { color: "secondary", modifiers: "center", element: "div", children: c }) })
|
|
38
38
|
] }) })
|
|
39
39
|
}
|
|
40
40
|
) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),S=require("../../../../../../external/classnames/index.cjs.js"),h=require("react"),j=require("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),S=require("../../../../../../external/classnames/index.cjs.js"),h=require("react"),j=require("../../../../../tedi/components/base/typography/text/text.cjs.js"),_=require("../../../form/select/select.cjs.js"),m=require("../../table-context.cjs.js"),l=require("./pagination.module.scss.cjs.js"),y=require("./PaginationNextButton.cjs.js"),z=require("./PaginationPageButton.cjs.js"),C=require("./use-pagination.cjs.js"),L=require("../../../../../tedi/providers/label-provider/use-labels.cjs.js"),N=s=>{const{getLabel:i}=L.useLabels(),{table:r,id:u}=h.useContext(m.TableContext),c=i("pagination.results",s.totalRows),{setPageSize:g,getState:d,getPageCount:p}=r,{pageIndex:b,pageSize:n}=d().pagination,o=[{value:"5",label:"5"},{value:"10",label:"10"},{value:"20",label:"20"},{value:"50",label:"50"},{value:"100",label:"100"}],v=Math.ceil(s.totalRows/n),{paginationItems:x}=C.usePagination({page:b+1,count:v}),f=o.find(e=>e.value===String(n))??{value:String(n),label:String(n)},P=e=>{const t=parseInt((e==null?void 0:e.value)||"10");g(t)},q=(e,t)=>e.type==="previous"||e.type==="next"?a.jsx(y.default,{type:e.type},t):e.type==="ellipsis"?a.jsx("li",{className:S.default(l.default.pagination__page),children:"..."},t):a.jsx(z.default,{item:e},t);return a.jsxs("div",{className:l.default.pagination__wrapper,children:[a.jsxs(j.Text,{color:"secondary",modifiers:"small",children:[s.totalRows," ",c]}),p()>1&&a.jsx("nav",{role:"navigation","aria-label":i("pagination.title"),className:l.default.pagination,children:a.jsx("ul",{className:l.default.pagination__pages,children:x.map((e,t)=>q(e,t))})}),a.jsx(_.Select,{id:`page-size-${u}`,label:i("pagination.page-size"),hideLabel:!0,isSearchable:!1,isClearable:!1,onChange:e=>P(e),value:f,size:"small",options:o})]})};exports.default=N;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import _ from "../../../../../../external/classnames/index.es.js";
|
|
3
3
|
import x from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Text as y } from "../../../../../tedi/components/base/typography/text/text.es.js";
|
|
5
|
+
import { Select as z } from "../../../form/select/select.es.js";
|
|
6
6
|
import { TableContext as N } from "../../table-context.es.js";
|
|
7
7
|
import n from "./pagination.module.scss.es.js";
|
|
8
8
|
import C from "./PaginationNextButton.es.js";
|
|
@@ -27,14 +27,14 @@ const D = (i) => {
|
|
|
27
27
|
u(e);
|
|
28
28
|
}, S = (a, e) => a.type === "previous" || a.type === "next" ? /* @__PURE__ */ t(C, { type: a.type }, e) : a.type === "ellipsis" ? /* @__PURE__ */ t("li", { className: _(n.pagination__page), children: "..." }, e) : /* @__PURE__ */ t(w, { item: a }, e);
|
|
29
29
|
return /* @__PURE__ */ r("div", { className: n.pagination__wrapper, children: [
|
|
30
|
-
/* @__PURE__ */ r(
|
|
30
|
+
/* @__PURE__ */ r(y, { color: "secondary", modifiers: "small", children: [
|
|
31
31
|
i.totalRows,
|
|
32
32
|
" ",
|
|
33
33
|
c
|
|
34
34
|
] }),
|
|
35
35
|
f() > 1 && /* @__PURE__ */ t("nav", { role: "navigation", "aria-label": o("pagination.title"), className: n.pagination, children: /* @__PURE__ */ t("ul", { className: n.pagination__pages, children: v.map((a, e) => S(a, e)) }) }),
|
|
36
36
|
/* @__PURE__ */ t(
|
|
37
|
-
|
|
37
|
+
z,
|
|
38
38
|
{
|
|
39
39
|
id: `page-size-${p}`,
|
|
40
40
|
label: o("pagination.page-size"),
|
package/src/community/components/table/components/table-filter/components/table-date-filter.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("dayjs"),_=require("../../../../../../../external/formik/dist/formik.esm.cjs.js"),q=require("react"),c=require("../../../../../../../external/yup/index.esm.cjs.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("dayjs"),_=require("../../../../../../../external/formik/dist/formik.esm.cjs.js"),q=require("react"),c=require("../../../../../../../external/yup/index.esm.cjs.js"),$=require("../../../../../../tedi/components/base/typography/text/text.cjs.js"),y=require("../../../../button/button.cjs.js"),A=require("../table-filter-context.cjs.js"),C=require("../../../../form/pickers/datepicker/datepicker.cjs.js"),M=require("../../../../../../tedi/providers/label-provider/use-labels.cjs.js"),v=require("../../../../../../tedi/components/layout/vertical-spacing/vertical-spacing.cjs.js"),z=require("../../../../../../tedi/components/layout/grid/row.cjs.js"),D=require("../../../../../../tedi/components/layout/grid/col.cjs.js"),G=()=>{var m,x,j,p,S;const{getLabel:a}=M.useLabels(),{column:t,open:b,setOpen:l,values:f}=q.useContext(A.TableFilterContext),k={dateRangeField:f==null?void 0:f.dateRange},s=(m=t==null?void 0:t.columnDef)==null?void 0:m.meta,T=(s==null?void 0:s.startDatePicker)??{},P=(s==null?void 0:s.endDatePicker)??{},B=a("table.filter"),F=a("table.filter.from"),R=a("table.filter.to"),u=`filter-date-${t==null?void 0:t.id}-from`,L=`filter-date-${t==null?void 0:t.id}-to`,I=a("table.filter.validation.to-before-from"),w=c.object().shape({dateRangeField:c.object().shape({from:c.string().defined().nullable(),to:c.string().defined().nullable().test("to-before-from",I,function(e){const{from:r}=this.parent;return!(e&&r&&n(e).isBefore(n(r),"day"))})})}),{values:i,errors:h,setFieldValue:g,handleReset:V,handleSubmit:E}=_.useFormik({initialValues:k,validationSchema:w,onSubmit:e=>{t==null||t.setFilterValue(e.dateRangeField),l==null||l(!1)},onReset:()=>{t==null||t.setFilterValue(""),l==null||l(!1)}});return q.useEffect(()=>{var e;if(b&&!i.dateRangeField){const r=document.getElementById(u);(e=r==null?void 0:r.focus)==null||e.call(r,{preventScroll:!0})}},[t==null?void 0:t.id,i.dateRangeField,b,u]),o.jsx("form",{onSubmit:E,children:o.jsxs(v.VerticalSpacing,{children:[o.jsx($.Text,{modifiers:"h5",children:B}),o.jsx(C.DatePicker,{id:u,label:F,...T,name:F,value:(x=i.dateRangeField)!=null&&x.from?n(i.dateRangeField.from):null,input:{autoComplete:"off"},onChange:e=>{var r,d;g("dateRangeField.from",(e==null?void 0:e.toISOString())??null),e&&((r=i.dateRangeField)!=null&&r.to)&&n(e).isAfter(n((d=i.dateRangeField)==null?void 0:d.to),"day")&&g("dateRangeField.to",null)}}),o.jsx(C.DatePicker,{id:L,label:R,shouldDisableDate:e=>{var r,d;return!!((r=i.dateRangeField)!=null&&r.from&&n(e).isBefore(n((d=i.dateRangeField)==null?void 0:d.from),"day"))},...P,name:R,value:(j=i.dateRangeField)!=null&&j.to?n((p=i.dateRangeField)==null?void 0:p.to):null,input:{autoComplete:"off"},onChange:e=>g("dateRangeField.to",(e==null?void 0:e.toISOString())??null),helper:(S=h.dateRangeField)!=null&&S.to?{text:h.dateRangeField.to,type:"error"}:void 0}),o.jsxs(z.Row,{gutter:2,justifyContent:"end",children:[o.jsx(D.Col,{width:"auto",children:o.jsx(y.Button,{visualType:"secondary",onClick:V,children:a("clear")})}),o.jsx(D.Col,{width:"auto",children:o.jsx(y.Button,{type:"submit",children:a("table.filter")})})]})]})})};exports.TableDateFilter=G;
|
package/src/community/components/table/components/table-filter/components/table-date-filter.es.js
CHANGED
|
@@ -3,8 +3,8 @@ import a from "dayjs";
|
|
|
3
3
|
import { useFormik as q } from "../../../../../../../external/formik/dist/formik.esm.es.js";
|
|
4
4
|
import D from "react";
|
|
5
5
|
import { object as x, string as T } from "../../../../../../../external/yup/index.esm.es.js";
|
|
6
|
+
import { Text as z } from "../../../../../../tedi/components/base/typography/text/text.es.js";
|
|
6
7
|
import { Button as j } from "../../../../button/button.es.js";
|
|
7
|
-
import { Text as z } from "../../../../typography/text/text.es.js";
|
|
8
8
|
import { TableFilterContext as G } from "../table-filter-context.es.js";
|
|
9
9
|
import { DatePicker as k } from "../../../../form/pickers/datepicker/datepicker.es.js";
|
|
10
10
|
import { useLabels as H } from "../../../../../../tedi/providers/label-provider/use-labels.es.js";
|
package/src/community/components/table/components/table-filter/components/table-select-filter.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),B=require("../../../../../../../external/formik/dist/formik.esm.cjs.js"),G=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),B=require("../../../../../../../external/formik/dist/formik.esm.cjs.js"),G=require("react"),N=require("../../../../../../tedi/components/base/typography/heading/heading.cjs.js"),F=require("../../../../button/button.cjs.js"),z=require("../../../../card/card.cjs.js"),P=require("../../../../card/card-content/card-content.cjs.js"),S=require("../../../table.module.scss.cjs.js"),H=require("../table-filter-context.cjs.js"),I=require("../../../../form/choice-group/choice-group.cjs.js"),M=require("../../../../../../tedi/providers/label-provider/use-labels.cjs.js"),A=require("../../../../../../tedi/components/layout/vertical-spacing/vertical-spacing.cjs.js"),E=require("../../../../../../tedi/components/layout/grid/row.cjs.js"),q=require("../../../../../../tedi/components/layout/grid/col.cjs.js"),y=s=>{var e,o;return(o=(e=s==null?void 0:s.filter(Boolean))==null?void 0:e.filter((i,r,l)=>(l==null?void 0:l.indexOf(i))===r))==null?void 0:o.sort((i,r)=>{var l;return typeof i=="number"&&typeof r=="number"?i-r:typeof i=="string"&&typeof r=="string"?(l=i==null?void 0:i.localeCompare)==null?void 0:l.call(i,r):0})},J=()=>{var m,C,j,x;const{getLabel:s}=M.useLabels(),{column:e,rows:o,setOpen:i,values:r}=G.useContext(H.TableFilterContext),l=s("table.filter"),f=(m=e==null?void 0:e.columnDef)==null?void 0:m.filterFn,c=f==="select"?"selectFilter":"multiSelectFilter",T={inputType:f,selectFilter:r==null?void 0:r.selectField,multiSelectFilter:r==null?void 0:r.multiSelectField},h=(C=e==null?void 0:e.columnDef)==null?void 0:C.meta,u=h==null?void 0:h.filterOptions,p=t=>typeof t=="object"&&t!==null&&"id"in t&&"label"in t&&"value"in t,k=o!=null&&o.length&&typeof((j=e==null?void 0:e.columnDef)==null?void 0:j.id)=="string"?o.map(t=>{var d,a;return(a=t==null?void 0:t.getValue)==null?void 0:a.call(t,(d=e==null?void 0:e.columnDef)==null?void 0:d.id)}):[],b=u!=null&&u.length?p(u[0])?u:y(u):y(k),R=b==null?void 0:b.map((t,d)=>{var a;return p(t)?t:{id:`${(a=e==null?void 0:e.columnDef)==null?void 0:a.id}-choice-${d}`,label:String(t),value:String(t)}}),{values:_,setFieldValue:D,handleReset:L,handleSubmit:$,errors:g}=B.useFormik({initialValues:T,onSubmit:t=>{var d;e==null||e.setFilterValue((d=t[c])!=null&&d.length?t[c]:""),i==null||i(!1)},onReset:()=>{e==null||e.setFilterValue(""),i==null||i(!1)}}),v=t=>D(c,t);return n.jsx("form",{onSubmit:$,children:n.jsxs(A.VerticalSpacing,{children:[n.jsx(N.Heading,{element:"h6",children:s("table.filter")}),n.jsx(z.Card,{className:S.default.filter__content,children:n.jsx(P.CardContent,{children:n.jsx(I.ChoiceGroup,{id:`filter-${c}-${e==null?void 0:e.id}`,name:l,label:l,hideLabel:!0,inputType:f==="select"?"radio":"checkbox",size:"small",value:_[c],indeterminateCheck:!0,indeterminateCheckProps:{indented:!1,className:S.default.filter__indeterminate},items:R,onChange:v,helper:((x=g[c])==null?void 0:x.length)!==0?{text:g[c],type:"error"}:{text:""}})})}),n.jsxs(E.Row,{gutter:2,justifyContent:"end",children:[n.jsx(q.Col,{width:"auto",children:n.jsx(F.Button,{visualType:"secondary",onClick:L,children:s("clear")})}),n.jsx(q.Col,{width:"auto",children:n.jsx(F.Button,{type:"submit",children:s("table.filter")})})]})]})})};exports.TableSelectFilter=J;
|
package/src/community/components/table/components/table-filter/components/table-select-filter.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as n, jsxs as y } from "react/jsx-runtime";
|
|
2
2
|
import { useFormik as G } from "../../../../../../../external/formik/dist/formik.esm.es.js";
|
|
3
3
|
import v from "react";
|
|
4
|
+
import { Heading as H } from "../../../../../../tedi/components/base/typography/heading/heading.es.js";
|
|
4
5
|
import { Button as _ } from "../../../../button/button.es.js";
|
|
5
|
-
import { Card as
|
|
6
|
-
import { CardContent as
|
|
7
|
-
import { Heading as P } from "../../../../typography/heading/heading.es.js";
|
|
6
|
+
import { Card as I } from "../../../../card/card.es.js";
|
|
7
|
+
import { CardContent as P } from "../../../../card/card-content/card-content.es.js";
|
|
8
8
|
import k from "../../../table.module.scss.es.js";
|
|
9
9
|
import { TableFilterContext as q } from "../table-filter-context.es.js";
|
|
10
10
|
import { ChoiceGroup as A } from "../../../../form/choice-group/choice-group.es.js";
|
|
@@ -46,8 +46,8 @@ const D = (o) => {
|
|
|
46
46
|
}
|
|
47
47
|
}), B = (t) => $(f, t);
|
|
48
48
|
return /* @__PURE__ */ n("form", { onSubmit: z, children: /* @__PURE__ */ y(J, { children: [
|
|
49
|
-
/* @__PURE__ */ n(
|
|
50
|
-
/* @__PURE__ */ n(
|
|
49
|
+
/* @__PURE__ */ n(H, { element: "h6", children: o("table.filter") }),
|
|
50
|
+
/* @__PURE__ */ n(I, { className: k.filter__content, children: /* @__PURE__ */ n(P, { children: /* @__PURE__ */ n(
|
|
51
51
|
A,
|
|
52
52
|
{
|
|
53
53
|
id: `filter-${f}-${e == null ? void 0 : e.id}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("../../../../external/classnames/index.cjs.js"),g=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("../../../../external/classnames/index.cjs.js"),g=require("react"),w=require("../../../tedi/components/base/typography/text/text.cjs.js"),_=require("../../../tedi/components/misc/separator/separator.cjs.js"),u=require("../icon/icon.cjs.js"),O=require("./table-of-contents.cjs.js"),l=require("./table-of-contents.module.scss.cjs.js"),r=require("../../../tedi/components/layout/grid/col.cjs.js"),x=require("../../../tedi/components/layout/grid/row.cjs.js");function f(h){const{children:s,content:o,isValid:c,separator:j,hideIcon:m,id:t,handleCloseModal:a}=h,{openItems:n,showIcons:C}=g.useContext(O.TableOfContentsContext),i=q.default(l.default["table-of-contents__icon"],{[l.default["table-of-contents__icon--hidden"]]:m});return e.jsxs(e.Fragment,{children:[e.jsx(r.Col,{role:"treeitem","aria-expanded":!!(t&&(n!=null&&n.includes(t))),children:e.jsxs(x.Row,{gutter:2,children:[C&&e.jsx(e.Fragment,{children:e.jsx(r.Col,{width:"auto",children:c===!1?e.jsx(u.Icon,{className:i,name:"warning",color:"danger"}):e.jsx(u.Icon,{className:i,name:"check",color:c===!0?"success":"disabled"})})}),e.jsx(r.Col,{children:e.jsx(w.Text,{element:"div",modifiers:"break-word",children:typeof o=="function"?o==null?void 0:o({closeModal:a}):o})})]})}),t&&(n==null?void 0:n.includes(t))&&(s==null?void 0:s.map((b,d)=>e.jsx(r.Col,{children:e.jsx(x.Row,{role:"treeitem",element:"ul",gutterX:0,gutterY:2,direction:"column",className:l.default["table-of-contents__child"],children:e.jsx(f,{...b,handleCloseModal:a},`${t}-${d}`)})},`${t}-${d}`))),j&&e.jsx(r.Col,{children:e.jsx(_.Separator,{})})]})}exports.TableOfContentsItem=f;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsxs as d, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import _ from "../../../../external/classnames/index.es.js";
|
|
3
3
|
import { useContext as w } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Text as N } from "../../../tedi/components/base/typography/text/text.es.js";
|
|
5
|
+
import { Separator as $ } from "../../../tedi/components/misc/separator/separator.es.js";
|
|
5
6
|
import { Icon as h } from "../icon/icon.es.js";
|
|
6
|
-
import { Text as $ } from "../typography/text/text.es.js";
|
|
7
7
|
import { TableOfContentsContext as T } from "./table-of-contents.es.js";
|
|
8
8
|
import l from "./table-of-contents.module.scss.es.js";
|
|
9
|
-
import { Col as
|
|
10
|
-
import { Row as
|
|
11
|
-
function j(
|
|
12
|
-
const { children:
|
|
9
|
+
import { Col as n } from "../../../tedi/components/layout/grid/col.es.js";
|
|
10
|
+
import { Row as u } from "../../../tedi/components/layout/grid/row.es.js";
|
|
11
|
+
function j(p) {
|
|
12
|
+
const { children: i, content: t, isValid: c, separator: b, hideIcon: x, id: o, handleCloseModal: s } = p, { openItems: r, showIcons: C } = w(T), a = _(l["table-of-contents__icon"], {
|
|
13
13
|
[l["table-of-contents__icon--hidden"]]: x
|
|
14
14
|
});
|
|
15
15
|
return /* @__PURE__ */ d(f, { children: [
|
|
16
|
-
/* @__PURE__ */ e(
|
|
17
|
-
C && /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
18
|
-
/* @__PURE__ */ e(
|
|
16
|
+
/* @__PURE__ */ e(n, { role: "treeitem", "aria-expanded": !!(o && (r != null && r.includes(o))), children: /* @__PURE__ */ d(u, { gutter: 2, children: [
|
|
17
|
+
C && /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(n, { width: "auto", children: c === !1 ? /* @__PURE__ */ e(h, { className: a, name: "warning", color: "danger" }) : /* @__PURE__ */ e(h, { className: a, name: "check", color: c === !0 ? "success" : "disabled" }) }) }),
|
|
18
|
+
/* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(N, { element: "div", modifiers: "break-word", children: typeof t == "function" ? t == null ? void 0 : t({ closeModal: s }) : t }) })
|
|
19
19
|
] }) }),
|
|
20
|
-
o && (
|
|
21
|
-
|
|
20
|
+
o && (r == null ? void 0 : r.includes(o)) && (i == null ? void 0 : i.map((g, m) => /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
|
|
21
|
+
u,
|
|
22
22
|
{
|
|
23
23
|
role: "treeitem",
|
|
24
24
|
element: "ul",
|
|
@@ -26,10 +26,10 @@ function j(u) {
|
|
|
26
26
|
gutterY: 2,
|
|
27
27
|
direction: "column",
|
|
28
28
|
className: l["table-of-contents__child"],
|
|
29
|
-
children: /* @__PURE__ */ e(j, { ...
|
|
29
|
+
children: /* @__PURE__ */ e(j, { ...g, handleCloseModal: s }, `${o}-${m}`)
|
|
30
30
|
}
|
|
31
31
|
) }, `${o}-${m}`))),
|
|
32
|
-
b && /* @__PURE__ */ e(
|
|
32
|
+
b && /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e($, {}) })
|
|
33
33
|
] });
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),q=require("react-dom"),f=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),q=require("react-dom"),f=require("../../../tedi/components/base/typography/heading/heading.cjs.js"),x=require("./table-of-contents-item.cjs.js"),j=require("../modal/modal-provider.cjs.js"),y=require("../../helpers/hooks/use-layout.cjs.js"),C=require("../../../tedi/components/layout/vertical-spacing/vertical-spacing.cjs.js"),I=require("../../../tedi/components/layout/grid/row.cjs.js"),O=s=>{const{items:r,setReturnFocus:e,showIcons:a,heading:l,breakToMobile:c=["mobile"],className:u}=s,d=y.useLayout(c),m=a?!0:!d,{closeModal:n}=i.useContext(j.ModalContext),o=i.useId(),h=()=>{q.flushSync(()=>{e==null||e(!1)}),n==null||n(),e==null||e(!0)};return t.jsxs(C.VerticalSpacing,{size:.5,className:u,children:[m&&t.jsx(f.Heading,{element:"h3",modifiers:"h4",id:o,children:l}),t.jsx("nav",{"aria-labelledby":o,children:t.jsx(I.Row,{role:"tree",element:"ul",direction:"column",gap:2,children:r.map((b,g)=>t.jsx(x.TableOfContentsItem,{handleCloseModal:h,...b},`toc-item-${g}`))})})]})};exports.TableOfContentsItems=O;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import r from "react";
|
|
3
3
|
import { flushSync as x } from "react-dom";
|
|
4
|
-
import { Heading as C } from "
|
|
4
|
+
import { Heading as C } from "../../../tedi/components/base/typography/heading/heading.es.js";
|
|
5
5
|
import { TableOfContentsItem as g } from "./table-of-contents-item.es.js";
|
|
6
6
|
import { ModalContext as y } from "../modal/modal-provider.es.js";
|
|
7
7
|
import { useLayout as I } from "../../helpers/hooks/use-layout.es.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),H=require("../../../../external/classnames/index.cjs.js"),d=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),H=require("../../../../external/classnames/index.cjs.js"),d=require("react"),f=require("../../../tedi/components/base/typography/heading/heading.cjs.js"),t=require("../../../tedi/components/base/typography/text/text.cjs.js"),S=require("../button/button.cjs.js"),k=require("../button-content/button-content.cjs.js"),h=require("../icon/icon.cjs.js"),B=require("./table-of-contents.cjs.js"),C=require("./table-of-contents.module.scss.cjs.js"),F=require("./table-of-contents-items.cjs.js"),$=require("../../../tedi/providers/label-provider/use-labels.cjs.js"),r=require("../../../tedi/components/layout/grid/row.cjs.js"),n=require("../../../tedi/components/layout/grid/col.cjs.js"),V=require("../modal/modal-provider.cjs.js"),W=require("../modal/modal-trigger.cjs.js"),z=require("../card/card.cjs.js"),b=require("../card/card-content/card-content.cjs.js"),A=require("../modal/modal.cjs.js"),D=require("../card/card-header/card-header.cjs.js"),E=x=>{const{getLabel:o}=$.useLabels(),{items:l,modalProps:p,modalProviderProps:q,heading:w,open:m,defaultOpen:T,onToggle:i,className:v}=x,a=l.map(s=>s.isValid===!0).filter(Boolean).length,c=l.map(s=>s.isValid===!1).filter(Boolean).length,j=d.useId(),[O,y]=d.useState(!0),[I,R]=d.useState(T),{showIcons:u}=d.useContext(B.TableOfContentsContext),N=i&&typeof m<"u"?m:I,L=o("table-of-contents.valid",`${a} / ${l.length}`),M=o("table-of-contents.valid",a),P=o("table-of-contents.invalid",c),_=s=>{R(s),i==null||i(s)},g=e.jsxs(e.Fragment,{children:[e.jsx(t.Text,{element:"span",modifiers:["normal","bold"],className:H.default({"sr-only":u}),children:w}),u&&c===0?e.jsxs(r.Row,{gutter:1,children:[e.jsx(n.Col,{width:"auto",children:e.jsx(h.Icon,{name:"check",color:"success"})}),e.jsxs(n.Col,{width:"auto",children:[e.jsxs(t.Text,{element:"span","aria-hidden":!0,children:[a," / ",l.length]}),e.jsx(t.Text,{element:"span",className:"sr-only",children:L})]})]}):u?e.jsxs(r.Row,{gutter:3,children:[e.jsx(n.Col,{width:"auto",children:e.jsxs(r.Row,{gutter:1,children:[e.jsx(n.Col,{width:"auto",children:e.jsx(h.Icon,{name:"check",color:"success"})}),e.jsxs(n.Col,{width:"auto",children:[e.jsx(t.Text,{element:"span","aria-hidden":!0,children:a}),e.jsx(t.Text,{element:"span",className:"sr-only",children:M})]})]})}),e.jsx(n.Col,{width:"auto",children:e.jsxs(r.Row,{gutter:1,children:[e.jsx(n.Col,{width:"auto",children:e.jsx(h.Icon,{name:"warning",color:"danger"})}),e.jsxs(n.Col,{width:"auto",children:[e.jsx(t.Text,{element:"span","aria-hidden":!0,children:c}),e.jsx(t.Text,{element:"span",className:"sr-only",children:P})]})]})})]}):null]});return e.jsxs(V.ModalProvider,{open:N,onToggle:_,...q,children:[e.jsx(f.Heading,{element:"h2",modifiers:"normal",className:v,children:e.jsx(W.ModalTrigger,{children:e.jsx(S.Button,{fullWidth:!0,noStyle:!0,className:C.default["table-of-contents__trigger"],children:e.jsx(z.Card,{className:C.default["table-of-contents__trigger-card"],children:e.jsx(b.CardContent,{children:e.jsxs(r.Row,{children:[e.jsx(n.Col,{children:g}),e.jsx(n.Col,{width:"auto","aria-hidden":!0,children:e.jsx(k.default,{as:"span",visualType:"link",iconRight:"expand_more",children:o("open")})})]})})})})})}),e.jsxs(A.Modal,{"aria-labelledby":j,position:"bottom",returnFocus:O,...p,children:[e.jsx(D.CardHeader,{variant:"white",id:j,children:e.jsx(f.Heading,{element:"h2",modifiers:"normal",children:g})}),e.jsx(b.CardContent,{children:e.jsx(F.TableOfContentsItems,{...x,setReturnFocus:y})})]})]})};exports.TableOfContentsModal=E;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as t, Fragment as H, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import S from "../../../../external/classnames/index.es.js";
|
|
3
3
|
import h, { useContext as j } from "react";
|
|
4
|
+
import { Heading as w } from "../../../tedi/components/base/typography/heading/heading.es.js";
|
|
5
|
+
import { Text as r } from "../../../tedi/components/base/typography/text/text.es.js";
|
|
4
6
|
import { Button as V } from "../button/button.es.js";
|
|
5
7
|
import $ from "../button-content/button-content.es.js";
|
|
6
8
|
import { Icon as p } from "../icon/icon.es.js";
|
|
7
|
-
import { Heading as v } from "../typography/heading/heading.es.js";
|
|
8
|
-
import { Text as r } from "../typography/text/text.es.js";
|
|
9
9
|
import { TableOfContentsContext as W } from "./table-of-contents.es.js";
|
|
10
|
-
import
|
|
10
|
+
import v from "./table-of-contents.module.scss.es.js";
|
|
11
11
|
import { TableOfContentsItems as q } from "./table-of-contents-items.es.js";
|
|
12
12
|
import { useLabels as z } from "../../../tedi/providers/label-provider/use-labels.es.js";
|
|
13
13
|
import { Row as i } from "../../../tedi/components/layout/grid/row.es.js";
|
|
@@ -18,13 +18,13 @@ import { Card as E } from "../card/card.es.js";
|
|
|
18
18
|
import { CardContent as C } from "../card/card-content/card-content.es.js";
|
|
19
19
|
import { Modal as G } from "../modal/modal.es.js";
|
|
20
20
|
import { CardHeader as J } from "../card/card-header/card-header.es.js";
|
|
21
|
-
const
|
|
22
|
-
const { getLabel: l } = z(), { items: a, modalProps: y, modalProviderProps: N, heading: x, open:
|
|
21
|
+
const ue = (u) => {
|
|
22
|
+
const { getLabel: l } = z(), { items: a, modalProps: y, modalProviderProps: N, heading: x, open: f, defaultOpen: I, onToggle: d, className: O } = u, s = a.map((o) => o.isValid === !0).filter(Boolean).length, c = a.map((o) => o.isValid === !1).filter(Boolean).length, g = h.useId(), [T, _] = h.useState(!0), [L, B] = h.useState(I), { showIcons: m } = j(W), M = d && typeof f < "u" ? f : L, P = l("table-of-contents.valid", `${s} / ${a.length}`), R = l("table-of-contents.valid", s), k = l("table-of-contents.invalid", c), F = (o) => {
|
|
23
23
|
B(o), d == null || d(o);
|
|
24
24
|
}, b = /* @__PURE__ */ t(H, { children: [
|
|
25
25
|
/* @__PURE__ */ e(r, { element: "span", modifiers: ["normal", "bold"], className: S({ "sr-only": m }), children: x }),
|
|
26
26
|
m && c === 0 ? /* @__PURE__ */ t(i, { gutter: 1, children: [
|
|
27
|
-
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "check", color: "
|
|
27
|
+
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "check", color: "success" }) }),
|
|
28
28
|
/* @__PURE__ */ t(n, { width: "auto", children: [
|
|
29
29
|
/* @__PURE__ */ t(r, { element: "span", "aria-hidden": !0, children: [
|
|
30
30
|
s,
|
|
@@ -35,14 +35,14 @@ const fe = (f) => {
|
|
|
35
35
|
] })
|
|
36
36
|
] }) : m ? /* @__PURE__ */ t(i, { gutter: 3, children: [
|
|
37
37
|
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ t(i, { gutter: 1, children: [
|
|
38
|
-
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "check", color: "
|
|
38
|
+
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "check", color: "success" }) }),
|
|
39
39
|
/* @__PURE__ */ t(n, { width: "auto", children: [
|
|
40
40
|
/* @__PURE__ */ e(r, { element: "span", "aria-hidden": !0, children: s }),
|
|
41
41
|
/* @__PURE__ */ e(r, { element: "span", className: "sr-only", children: R })
|
|
42
42
|
] })
|
|
43
43
|
] }) }),
|
|
44
44
|
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ t(i, { gutter: 1, children: [
|
|
45
|
-
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "warning", color: "
|
|
45
|
+
/* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(p, { name: "warning", color: "danger" }) }),
|
|
46
46
|
/* @__PURE__ */ t(n, { width: "auto", children: [
|
|
47
47
|
/* @__PURE__ */ e(r, { element: "span", "aria-hidden": !0, children: c }),
|
|
48
48
|
/* @__PURE__ */ e(r, { element: "span", className: "sr-only", children: k })
|
|
@@ -51,16 +51,16 @@ const fe = (f) => {
|
|
|
51
51
|
] }) : null
|
|
52
52
|
] });
|
|
53
53
|
return /* @__PURE__ */ t(A, { open: M, onToggle: F, ...N, children: [
|
|
54
|
-
/* @__PURE__ */ e(
|
|
54
|
+
/* @__PURE__ */ e(w, { element: "h2", modifiers: "normal", className: O, children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(V, { fullWidth: !0, noStyle: !0, className: v["table-of-contents__trigger"], children: /* @__PURE__ */ e(E, { className: v["table-of-contents__trigger-card"], children: /* @__PURE__ */ e(C, { children: /* @__PURE__ */ t(i, { children: [
|
|
55
55
|
/* @__PURE__ */ e(n, { children: b }),
|
|
56
56
|
/* @__PURE__ */ e(n, { width: "auto", "aria-hidden": !0, children: /* @__PURE__ */ e($, { as: "span", visualType: "link", iconRight: "expand_more", children: l("open") }) })
|
|
57
57
|
] }) }) }) }) }) }),
|
|
58
58
|
/* @__PURE__ */ t(G, { "aria-labelledby": g, position: "bottom", returnFocus: T, ...y, children: [
|
|
59
|
-
/* @__PURE__ */ e(J, { variant: "white", id: g, children: /* @__PURE__ */ e(
|
|
60
|
-
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(q, { ...
|
|
59
|
+
/* @__PURE__ */ e(J, { variant: "white", id: g, children: /* @__PURE__ */ e(w, { element: "h2", modifiers: "normal", children: b }) }),
|
|
60
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(q, { ...u, setReturnFocus: _ }) })
|
|
61
61
|
] })
|
|
62
62
|
] });
|
|
63
63
|
};
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
ue as TableOfContentsModal
|
|
66
66
|
};
|
package/src/community/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from './components/commonTypes';
|
|
2
|
-
export * from './components/typography/heading/heading';
|
|
3
|
-
export * from './components/typography/text/text';
|
|
4
2
|
export * from './components/button/button';
|
|
5
3
|
export * from './components/anchor/anchor';
|
|
6
4
|
export * from './components/layout';
|
|
@@ -32,5 +32,5 @@ export interface LabelProps extends BreakpointSupport<LabelBreakpointProps>, Lab
|
|
|
32
32
|
*/
|
|
33
33
|
tooltip?: string;
|
|
34
34
|
}
|
|
35
|
-
export declare const Label: import('react').ForwardRefExoticComponent<LabelProps & import('react').RefAttributes<
|
|
35
|
+
export declare const Label: import('react').ForwardRefExoticComponent<LabelProps & import('react').RefAttributes<HTMLLabelElement | HTMLSpanElement>>;
|
|
36
36
|
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),i=require("../text/text.cjs.js"),e=t=>{const{children:r,element:n="h1",...s}=t;return u.jsx(i.Text,{element:n,...s,children:r})};exports.Heading=e;exports.default=e;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HeadingModifiers, TextProps } from '../text/text';
|
|
2
|
-
export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
-
export type HeadingProps = Omit<TextProps, 'element'> & {
|
|
4
|
-
/**
|
|
5
|
-
* Semantic heading tag. h1-h6 are allowed values.
|
|
6
|
-
* @default h1
|
|
7
|
-
*/
|
|
8
|
-
element?: Extract<TextProps['element'], HeadingModifiers>;
|
|
9
|
-
};
|
|
10
|
-
export declare const Heading: (props: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default Heading;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { Text as m } from "../text/text.es.js";
|
|
3
|
-
const a = (e) => {
|
|
4
|
-
const { children: t, element: r = "h1", ...o } = e;
|
|
5
|
-
return /* @__PURE__ */ n(m, { element: r, ...o, children: t });
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
a as Heading,
|
|
9
|
-
a as default
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("react/jsx-runtime"),p=require("../../../../../external/classnames/index.cjs.js"),f=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),s=e=>{const{getCurrentBreakpointProps:o}=f.useBreakpointProps(e.defaultServerBreakpoint),{children:i,className:u,tabIndex:a,element:c="p",modifiers:t,color:r,...l}=o(e,{tabIndex:e.id?-1:void 0}),n=typeof t=="string"?[t]:t,d=p.default(u,n==null?void 0:n.map(x=>`text-${x}`),{[`text-${r}`]:r});return m.jsx(c,{className:d,...l,tabIndex:a,children:i})};exports.Text=s;exports.default=s;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BreakpointSupport } from '../../../helpers';
|
|
2
|
-
import { HeadingLevel } from '../heading/heading';
|
|
3
|
-
export type HeadingModifiers = `h${HeadingLevel}`;
|
|
4
|
-
export type TextModifiers = HeadingModifiers | 'normal' | 'small' | 'bold' | 'thin' | 'italic' | 'center' | 'left' | 'right' | 'nowrap' | 'break-all' | 'break-word' | 'break-spaces' | 'uppercase' | 'lowercase' | 'capitalize' | 'capitalize-first' | 'inline-block' | 'inline' | 'line-normal' | 'line-condensed';
|
|
5
|
-
export type TextColor = 'default' | 'primary' | 'muted' | 'subtle' | 'disabled' | 'inverted' | 'positive' | 'important' | 'warning';
|
|
6
|
-
export type TextElement = 'div' | 'p' | 'span' | 'li' | HeadingModifiers;
|
|
7
|
-
type TextBreakpointProps = {
|
|
8
|
-
/**
|
|
9
|
-
* Additional class.
|
|
10
|
-
*/
|
|
11
|
-
className?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Base element.
|
|
14
|
-
* @default p
|
|
15
|
-
*/
|
|
16
|
-
element?: TextElement;
|
|
17
|
-
/**
|
|
18
|
-
* Single or multiple modifiers to change the text behavior.
|
|
19
|
-
*/
|
|
20
|
-
modifiers?: TextModifiers[] | TextModifiers;
|
|
21
|
-
/**
|
|
22
|
-
* Which color text should be.
|
|
23
|
-
* Use 'positive', 'important' or 'warning' with caution, usually they should not be in application UI.
|
|
24
|
-
* @default default
|
|
25
|
-
*/
|
|
26
|
-
color?: TextColor;
|
|
27
|
-
};
|
|
28
|
-
export interface TextProps extends BreakpointSupport<TextBreakpointProps> {
|
|
29
|
-
/**
|
|
30
|
-
* Children of the text.
|
|
31
|
-
*/
|
|
32
|
-
children: React.ReactNode;
|
|
33
|
-
/**
|
|
34
|
-
* ID attribute.
|
|
35
|
-
*/
|
|
36
|
-
id?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Allows to focus the element
|
|
39
|
-
*/
|
|
40
|
-
tabIndex?: number;
|
|
41
|
-
}
|
|
42
|
-
export declare const Text: (props: TextProps) => JSX.Element;
|
|
43
|
-
export default Text;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import x from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import { useBreakpointProps as f } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
4
|
-
const N = (t) => {
|
|
5
|
-
const { getCurrentBreakpointProps: s } = f(t.defaultServerBreakpoint), {
|
|
6
|
-
children: n,
|
|
7
|
-
className: a,
|
|
8
|
-
tabIndex: m,
|
|
9
|
-
element: c = "p",
|
|
10
|
-
modifiers: e,
|
|
11
|
-
color: r,
|
|
12
|
-
...i
|
|
13
|
-
} = s(t, {
|
|
14
|
-
tabIndex: t.id ? -1 : void 0
|
|
15
|
-
// when id is set on a text element we most likely want to jump to it with a reference link
|
|
16
|
-
}), o = typeof e == "string" ? [e] : e, l = x(
|
|
17
|
-
a,
|
|
18
|
-
o == null ? void 0 : o.map((p) => `text-${p}`),
|
|
19
|
-
{ [`text-${r}`]: r }
|
|
20
|
-
);
|
|
21
|
-
return /* @__PURE__ */ d(c, { className: l, ...i, tabIndex: m, children: n });
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
N as Text,
|
|
25
|
-
N as default
|
|
26
|
-
};
|