fictoan-react 1.2.1 → 1.2.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/dist/components/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.js +83 -26
- package/dist/components/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.cjs +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.d.ts +4 -1
- package/dist/components/Breadcrumbs/BreadcrumbItem/BreadcrumbItem.js +31 -15
- package/dist/components/Breadcrumbs/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs/Breadcrumbs.d.ts +5 -3
- package/dist/components/Breadcrumbs/Breadcrumbs/Breadcrumbs.js +31 -15
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.ts +2 -1
- package/dist/components/CodeBlock/CodeBlock.js +29 -26
- package/dist/components/CodeBlock/CodeBlock.stories.d.ts +6 -0
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -0
- package/dist/components/Element/Element.cjs +1 -1
- package/dist/components/Element/Element.js +18 -18
- package/dist/components/Element/constants.d.ts +1 -0
- package/dist/components/Form/Range/Range.cjs +1 -1
- package/dist/components/Form/Range/Range.d.ts +4 -3
- package/dist/components/Form/Range/Range.js +18 -15
- package/dist/components/Form/Range/index.cjs +1 -1
- package/dist/components/Form/Range/index.js +3 -0
- package/dist/components/Table/TablePagination/TablePagination.cjs +1 -1
- package/dist/components/Table/TablePagination/TablePagination.js +2 -2
- package/dist/components/Typography/Heading.cjs +1 -1
- package/dist/components/Typography/Heading.d.ts +10 -4
- package/dist/components/Typography/Heading.js +41 -24
- package/dist/components/Typography/Heading.stories.d.ts +3 -3
- package/dist/components/Typography/index.cjs +1 -1
- package/dist/components/Typography/index.d.ts +1 -1
- package/dist/components/Typography/index.js +7 -2
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +7 -2
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../Element/Element.cjs"),t=require("../Typography/Text.cjs");var n=["summary","children"];function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../Element/Element.cjs"),t=require("../Typography/Text.cjs");var n=["summary","children","open"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(this,arguments)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var i=e.forwardRef((function(i,l){var u,c,f=i.summary,s=i.children,y=i.open,p=void 0!==y&&y,b=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(i,n),d=(u=e.useState(p),c=2,function(e){if(Array.isArray(e))return e}(u)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a,i,l=[],u=!0,c=!1;try{if(a=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=a.call(t)).done)&&(l.push(n.value),l.length!==r);u=!0);}catch(f){c=!0,o=f}finally{try{if(!u&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(c)throw o}}return l}}(u,c)||function(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}(u,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=d[0],g=d[1],v=function(){return g(!m)};return e.useEffect((function(){l&&"current"in l&&l.current&&l.current.setAttribute("aria-expanded",m.toString())}),[m,l]),e.createElement(r.Element,o({as:"details","data-expandable-content":!0,ref:l},b,{open:m,role:"region","aria-labelledby":"accordion-summary"}),e.createElement("summary",{role:"button",tabIndex:0,"aria-controls":"accordion-content","aria-expanded":m,onClick:v,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),v())}},"string"==typeof f?e.createElement(t.Text,{margin:"none"},f):f),s)}));exports.Accordion=i;
|
|
@@ -1,39 +1,96 @@
|
|
|
1
|
-
import r from "react";
|
|
2
|
-
import { Element as
|
|
3
|
-
import { Text as
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
for (var
|
|
8
|
-
var
|
|
9
|
-
for (var n2 in
|
|
10
|
-
Object.prototype.hasOwnProperty.call(
|
|
1
|
+
import r, { useState as t, useEffect as e } from "react";
|
|
2
|
+
import { Element as n } from "../Element/Element.js";
|
|
3
|
+
import { Text as o } from "../Typography/Text.js";
|
|
4
|
+
var a = ["summary", "children", "open"];
|
|
5
|
+
function i() {
|
|
6
|
+
return i = Object.assign ? Object.assign.bind() : function(r2) {
|
|
7
|
+
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
8
|
+
var e2 = arguments[t2];
|
|
9
|
+
for (var n2 in e2)
|
|
10
|
+
Object.prototype.hasOwnProperty.call(e2, n2) && (r2[n2] = e2[n2]);
|
|
11
11
|
}
|
|
12
12
|
return r2;
|
|
13
|
-
},
|
|
13
|
+
}, i.apply(this, arguments);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(r2, t2) {
|
|
16
|
+
return function(r3) {
|
|
17
|
+
if (Array.isArray(r3))
|
|
18
|
+
return r3;
|
|
19
|
+
}(r2) || function(r3, t3) {
|
|
20
|
+
var e2 = null == r3 ? null : "undefined" != typeof Symbol && r3[Symbol.iterator] || r3["@@iterator"];
|
|
21
|
+
if (null != e2) {
|
|
22
|
+
var n2, o2, a2, i2, l2 = [], u2 = true, c2 = false;
|
|
23
|
+
try {
|
|
24
|
+
if (a2 = (e2 = e2.call(r3)).next, 0 === t3) {
|
|
25
|
+
if (Object(e2) !== e2)
|
|
26
|
+
return;
|
|
27
|
+
u2 = false;
|
|
28
|
+
} else
|
|
29
|
+
for (; !(u2 = (n2 = a2.call(e2)).done) && (l2.push(n2.value), l2.length !== t3); u2 = true)
|
|
30
|
+
;
|
|
31
|
+
} catch (r4) {
|
|
32
|
+
c2 = true, o2 = r4;
|
|
33
|
+
} finally {
|
|
34
|
+
try {
|
|
35
|
+
if (!u2 && null != e2.return && (i2 = e2.return(), Object(i2) !== i2))
|
|
36
|
+
return;
|
|
37
|
+
} finally {
|
|
38
|
+
if (c2)
|
|
39
|
+
throw o2;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return l2;
|
|
43
|
+
}
|
|
44
|
+
}(r2, t2) || function(r3, t3) {
|
|
45
|
+
if (!r3)
|
|
46
|
+
return;
|
|
47
|
+
if ("string" == typeof r3)
|
|
48
|
+
return u(r3, t3);
|
|
49
|
+
var e2 = Object.prototype.toString.call(r3).slice(8, -1);
|
|
50
|
+
"Object" === e2 && r3.constructor && (e2 = r3.constructor.name);
|
|
51
|
+
if ("Map" === e2 || "Set" === e2)
|
|
52
|
+
return Array.from(r3);
|
|
53
|
+
if ("Arguments" === e2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e2))
|
|
54
|
+
return u(r3, t3);
|
|
55
|
+
}(r2, t2) || function() {
|
|
56
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
+
}();
|
|
58
|
+
}
|
|
59
|
+
function u(r2, t2) {
|
|
60
|
+
(null == t2 || t2 > r2.length) && (t2 = r2.length);
|
|
61
|
+
for (var e2 = 0, n2 = new Array(t2); e2 < t2; e2++)
|
|
62
|
+
n2[e2] = r2[e2];
|
|
63
|
+
return n2;
|
|
64
|
+
}
|
|
65
|
+
function c(r2, t2) {
|
|
16
66
|
if (null == r2)
|
|
17
67
|
return {};
|
|
18
|
-
var
|
|
68
|
+
var e2, n2, o2 = function(r3, t3) {
|
|
19
69
|
if (null == r3)
|
|
20
70
|
return {};
|
|
21
|
-
var
|
|
22
|
-
for (n3 = 0; n3 <
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
}(r2,
|
|
71
|
+
var e3, n3, o3 = {}, a3 = Object.keys(r3);
|
|
72
|
+
for (n3 = 0; n3 < a3.length; n3++)
|
|
73
|
+
e3 = a3[n3], t3.indexOf(e3) >= 0 || (o3[e3] = r3[e3]);
|
|
74
|
+
return o3;
|
|
75
|
+
}(r2, t2);
|
|
26
76
|
if (Object.getOwnPropertySymbols) {
|
|
27
|
-
var
|
|
28
|
-
for (n2 = 0; n2 <
|
|
29
|
-
|
|
77
|
+
var a2 = Object.getOwnPropertySymbols(r2);
|
|
78
|
+
for (n2 = 0; n2 < a2.length; n2++)
|
|
79
|
+
e2 = a2[n2], t2.indexOf(e2) >= 0 || Object.prototype.propertyIsEnumerable.call(r2, e2) && (o2[e2] = r2[e2]);
|
|
30
80
|
}
|
|
31
|
-
return
|
|
81
|
+
return o2;
|
|
32
82
|
}
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
|
|
83
|
+
var f = /* @__PURE__ */ r.forwardRef(function(u2, f2) {
|
|
84
|
+
var y = u2.summary, p = u2.children, s = u2.open, m = void 0 !== s && s, b = c(u2, a), d = l(t(m), 2), g = d[0], v = d[1], h = function() {
|
|
85
|
+
return v(!g);
|
|
86
|
+
};
|
|
87
|
+
e(function() {
|
|
88
|
+
f2 && "current" in f2 && f2.current && f2.current.setAttribute("aria-expanded", g.toString());
|
|
89
|
+
}, [g, f2]);
|
|
90
|
+
return r.createElement(n, i({ as: "details", "data-expandable-content": true, ref: f2 }, b, { open: g, role: "region", "aria-labelledby": "accordion-summary" }), /* @__PURE__ */ r.createElement("summary", { role: "button", tabIndex: 0, "aria-controls": "accordion-content", "aria-expanded": g, onClick: h, onKeyDown: function(r2) {
|
|
91
|
+
"Enter" !== r2.key && " " !== r2.key || (r2.preventDefault(), h());
|
|
92
|
+
} }, "string" == typeof y ? /* @__PURE__ */ r.createElement(o, { margin: "none" }, y) : y), p);
|
|
36
93
|
});
|
|
37
94
|
export {
|
|
38
|
-
|
|
95
|
+
f as Accordion
|
|
39
96
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),e=require("../../Element/Element.cjs");var t=["children","current"];function n(){return n=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},n.apply(this,arguments)}var a=r.forwardRef((function(a,o){var i=a.children,c=a.current,l=function(r,e){if(null==r)return{};var t,n,a=function(r,e){if(null==r)return{};var t,n,a={},o=Object.keys(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)>=0||(a[t]=r[t]);return a}(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(r,t)&&(a[t]=r[t])}return a}(a,t);return r.createElement(e.Element,n({as:"li","data-breadcrumb-item":!0,ref:o},l,{"aria-current":c?"page":void 0,className:c?"current":void 0,role:"navigation","aria-label":"List of breadcrumbs"}),i)}));exports.BreadcrumbItem=a;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CommonAndHTMLProps } from "../../Element/constants";
|
|
3
3
|
export type BreadcrumbItemElementType = HTMLLIElement;
|
|
4
|
-
export
|
|
4
|
+
export interface BreadcrumbItemProps extends CommonAndHTMLProps<BreadcrumbItemElementType> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
current?: boolean;
|
|
7
|
+
}
|
|
5
8
|
export declare const BreadcrumbItem: React.ForwardRefExoticComponent<BreadcrumbItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
import { Element as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { Element as e } from "../../Element/Element.js";
|
|
3
|
+
var t = ["children", "current"];
|
|
4
|
+
function n() {
|
|
5
|
+
return n = Object.assign ? Object.assign.bind() : function(r2) {
|
|
6
|
+
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
7
|
+
var t2 = arguments[e2];
|
|
8
|
+
for (var n2 in t2)
|
|
9
|
+
Object.prototype.hasOwnProperty.call(t2, n2) && (r2[n2] = t2[n2]);
|
|
9
10
|
}
|
|
10
11
|
return r2;
|
|
11
|
-
},
|
|
12
|
+
}, n.apply(this, arguments);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
function a(r2, e2) {
|
|
15
|
+
if (null == r2)
|
|
16
|
+
return {};
|
|
17
|
+
var t2, n2, a2 = function(r3, e3) {
|
|
18
|
+
if (null == r3)
|
|
19
|
+
return {};
|
|
20
|
+
var t3, n3, a3 = {}, o3 = Object.keys(r3);
|
|
21
|
+
for (n3 = 0; n3 < o3.length; n3++)
|
|
22
|
+
t3 = o3[n3], e3.indexOf(t3) >= 0 || (a3[t3] = r3[t3]);
|
|
23
|
+
return a3;
|
|
24
|
+
}(r2, e2);
|
|
25
|
+
if (Object.getOwnPropertySymbols) {
|
|
26
|
+
var o2 = Object.getOwnPropertySymbols(r2);
|
|
27
|
+
for (n2 = 0; n2 < o2.length; n2++)
|
|
28
|
+
t2 = o2[n2], e2.indexOf(t2) >= 0 || Object.prototype.propertyIsEnumerable.call(r2, t2) && (a2[t2] = r2[t2]);
|
|
29
|
+
}
|
|
30
|
+
return a2;
|
|
31
|
+
}
|
|
32
|
+
var o = /* @__PURE__ */ r.forwardRef(function(o2, i) {
|
|
33
|
+
var c = o2.children, l = o2.current, u = a(o2, t);
|
|
34
|
+
return r.createElement(e, n({ as: "li", "data-breadcrumb-item": true, ref: i }, u, { "aria-current": l ? "page" : void 0, className: l ? "current" : void 0, role: "navigation", "aria-label": "List of breadcrumbs" }), c);
|
|
19
35
|
});
|
|
20
36
|
export {
|
|
21
|
-
|
|
37
|
+
o as BreadcrumbItem
|
|
22
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),r=require("../../Element/Element.cjs");var t=["children"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n.apply(this,arguments)}var a=e.forwardRef((function(a,l){var o=a.children,c=function(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},l=Object.keys(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)t=l[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}(a,t);return e.createElement("nav",n({"aria-label":"Breadcrumb",ref:l},c),e.createElement(r.Element,{as:"ul","data-breadcrumbs-wrapper":!0},o))}));exports.Breadcrumbs=a;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CommonAndHTMLProps } from "../../Element/constants";
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
|
|
3
|
+
export type BreadcrumbsElementType = HTMLDivElement;
|
|
4
|
+
export interface BreadcrumbsProps extends CommonAndHTMLProps<BreadcrumbsElementType> {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import r from "react";
|
|
2
|
-
import { Element as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { Element as e } from "../../Element/Element.js";
|
|
3
|
+
var t = ["children"];
|
|
4
|
+
function n() {
|
|
5
|
+
return n = Object.assign ? Object.assign.bind() : function(r2) {
|
|
6
|
+
for (var e2 = 1; e2 < arguments.length; e2++) {
|
|
7
|
+
var t2 = arguments[e2];
|
|
8
|
+
for (var n2 in t2)
|
|
9
|
+
Object.prototype.hasOwnProperty.call(t2, n2) && (r2[n2] = t2[n2]);
|
|
9
10
|
}
|
|
10
11
|
return r2;
|
|
11
|
-
},
|
|
12
|
+
}, n.apply(this, arguments);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
function a(r2, e2) {
|
|
15
|
+
if (null == r2)
|
|
16
|
+
return {};
|
|
17
|
+
var t2, n2, a2 = function(r3, e3) {
|
|
18
|
+
if (null == r3)
|
|
19
|
+
return {};
|
|
20
|
+
var t3, n3, a3 = {}, o3 = Object.keys(r3);
|
|
21
|
+
for (n3 = 0; n3 < o3.length; n3++)
|
|
22
|
+
t3 = o3[n3], e3.indexOf(t3) >= 0 || (a3[t3] = r3[t3]);
|
|
23
|
+
return a3;
|
|
24
|
+
}(r2, e2);
|
|
25
|
+
if (Object.getOwnPropertySymbols) {
|
|
26
|
+
var o2 = Object.getOwnPropertySymbols(r2);
|
|
27
|
+
for (n2 = 0; n2 < o2.length; n2++)
|
|
28
|
+
t2 = o2[n2], e2.indexOf(t2) >= 0 || Object.prototype.propertyIsEnumerable.call(r2, t2) && (a2[t2] = r2[t2]);
|
|
29
|
+
}
|
|
30
|
+
return a2;
|
|
31
|
+
}
|
|
32
|
+
var o = /* @__PURE__ */ r.forwardRef(function(o2, l) {
|
|
33
|
+
var c = o2.children, i = a(o2, t);
|
|
34
|
+
return r.createElement("nav", n({ "aria-label": "Breadcrumb", ref: l }, i), /* @__PURE__ */ r.createElement(e, { as: "ul", "data-breadcrumbs-wrapper": true }, c));
|
|
19
35
|
});
|
|
20
36
|
export {
|
|
21
|
-
|
|
37
|
+
o as Breadcrumbs
|
|
22
38
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Breadcrumbs, type
|
|
1
|
+
export { Breadcrumbs, type BreadcrumbsProps } from "../Breadcrumbs/Breadcrumbs/Breadcrumbs";
|
|
2
2
|
export { BreadcrumbItem, type BreadcrumbItemProps } from "./BreadcrumbItem/BreadcrumbItem";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../Element/Element.cjs"),r=require("../Button/Button.cjs");var
|
|
1
|
+
"use strict";Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),t=require("../Element/Element.cjs"),r=require("../Button/Button.cjs"),n=require("../Badge/Badge.cjs");var o=["children","source","language","showCopyButton","showLineNumbers"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a.apply(this,arguments)}function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var i=e.lazy((function(){return import("prism-react-renderer").then((function(t){return t.Highlight?{default:t.Highlight}:(console.log("FICTOAN : [35mLooking[33m for[32m syntax[34m highlighting[36m?[31m\n╭──────────────────────────────────────────────────────────────────────────────────────────────────╮\n│ Please install the prism-react-renderer (https://www.npmjs.com/package/prism-react-renderer) │\n│ package to have syntax highlighting in the CodeBlock component. │\n│ For example: [46m[30myarn add prism-react-renderer[0m[31m │\n╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"),{default:function(t){var r=t.code;return e.createElement("pre",{"data-code-block":!0,className:"module-fallback"},r)}})}))})),u=e.forwardRef((function(u,s){var p,m,f=u.children,y=u.source,d=u.language,b=void 0===d?"json":d,g=u.showCopyButton,h=u.showLineNumbers,O=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(u,o),v=(p=e.useState(!1),m=2,function(e){if(Array.isArray(e))return e}(p)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,l,c=[],i=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;i=!1}else for(;!(i=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);i=!0);}catch(s){u=!0,o=s}finally{try{if(!i&&null!=r.return&&(l=r.return(),Object(l)!==l))return}finally{if(u)throw o}}return c}}(p,m)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}(p,m)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),j=v[0],k=v[1],w="string"==typeof f?f:e.Children.toArray(f).join("");f||(w="object"===l(y)?JSON.stringify(y,null,2):null!=y?y:"");var E=[];return h&&E.push("show-line-numbers"),e.createElement(t.Element,a({"data-code-block":!0,as:"div",classNames:E},O),g?j?e.createElement(n.Badge,{className:"code-block-copied-badge",size:"tiny",shape:"rounded","aria-live":"polite"},"Copied!"):e.createElement(r.Button,{type:"button",className:"code-block-copy-button",size:"tiny",shape:"rounded",onClick:function(){navigator.clipboard.writeText(w).then((function(){k(!0),setTimeout((function(){return k(!1)}),3e3)})).catch((function(e){console.error("Could not copy text: ",e)}))},role:"button","aria-label":"Copy code to clipboard"},"Copy"):null,e.createElement(e.Suspense,{fallback:e.createElement("pre",{"data-code-block":!0,className:"suspense-fallback"},w)},e.createElement(i,{code:w,language:b,theme:void 0},(function(t){var r=t.className,n=t.tokens,o=t.getLineProps,a=t.getTokenProps;return e.createElement("pre",{ref:s,className:r},n.map((function(t,r){return e.createElement("div",o({line:t,key:r}),h&&e.createElement("span",{className:"line-numbers"},r+1),e.createElement("span",{className:"l-o-c"},t.map((function(t,r){return e.createElement("span",a({token:t,key:r}))}))))})))}))))}));exports.CodeBlock=u;
|
|
@@ -2,8 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { CommonAndHTMLProps } from "../Element/constants";
|
|
3
3
|
export interface CodeBlockCustomProps {
|
|
4
4
|
source?: object | string;
|
|
5
|
-
language?: string;
|
|
5
|
+
language?: string | undefined;
|
|
6
6
|
showCopyButton?: boolean;
|
|
7
|
+
showLineNumbers?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export type CodeBlockElementType = HTMLPreElement;
|
|
9
10
|
export type CodeBlockProps = Omit<CommonAndHTMLProps<CodeBlockElementType>, keyof CodeBlockCustomProps> & CodeBlockCustomProps;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import e, { useState as t, Suspense as r } from "react";
|
|
2
2
|
import { Element as n } from "../Element/Element.js";
|
|
3
3
|
import { Button as o } from "../Button/Button.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { Badge as a } from "../Badge/Badge.js";
|
|
5
|
+
var l = ["children", "source", "language", "showCopyButton", "showLineNumbers"];
|
|
6
|
+
function i() {
|
|
7
|
+
return i = Object.assign ? Object.assign.bind() : function(e2) {
|
|
7
8
|
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
8
9
|
var r2 = arguments[t2];
|
|
9
10
|
for (var n2 in r2)
|
|
10
11
|
Object.prototype.hasOwnProperty.call(r2, n2) && (e2[n2] = r2[n2]);
|
|
11
12
|
}
|
|
12
13
|
return e2;
|
|
13
|
-
},
|
|
14
|
+
}, i.apply(this, arguments);
|
|
14
15
|
}
|
|
15
16
|
function c(e2) {
|
|
16
17
|
return (c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) {
|
|
@@ -19,57 +20,57 @@ function c(e2) {
|
|
|
19
20
|
return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
|
|
20
21
|
})(e2);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function u(e2, t2) {
|
|
23
24
|
return function(e3) {
|
|
24
25
|
if (Array.isArray(e3))
|
|
25
26
|
return e3;
|
|
26
27
|
}(e2) || function(e3, t3) {
|
|
27
28
|
var r2 = null == e3 ? null : "undefined" != typeof Symbol && e3[Symbol.iterator] || e3["@@iterator"];
|
|
28
29
|
if (null != r2) {
|
|
29
|
-
var n2, o2, a2, l2,
|
|
30
|
+
var n2, o2, a2, l2, i2 = [], c2 = true, u2 = false;
|
|
30
31
|
try {
|
|
31
32
|
if (a2 = (r2 = r2.call(e3)).next, 0 === t3) {
|
|
32
33
|
if (Object(r2) !== r2)
|
|
33
34
|
return;
|
|
34
|
-
|
|
35
|
+
c2 = false;
|
|
35
36
|
} else
|
|
36
|
-
for (; !(
|
|
37
|
+
for (; !(c2 = (n2 = a2.call(r2)).done) && (i2.push(n2.value), i2.length !== t3); c2 = true)
|
|
37
38
|
;
|
|
38
39
|
} catch (e4) {
|
|
39
40
|
u2 = true, o2 = e4;
|
|
40
41
|
} finally {
|
|
41
42
|
try {
|
|
42
|
-
if (!
|
|
43
|
+
if (!c2 && null != r2.return && (l2 = r2.return(), Object(l2) !== l2))
|
|
43
44
|
return;
|
|
44
45
|
} finally {
|
|
45
46
|
if (u2)
|
|
46
47
|
throw o2;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
return
|
|
50
|
+
return i2;
|
|
50
51
|
}
|
|
51
52
|
}(e2, t2) || function(e3, t3) {
|
|
52
53
|
if (!e3)
|
|
53
54
|
return;
|
|
54
55
|
if ("string" == typeof e3)
|
|
55
|
-
return
|
|
56
|
+
return s(e3, t3);
|
|
56
57
|
var r2 = Object.prototype.toString.call(e3).slice(8, -1);
|
|
57
58
|
"Object" === r2 && e3.constructor && (r2 = e3.constructor.name);
|
|
58
59
|
if ("Map" === r2 || "Set" === r2)
|
|
59
60
|
return Array.from(e3);
|
|
60
61
|
if ("Arguments" === r2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r2))
|
|
61
|
-
return
|
|
62
|
+
return s(e3, t3);
|
|
62
63
|
}(e2, t2) || function() {
|
|
63
64
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
64
65
|
}();
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function s(e2, t2) {
|
|
67
68
|
(null == t2 || t2 > e2.length) && (t2 = e2.length);
|
|
68
69
|
for (var r2 = 0, n2 = new Array(t2); r2 < t2; r2++)
|
|
69
70
|
n2[r2] = e2[r2];
|
|
70
71
|
return n2;
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function m(e2, t2) {
|
|
73
74
|
if (null == e2)
|
|
74
75
|
return {};
|
|
75
76
|
var r2, n2, o2 = function(e3, t3) {
|
|
@@ -87,7 +88,7 @@ function f(e2, t2) {
|
|
|
87
88
|
}
|
|
88
89
|
return o2;
|
|
89
90
|
}
|
|
90
|
-
var
|
|
91
|
+
var f = /* @__PURE__ */ e.lazy(function() {
|
|
91
92
|
return import("prism-react-renderer").then(function(t2) {
|
|
92
93
|
if (t2.Highlight)
|
|
93
94
|
return { default: t2.Highlight };
|
|
@@ -97,25 +98,27 @@ var s = /* @__PURE__ */ e.lazy(function() {
|
|
|
97
98
|
return e.createElement("pre", { "data-code-block": true, className: "module-fallback" }, r2);
|
|
98
99
|
} };
|
|
99
100
|
});
|
|
100
|
-
}),
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
}), p = /* @__PURE__ */ e.forwardRef(function(s2, p2) {
|
|
102
|
+
var y = s2.children, d = s2.source, b = s2.language, h = void 0 === b ? "json" : b, g = s2.showCopyButton, v = s2.showLineNumbers, j = m(s2, l), k = u(t(false), 2), O = k[0], w = k[1], E = "string" == typeof y ? y : e.Children.toArray(y).join("");
|
|
103
|
+
y || (E = "object" === c(d) ? JSON.stringify(d, null, 2) : null != d ? d : "");
|
|
104
|
+
var N = [];
|
|
105
|
+
return v && N.push("show-line-numbers"), /* @__PURE__ */ e.createElement(n, i({ "data-code-block": true, as: "div", classNames: N }, j), g ? O ? /* @__PURE__ */ e.createElement(a, { className: "code-block-copied-badge", size: "tiny", shape: "rounded", "aria-live": "polite" }, "Copied!") : /* @__PURE__ */ e.createElement(o, { type: "button", className: "code-block-copy-button", size: "tiny", shape: "rounded", onClick: function() {
|
|
106
|
+
navigator.clipboard.writeText(E).then(function() {
|
|
107
|
+
w(true), setTimeout(function() {
|
|
108
|
+
return w(false);
|
|
106
109
|
}, 3e3);
|
|
107
110
|
}).catch(function(e2) {
|
|
108
111
|
console.error("Could not copy text: ", e2);
|
|
109
112
|
});
|
|
110
|
-
} }, "Copy") : null, /* @__PURE__ */ e.createElement(r, { fallback: /* @__PURE__ */ e.createElement("pre", { "data-code-block": true, className: "suspense-fallback" },
|
|
113
|
+
}, role: "button", "aria-label": "Copy code to clipboard" }, "Copy") : null, /* @__PURE__ */ e.createElement(r, { fallback: /* @__PURE__ */ e.createElement("pre", { "data-code-block": true, className: "suspense-fallback" }, E) }, /* @__PURE__ */ e.createElement(f, { code: E, language: h, theme: void 0 }, function(t2) {
|
|
111
114
|
var r2 = t2.className, n2 = t2.tokens, o2 = t2.getLineProps, a2 = t2.getTokenProps;
|
|
112
|
-
return e.createElement("pre", { ref:
|
|
113
|
-
return e.createElement("div", o2({ line: t3, key: r3 }), t3.map(function(t4, r4) {
|
|
115
|
+
return e.createElement("pre", { ref: p2, className: r2 }, n2.map(function(t3, r3) {
|
|
116
|
+
return e.createElement("div", o2({ line: t3, key: r3 }), v && /* @__PURE__ */ e.createElement("span", { className: "line-numbers" }, r3 + 1), /* @__PURE__ */ e.createElement("span", { className: "l-o-c" }, t3.map(function(t4, r4) {
|
|
114
117
|
return e.createElement("span", a2({ token: t4, key: r4 }));
|
|
115
|
-
}));
|
|
118
|
+
})));
|
|
116
119
|
}));
|
|
117
120
|
})));
|
|
118
121
|
});
|
|
119
122
|
export {
|
|
120
|
-
|
|
123
|
+
p as CodeBlock
|
|
121
124
|
};
|
|
@@ -8,3 +8,9 @@ export declare const CSS: Story;
|
|
|
8
8
|
export declare const Python: Story;
|
|
9
9
|
export declare const Go: Story;
|
|
10
10
|
export declare const CSharp: Story;
|
|
11
|
+
export declare const TypeScript: Story;
|
|
12
|
+
export declare const JSON: Story;
|
|
13
|
+
export declare const Swift: Story;
|
|
14
|
+
export declare const Kotlin: Story;
|
|
15
|
+
export declare const GraphQL: Story;
|
|
16
|
+
export declare const YAML: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./CodeBlock.cjs");require("react"),require("../Element/Element.cjs"),require("../Button/Button.cjs"),exports.CodeBlock=e.CodeBlock;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./CodeBlock.cjs");require("react"),require("../Element/Element.cjs"),require("../Button/Button.cjs"),require("../Badge/Badge.cjs"),exports.CodeBlock=e.CodeBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");var o=["as"],a=["classNames","bgColor","bgColour","borderColor","borderColour","className","columns","fillColor","fillColour","gap","hideOnDesktop","hideOnMobile","hideOnTabletLandscape","hideOnTabletPortrait","horizontalMargin","horizontalPadding","horizontallyCenterThis","horizontallyCentreThis","isFullHeight","isFullWidth","layoutAsFlexbox","layoutAsGrid","marginLeft","marginBottom","margin","marginRight","marginTop","opacity","paddingBottom","paddingLeft","padding","paddingRight","paddingTop","pushItemsToEnds","shadow","shape","showOnlyOnDesktop","showOnlyOnMobile","showOnlyOnTabletLandscape","showOnlyOnTabletPortrait","size","strokeColor","strokeColour","textColor","textColour","verticalMargin","verticalPadding","verticallyCenterItems","verticallyCentreItems","weight"],n=["className","classNames"];function e(){return e=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},e.apply(this,arguments)}function r(t,o){if(null==t)return{};var a,n,e=function(t,o){if(null==t)return{};var a,n,e={},r=Object.keys(t);for(n=0;n<r.length;n++)a=r[n],o.indexOf(a)>=0||(e[a]=t[a]);return e}(t,o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)a=r[n],o.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(e[a]=t[a])}return e}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");var o=["as","role","ariaLabel","tabIndex","onKeyDown"],a=["classNames","bgColor","bgColour","borderColor","borderColour","className","columns","fillColor","fillColour","gap","hideOnDesktop","hideOnMobile","hideOnTabletLandscape","hideOnTabletPortrait","horizontalMargin","horizontalPadding","horizontallyCenterThis","horizontallyCentreThis","isFullHeight","isFullWidth","layoutAsFlexbox","layoutAsGrid","marginLeft","marginBottom","margin","marginRight","marginTop","opacity","paddingBottom","paddingLeft","padding","paddingRight","paddingTop","pushItemsToEnds","shadow","shape","showOnlyOnDesktop","showOnlyOnMobile","showOnlyOnTabletLandscape","showOnlyOnTabletPortrait","size","strokeColor","strokeColour","textColor","textColour","verticalMargin","verticalPadding","verticallyCenterItems","verticallyCentreItems","weight"],n=["className","classNames"];function e(){return e=Object.assign?Object.assign.bind():function(t){for(var o=1;o<arguments.length;o++){var a=arguments[o];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n])}return t},e.apply(this,arguments)}function r(t,o){if(null==t)return{};var a,n,e=function(t,o){if(null==t)return{};var a,n,e={},r=Object.keys(t);for(n=0;n<r.length;n++)a=r[n],o.indexOf(a)>=0||(e[a]=t[a]);return e}(t,o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)a=r[n],o.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(e[a]=t[a])}return e}var l=t.forwardRef((function(l,i){var c=l.as,s=void 0===c?"div":c,d=l.role,g=l.ariaLabel,h=l.tabIndex,p=l.onKeyDown,b=r(l,o),m=b.classNames,u=void 0===m?[]:m,y=b.bgColor,f=b.bgColour,O=b.borderColor,C=b.borderColour,v=b.className;b.columns;var w=b.fillColor,x=b.fillColour;b.gap;var T=b.hideOnDesktop,k=b.hideOnMobile,z=b.hideOnTabletLandscape,P=b.hideOnTabletPortrait,I=b.horizontalMargin,L=b.horizontalPadding,N=b.horizontallyCenterThis,j=b.horizontallyCentreThis,M=b.isFullHeight,D=b.isFullWidth,F=b.layoutAsFlexbox,E=b.layoutAsGrid,R=b.marginLeft,A=b.marginBottom,B=b.margin,S=b.marginRight,K=b.marginTop,G=b.opacity,H=b.paddingBottom,W=b.paddingLeft,q=b.padding,J=b.paddingRight,Q=b.paddingTop,U=b.pushItemsToEnds,V=b.shadow,X=b.shape,Y=b.showOnlyOnDesktop,Z=b.showOnlyOnMobile,$=b.showOnlyOnTabletLandscape,_=b.showOnlyOnTabletPortrait,tt=b.size,ot=b.strokeColor,at=b.strokeColour,nt=b.textColor,et=b.textColour,rt=b.verticalMargin,lt=b.verticalPadding,it=b.verticallyCenterItems,ct=b.verticallyCentreItems,st=b.weight,dt=r(b,a);b.className,b.classNames,r(b,n);var gt,ht=function(t){var o=t.split("-");return 2===o.length?"".concat(o[0],"-light-").concat(100-Number(o[1])):t};return t.createElement(s,e({ref:i,role:d,"aria-label":g,tabIndex:h,onKeyDown:p},dt,{className:(gt=[v,y&&"bg-".concat(ht(y)),f&&"bg-".concat(ht(f)),O&&"border-".concat(ht(O)),C&&"border-".concat(ht(C)),w&&"fill-".concat(ht(w)),x&&"fill-".concat(ht(x)),T&&"hide-on-desktop",k&&"hide-on-mobile",z&&"hide-on-tablet-landscape",P&&"hide-on-tablet-portrait",I&&"margin-right-".concat(I," margin-left-").concat(I),L&&"padding-right-".concat(L," padding-left-").concat(L),N&&"horizontally-centre-this",j&&"horizontally-centre-this",M&&"full-height",D&&"full-width",F&&"layout-flexbox",E&&"layout-grid",R&&"margin-left-".concat(R),A&&"margin-bottom-".concat(A),B&&"margin-all-".concat(B),S&&"margin-right-".concat(S),K&&"margin-top-".concat(K),G&&"opacity-".concat(G),H&&"padding-bottom-".concat(H),W&&"padding-left-".concat(W),q&&"padding-all-".concat(q),J&&"padding-right-".concat(J),Q&&"padding-top-".concat(Q),U&&"push-to-ends",V&&"shadow-".concat(V),X&&"shape-".concat(X),Y&&"show-only-on-desktop",Z&&"show-only-on-mobile",$&&"show-only-on-tablet-landscape",_&&"show-only-on-tablet-portrait",tt&&"size-".concat(tt),ot&&"stroke-".concat(ht(ot)),at&&"stroke-".concat(ht(at)),nt&&"text-".concat(ht(nt)),et&&"text-".concat(ht(et)),rt&&"margin-top-".concat(rt," margin-bottom-").concat(rt),lt&&"padding-top-".concat(lt," padding-bottom-").concat(lt),it&&"vertically-centre-items",ct&&"vertically-centre-items",st&&"weight-".concat(st)].concat(u),gt.filter((function(t){return!!t})).join(" "))}))}));exports.Element=l;
|