kff-ui-kit 0.1.0 → 0.2.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.d.cts CHANGED
@@ -325,8 +325,10 @@ type FormDialogProps = {
325
325
  children?: ReactNode;
326
326
  primaryLabel: string;
327
327
  onSubmit: () => void;
328
+ /** См. Base UI Dialog `Popup.initialFocus` — элемент/условие для начального фокуса при открытии. */
329
+ initialFocus?: Dialog$1.Popup.Props['initialFocus'];
328
330
  };
329
- declare function FormDialog({ open, onOpenChange, requirement, title, description, errors, children, primaryLabel, onSubmit, }: FormDialogProps): React$1.JSX.Element;
331
+ declare function FormDialog({ open, onOpenChange, requirement, title, description, errors, children, primaryLabel, onSubmit, initialFocus, }: FormDialogProps): React$1.JSX.Element;
330
332
 
331
333
  type CellState = 'value' | 'unanswered' | 'empty' | 'na' | 'computed';
332
334
  declare function ValueCell({ state, value, reason, source, onEdit, }: {
@@ -371,10 +373,16 @@ type PageHeaderTrailItem = {
371
373
  label: string;
372
374
  href?: string;
373
375
  };
374
- declare function PageHeader({ trail, title, actions, }: {
376
+ type PageHeaderLinkComponent = ElementType<{
377
+ href: string;
378
+ } & ComponentProps<'a'>>;
379
+ declare function PageHeader({ trail, title, actions, backLabel, linkAs: LinkAs, }: {
375
380
  trail: PageHeaderTrailItem[];
376
381
  title: string;
377
382
  actions?: ReactNode;
383
+ /** Текст кнопки "назад" (без неё, если не задан). Библиотека не хардкодит язык. */
384
+ backLabel?: ReactNode;
385
+ linkAs?: PageHeaderLinkComponent;
378
386
  }): React$1.JSX.Element;
379
387
 
380
388
  declare function SectionTabs({ value, onChange, items, }: {
package/dist/index.d.ts CHANGED
@@ -325,8 +325,10 @@ type FormDialogProps = {
325
325
  children?: ReactNode;
326
326
  primaryLabel: string;
327
327
  onSubmit: () => void;
328
+ /** См. Base UI Dialog `Popup.initialFocus` — элемент/условие для начального фокуса при открытии. */
329
+ initialFocus?: Dialog$1.Popup.Props['initialFocus'];
328
330
  };
329
- declare function FormDialog({ open, onOpenChange, requirement, title, description, errors, children, primaryLabel, onSubmit, }: FormDialogProps): React$1.JSX.Element;
331
+ declare function FormDialog({ open, onOpenChange, requirement, title, description, errors, children, primaryLabel, onSubmit, initialFocus, }: FormDialogProps): React$1.JSX.Element;
330
332
 
331
333
  type CellState = 'value' | 'unanswered' | 'empty' | 'na' | 'computed';
332
334
  declare function ValueCell({ state, value, reason, source, onEdit, }: {
@@ -371,10 +373,16 @@ type PageHeaderTrailItem = {
371
373
  label: string;
372
374
  href?: string;
373
375
  };
374
- declare function PageHeader({ trail, title, actions, }: {
376
+ type PageHeaderLinkComponent = ElementType<{
377
+ href: string;
378
+ } & ComponentProps<'a'>>;
379
+ declare function PageHeader({ trail, title, actions, backLabel, linkAs: LinkAs, }: {
375
380
  trail: PageHeaderTrailItem[];
376
381
  title: string;
377
382
  actions?: ReactNode;
383
+ /** Текст кнопки "назад" (без неё, если не задан). Библиотека не хардкодит язык. */
384
+ backLabel?: ReactNode;
385
+ linkAs?: PageHeaderLinkComponent;
378
386
  }): React$1.JSX.Element;
379
387
 
380
388
  declare function SectionTabs({ value, onChange, items, }: {
package/dist/index.js CHANGED
@@ -458,6 +458,9 @@ styleInject(`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
458
458
  .right-3 {
459
459
  right: calc(var(--spacing) * 3);
460
460
  }
461
+ .bottom-0 {
462
+ bottom: 0;
463
+ }
461
464
  .left-0 {
462
465
  left: 0;
463
466
  }
@@ -670,6 +673,9 @@ styleInject(`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
670
673
  .max-h-\\(--available-height\\) {
671
674
  max-height: var(--available-height);
672
675
  }
676
+ .max-h-\\[calc\\(100vh-2rem\\)\\] {
677
+ max-height: calc(100vh - 2rem);
678
+ }
673
679
  .min-h-0 {
674
680
  min-height: 0;
675
681
  }
@@ -3362,7 +3368,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
3362
3368
  import { cva as cva3 } from "class-variance-authority";
3363
3369
  import { jsx as jsx3 } from "react/jsx-runtime";
3364
3370
  var buttonVariants = cva3(
3365
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3371
+ "group/button inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
3366
3372
  {
3367
3373
  variants: {
3368
3374
  variant: {
@@ -3570,7 +3576,7 @@ function DialogContent({
3570
3576
  {
3571
3577
  "data-slot": "dialog-content",
3572
3578
  className: cn(
3573
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
3579
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] max-h-[calc(100vh-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
3574
3580
  className
3575
3581
  ),
3576
3582
  ...props,
@@ -4931,7 +4937,7 @@ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
4931
4937
  import { cva as cva6 } from "class-variance-authority";
4932
4938
  import { jsx as jsx19 } from "react/jsx-runtime";
4933
4939
  var toggleVariants = cva6(
4934
- "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4940
+ "group/toggle inline-flex cursor-pointer items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4935
4941
  {
4936
4942
  variants: {
4937
4943
  variant: {
@@ -5497,15 +5503,17 @@ function FormDialog({
5497
5503
  errors = [],
5498
5504
  children,
5499
5505
  primaryLabel,
5500
- onSubmit
5506
+ onSubmit,
5507
+ initialFocus
5501
5508
  }) {
5502
5509
  return /* @__PURE__ */ jsx28(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs14(
5503
5510
  DialogContent,
5504
5511
  {
5505
5512
  showCloseButton: false,
5513
+ initialFocus,
5506
5514
  className: "max-w-115 gap-0 rounded-none border-2 border-primary bg-background p-0 text-primary",
5507
5515
  children: [
5508
- /* @__PURE__ */ jsxs14(DialogHeader, { className: "bg-hatch flex-row items-center justify-between gap-3.5 border-b border-primary px-4 py-2.75", children: [
5516
+ /* @__PURE__ */ jsxs14(DialogHeader, { className: "bg-hatch sticky top-0 z-10 flex-row items-center justify-between gap-3.5 border-b border-primary px-4 py-2.75", children: [
5509
5517
  /* @__PURE__ */ jsx28("span", { className: "w-fit bg-background px-2 py-0.75 font-mono text-[10px]", children: requirement }),
5510
5518
  /* @__PURE__ */ jsx28(DialogClose, { className: "w-fit cursor-pointer bg-background px-1.75 py-0.75 font-mono text-[10px]", children: "\u2715" })
5511
5519
  ] }),
@@ -5515,7 +5523,7 @@ function FormDialog({
5515
5523
  /* @__PURE__ */ jsx28(ValidationSummary, { errors }),
5516
5524
  children
5517
5525
  ] }),
5518
- /* @__PURE__ */ jsxs14(DialogFooter, { className: "mx-0 mb-0 flex-row justify-end gap-2.25 rounded-none border-t border-primary bg-secondary px-4.5 py-3", children: [
5526
+ /* @__PURE__ */ jsxs14(DialogFooter, { className: "sticky bottom-0 z-10 mx-0 mb-0 flex-row justify-end gap-2.25 rounded-none border-t border-primary bg-secondary px-4.5 py-3", children: [
5519
5527
  /* @__PURE__ */ jsx28(ActionButton, { variant: "outline", onClick: () => onOpenChange(false), children: "\u041E\u0442\u043C\u0435\u043D\u0430" }),
5520
5528
  /* @__PURE__ */ jsx28(ActionButton, { onClick: onSubmit, children: primaryLabel })
5521
5529
  ] })
@@ -5665,17 +5673,29 @@ import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
5665
5673
  function PageHeader({
5666
5674
  trail,
5667
5675
  title,
5668
- actions
5676
+ actions,
5677
+ backLabel,
5678
+ linkAs: LinkAs = "a"
5669
5679
  }) {
5670
- const back = [...trail].reverse().find((t) => t.href);
5680
+ const back = [...trail].reverse().find((t) => Boolean(t.href));
5671
5681
  return /* @__PURE__ */ jsxs18("header", { className: "flex flex-wrap items-center justify-between gap-5 border-b border-border bg-background px-8 py-5", children: [
5672
5682
  /* @__PURE__ */ jsxs18("div", { className: "min-w-0", children: [
5673
5683
  /* @__PURE__ */ jsx32(Breadcrumb, { children: /* @__PURE__ */ jsx32(BreadcrumbList, { className: "font-mono text-[12px]", children: trail.map((t, i) => /* @__PURE__ */ jsxs18(Fragment, { children: [
5674
5684
  i > 0 && /* @__PURE__ */ jsx32(BreadcrumbSeparator, {}),
5675
- /* @__PURE__ */ jsx32(BreadcrumbItem, { children: t.href ? /* @__PURE__ */ jsx32(BreadcrumbLink, { href: t.href, children: t.label }) : /* @__PURE__ */ jsx32(BreadcrumbPage, { className: "text-muted-foreground", children: t.label }) })
5685
+ /* @__PURE__ */ jsx32(BreadcrumbItem, { children: t.href ? /* @__PURE__ */ jsx32(BreadcrumbLink, { render: /* @__PURE__ */ jsx32(LinkAs, { href: t.href }), children: t.label }) : /* @__PURE__ */ jsx32(BreadcrumbPage, { className: "text-muted-foreground", children: t.label }) })
5676
5686
  ] }, t.label)) }) }),
5677
5687
  /* @__PURE__ */ jsxs18("div", { className: "mt-1.5 flex items-center gap-3", children: [
5678
- back && /* @__PURE__ */ jsx32(ActionButton, { variant: "outline", size: "sm", render: /* @__PURE__ */ jsx32("a", { href: back.href, children: "\u2039 \u041D\u0430\u0437\u0430\u0434" }) }),
5688
+ back && backLabel && /* @__PURE__ */ jsx32(
5689
+ ActionButton,
5690
+ {
5691
+ variant: "outline",
5692
+ size: "sm",
5693
+ render: /* @__PURE__ */ jsxs18(LinkAs, { href: back.href, children: [
5694
+ "\u2039 ",
5695
+ backLabel
5696
+ ] })
5697
+ }
5698
+ ),
5679
5699
  /* @__PURE__ */ jsx32("h1", { className: "truncate text-[19px] font-semibold text-primary", children: title })
5680
5700
  ] })
5681
5701
  ] }),