klun-ui 0.1.3 → 0.1.5

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
@@ -2666,17 +2666,45 @@ type ConfirmResult = false | true | {
2666
2666
  */
2667
2667
  declare function Confirm(opts?: ConfirmOptions): Promise<ConfirmResult>;
2668
2668
 
2669
+ type DrawerPlacement = "top" | "right" | "bottom" | "left";
2669
2670
  interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "style"> {
2670
2671
  open: boolean;
2671
2672
  onClose?: () => void;
2672
2673
  title?: ReactNode;
2674
+ /** Edge the drawer slides from. Default `"right"`. */
2675
+ placement?: DrawerPlacement;
2676
+ /** Alias of `placement`, kept for back-compat. */
2673
2677
  side?: "left" | "right";
2678
+ /** Width for left/right placements. Default `378`. */
2674
2679
  width?: number | string;
2680
+ /** Height for top/bottom placements. Default `378`. */
2681
+ height?: number | string;
2682
+ /** Preset size along the slide axis: `"default"` (378) | `"large"` (736). */
2683
+ size?: "default" | "large";
2684
+ /** Show the close button. Default `true`. */
2685
+ closable?: boolean;
2686
+ /** Close when the backdrop (mask) is clicked. Default `true`. */
2687
+ maskClosable?: boolean;
2688
+ /** Render the dimmed backdrop. Default `true`. */
2689
+ mask?: boolean;
2690
+ /** Allow Esc to close. Default `true`. */
2691
+ keyboard?: boolean;
2692
+ /** Extra actions rendered in the header, before the close button. */
2693
+ extra?: ReactNode;
2675
2694
  footer?: ReactNode;
2695
+ /** z-index of the drawer layer. */
2696
+ zIndex?: number;
2697
+ /** Called whenever the open state changes. */
2698
+ afterOpenChange?: (open: boolean) => void;
2676
2699
  children?: ReactNode;
2677
2700
  style?: CSSProperties;
2678
2701
  }
2679
- /** Klun UI Drawer — slide-over panel anchored to an edge. */
2702
+ /**
2703
+ * Klun UI Drawer — slide-over panel anchored to an edge. antd-aligned:
2704
+ * `placement` (top/right/bottom/left), `width`/`height`/`size`, `closable`,
2705
+ * `maskClosable`, `mask`, `keyboard`, `extra` header actions, `zIndex` and
2706
+ * `afterOpenChange`.
2707
+ */
2680
2708
  declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
2681
2709
 
2682
2710
  interface DropdownItem {
@@ -2698,20 +2726,58 @@ declare const Dropdown: react.ForwardRefExoticComponent<DropdownProps & react.Re
2698
2726
 
2699
2727
  interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "style"> {
2700
2728
  open: boolean;
2729
+ /** Close handler — fired by the close button, backdrop, Esc and the cancel button (alias of `onCancel`). */
2701
2730
  onClose?: () => void;
2731
+ /** Confirm handler for the default OK button. */
2732
+ onOk?: () => void;
2733
+ /** Cancel handler; falls back to `onClose`. */
2734
+ onCancel?: () => void;
2702
2735
  title?: ReactNode;
2736
+ /** Sub-text under the title (klun extra). */
2703
2737
  description?: ReactNode;
2738
+ /** Leading icon node (klun extra). */
2704
2739
  icon?: ReactNode;
2705
- footer?: ReactNode;
2740
+ /** Footer content. `undefined` → default Cancel/OK buttons; `null` → no footer. */
2741
+ footer?: ReactNode | null;
2742
+ okText?: ReactNode;
2743
+ cancelText?: ReactNode;
2744
+ /** Loading spinner on the OK button (e.g. while an async submit runs). */
2745
+ confirmLoading?: boolean;
2746
+ /** OK button type. `"danger"` renders a red button. Default `"primary"`. */
2747
+ okType?: "primary" | "danger";
2748
+ okButtonProps?: Partial<DefaultButtonProps>;
2749
+ cancelButtonProps?: Partial<DefaultButtonProps>;
2750
+ /** Dialog width. Default `520`. */
2706
2751
  width?: number | string;
2707
- /** Show the close button + allow Esc/backdrop close. Default true. */
2752
+ /** Vertically center the dialog. Default `false` (top-aligned, like antd). */
2753
+ centered?: boolean;
2754
+ /** Show the top-right close button. Default `true`. */
2708
2755
  closable?: boolean;
2709
- /** Close when the dimmed backdrop is clicked. Default true. */
2756
+ /** Close when the backdrop (mask) is clicked. Default `true`. */
2757
+ maskClosable?: boolean;
2758
+ /** Alias of `maskClosable`. */
2710
2759
  closeOnBackdrop?: boolean;
2760
+ /** Allow Esc to close. Default `true`. */
2761
+ keyboard?: boolean;
2762
+ /** Render the dimmed backdrop. Default `true`. */
2763
+ mask?: boolean;
2764
+ /** Drag the dialog by its header. Default `false`. */
2765
+ draggable?: boolean;
2766
+ /** z-index of the modal layer. */
2767
+ zIndex?: number;
2768
+ /** Called after the modal has closed. */
2769
+ afterClose?: () => void;
2770
+ /** Called whenever the open state changes. */
2771
+ afterOpenChange?: (open: boolean) => void;
2711
2772
  children?: ReactNode;
2712
2773
  style?: CSSProperties;
2713
2774
  }
2714
- /** Klun UI Modal — centered dialog with dimmed backdrop. Controlled via `open` / `onClose`. */
2775
+ /**
2776
+ * Klun UI Modal — controlled dialog with a dimmed backdrop. antd-aligned: a
2777
+ * default Cancel/OK footer driven by `onOk`/`onCancel`/`confirmLoading`
2778
+ * (pass `footer={null}` to hide it), plus `centered`, `maskClosable`,
2779
+ * `keyboard`, `mask`, `draggable` and lifecycle callbacks.
2780
+ */
2715
2781
  declare const Modal: react.ForwardRefExoticComponent<ModalProps & react.RefAttributes<HTMLDivElement>>;
2716
2782
 
2717
2783
  interface PopconfirmProps extends Omit<HTMLAttributes<HTMLSpanElement>, "title"> {
package/dist/index.d.ts CHANGED
@@ -2666,17 +2666,45 @@ type ConfirmResult = false | true | {
2666
2666
  */
2667
2667
  declare function Confirm(opts?: ConfirmOptions): Promise<ConfirmResult>;
2668
2668
 
2669
+ type DrawerPlacement = "top" | "right" | "bottom" | "left";
2669
2670
  interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "style"> {
2670
2671
  open: boolean;
2671
2672
  onClose?: () => void;
2672
2673
  title?: ReactNode;
2674
+ /** Edge the drawer slides from. Default `"right"`. */
2675
+ placement?: DrawerPlacement;
2676
+ /** Alias of `placement`, kept for back-compat. */
2673
2677
  side?: "left" | "right";
2678
+ /** Width for left/right placements. Default `378`. */
2674
2679
  width?: number | string;
2680
+ /** Height for top/bottom placements. Default `378`. */
2681
+ height?: number | string;
2682
+ /** Preset size along the slide axis: `"default"` (378) | `"large"` (736). */
2683
+ size?: "default" | "large";
2684
+ /** Show the close button. Default `true`. */
2685
+ closable?: boolean;
2686
+ /** Close when the backdrop (mask) is clicked. Default `true`. */
2687
+ maskClosable?: boolean;
2688
+ /** Render the dimmed backdrop. Default `true`. */
2689
+ mask?: boolean;
2690
+ /** Allow Esc to close. Default `true`. */
2691
+ keyboard?: boolean;
2692
+ /** Extra actions rendered in the header, before the close button. */
2693
+ extra?: ReactNode;
2675
2694
  footer?: ReactNode;
2695
+ /** z-index of the drawer layer. */
2696
+ zIndex?: number;
2697
+ /** Called whenever the open state changes. */
2698
+ afterOpenChange?: (open: boolean) => void;
2676
2699
  children?: ReactNode;
2677
2700
  style?: CSSProperties;
2678
2701
  }
2679
- /** Klun UI Drawer — slide-over panel anchored to an edge. */
2702
+ /**
2703
+ * Klun UI Drawer — slide-over panel anchored to an edge. antd-aligned:
2704
+ * `placement` (top/right/bottom/left), `width`/`height`/`size`, `closable`,
2705
+ * `maskClosable`, `mask`, `keyboard`, `extra` header actions, `zIndex` and
2706
+ * `afterOpenChange`.
2707
+ */
2680
2708
  declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
2681
2709
 
2682
2710
  interface DropdownItem {
@@ -2698,20 +2726,58 @@ declare const Dropdown: react.ForwardRefExoticComponent<DropdownProps & react.Re
2698
2726
 
2699
2727
  interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title" | "style"> {
2700
2728
  open: boolean;
2729
+ /** Close handler — fired by the close button, backdrop, Esc and the cancel button (alias of `onCancel`). */
2701
2730
  onClose?: () => void;
2731
+ /** Confirm handler for the default OK button. */
2732
+ onOk?: () => void;
2733
+ /** Cancel handler; falls back to `onClose`. */
2734
+ onCancel?: () => void;
2702
2735
  title?: ReactNode;
2736
+ /** Sub-text under the title (klun extra). */
2703
2737
  description?: ReactNode;
2738
+ /** Leading icon node (klun extra). */
2704
2739
  icon?: ReactNode;
2705
- footer?: ReactNode;
2740
+ /** Footer content. `undefined` → default Cancel/OK buttons; `null` → no footer. */
2741
+ footer?: ReactNode | null;
2742
+ okText?: ReactNode;
2743
+ cancelText?: ReactNode;
2744
+ /** Loading spinner on the OK button (e.g. while an async submit runs). */
2745
+ confirmLoading?: boolean;
2746
+ /** OK button type. `"danger"` renders a red button. Default `"primary"`. */
2747
+ okType?: "primary" | "danger";
2748
+ okButtonProps?: Partial<DefaultButtonProps>;
2749
+ cancelButtonProps?: Partial<DefaultButtonProps>;
2750
+ /** Dialog width. Default `520`. */
2706
2751
  width?: number | string;
2707
- /** Show the close button + allow Esc/backdrop close. Default true. */
2752
+ /** Vertically center the dialog. Default `false` (top-aligned, like antd). */
2753
+ centered?: boolean;
2754
+ /** Show the top-right close button. Default `true`. */
2708
2755
  closable?: boolean;
2709
- /** Close when the dimmed backdrop is clicked. Default true. */
2756
+ /** Close when the backdrop (mask) is clicked. Default `true`. */
2757
+ maskClosable?: boolean;
2758
+ /** Alias of `maskClosable`. */
2710
2759
  closeOnBackdrop?: boolean;
2760
+ /** Allow Esc to close. Default `true`. */
2761
+ keyboard?: boolean;
2762
+ /** Render the dimmed backdrop. Default `true`. */
2763
+ mask?: boolean;
2764
+ /** Drag the dialog by its header. Default `false`. */
2765
+ draggable?: boolean;
2766
+ /** z-index of the modal layer. */
2767
+ zIndex?: number;
2768
+ /** Called after the modal has closed. */
2769
+ afterClose?: () => void;
2770
+ /** Called whenever the open state changes. */
2771
+ afterOpenChange?: (open: boolean) => void;
2711
2772
  children?: ReactNode;
2712
2773
  style?: CSSProperties;
2713
2774
  }
2714
- /** Klun UI Modal — centered dialog with dimmed backdrop. Controlled via `open` / `onClose`. */
2775
+ /**
2776
+ * Klun UI Modal — controlled dialog with a dimmed backdrop. antd-aligned: a
2777
+ * default Cancel/OK footer driven by `onOk`/`onCancel`/`confirmLoading`
2778
+ * (pass `footer={null}` to hide it), plus `centered`, `maskClosable`,
2779
+ * `keyboard`, `mask`, `draggable` and lifecycle callbacks.
2780
+ */
2715
2781
  declare const Modal: react.ForwardRefExoticComponent<ModalProps & react.RefAttributes<HTMLDivElement>>;
2716
2782
 
2717
2783
  interface PopconfirmProps extends Omit<HTMLAttributes<HTMLSpanElement>, "title"> {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, Chip, CircularProgress, CodeViewer, Col, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, CopyButton, CounterInput, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DigitInput, Divider, Drawer, Dropdown, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, InlineInput, InlineSelect, Input, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Masonry, Menu, Message, Modal, Money, Notification, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner, Splitter, SplitterPanel, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, Wizard, arSA, deDE, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, plPL, primaryColorVars, ptBR, ruRU, toast, trTR, useBreakpoint, useConfig, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW } from './chunk-7EOW4LHP.js';
1
+ export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, Chip, CircularProgress, CodeViewer, Col, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, CopyButton, CounterInput, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DigitInput, Divider, Drawer, Dropdown, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, InlineInput, InlineSelect, Input, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Masonry, Menu, Message, Modal, Money, Notification, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner, Splitter, SplitterPanel, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, Wizard, arSA, deDE, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, plPL, primaryColorVars, ptBR, ruRU, toast, trTR, useBreakpoint, useConfig, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW } from './chunk-Z2TY6K3O.js';
2
2
  export { cx } from './chunk-T225J6LV.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
package/dist/styles.css CHANGED
@@ -8832,6 +8832,15 @@ body {
8832
8832
  .klun-drawer--left {
8833
8833
  justify-content: flex-start;
8834
8834
  }
8835
+ .klun-drawer--top {
8836
+ align-items: flex-start;
8837
+ }
8838
+ .klun-drawer--bottom {
8839
+ align-items: flex-end;
8840
+ }
8841
+ .klun-drawer--no-mask {
8842
+ background: transparent;
8843
+ }
8835
8844
  .klun-drawer__panel {
8836
8845
  max-width: 100%;
8837
8846
  height: 100%;
@@ -8846,6 +8855,12 @@ body {
8846
8855
  .klun-drawer--left .klun-drawer__panel {
8847
8856
  animation: klun-drawer-in-left 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8848
8857
  }
8858
+ .klun-drawer--top .klun-drawer__panel {
8859
+ animation: klun-drawer-in-top 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8860
+ }
8861
+ .klun-drawer--bottom .klun-drawer__panel {
8862
+ animation: klun-drawer-in-bottom 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8863
+ }
8849
8864
  @keyframes klun-drawer-in-right {
8850
8865
  from {
8851
8866
  transform: translateX(24px);
@@ -8866,6 +8881,26 @@ body {
8866
8881
  opacity: 1;
8867
8882
  }
8868
8883
  }
8884
+ @keyframes klun-drawer-in-top {
8885
+ from {
8886
+ transform: translateY(-24px);
8887
+ opacity: 0.6;
8888
+ }
8889
+ to {
8890
+ transform: none;
8891
+ opacity: 1;
8892
+ }
8893
+ }
8894
+ @keyframes klun-drawer-in-bottom {
8895
+ from {
8896
+ transform: translateY(24px);
8897
+ opacity: 0.6;
8898
+ }
8899
+ to {
8900
+ transform: none;
8901
+ opacity: 1;
8902
+ }
8903
+ }
8869
8904
  .klun-drawer__header {
8870
8905
  display: flex;
8871
8906
  align-items: center;
@@ -8878,6 +8913,11 @@ body {
8878
8913
  font: var(--klun-text-label-lg);
8879
8914
  color: var(--klun-text-strong-950);
8880
8915
  }
8916
+ .klun-drawer__extra {
8917
+ display: inline-flex;
8918
+ align-items: center;
8919
+ gap: 8px;
8920
+ }
8881
8921
  .klun-drawer__close {
8882
8922
  display: inline-flex;
8883
8923
  border: none;
@@ -8972,26 +9012,43 @@ body {
8972
9012
  inset: 0;
8973
9013
  z-index: 100;
8974
9014
  display: flex;
8975
- align-items: center;
9015
+ align-items: flex-start;
8976
9016
  justify-content: center;
8977
9017
  padding: 24px;
9018
+ overflow-y: auto;
8978
9019
  background: var(--klun-overlay-overlay-gray);
8979
9020
  backdrop-filter: blur(2px);
8980
9021
  }
9022
+ .klun-modal--centered {
9023
+ align-items: center;
9024
+ }
9025
+ .klun-modal--no-mask {
9026
+ background: transparent;
9027
+ backdrop-filter: none;
9028
+ }
8981
9029
  .klun-modal__dialog {
8982
9030
  max-width: 100%;
8983
- max-height: 90vh;
8984
- overflow: auto;
9031
+ margin: min(8vh, 80px) 0;
8985
9032
  background: var(--klun-bg-white-0);
8986
9033
  border-radius: var(--klun-radius-3xl);
8987
9034
  box-shadow: var(--klun-shadow-lg);
8988
9035
  }
9036
+ .klun-modal--centered .klun-modal__dialog {
9037
+ margin: 0;
9038
+ }
8989
9039
  .klun-modal__header {
8990
9040
  display: flex;
8991
9041
  align-items: flex-start;
8992
9042
  gap: 12px;
8993
9043
  padding: 20px 20px 0;
8994
9044
  }
9045
+ .klun-modal__header--draggable {
9046
+ cursor: move;
9047
+ user-select: none;
9048
+ }
9049
+ .klun-modal__header--draggable .klun-modal__close {
9050
+ cursor: pointer;
9051
+ }
8995
9052
  .klun-modal__icon {
8996
9053
  width: 40px;
8997
9054
  height: 40px;
@@ -9037,6 +9094,10 @@ body {
9037
9094
  padding: 16px 20px 20px;
9038
9095
  border-top: 1px solid var(--klun-stroke-soft-200);
9039
9096
  }
9097
+ .klun-modal__footer--flush {
9098
+ border-top: none;
9099
+ padding-top: 20px;
9100
+ }
9040
9101
 
9041
9102
  /* src/components/overlays/Popconfirm.css */
9042
9103
  .klun-popconfirm {