@umami/react-zen 0.7.0 → 0.8.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/dist/index.css +6 -1
- package/dist/index.d.ts +750 -747
- package/dist/index.js +234 -198
- package/dist/index.mjs +75 -34
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -25322,9 +25322,28 @@ function Form(props) {
|
|
|
25322
25322
|
}
|
|
25323
25323
|
|
|
25324
25324
|
// src/components/form/FormField.tsx
|
|
25325
|
-
import {
|
|
25325
|
+
import { cloneElement as cloneElement2 } from "react";
|
|
25326
25326
|
var import_classnames7 = __toESM(require_classnames());
|
|
25327
25327
|
|
|
25328
|
+
// src/lib/utils.ts
|
|
25329
|
+
import {
|
|
25330
|
+
Children,
|
|
25331
|
+
cloneElement,
|
|
25332
|
+
Fragment,
|
|
25333
|
+
isValidElement
|
|
25334
|
+
} from "react";
|
|
25335
|
+
function getFragmentChildren(children) {
|
|
25336
|
+
return children?.type === Fragment ? children.props.children : children;
|
|
25337
|
+
}
|
|
25338
|
+
function mapChildren(children, handler) {
|
|
25339
|
+
return Children.map(getFragmentChildren(children), (child, index) => {
|
|
25340
|
+
if (!child?.props) {
|
|
25341
|
+
return null;
|
|
25342
|
+
}
|
|
25343
|
+
return handler(child, index);
|
|
25344
|
+
});
|
|
25345
|
+
}
|
|
25346
|
+
|
|
25328
25347
|
// src/components/form/FormField.module.css
|
|
25329
25348
|
var FormField_default = {
|
|
25330
25349
|
input: "FormField_input",
|
|
@@ -25339,9 +25358,8 @@ function FormField({ name, description, rules, className, children, ...props })
|
|
|
25339
25358
|
const { field } = useController({ name, control, rules });
|
|
25340
25359
|
const errors = formState?.errors || {};
|
|
25341
25360
|
const errorMessage = errors[name]?.message;
|
|
25342
|
-
const child = Children.only(children);
|
|
25343
25361
|
return /* @__PURE__ */ jsxs3("div", { ...props, className: (0, import_classnames7.default)(FormField_default.input, className), children: [
|
|
25344
|
-
typeof
|
|
25362
|
+
typeof children === "function" ? children(field) : mapChildren(children, (child) => child ? cloneElement2(child, field) : null),
|
|
25345
25363
|
description && /* @__PURE__ */ jsx8("div", { className: FormField_default.description, children: description }),
|
|
25346
25364
|
errorMessage && /* @__PURE__ */ jsx8("div", { className: FormField_default.error, children: errorMessage })
|
|
25347
25365
|
] });
|
|
@@ -26480,10 +26498,10 @@ var Dialog_default = {
|
|
|
26480
26498
|
};
|
|
26481
26499
|
|
|
26482
26500
|
// src/components/Dialog.tsx
|
|
26483
|
-
import { Fragment, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
26501
|
+
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
26484
26502
|
function Dialog({ title, children, className, ...props }) {
|
|
26485
26503
|
return /* @__PURE__ */ jsx15($de32f1b87079253c$export$3ddf2d174ce01153, { ...props, className: (0, import_classnames11.default)(Dialog_default.dialog, className), children: ({ close }) => {
|
|
26486
|
-
return /* @__PURE__ */ jsxs7(
|
|
26504
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
26487
26505
|
title && /* @__PURE__ */ jsx15("div", { className: Dialog_default.title, children: title }),
|
|
26488
26506
|
typeof children === "function" ? children({ close }) : children
|
|
26489
26507
|
] });
|
|
@@ -26606,10 +26624,10 @@ var Checkbox_default = {
|
|
|
26606
26624
|
};
|
|
26607
26625
|
|
|
26608
26626
|
// src/components/Checkbox.tsx
|
|
26609
|
-
import { Fragment as
|
|
26627
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
26610
26628
|
function Checkbox({ className, children, ...props }) {
|
|
26611
26629
|
return /* @__PURE__ */ jsx20($bc237834342dbd75$export$48513f6b9f8ce62d, { ...props, className: (0, import_classnames15.default)(Checkbox_default.checkbox, className), children: ({ isIndeterminate, isSelected }) => {
|
|
26612
|
-
return /* @__PURE__ */ jsxs11(
|
|
26630
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
26613
26631
|
/* @__PURE__ */ jsx20("div", { className: Checkbox_default.box, children: /* @__PURE__ */ jsx20(Icon, { className: Checkbox_default.icon, size: "xs", children: isIndeterminate ? /* @__PURE__ */ jsx20(Icons.Minus, {}) : isSelected ? /* @__PURE__ */ jsx20(Icons.Check, {}) : null }) }),
|
|
26614
26632
|
children
|
|
26615
26633
|
] });
|
|
@@ -26767,12 +26785,13 @@ function TextField({
|
|
|
26767
26785
|
useEffect3(() => {
|
|
26768
26786
|
setInputValue(value);
|
|
26769
26787
|
}, [value]);
|
|
26770
|
-
return /* @__PURE__ */ jsxs14($bcdf0525bf22703d$export$2c73285ae9390cec, {
|
|
26788
|
+
return /* @__PURE__ */ jsxs14($bcdf0525bf22703d$export$2c73285ae9390cec, { className: (0, import_classnames21.default)(Input_default.field, className), children: [
|
|
26771
26789
|
label && /* @__PURE__ */ jsx26($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: Input_default.label, children: label }),
|
|
26772
26790
|
/* @__PURE__ */ jsxs14("div", { className: Input_default.row, children: [
|
|
26773
26791
|
/* @__PURE__ */ jsx26(
|
|
26774
26792
|
Component,
|
|
26775
26793
|
{
|
|
26794
|
+
...props,
|
|
26776
26795
|
value: inputValue,
|
|
26777
26796
|
className: (0, import_classnames21.default)(
|
|
26778
26797
|
TextField_default.input,
|
|
@@ -26795,7 +26814,7 @@ var ConfirmationDialog_default = {
|
|
|
26795
26814
|
};
|
|
26796
26815
|
|
|
26797
26816
|
// src/components/ConfirmationDialog.tsx
|
|
26798
|
-
import { Fragment as
|
|
26817
|
+
import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
26799
26818
|
function ConfirmationDialog({
|
|
26800
26819
|
value,
|
|
26801
26820
|
confirmMessage,
|
|
@@ -26814,7 +26833,7 @@ function ConfirmationDialog({
|
|
|
26814
26833
|
className: (0, import_classnames22.default)(ConfirmationDialog_default.dialog, className),
|
|
26815
26834
|
isConfirmDisabled: !canSave,
|
|
26816
26835
|
children: ({ close }) => {
|
|
26817
|
-
return /* @__PURE__ */ jsxs15(
|
|
26836
|
+
return /* @__PURE__ */ jsxs15(Fragment4, { children: [
|
|
26818
26837
|
typeof children === "function" ? children({ close }) : children,
|
|
26819
26838
|
/* @__PURE__ */ jsxs15(Text, { children: [
|
|
26820
26839
|
confirmMessage || "Type the following value to confirm",
|
|
@@ -26830,7 +26849,7 @@ function ConfirmationDialog({
|
|
|
26830
26849
|
|
|
26831
26850
|
// src/components/DataTable.tsx
|
|
26832
26851
|
var import_classnames24 = __toESM(require_classnames());
|
|
26833
|
-
import { Children as
|
|
26852
|
+
import { Children as Children3 } from "react";
|
|
26834
26853
|
|
|
26835
26854
|
// src/components/Table.tsx
|
|
26836
26855
|
var import_classnames23 = __toESM(require_classnames());
|
|
@@ -26887,7 +26906,7 @@ var DataTable_default = {
|
|
|
26887
26906
|
import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
26888
26907
|
import { createElement as createElement2 } from "react";
|
|
26889
26908
|
function DataTable({ data = [], className, children, ...props }) {
|
|
26890
|
-
const columns =
|
|
26909
|
+
const columns = Children3.map(children, (child) => {
|
|
26891
26910
|
return { ...child.props, value: child.props.children };
|
|
26892
26911
|
});
|
|
26893
26912
|
return /* @__PURE__ */ jsxs16(Table, { ...props, className: (0, import_classnames24.default)(DataTable_default.datatable, className), children: [
|
|
@@ -27178,10 +27197,10 @@ var ProgressBar_default = {
|
|
|
27178
27197
|
};
|
|
27179
27198
|
|
|
27180
27199
|
// src/components/ProgressBar.tsx
|
|
27181
|
-
import { Fragment as
|
|
27200
|
+
import { Fragment as Fragment5, jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
27182
27201
|
function ProgressBar({ className, showValue, ...props }) {
|
|
27183
27202
|
return /* @__PURE__ */ jsx40($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames35.default)(ProgressBar_default.progressbar, className), children: ({ percentage = 0, valueText }) => {
|
|
27184
|
-
return /* @__PURE__ */ jsxs22(
|
|
27203
|
+
return /* @__PURE__ */ jsxs22(Fragment5, { children: [
|
|
27185
27204
|
/* @__PURE__ */ jsx40("div", { className: ProgressBar_default.track, children: /* @__PURE__ */ jsx40("div", { className: ProgressBar_default.fill, style: { width: `${percentage}%` } }) }),
|
|
27186
27205
|
showValue && /* @__PURE__ */ jsx40("div", { className: ProgressBar_default.value, children: valueText })
|
|
27187
27206
|
] });
|
|
@@ -27200,13 +27219,13 @@ var ProgressCircle_default = {
|
|
|
27200
27219
|
};
|
|
27201
27220
|
|
|
27202
27221
|
// src/components/ProgressCircle.tsx
|
|
27203
|
-
import { Fragment as
|
|
27222
|
+
import { Fragment as Fragment6, jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
27204
27223
|
function ProgressCircle({ className, showValue, ...props }) {
|
|
27205
27224
|
return /* @__PURE__ */ jsx41($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames36.default)(ProgressCircle_default.progresscircle, className), children: ({ percentage = 0, valueText }) => {
|
|
27206
27225
|
const radius = 45;
|
|
27207
27226
|
const circumference = radius * 2 * Math.PI;
|
|
27208
27227
|
const offset = circumference - percentage / 100 * circumference;
|
|
27209
|
-
return /* @__PURE__ */ jsxs23(
|
|
27228
|
+
return /* @__PURE__ */ jsxs23(Fragment6, { children: [
|
|
27210
27229
|
/* @__PURE__ */ jsxs23("svg", { viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
27211
27230
|
/* @__PURE__ */ jsx41("circle", { className: ProgressCircle_default.track, cx: "50", cy: "50", r: "45" }),
|
|
27212
27231
|
/* @__PURE__ */ jsx41(
|
|
@@ -27304,15 +27323,36 @@ var Select_default = {
|
|
|
27304
27323
|
|
|
27305
27324
|
// src/components/Select.tsx
|
|
27306
27325
|
import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
27307
|
-
function Select({
|
|
27308
|
-
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
|
|
27326
|
+
function Select({
|
|
27327
|
+
children,
|
|
27328
|
+
items = [],
|
|
27329
|
+
value,
|
|
27330
|
+
label,
|
|
27331
|
+
className,
|
|
27332
|
+
onSelectionChange,
|
|
27333
|
+
onChange,
|
|
27334
|
+
...props
|
|
27335
|
+
}) {
|
|
27336
|
+
const handleChange = (e) => {
|
|
27337
|
+
onSelectionChange?.(e);
|
|
27338
|
+
onChange?.(e);
|
|
27339
|
+
};
|
|
27340
|
+
return /* @__PURE__ */ jsxs25(
|
|
27341
|
+
$82d7e5349645de74$export$ef9b1a59e592288f,
|
|
27342
|
+
{
|
|
27343
|
+
...props,
|
|
27344
|
+
className: (0, import_classnames39.default)(Input_default.field, className),
|
|
27345
|
+
onSelectionChange: handleChange,
|
|
27346
|
+
children: [
|
|
27347
|
+
label && /* @__PURE__ */ jsx44($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: Input_default.label, children: label }),
|
|
27348
|
+
/* @__PURE__ */ jsx44($d2b4bc8c273e7be6$export$353f5b6fc5456de1, { className: (0, import_classnames39.default)(Input_default.input, className), children: /* @__PURE__ */ jsxs25(Row, { justifyContent: "space-between", gap: "md", children: [
|
|
27349
|
+
/* @__PURE__ */ jsx44($82d7e5349645de74$export$e288731fd71264f0, {}),
|
|
27350
|
+
/* @__PURE__ */ jsx44("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx44(Icon, { rotate: 90, size: "xs", className: Input_default.icon, children: /* @__PURE__ */ jsx44(Icons.Chevron, {}) }) })
|
|
27351
|
+
] }) }),
|
|
27352
|
+
/* @__PURE__ */ jsx44(Popover, { children: /* @__PURE__ */ jsx44(List, { items, className: Select_default.list, children }) })
|
|
27353
|
+
]
|
|
27354
|
+
}
|
|
27355
|
+
);
|
|
27316
27356
|
}
|
|
27317
27357
|
|
|
27318
27358
|
// src/components/Slider.tsx
|
|
@@ -27329,14 +27369,14 @@ var Slider_default = {
|
|
|
27329
27369
|
};
|
|
27330
27370
|
|
|
27331
27371
|
// src/components/Slider.tsx
|
|
27332
|
-
import { Fragment as
|
|
27372
|
+
import { Fragment as Fragment7, jsx as jsx45, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
27333
27373
|
function Slider({ className, showValue = true, label, ...props }) {
|
|
27334
27374
|
return /* @__PURE__ */ jsxs26($6f909507e6374d18$export$472062a354075cee, { ...props, className: (0, import_classnames40.default)(Slider_default.slider, className), children: [
|
|
27335
27375
|
label && /* @__PURE__ */ jsx45(Label, { className: Slider_default.label, children: label }),
|
|
27336
27376
|
showValue && /* @__PURE__ */ jsx45($6f909507e6374d18$export$a590f758a961cb5b, { className: Slider_default.output }),
|
|
27337
27377
|
/* @__PURE__ */ jsx45($6f909507e6374d18$export$105594979f116971, { className: Slider_default.track, children: ({ state }) => {
|
|
27338
27378
|
const isHorizontal = state.orientation === "horizontal";
|
|
27339
|
-
return /* @__PURE__ */ jsxs26(
|
|
27379
|
+
return /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
27340
27380
|
/* @__PURE__ */ jsx45(
|
|
27341
27381
|
"div",
|
|
27342
27382
|
{
|
|
@@ -27446,6 +27486,7 @@ var import_classnames44 = __toESM(require_classnames());
|
|
|
27446
27486
|
|
|
27447
27487
|
// src/components/TextArea.module.css
|
|
27448
27488
|
var TextArea_default = {
|
|
27489
|
+
textarea: "TextArea_textarea",
|
|
27449
27490
|
none: "TextArea_none",
|
|
27450
27491
|
horizontal: "TextArea_horizontal",
|
|
27451
27492
|
vertical: "TextArea_vertical"
|
|
@@ -27557,7 +27598,7 @@ function composeContextScopes(...scopes) {
|
|
|
27557
27598
|
|
|
27558
27599
|
// node_modules/@radix-ui/react-toast/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
27559
27600
|
import * as React7 from "react";
|
|
27560
|
-
import { Fragment as
|
|
27601
|
+
import { Fragment as Fragment8, jsx as jsx52 } from "react/jsx-runtime";
|
|
27561
27602
|
var Slot = React7.forwardRef((props, forwardedRef) => {
|
|
27562
27603
|
const { children, ...slotProps } = props;
|
|
27563
27604
|
const childrenArray = React7.Children.toArray(children);
|
|
@@ -27591,7 +27632,7 @@ var SlotClone = React7.forwardRef((props, forwardedRef) => {
|
|
|
27591
27632
|
});
|
|
27592
27633
|
SlotClone.displayName = "SlotClone";
|
|
27593
27634
|
var Slottable = ({ children }) => {
|
|
27594
|
-
return /* @__PURE__ */ jsx52(
|
|
27635
|
+
return /* @__PURE__ */ jsx52(Fragment8, { children });
|
|
27595
27636
|
};
|
|
27596
27637
|
function isSlottable(child) {
|
|
27597
27638
|
return React7.isValidElement(child) && child.type === Slottable;
|
|
@@ -28180,7 +28221,7 @@ var VisuallyHidden = React17.forwardRef(
|
|
|
28180
28221
|
VisuallyHidden.displayName = NAME;
|
|
28181
28222
|
|
|
28182
28223
|
// node_modules/@radix-ui/react-toast/dist/index.mjs
|
|
28183
|
-
import { Fragment as
|
|
28224
|
+
import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
28184
28225
|
var PROVIDER_NAME = "ToastProvider";
|
|
28185
28226
|
var [Collection, useCollection, createCollectionScope] = createCollection("Toast");
|
|
28186
28227
|
var [createToastContext, createToastScope] = createContextScope("Toast", [createCollectionScope]);
|
|
@@ -28526,7 +28567,7 @@ var ToastImpl = React18.forwardRef(
|
|
|
28526
28567
|
return node ? getAnnounceTextContent(node) : null;
|
|
28527
28568
|
}, [node]);
|
|
28528
28569
|
if (!context.viewport) return null;
|
|
28529
|
-
return /* @__PURE__ */ jsxs29(
|
|
28570
|
+
return /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
28530
28571
|
announceTextContent && /* @__PURE__ */ jsx58(
|
|
28531
28572
|
ToastAnnounce,
|
|
28532
28573
|
{
|
|
@@ -28646,7 +28687,7 @@ var ToastAnnounce = (props) => {
|
|
|
28646
28687
|
const timer = window.setTimeout(() => setIsAnnounced(true), 1e3);
|
|
28647
28688
|
return () => window.clearTimeout(timer);
|
|
28648
28689
|
}, []);
|
|
28649
|
-
return isAnnounced ? null : /* @__PURE__ */ jsx58(Portal, { asChild: true, children: /* @__PURE__ */ jsx58(VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ jsxs29(
|
|
28690
|
+
return isAnnounced ? null : /* @__PURE__ */ jsx58(Portal, { asChild: true, children: /* @__PURE__ */ jsx58(VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
28650
28691
|
context.label,
|
|
28651
28692
|
" ",
|
|
28652
28693
|
children
|
|
@@ -28807,7 +28848,7 @@ var Toast_default = {
|
|
|
28807
28848
|
};
|
|
28808
28849
|
|
|
28809
28850
|
// src/components/Toast.tsx
|
|
28810
|
-
import { Fragment as
|
|
28851
|
+
import { Fragment as Fragment10, jsx as jsx59, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
28811
28852
|
import { createElement as createElement4 } from "react";
|
|
28812
28853
|
var icons = {
|
|
28813
28854
|
info: Icons.Info,
|
|
@@ -28833,7 +28874,7 @@ function Toast2({
|
|
|
28833
28874
|
}
|
|
28834
28875
|
function Toaster(props) {
|
|
28835
28876
|
const { toasts } = useToast();
|
|
28836
|
-
return /* @__PURE__ */ jsxs30(
|
|
28877
|
+
return /* @__PURE__ */ jsxs30(Fragment10, { children: [
|
|
28837
28878
|
toasts.map(({ id, message, props: props2 }) => {
|
|
28838
28879
|
return /* @__PURE__ */ createElement4(Toast2, { ...props2, key: id, description: message });
|
|
28839
28880
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umami/react-zen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "React components built by Umami.",
|
|
5
5
|
"author": "Umami <hello@umami.is>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -133,6 +133,6 @@
|
|
|
133
133
|
"stylelint": "^16.7.0",
|
|
134
134
|
"stylelint-config-prettier": "^9.0.5",
|
|
135
135
|
"tsup": "^8.3.0",
|
|
136
|
-
"typescript": "^5"
|
|
136
|
+
"typescript": "^5.6.3"
|
|
137
137
|
}
|
|
138
138
|
}
|