@mediaradar/design-components 0.8.1 → 0.9.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.cjs +50 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -12
- package/dist/index.d.ts +72 -12
- package/dist/index.js +49 -25
- package/dist/index.js.map +1 -1
- package/package.json +63 -63
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(index_exports, {
|
|
|
28
28
|
Button: () => Button,
|
|
29
29
|
Card: () => Card,
|
|
30
30
|
CheckBox: () => CheckBox,
|
|
31
|
+
CheckBoxBox: () => CheckBoxBox,
|
|
31
32
|
ChipContent: () => ChipContent,
|
|
32
33
|
DEFAULT_SEARCH_MATCH: () => DEFAULT_SEARCH_MATCH,
|
|
33
34
|
DataScopeFilter: () => DataScopeFilter,
|
|
@@ -463,9 +464,39 @@ function OptionRow({
|
|
|
463
464
|
|
|
464
465
|
// src/CheckBox.tsx
|
|
465
466
|
var import_lucide_react4 = require("lucide-react");
|
|
467
|
+
|
|
468
|
+
// src/cn.ts
|
|
469
|
+
var import_clsx = require("clsx");
|
|
470
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
471
|
+
function cn(...inputs) {
|
|
472
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/CheckBox.tsx
|
|
466
476
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
467
|
-
function
|
|
468
|
-
|
|
477
|
+
function boxClass(on, disabled) {
|
|
478
|
+
return cn(
|
|
479
|
+
"flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
|
|
480
|
+
on ? "border-transparent bg-brand-primaryAction text-white" : "border-border-interactive bg-input",
|
|
481
|
+
disabled && "cursor-not-allowed opacity-50"
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
function Glyph({ checked, indeterminate }) {
|
|
485
|
+
if (indeterminate) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Minus, { size: 13, strokeWidth: 3 });
|
|
486
|
+
return checked ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Check, { size: 13, strokeWidth: 3 }) : null;
|
|
487
|
+
}
|
|
488
|
+
function CheckBox({
|
|
489
|
+
checked,
|
|
490
|
+
indeterminate,
|
|
491
|
+
onChange,
|
|
492
|
+
ariaLabel,
|
|
493
|
+
disabled,
|
|
494
|
+
stopPropagation = true,
|
|
495
|
+
testId,
|
|
496
|
+
title,
|
|
497
|
+
className
|
|
498
|
+
}) {
|
|
499
|
+
const on = checked || !!indeterminate;
|
|
469
500
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
470
501
|
"button",
|
|
471
502
|
{
|
|
@@ -477,25 +508,26 @@ function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, testI
|
|
|
477
508
|
disabled,
|
|
478
509
|
"data-testid": testId,
|
|
479
510
|
onClick: (e) => {
|
|
480
|
-
e.stopPropagation();
|
|
511
|
+
if (stopPropagation) e.stopPropagation();
|
|
481
512
|
onChange();
|
|
482
513
|
},
|
|
483
|
-
className:
|
|
484
|
-
|
|
514
|
+
className: cn(
|
|
515
|
+
boxClass(on, disabled),
|
|
485
516
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
486
|
-
on
|
|
517
|
+
!on && "hover:border-brand-primaryAction",
|
|
487
518
|
// Cancels the unchecked hover-border preview when disabled -- without
|
|
488
519
|
// this, a disabled box still visually previews the "you can click
|
|
489
520
|
// this" affordance on hover even though the click does nothing.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
].filter(Boolean).join(" "),
|
|
495
|
-
children: indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Minus, { size: 13, strokeWidth: 3 }) : checked ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_lucide_react4.Check, { size: 13, strokeWidth: 3 }) : null
|
|
521
|
+
disabled && "hover:border-border-interactive",
|
|
522
|
+
className
|
|
523
|
+
),
|
|
524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Glyph, { checked, indeterminate })
|
|
496
525
|
}
|
|
497
526
|
);
|
|
498
527
|
}
|
|
528
|
+
function CheckBoxBox({ checked, indeterminate, disabled, className }) {
|
|
529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": "true", className: cn(boxClass(checked || !!indeterminate, disabled), className), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Glyph, { checked, indeterminate }) });
|
|
530
|
+
}
|
|
499
531
|
|
|
500
532
|
// src/DateRangeFilter.tsx
|
|
501
533
|
var import_react3 = require("react");
|
|
@@ -2631,15 +2663,6 @@ var import_react13 = require("react");
|
|
|
2631
2663
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
2632
2664
|
var import_class_variance_authority = require("class-variance-authority");
|
|
2633
2665
|
var import_lucide_react15 = require("lucide-react");
|
|
2634
|
-
|
|
2635
|
-
// src/cn.ts
|
|
2636
|
-
var import_clsx = require("clsx");
|
|
2637
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
2638
|
-
function cn(...inputs) {
|
|
2639
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
2640
|
-
}
|
|
2641
|
-
|
|
2642
|
-
// src/Button.tsx
|
|
2643
2666
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2644
2667
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
2645
2668
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-control font-medium transition-all duration-(--mr-motion-duration-interactive) ease-interactive disabled:pointer-events-none disabled:opacity-40 focus-visible:outline-hidden focus-visible:ring-0",
|
|
@@ -2767,12 +2790,13 @@ function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit })
|
|
|
2767
2790
|
|
|
2768
2791
|
// src/ChipTrigger.tsx
|
|
2769
2792
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2770
|
-
function chipTriggerClass() {
|
|
2793
|
+
function chipTriggerClass(variant = "box") {
|
|
2771
2794
|
return cn(
|
|
2772
2795
|
"flex h-11 items-center gap-2 rounded-control border bg-input px-2.5 text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
2773
|
-
//
|
|
2774
|
-
// control against the warm canvas
|
|
2775
|
-
|
|
2796
|
+
// Both variants sit on the input fill. `inline` carries the darker stroke
|
|
2797
|
+
// so it still reads as a control against the warm canvas with no boxed
|
|
2798
|
+
// shell behind it.
|
|
2799
|
+
variant === "inline" ? "border-border-strong" : "border-border-default"
|
|
2776
2800
|
);
|
|
2777
2801
|
}
|
|
2778
2802
|
function ChipContent({ caption, value, icon }) {
|
|
@@ -3599,6 +3623,7 @@ function Freshness({ level }) {
|
|
|
3599
3623
|
Button,
|
|
3600
3624
|
Card,
|
|
3601
3625
|
CheckBox,
|
|
3626
|
+
CheckBoxBox,
|
|
3602
3627
|
ChipContent,
|
|
3603
3628
|
DEFAULT_SEARCH_MATCH,
|
|
3604
3629
|
DataScopeFilter,
|