klun-ui 0.1.4 → 0.1.6

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-OZ5MAWZC.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
@@ -8823,7 +8823,8 @@ body {
8823
8823
  position: fixed;
8824
8824
  inset: 0;
8825
8825
  z-index: 100;
8826
- background: var(--klun-overlay-overlay-gray);
8826
+ background: rgba(0, 0, 0, 0.45);
8827
+ backdrop-filter: blur(3px);
8827
8828
  display: flex;
8828
8829
  }
8829
8830
  .klun-drawer--right {
@@ -8832,6 +8833,15 @@ body {
8832
8833
  .klun-drawer--left {
8833
8834
  justify-content: flex-start;
8834
8835
  }
8836
+ .klun-drawer--top {
8837
+ align-items: flex-start;
8838
+ }
8839
+ .klun-drawer--bottom {
8840
+ align-items: flex-end;
8841
+ }
8842
+ .klun-drawer--no-mask {
8843
+ background: transparent;
8844
+ }
8835
8845
  .klun-drawer__panel {
8836
8846
  max-width: 100%;
8837
8847
  height: 100%;
@@ -8846,6 +8856,12 @@ body {
8846
8856
  .klun-drawer--left .klun-drawer__panel {
8847
8857
  animation: klun-drawer-in-left 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8848
8858
  }
8859
+ .klun-drawer--top .klun-drawer__panel {
8860
+ animation: klun-drawer-in-top 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8861
+ }
8862
+ .klun-drawer--bottom .klun-drawer__panel {
8863
+ animation: klun-drawer-in-bottom 0.24s cubic-bezier(0.4, 0, 0.2, 1);
8864
+ }
8849
8865
  @keyframes klun-drawer-in-right {
8850
8866
  from {
8851
8867
  transform: translateX(24px);
@@ -8866,6 +8882,26 @@ body {
8866
8882
  opacity: 1;
8867
8883
  }
8868
8884
  }
8885
+ @keyframes klun-drawer-in-top {
8886
+ from {
8887
+ transform: translateY(-24px);
8888
+ opacity: 0.6;
8889
+ }
8890
+ to {
8891
+ transform: none;
8892
+ opacity: 1;
8893
+ }
8894
+ }
8895
+ @keyframes klun-drawer-in-bottom {
8896
+ from {
8897
+ transform: translateY(24px);
8898
+ opacity: 0.6;
8899
+ }
8900
+ to {
8901
+ transform: none;
8902
+ opacity: 1;
8903
+ }
8904
+ }
8869
8905
  .klun-drawer__header {
8870
8906
  display: flex;
8871
8907
  align-items: center;
@@ -8878,6 +8914,11 @@ body {
8878
8914
  font: var(--klun-text-label-lg);
8879
8915
  color: var(--klun-text-strong-950);
8880
8916
  }
8917
+ .klun-drawer__extra {
8918
+ display: inline-flex;
8919
+ align-items: center;
8920
+ gap: 8px;
8921
+ }
8881
8922
  .klun-drawer__close {
8882
8923
  display: inline-flex;
8883
8924
  border: none;
@@ -8972,26 +9013,43 @@ body {
8972
9013
  inset: 0;
8973
9014
  z-index: 100;
8974
9015
  display: flex;
8975
- align-items: center;
9016
+ align-items: flex-start;
8976
9017
  justify-content: center;
8977
9018
  padding: 24px;
8978
- background: var(--klun-overlay-overlay-gray);
8979
- backdrop-filter: blur(2px);
9019
+ overflow-y: auto;
9020
+ background: rgba(0, 0, 0, 0.45);
9021
+ backdrop-filter: blur(3px);
9022
+ }
9023
+ .klun-modal--centered {
9024
+ align-items: center;
9025
+ }
9026
+ .klun-modal--no-mask {
9027
+ background: transparent;
9028
+ backdrop-filter: none;
8980
9029
  }
8981
9030
  .klun-modal__dialog {
8982
9031
  max-width: 100%;
8983
- max-height: 90vh;
8984
- overflow: auto;
9032
+ margin: min(8vh, 80px) 0;
8985
9033
  background: var(--klun-bg-white-0);
8986
9034
  border-radius: var(--klun-radius-3xl);
8987
9035
  box-shadow: var(--klun-shadow-lg);
8988
9036
  }
9037
+ .klun-modal--centered .klun-modal__dialog {
9038
+ margin: 0;
9039
+ }
8989
9040
  .klun-modal__header {
8990
9041
  display: flex;
8991
9042
  align-items: flex-start;
8992
9043
  gap: 12px;
8993
9044
  padding: 20px 20px 0;
8994
9045
  }
9046
+ .klun-modal__header--draggable {
9047
+ cursor: move;
9048
+ user-select: none;
9049
+ }
9050
+ .klun-modal__header--draggable .klun-modal__close {
9051
+ cursor: pointer;
9052
+ }
8995
9053
  .klun-modal__icon {
8996
9054
  width: 40px;
8997
9055
  height: 40px;