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/README.md CHANGED
@@ -2,29 +2,12 @@
2
2
 
3
3
  Внутренняя UI-библиотека КФФ на Tailwind CSS v4 + shadcn/base-ui.
4
4
 
5
- ## Структура
6
-
7
- ```
8
- src/
9
- ├── components/
10
- │ ├── ui/ # примитивы (shadcn/base-ui) — Button, Dialog, Input и т.д.
11
- │ └── kff/ # компоненты, собранные поверх примитивов — ActionButton, AppSidebar и т.д.
12
- ├── hooks/
13
- ├── lib/ # cn() и утилиты, специфичные для КФФ
14
- ├── styles/
15
- │ ├── globals.css # токены темы + @import "tailwindcss" (исходник)
16
- │ └── generated.css # сгенерирован из globals.css Tailwind CLI при сборке, в git не хранится
17
- └── index.ts # единая точка входа пакета
18
- ```
19
-
20
- Пакет — **один entry point**: и примитивы, и составные компоненты экспортируются из `@kff/ui-kit`.
21
-
22
5
  ## Использование
23
6
 
24
7
  ```bash
25
- npm install @kff/ui-kit
8
+ npm install kff-ui-kit
26
9
  ```
27
10
 
28
11
  ```ts
29
- import { Button, ActionButton } from "@kff/ui-kit";
12
+ import { Button, ActionButton } from "kff-ui-kit";
30
13
  ```
package/dist/index.cjs CHANGED
@@ -631,6 +631,9 @@ styleInject(`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
631
631
  .right-3 {
632
632
  right: calc(var(--spacing) * 3);
633
633
  }
634
+ .bottom-0 {
635
+ bottom: 0;
636
+ }
634
637
  .left-0 {
635
638
  left: 0;
636
639
  }
@@ -843,6 +846,9 @@ styleInject(`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
843
846
  .max-h-\\(--available-height\\) {
844
847
  max-height: var(--available-height);
845
848
  }
849
+ .max-h-\\[calc\\(100vh-2rem\\)\\] {
850
+ max-height: calc(100vh - 2rem);
851
+ }
846
852
  .min-h-0 {
847
853
  min-height: 0;
848
854
  }
@@ -3535,7 +3541,7 @@ var import_button = require("@base-ui/react/button");
3535
3541
  var import_class_variance_authority3 = require("class-variance-authority");
3536
3542
  var import_jsx_runtime3 = require("react/jsx-runtime");
3537
3543
  var buttonVariants = (0, import_class_variance_authority3.cva)(
3538
- "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",
3544
+ "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",
3539
3545
  {
3540
3546
  variants: {
3541
3547
  variant: {
@@ -3743,7 +3749,7 @@ function DialogContent({
3743
3749
  {
3744
3750
  "data-slot": "dialog-content",
3745
3751
  className: cn(
3746
- "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",
3752
+ "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",
3747
3753
  className
3748
3754
  ),
3749
3755
  ...props,
@@ -5098,7 +5104,7 @@ var import_toggle = require("@base-ui/react/toggle");
5098
5104
  var import_class_variance_authority6 = require("class-variance-authority");
5099
5105
  var import_jsx_runtime19 = require("react/jsx-runtime");
5100
5106
  var toggleVariants = (0, import_class_variance_authority6.cva)(
5101
- "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",
5107
+ "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",
5102
5108
  {
5103
5109
  variants: {
5104
5110
  variant: {
@@ -5664,15 +5670,17 @@ function FormDialog({
5664
5670
  errors = [],
5665
5671
  children,
5666
5672
  primaryLabel,
5667
- onSubmit
5673
+ onSubmit,
5674
+ initialFocus
5668
5675
  }) {
5669
5676
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
5670
5677
  DialogContent,
5671
5678
  {
5672
5679
  showCloseButton: false,
5680
+ initialFocus,
5673
5681
  className: "max-w-115 gap-0 rounded-none border-2 border-primary bg-background p-0 text-primary",
5674
5682
  children: [
5675
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DialogHeader, { className: "bg-hatch flex-row items-center justify-between gap-3.5 border-b border-primary px-4 py-2.75", children: [
5683
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(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: [
5676
5684
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "w-fit bg-background px-2 py-0.75 font-mono text-[10px]", children: requirement }),
5677
5685
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DialogClose, { className: "w-fit cursor-pointer bg-background px-1.75 py-0.75 font-mono text-[10px]", children: "\u2715" })
5678
5686
  ] }),
@@ -5682,7 +5690,7 @@ function FormDialog({
5682
5690
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ValidationSummary, { errors }),
5683
5691
  children
5684
5692
  ] }),
5685
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(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: [
5693
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(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: [
5686
5694
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ActionButton, { variant: "outline", onClick: () => onOpenChange(false), children: "\u041E\u0442\u043C\u0435\u043D\u0430" }),
5687
5695
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ActionButton, { onClick: onSubmit, children: primaryLabel })
5688
5696
  ] })
@@ -5832,17 +5840,29 @@ var import_jsx_runtime32 = require("react/jsx-runtime");
5832
5840
  function PageHeader({
5833
5841
  trail,
5834
5842
  title,
5835
- actions
5843
+ actions,
5844
+ backLabel,
5845
+ linkAs: LinkAs = "a"
5836
5846
  }) {
5837
- const back = [...trail].reverse().find((t) => t.href);
5847
+ const back = [...trail].reverse().find((t) => Boolean(t.href));
5838
5848
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("header", { className: "flex flex-wrap items-center justify-between gap-5 border-b border-border bg-background px-8 py-5", children: [
5839
5849
  /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "min-w-0", children: [
5840
5850
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Breadcrumb, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbList, { className: "font-mono text-[12px]", children: trail.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react2.Fragment, { children: [
5841
5851
  i > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbSeparator, {}),
5842
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbItem, { children: t.href ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbLink, { href: t.href, children: t.label }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbPage, { className: "text-muted-foreground", children: t.label }) })
5852
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbItem, { children: t.href ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbLink, { render: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkAs, { href: t.href }), children: t.label }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BreadcrumbPage, { className: "text-muted-foreground", children: t.label }) })
5843
5853
  ] }, t.label)) }) }),
5844
5854
  /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "mt-1.5 flex items-center gap-3", children: [
5845
- back && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ActionButton, { variant: "outline", size: "sm", render: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: back.href, children: "\u2039 \u041D\u0430\u0437\u0430\u0434" }) }),
5855
+ back && backLabel && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5856
+ ActionButton,
5857
+ {
5858
+ variant: "outline",
5859
+ size: "sm",
5860
+ render: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(LinkAs, { href: back.href, children: [
5861
+ "\u2039 ",
5862
+ backLabel
5863
+ ] })
5864
+ }
5865
+ ),
5846
5866
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h1", { className: "truncate text-[19px] font-semibold text-primary", children: title })
5847
5867
  ] })
5848
5868
  ] }),