@shware/workflow-ui 2.0.0 → 2.0.1
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/index.d.mts.map +1 -1
- package/dist/index.mjs +39 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/integrations/theme/root-provider.tsx +24 -12
- package/src/components/date-range.tsx +10 -2
- package/src/components/dropdown/index.tsx +10 -2
- package/src/components/flag.tsx +10 -7
- package/src/components/menu/index.tsx +10 -2
- package/src/components/modal/index.tsx +2 -1
- package/src/components/profile-drawer.tsx +29 -15
- package/src/components/slack-preview.tsx +33 -30
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["Props","Props","Props"],"sources":["../src/components/button/index.tsx","../src/components/corner-shape.ts","../src/components/workflow-canvas.tsx","../src/utils/template-content.ts","../src/components/template-refs.ts","../src/components/templates-page.tsx","../src/components/push-preview.tsx","../src/components/workflow-list.tsx","../src/components/metric-card.tsx","../src/components/date-range.tsx","../src/components/channel-icon.ts","../src/components/avatar.tsx","../src/components/sparkline.tsx","../src/components/layout.ts"],"mappings":";;;;;;;;;;;KAWY;UAEFA,gBAAc,KAAK;EAC3B,OAAO;EACP,WAAW;EACX;EACA;;wBAyCc,SACd,UACA,WACA,MACA,OACA,MACA,YACG,SACFA,0BAAK,IAAA;;;;;;;;;;;;;qBCtDK,cAAuD;;;;;;;;;;;;;;UCgDnD;EACf,IAAI;;EAEJ,QAAQ;;;;;;;EAOR;;EAEA;;EAEA,gBAAgB;;wBAkXF,iBACd,IACA,OACA,WACA,YACA,gBACC,sCAAmB,IAAA;;;;;;;;;;;;KCraVC,UAAQ;;;;;;UAOH;EACf;EACA,QAAQ;;;;;;;;;UC/BO;;EAEf;;EAEA;;EAEA,OAAO;;UAGQ;EACf;EACA;;EAEA,QAAQ;;;;;;wBA8BM,oBAAoB,cAAc,eAAe;;;;;;;wBA+BjD,iBACd,cAAc,cACd;EAAc;EAAiB;EAAiB;EAAmB;IAClE;;;;;;;;UClDc;EACf;EACA;;EAEA,UAAU;;EAEV;EACA;;UAKe;EACf,MAAM;;EAEN,QAAQ,eAAe;;EAEvB,SAAS,eAAe;;EAExB,WAAW,eAAe;EAC1B,SAAS,eAAe;;EAExB;EACA;;;;;;EAMA;;EAEA,SAAS;;EAET,cAAc;;;;;EAKd,eAAeC;;;;;EAKf,wBAAwB,OAAOA;;;;;;EAM/B;;wBA+Jc,gBACd,MACA,QACA,QACA,UACA,QACA,SACA,UACA,iBACA,SACA,aACA,cACA,sBACA,iBACC,qCAAkB,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC7NJ;;EAEf;;EAEA;EACA;EACA;EACA;;wBAgac,cAAc,SAAS,OAAO,MAAM,QAAQ,QAAQ,mCAAgB,IAAA;;;;;;;;;;;;;UCvbnE;;EAEf;IAAS;IAAa,IAAI;;EAC1B,UAAU;EACV,SAAS;;wBAqDK,eAAe,OAAO,SAAS,UAAU,oCAAiB,IAAA;;;;;;;;;;;;;;;;;KCxD9D;;;;;;;;;UAUK;;EAEf;;EAEA;;UAGe;EACf;;EAEA;;EAEA;IAAU;IAAc,OAAO;;;;;;EAK/B;;;;;;EAMA,iBAAiB;;EAEjB,SAAS;;wBAkEK,aAAa,OAAO,OAAO,OAAO,OAAO,QAAQ,UAAU,kCAAe,IAAA;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Props","Props","Props"],"sources":["../src/components/button/index.tsx","../src/components/corner-shape.ts","../src/components/workflow-canvas.tsx","../src/utils/template-content.ts","../src/components/template-refs.ts","../src/components/templates-page.tsx","../src/components/push-preview.tsx","../src/components/workflow-list.tsx","../src/components/metric-card.tsx","../src/components/date-range.tsx","../src/components/channel-icon.ts","../src/components/avatar.tsx","../src/components/sparkline.tsx","../src/components/layout.ts"],"mappings":";;;;;;;;;;;KAWY;UAEFA,gBAAc,KAAK;EAC3B,OA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BAAiB;;EAEjB,SAAS;;wBAkEK,aAAa,OAAO,OAAO,OAAO,OAAO,QAAQ,UAAU,kCAAe,IAAA;;;;;;;;UC/FzE;EACf;EACA;;;;;;;wBAQc,OAAO,MAAM;;wBAQb,YAAY,cAAc;;wBAM1B,SAAS,gBAAgB;;wBAQzB,UAAU,aAAa;UAU7B;EACR,OAAO;EACP,WAAW,OAAO;EAClB;;;;;;;;;;wBAWc,kBAAkB,OAAO,UAAU,aAAa,wBAAK,IAAA;;;;;;;;;;;;qBC3DxD,cAAc,OAAO,eAAe;;qBAYpC,mBAAmB;qBAEnB,cAAW,SAAa,8BAA4B;;;;;;;;;;;;;UCxBhD;;EAEf;;EAEA;;EAEA;;wBASc,SAAS,SAAS,OAAO,QAAe,8BAAW,IAAA;;;;;;;;;;UCrBlD;EACf;EACA;EACA;EACA;;wBAGc,YAAY,QAAQ,OAAY,QAAa,aAAa,iCAAc,IAAA;;;;;;;;;;;;KCD5E;KAEA;UAmBK,uBAAuB;EACtC;EACA;EACA,UAAU;;EAEV;EACA,MAAM;;EAEN;;;qBAIW;WAAc;WAAQ;;;;;;;;qBAOtB;WAAc;WAAgB;;UAE1B;EACf;EACA;EACA;IAAY;IAAW;;EACvB,MAAM;;UAGS;EACf;EACA;EACA;EACA;;EAEA;IAAS;;;wBAmNK,OACd,IAAI,YACJ,QAAQ;EACL,OAAO;EAAc,OAAO"}
|
package/dist/index.mjs
CHANGED
|
@@ -1453,38 +1453,38 @@ const textOf = (value) => {
|
|
|
1453
1453
|
const object = value;
|
|
1454
1454
|
return typeof object.text === "string" ? object : void 0;
|
|
1455
1455
|
};
|
|
1456
|
+
const linkClass = "text-[#1d9bd1] hover:underline";
|
|
1457
|
+
const Text = ({ value, className }) => value === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
1458
|
+
className: `break-words whitespace-pre-wrap ${className ?? ""}`,
|
|
1459
|
+
children: value.type === "mrkdwn" ? /* @__PURE__ */ jsx(ChatMarkup, {
|
|
1460
|
+
text: value.text,
|
|
1461
|
+
dialect: "slack",
|
|
1462
|
+
linkClass
|
|
1463
|
+
}) : value.text
|
|
1464
|
+
});
|
|
1465
|
+
const Button$1 = ({ element, colors }) => {
|
|
1466
|
+
const style = element.style;
|
|
1467
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1468
|
+
className: "inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold",
|
|
1469
|
+
style: style === "primary" ? {
|
|
1470
|
+
background: "#007a5a",
|
|
1471
|
+
borderColor: "#007a5a",
|
|
1472
|
+
color: "#fff"
|
|
1473
|
+
} : style === "danger" ? {
|
|
1474
|
+
background: "#e01e5a",
|
|
1475
|
+
borderColor: "#e01e5a",
|
|
1476
|
+
color: "#fff"
|
|
1477
|
+
} : {
|
|
1478
|
+
borderColor: colors.border,
|
|
1479
|
+
color: colors.name
|
|
1480
|
+
},
|
|
1481
|
+
children: textOf(element.text)?.text
|
|
1482
|
+
});
|
|
1483
|
+
};
|
|
1456
1484
|
function SlackPreview({ message, appName, scheme, zoom }) {
|
|
1457
1485
|
const { t } = useTranslation();
|
|
1458
1486
|
const colors = PALETTE[scheme];
|
|
1459
1487
|
const name = message.username ?? appName;
|
|
1460
|
-
const linkClass = "text-[#1d9bd1] hover:underline";
|
|
1461
|
-
const Text = ({ value, className }) => value === void 0 ? null : /* @__PURE__ */ jsx("div", {
|
|
1462
|
-
className: `break-words whitespace-pre-wrap ${className ?? ""}`,
|
|
1463
|
-
children: value.type === "mrkdwn" ? /* @__PURE__ */ jsx(ChatMarkup, {
|
|
1464
|
-
text: value.text,
|
|
1465
|
-
dialect: "slack",
|
|
1466
|
-
linkClass
|
|
1467
|
-
}) : value.text
|
|
1468
|
-
});
|
|
1469
|
-
const Button = ({ element }) => {
|
|
1470
|
-
const style = element.style;
|
|
1471
|
-
return /* @__PURE__ */ jsx("span", {
|
|
1472
|
-
className: "inline-flex h-8 items-center rounded-lg border px-3 text-[13px] font-bold",
|
|
1473
|
-
style: style === "primary" ? {
|
|
1474
|
-
background: "#007a5a",
|
|
1475
|
-
borderColor: "#007a5a",
|
|
1476
|
-
color: "#fff"
|
|
1477
|
-
} : style === "danger" ? {
|
|
1478
|
-
background: "#e01e5a",
|
|
1479
|
-
borderColor: "#e01e5a",
|
|
1480
|
-
color: "#fff"
|
|
1481
|
-
} : {
|
|
1482
|
-
borderColor: colors.border,
|
|
1483
|
-
color: colors.name
|
|
1484
|
-
},
|
|
1485
|
-
children: textOf(element.text)?.text
|
|
1486
|
-
});
|
|
1487
|
-
};
|
|
1488
1488
|
const blocks = message.blocks ?? [];
|
|
1489
1489
|
return /* @__PURE__ */ jsx("div", {
|
|
1490
1490
|
className: "mx-auto w-full max-w-2xl overflow-hidden rounded-2xl border shadow-sm",
|
|
@@ -1562,7 +1562,10 @@ function SlackPreview({ message, appName, scheme, zoom }) {
|
|
|
1562
1562
|
alt: accessory.alt_text ?? "",
|
|
1563
1563
|
className: "size-[88px] shrink-0 rounded-lg object-cover"
|
|
1564
1564
|
}),
|
|
1565
|
-
accessory?.type === "button" && /* @__PURE__ */ jsx(Button, {
|
|
1565
|
+
accessory?.type === "button" && /* @__PURE__ */ jsx(Button$1, {
|
|
1566
|
+
element: accessory,
|
|
1567
|
+
colors
|
|
1568
|
+
})
|
|
1566
1569
|
]
|
|
1567
1570
|
}, key);
|
|
1568
1571
|
}
|
|
@@ -1577,7 +1580,10 @@ function SlackPreview({ message, appName, scheme, zoom }) {
|
|
|
1577
1580
|
}, key);
|
|
1578
1581
|
case "actions": return /* @__PURE__ */ jsx("div", {
|
|
1579
1582
|
className: "mt-1 flex flex-wrap gap-2",
|
|
1580
|
-
children: (block.elements ?? []).map((element, i) => element.type === "button" ? /* @__PURE__ */ jsx(Button, {
|
|
1583
|
+
children: (block.elements ?? []).map((element, i) => element.type === "button" ? /* @__PURE__ */ jsx(Button$1, {
|
|
1584
|
+
element,
|
|
1585
|
+
colors
|
|
1586
|
+
}, i) : null)
|
|
1581
1587
|
}, key);
|
|
1582
1588
|
case "image": return /* @__PURE__ */ jsxs("figure", {
|
|
1583
1589
|
className: "mt-1",
|
|
@@ -2515,6 +2521,7 @@ function DateRangePicker({ value, onChange, className }) {
|
|
|
2515
2521
|
shift({ padding: 8 })
|
|
2516
2522
|
]
|
|
2517
2523
|
});
|
|
2524
|
+
const { setFloating, setReference } = refs;
|
|
2518
2525
|
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
2519
2526
|
useClick(context),
|
|
2520
2527
|
useDismiss(context),
|
|
@@ -2534,7 +2541,7 @@ function DateRangePicker({ value, onChange, className }) {
|
|
|
2534
2541
|
});
|
|
2535
2542
|
};
|
|
2536
2543
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Button, {
|
|
2537
|
-
ref:
|
|
2544
|
+
ref: setReference,
|
|
2538
2545
|
size: "sm",
|
|
2539
2546
|
variant: "outline",
|
|
2540
2547
|
className: cn("gap-2 font-normal", className),
|
|
@@ -2556,7 +2563,7 @@ function DateRangePicker({ value, onChange, className }) {
|
|
|
2556
2563
|
context,
|
|
2557
2564
|
modal: false,
|
|
2558
2565
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2559
|
-
ref:
|
|
2566
|
+
ref: setFloating,
|
|
2560
2567
|
style: {
|
|
2561
2568
|
...floatingStyles,
|
|
2562
2569
|
...superellipse
|