@customafk/lunas-ui 0.2.10 → 0.2.12
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/{alert-LqhAi5XB.d.cts → alert-Bi9GgWBf.d.cts} +5 -5
- package/dist/{alert-Dt_GDCm5.d.mts → alert-DBdAWJoD.d.mts} +7 -7
- package/dist/{alert-DQHE-pdI.mjs → alert-DjfDTXIK.mjs} +1 -1
- package/dist/{alert-DQHE-pdI.mjs.map → alert-DjfDTXIK.mjs.map} +1 -1
- package/dist/{alert-BqJVf4wD.cjs → alert-kJbUcjIR.cjs} +1 -1
- package/dist/{alert-BqJVf4wD.cjs.map → alert-kJbUcjIR.cjs.map} +1 -1
- package/dist/{badge-DaaGIpeV.d.mts → badge-BrBsWjjy.d.mts} +3 -3
- package/dist/{badge-Gsrn62XW.d.cts → badge-OocBN04L.d.cts} +3 -3
- package/dist/{button-gKqh2psz.d.cts → button-Bg7LOzPN.d.cts} +4 -4
- package/dist/{button-CjlinfYI.d.mts → button-CM0enIRc.d.mts} +4 -4
- package/dist/{calendar-B2V4Lv0T.cjs → calendar-BMXIBCsr.cjs} +1 -1
- package/dist/{calendar-B2V4Lv0T.cjs.map → calendar-BMXIBCsr.cjs.map} +1 -1
- package/dist/{calendar-Cw1G0sVL.mjs → calendar-WMJIKojX.mjs} +1 -1
- package/dist/{calendar-Cw1G0sVL.mjs.map → calendar-WMJIKojX.mjs.map} +1 -1
- package/dist/cards/simple-card.d.cts +2 -2
- package/dist/cards/simple-card.d.mts +2 -2
- package/dist/{cms-layout-r9TmK6hi.cjs → cms-layout-BLJpfFpE.cjs} +1 -1
- package/dist/{cms-layout-r9TmK6hi.cjs.map → cms-layout-BLJpfFpE.cjs.map} +1 -1
- package/dist/{cms-layout-Bp6rU_of.mjs → cms-layout-BYzUepEk.mjs} +1 -1
- package/dist/{cms-layout-Bp6rU_of.mjs.map → cms-layout-BYzUepEk.mjs.map} +1 -1
- package/dist/data-display/statistic.d.mts +4 -4
- package/dist/{dialog-DrJyRArf.d.mts → dialog-BXi5bgG0.d.cts} +12 -12
- package/dist/{dialog-Coe4g5Lp.d.cts → dialog-DLOes4WS.d.mts} +12 -12
- package/dist/dialogs/detail-dialog/components/sidebar.d.cts +26 -26
- package/dist/dialogs/detail-dialog/components/sidebar.d.mts +26 -26
- package/dist/dialogs/detail-dialog/index.cjs +1 -1
- package/dist/dialogs/detail-dialog/index.cjs.map +1 -1
- package/dist/dialogs/detail-dialog/index.mjs +1 -1
- package/dist/dialogs/detail-dialog/index.mjs.map +1 -1
- package/dist/features/descriptions/index.cjs +1 -1
- package/dist/features/descriptions/index.cjs.map +1 -1
- package/dist/features/descriptions/index.d.cts +25 -2
- package/dist/features/descriptions/index.d.mts +25 -2
- package/dist/features/descriptions/index.mjs +1 -1
- package/dist/features/descriptions/index.mjs.map +1 -1
- package/dist/features/search-modal/index.d.cts +2 -2
- package/dist/features/search-modal/index.d.mts +2 -2
- package/dist/features/tables/index.cjs +1 -1
- package/dist/features/tables/index.d.cts +90 -16
- package/dist/features/tables/index.d.mts +90 -16
- package/dist/features/tables/index.mjs +1 -1
- package/dist/features/tanstack-form/index.cjs +1 -1
- package/dist/features/tanstack-form/index.d.cts +1 -1
- package/dist/features/tanstack-form/index.d.mts +1 -1
- package/dist/features/tanstack-form/index.mjs +1 -1
- package/dist/{field-DfsTE4Ie.mjs → field-C5HOxxiX.mjs} +2 -2
- package/dist/{field-DfsTE4Ie.mjs.map → field-C5HOxxiX.mjs.map} +1 -1
- package/dist/{field-C51eJ6QN.cjs → field-D1wvj5Wj.cjs} +2 -2
- package/dist/{field-C51eJ6QN.cjs.map → field-D1wvj5Wj.cjs.map} +1 -1
- package/dist/{index-rnLTzTi7.d.cts → index-CkmisxOx.d.cts} +173 -173
- package/dist/{index-DzSTWYsk.d.mts → index-Cyc9v5Az.d.mts} +122 -122
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +1 -1
- package/dist/{input-DpaSVQ7H.d.mts → input-CvWCE7ft.d.mts} +6 -6
- package/dist/{input-BRVTkuUg.d.cts → input-D9N-kPNc.d.cts} +6 -6
- package/dist/{label-3vAlNtF9.mjs → label-COqDQDMy.mjs} +1 -1
- package/dist/{label-3vAlNtF9.mjs.map → label-COqDQDMy.mjs.map} +1 -1
- package/dist/{label-zyBJYydC.cjs → label-DYsRdKMt.cjs} +1 -1
- package/dist/{label-zyBJYydC.cjs.map → label-DYsRdKMt.cjs.map} +1 -1
- package/dist/layouts/cms-layout/index.cjs +1 -1
- package/dist/layouts/cms-layout/index.mjs +1 -1
- package/dist/layouts/flex.d.cts +7 -7
- package/dist/layouts/flex.d.mts +9 -9
- package/dist/layouts/payment-layout/index.cjs +1 -1
- package/dist/layouts/payment-layout/index.mjs +1 -1
- package/dist/pages/FeatureDeveloping.d.cts +2 -2
- package/dist/pages/FeatureDeveloping.d.mts +2 -2
- package/dist/pages/FeatureFixing.d.cts +2 -2
- package/dist/pages/FeatureFixing.d.mts +2 -2
- package/dist/pages/NotAuthorized.d.cts +2 -2
- package/dist/pages/NotAuthorized.d.mts +2 -2
- package/dist/pages/NotFound.d.cts +2 -2
- package/dist/pages/NotFound.d.mts +2 -2
- package/dist/{payment-layout-C9pP5HdT.cjs → payment-layout-C8_xrnVn.cjs} +1 -1
- package/dist/{payment-layout-C9pP5HdT.cjs.map → payment-layout-C8_xrnVn.cjs.map} +1 -1
- package/dist/{payment-layout-D-69gOPJ.mjs → payment-layout-CVBTGjMw.mjs} +1 -1
- package/dist/{payment-layout-D-69gOPJ.mjs.map → payment-layout-CVBTGjMw.mjs.map} +1 -1
- package/dist/{popover-CmoqhK17.cjs → popover-AEt-aSy3.cjs} +1 -1
- package/dist/{popover-CmoqhK17.cjs.map → popover-AEt-aSy3.cjs.map} +1 -1
- package/dist/{popover-BFJhuzW3.mjs → popover-OJXFbqJi.mjs} +1 -1
- package/dist/{popover-BFJhuzW3.mjs.map → popover-OJXFbqJi.mjs.map} +1 -1
- package/dist/{radio-group-D5OurBIG.mjs → radio-group-5ktXGXSv.mjs} +1 -1
- package/dist/{radio-group-D5OurBIG.mjs.map → radio-group-5ktXGXSv.mjs.map} +1 -1
- package/dist/{radio-group-DAv2EU3F.cjs → radio-group-C7FAAawm.cjs} +1 -1
- package/dist/{radio-group-DAv2EU3F.cjs.map → radio-group-C7FAAawm.cjs.map} +1 -1
- package/dist/{select-DRCKwnTV.mjs → select-DrHceSnf.mjs} +1 -1
- package/dist/{select-DRCKwnTV.mjs.map → select-DrHceSnf.mjs.map} +1 -1
- package/dist/{select-DfvSMRUq.cjs → select-DzylYFes.cjs} +1 -1
- package/dist/{select-DfvSMRUq.cjs.map → select-DzylYFes.cjs.map} +1 -1
- package/dist/tables-BQkO4mz6.cjs +4 -0
- package/dist/tables-BQkO4mz6.cjs.map +1 -0
- package/dist/tables-iT8uH25j.mjs +4 -0
- package/dist/tables-iT8uH25j.mjs.map +1 -0
- package/dist/{tanstack-form-Bb9JXuEq.cjs → tanstack-form-BUjk7DIz.cjs} +2 -2
- package/dist/{tanstack-form-Bb9JXuEq.cjs.map → tanstack-form-BUjk7DIz.cjs.map} +1 -1
- package/dist/{tanstack-form-BwyHENeF.mjs → tanstack-form-DtZdrifK.mjs} +2 -2
- package/dist/{tanstack-form-BwyHENeF.mjs.map → tanstack-form-DtZdrifK.mjs.map} +1 -1
- package/dist/{textarea-CvoBIPlJ.cjs → textarea-DZ86A_cm.cjs} +1 -1
- package/dist/{textarea-CvoBIPlJ.cjs.map → textarea-DZ86A_cm.cjs.map} +1 -1
- package/dist/{textarea-5RD9ToTV.mjs → textarea-Dd1fBf_4.mjs} +1 -1
- package/dist/{textarea-5RD9ToTV.mjs.map → textarea-Dd1fBf_4.mjs.map} +1 -1
- package/dist/typography/paragraph.d.cts +5 -5
- package/dist/typography/paragraph.d.mts +5 -5
- package/dist/typography/title.d.cts +2 -2
- package/dist/typography/title.d.mts +2 -2
- package/dist/ui/alert-dialog.d.cts +12 -12
- package/dist/ui/alert-dialog.d.mts +12 -12
- package/dist/ui/alert.cjs +1 -1
- package/dist/ui/alert.d.cts +1 -1
- package/dist/ui/alert.d.mts +1 -1
- package/dist/ui/alert.mjs +1 -1
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.mts +2 -2
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.mts +4 -4
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.mts +1 -1
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.mts +8 -8
- package/dist/ui/button-group.d.cts +7 -7
- package/dist/ui/button-group.d.mts +7 -7
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.mts +1 -1
- package/dist/ui/calendar.cjs +1 -1
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.mts +4 -4
- package/dist/ui/calendar.mjs +1 -1
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.mts +8 -8
- package/dist/ui/carousel.d.cts +7 -7
- package/dist/ui/carousel.d.mts +7 -7
- package/dist/ui/checkbox.d.cts +2 -2
- package/dist/ui/checkbox.d.mts +2 -2
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.mts +4 -4
- package/dist/ui/command.d.cts +11 -11
- package/dist/ui/command.d.mts +11 -11
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.mts +16 -16
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.mts +1 -1
- package/dist/ui/drawer.d.cts +11 -11
- package/dist/ui/drawer.d.mts +11 -11
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.mts +16 -16
- package/dist/ui/empty.d.cts +9 -9
- package/dist/ui/empty.d.mts +9 -9
- package/dist/ui/field.cjs +1 -1
- package/dist/ui/field.d.cts +23 -23
- package/dist/ui/field.d.mts +25 -25
- package/dist/ui/field.mjs +1 -1
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.mts +2 -2
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.d.cts +11 -11
- package/dist/ui/form.d.mts +11 -11
- package/dist/ui/form.mjs +1 -1
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.mts +4 -4
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.mts +5 -5
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.mts +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.mts +3 -3
- package/dist/ui/item.d.cts +15 -15
- package/dist/ui/item.d.mts +15 -15
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.mts +2 -2
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.mts +17 -17
- package/dist/ui/multi-select.d.cts +2 -2
- package/dist/ui/multi-select.d.mts +1 -1
- package/dist/ui/navigation-menu.d.cts +9 -9
- package/dist/ui/navigation-menu.d.mts +9 -9
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.mts +9 -9
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.d.cts +6 -6
- package/dist/ui/popover.d.mts +6 -6
- package/dist/ui/popover.mjs +1 -1
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.mts +2 -2
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.mts +3 -3
- package/dist/ui/radio-group.mjs +1 -1
- package/dist/ui/resizable.d.cts +9 -9
- package/dist/ui/resizable.d.mts +9 -9
- package/dist/ui/scroll-area.d.cts +6 -6
- package/dist/ui/scroll-area.d.mts +6 -6
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +9 -9
- package/dist/ui/select.d.mts +9 -9
- package/dist/ui/select.mjs +1 -1
- package/dist/ui/separator.d.cts +2 -2
- package/dist/ui/separator.d.mts +2 -2
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.mts +9 -9
- package/dist/ui/sidebar.d.cts +28 -28
- package/dist/ui/sidebar.d.mts +28 -28
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.mts +2 -2
- package/dist/ui/slider.d.cts +2 -2
- package/dist/ui/slider.d.mts +2 -2
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.mts +2 -2
- package/dist/ui/spinner.d.cts +2 -2
- package/dist/ui/spinner.d.mts +2 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.mts +2 -2
- package/dist/ui/table.d.cts +18 -18
- package/dist/ui/table.d.mts +18 -18
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.mts +5 -5
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.mts +2 -2
- package/dist/ui/textarea.mjs +1 -1
- package/dist/ui/toggle-group.d.cts +3 -3
- package/dist/ui/toggle-group.d.mts +3 -3
- package/dist/ui/toggle.d.cts +4 -4
- package/dist/ui/toggle.d.mts +4 -4
- package/dist/ui/tooltip.d.cts +5 -5
- package/dist/ui/tooltip.d.mts +5 -5
- package/package.json +1 -1
- package/dist/tables-Chn2pQSc.cjs +0 -4
- package/dist/tables-Chn2pQSc.cjs.map +0 -1
- package/dist/tables-eLIhswqW.mjs +0 -4
- package/dist/tables-eLIhswqW.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AnyEntity } from "../../types-CDYHkcOk.cjs";
|
|
2
|
-
import { t as Input } from "../../input-
|
|
2
|
+
import { t as Input } from "../../input-D9N-kPNc.cjs";
|
|
3
3
|
import * as react_jsx_runtime346 from "react/jsx-runtime";
|
|
4
4
|
import * as react286 from "react";
|
|
5
5
|
import { AccessorKeyColumnDef, CellContext, Column, ColumnPinningPosition, ColumnPinningState, Header, HeaderGroup, Row, RowSelectionState, Table } from "@tanstack/react-table";
|
|
@@ -599,6 +599,10 @@ type TTableContext<TData extends RowData<TData>> = {
|
|
|
599
599
|
csvData?: CsvCell[][];
|
|
600
600
|
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
601
601
|
csvFileName?: string;
|
|
602
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
603
|
+
filterDefinitions?: FilterDefinition[];
|
|
604
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
605
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
602
606
|
};
|
|
603
607
|
/** Context value provided by `UITableInnerWrapperProvider`. */
|
|
604
608
|
type TTableInnerWrapperContext = {
|
|
@@ -715,6 +719,68 @@ type TableProviderProps<TData extends RowData<TData>, TKey extends keyof TData =
|
|
|
715
719
|
csvData?: CsvCell[][];
|
|
716
720
|
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
717
721
|
csvFileName?: string;
|
|
722
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
723
|
+
filterDefinitions?: FilterDefinition[];
|
|
724
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
725
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
726
|
+
};
|
|
727
|
+
type FilterType = 'tag' | 'date-range' | 'number' | 'text' | 'boolean';
|
|
728
|
+
/** A selectable option for tag/enum filters. */
|
|
729
|
+
type FilterOption = {
|
|
730
|
+
label: string;
|
|
731
|
+
value: string;
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Declares a filterable field available in the "Add Filter" dropdown.
|
|
735
|
+
* `options` is required when `type === 'tag'`.
|
|
736
|
+
*/
|
|
737
|
+
type FilterDefinition = {
|
|
738
|
+
id: string;
|
|
739
|
+
label: string;
|
|
740
|
+
type: FilterType;
|
|
741
|
+
options?: FilterOption[];
|
|
742
|
+
};
|
|
743
|
+
type TagFilterValue = {
|
|
744
|
+
type: 'tag';
|
|
745
|
+
values: string[];
|
|
746
|
+
};
|
|
747
|
+
type DateRangeFilterValue = {
|
|
748
|
+
type: 'date-range';
|
|
749
|
+
/** ISO date string, e.g. `"2024-01-01"`. */
|
|
750
|
+
from?: string;
|
|
751
|
+
to?: string;
|
|
752
|
+
};
|
|
753
|
+
type NumberFilterValue = {
|
|
754
|
+
type: 'number';
|
|
755
|
+
operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'between';
|
|
756
|
+
value?: number;
|
|
757
|
+
valueTo?: number;
|
|
758
|
+
};
|
|
759
|
+
type TextFilterValue = {
|
|
760
|
+
type: 'text';
|
|
761
|
+
operator: 'contains' | 'equals' | 'starts-with' | 'ends-with';
|
|
762
|
+
value: string;
|
|
763
|
+
};
|
|
764
|
+
type BooleanFilterValue = {
|
|
765
|
+
type: 'boolean';
|
|
766
|
+
value: boolean | null;
|
|
767
|
+
};
|
|
768
|
+
type FilterValue = TagFilterValue | DateRangeFilterValue | NumberFilterValue | TextFilterValue | BooleanFilterValue;
|
|
769
|
+
/** An active (added) filter instance with its current value. */
|
|
770
|
+
type ActiveFilter = {
|
|
771
|
+
/** Unique instance id for this filter entry. */
|
|
772
|
+
id: string;
|
|
773
|
+
/** References a `FilterDefinition.id`. */
|
|
774
|
+
definitionId: string;
|
|
775
|
+
value: FilterValue;
|
|
776
|
+
};
|
|
777
|
+
/** Context value exposed by `UITableProvider` for the filter panel. */
|
|
778
|
+
type TTableFilterContext = {
|
|
779
|
+
filterDefinitions: FilterDefinition[];
|
|
780
|
+
activeFilters: ActiveFilter[];
|
|
781
|
+
addFilter: (definitionId: string) => void;
|
|
782
|
+
removeFilter: (filterId: string) => void;
|
|
783
|
+
updateFilter: (filterId: string, value: FilterValue) => void;
|
|
718
784
|
};
|
|
719
785
|
//#endregion
|
|
720
786
|
//#region packages/components/features/tables/components/common.d.ts
|
|
@@ -1037,25 +1103,31 @@ declare const UITableContainer: React.FC<React.PropsWithChildren>;
|
|
|
1037
1103
|
//#endregion
|
|
1038
1104
|
//#region packages/components/features/tables/components/table/filter.d.ts
|
|
1039
1105
|
/**
|
|
1040
|
-
* Collapsible side-panel that lets users toggle column visibility and
|
|
1041
|
-
*
|
|
1106
|
+
* Collapsible side-panel that lets users toggle column visibility and build
|
|
1107
|
+
* row filters without leaving the table view.
|
|
1042
1108
|
*
|
|
1043
1109
|
* The panel collapses to a narrow icon strip when no tab is active and expands
|
|
1044
|
-
* to at least 64 units when the "Columns" or "Filters" tab is selected.
|
|
1045
|
-
*
|
|
1110
|
+
* to at least 64 units when the "Columns" or "Filters" tab is selected.
|
|
1111
|
+
*
|
|
1112
|
+
* Wire filter capability by passing `filterDefinitions` and `onFilterChange` to
|
|
1113
|
+
* the parent `UITableProvider`.
|
|
1046
1114
|
*
|
|
1047
1115
|
* @example
|
|
1048
1116
|
* ```tsx
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
* <
|
|
1058
|
-
*
|
|
1117
|
+
* <UITableProvider
|
|
1118
|
+
* filterDefinitions={[
|
|
1119
|
+
* { id: 'status', label: 'Status', type: 'tag', options: [{ label: 'Active', value: 'active' }] },
|
|
1120
|
+
* { id: 'created', label: 'Created At', type: 'date-range' },
|
|
1121
|
+
* { id: 'amount', label: 'Amount', type: 'number' },
|
|
1122
|
+
* ]}
|
|
1123
|
+
* onFilterChange={filters => console.log(filters)}
|
|
1124
|
+
* >
|
|
1125
|
+
* <ResizablePanelGroup direction="horizontal">
|
|
1126
|
+
* <ResizablePanel><UITable /></ResizablePanel>
|
|
1127
|
+
* <ResizableHandle />
|
|
1128
|
+
* <UITableFilter />
|
|
1129
|
+
* </ResizablePanelGroup>
|
|
1130
|
+
* </UITableProvider>
|
|
1059
1131
|
* ```
|
|
1060
1132
|
*/
|
|
1061
1133
|
declare const UITableFilter: () => react_jsx_runtime346.JSX.Element;
|
|
@@ -1109,6 +1181,8 @@ declare const UITableProvider: <TData extends RowData<TData> = RowData<AnyEntity
|
|
|
1109
1181
|
fetchMoreData,
|
|
1110
1182
|
csvData,
|
|
1111
1183
|
csvFileName,
|
|
1184
|
+
filterDefinitions,
|
|
1185
|
+
onFilterChange,
|
|
1112
1186
|
children
|
|
1113
1187
|
}: React.PropsWithChildren<TableProviderProps<TData, TKey, TColumns>>) => react_jsx_runtime346.JSX.Element;
|
|
1114
1188
|
//#endregion
|
|
@@ -1177,5 +1251,5 @@ declare const UITableTooltipActions: React.FC<{
|
|
|
1177
1251
|
*/
|
|
1178
1252
|
declare const UITableTooltip: React.FC<React.PropsWithChildren>;
|
|
1179
1253
|
//#endregion
|
|
1180
|
-
export { CsvCell, RowData, TTableBodyContext, TTableContext, TTableHeadRowContext, TTableInnerTableContext, TTableInnerWrapperContext, TTableRowContext, TTableVirtualizerContext, TUITableBody, TUITableCell, TUITableCellActions, TUITableCellSelect, TUITableColumn, TUITableEmptyDisplay, TUITableFooter, TUITableHead, TUITableHeadCell, TUITableHeadCellOption, TUITableHeadCellSelect, TUITableHeadRow, TUITableInnerTable, TUITableInnerWrapper, TUITableLoadMore, TUITableRow, TUITableWrapper, TableProviderProps, UITableBadgeDisplay, UITableBody, UITableBooleanDisplay, UITableCell, UITableCellActions, UITableCellSelect, UITableContainer, UITableCurrencyDisplay, UITableDateDisplay, UITableDescriptionDisplay, UITableEmailDisplay, UITableEmptyDisplay, UITableFilter, UITableFooter, UITableHead, UITableHeadCell, UITableHeadCellOption, UITableHeadCellSelect, UITableHeadRow, UITableInnerTable, UITableInnerWrapper, UITableListDisplay, UITableLoadMore, UITableMoreButton, UITableNameDisplay, UITablePermalink, UITablePhoneNumberDisplay, UITableProgressDisplay, UITableProvider, UITableRemoveButton, UITableRow, UITableStatisticDisplay, UITableStatusDisplay, UITableTooltip, UITableTooltipActions, UITableTooltipFilter, UITableUserDataDisplay, UITableWrapper };
|
|
1254
|
+
export { ActiveFilter, BooleanFilterValue, CsvCell, DateRangeFilterValue, FilterDefinition, FilterOption, FilterType, FilterValue, NumberFilterValue, RowData, TTableBodyContext, TTableContext, TTableFilterContext, TTableHeadRowContext, TTableInnerTableContext, TTableInnerWrapperContext, TTableRowContext, TTableVirtualizerContext, TUITableBody, TUITableCell, TUITableCellActions, TUITableCellSelect, TUITableColumn, TUITableEmptyDisplay, TUITableFooter, TUITableHead, TUITableHeadCell, TUITableHeadCellOption, TUITableHeadCellSelect, TUITableHeadRow, TUITableInnerTable, TUITableInnerWrapper, TUITableLoadMore, TUITableRow, TUITableWrapper, TableProviderProps, TagFilterValue, TextFilterValue, UITableBadgeDisplay, UITableBody, UITableBooleanDisplay, UITableCell, UITableCellActions, UITableCellSelect, UITableContainer, UITableCurrencyDisplay, UITableDateDisplay, UITableDescriptionDisplay, UITableEmailDisplay, UITableEmptyDisplay, UITableFilter, UITableFooter, UITableHead, UITableHeadCell, UITableHeadCellOption, UITableHeadCellSelect, UITableHeadRow, UITableInnerTable, UITableInnerWrapper, UITableListDisplay, UITableLoadMore, UITableMoreButton, UITableNameDisplay, UITablePermalink, UITablePhoneNumberDisplay, UITableProgressDisplay, UITableProvider, UITableRemoveButton, UITableRow, UITableStatisticDisplay, UITableStatusDisplay, UITableTooltip, UITableTooltipActions, UITableTooltipFilter, UITableUserDataDisplay, UITableWrapper };
|
|
1181
1255
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AnyEntity } from "../../types-CkRjAQZ2.mjs";
|
|
2
|
-
import { t as Input } from "../../input-
|
|
2
|
+
import { t as Input } from "../../input-CvWCE7ft.mjs";
|
|
3
3
|
import * as react286 from "react";
|
|
4
4
|
import * as react_jsx_runtime346 from "react/jsx-runtime";
|
|
5
5
|
import { AccessorKeyColumnDef, CellContext, Column, ColumnPinningPosition, ColumnPinningState, Header, HeaderGroup, Row, RowSelectionState, Table } from "@tanstack/react-table";
|
|
@@ -599,6 +599,10 @@ type TTableContext<TData extends RowData<TData>> = {
|
|
|
599
599
|
csvData?: CsvCell[][];
|
|
600
600
|
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
601
601
|
csvFileName?: string;
|
|
602
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
603
|
+
filterDefinitions?: FilterDefinition[];
|
|
604
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
605
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
602
606
|
};
|
|
603
607
|
/** Context value provided by `UITableInnerWrapperProvider`. */
|
|
604
608
|
type TTableInnerWrapperContext = {
|
|
@@ -715,6 +719,68 @@ type TableProviderProps<TData extends RowData<TData>, TKey extends keyof TData =
|
|
|
715
719
|
csvData?: CsvCell[][];
|
|
716
720
|
/** File name (without `.csv`) for the downloaded file. Defaults to the table title. */
|
|
717
721
|
csvFileName?: string;
|
|
722
|
+
/** Definitions of all filterable fields shown in the "Add Filter" dropdown. */
|
|
723
|
+
filterDefinitions?: FilterDefinition[];
|
|
724
|
+
/** Called with the full list of active filters whenever filters are added, removed, or updated. */
|
|
725
|
+
onFilterChange?: (filters: ActiveFilter[]) => void;
|
|
726
|
+
};
|
|
727
|
+
type FilterType = 'tag' | 'date-range' | 'number' | 'text' | 'boolean';
|
|
728
|
+
/** A selectable option for tag/enum filters. */
|
|
729
|
+
type FilterOption = {
|
|
730
|
+
label: string;
|
|
731
|
+
value: string;
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Declares a filterable field available in the "Add Filter" dropdown.
|
|
735
|
+
* `options` is required when `type === 'tag'`.
|
|
736
|
+
*/
|
|
737
|
+
type FilterDefinition = {
|
|
738
|
+
id: string;
|
|
739
|
+
label: string;
|
|
740
|
+
type: FilterType;
|
|
741
|
+
options?: FilterOption[];
|
|
742
|
+
};
|
|
743
|
+
type TagFilterValue = {
|
|
744
|
+
type: 'tag';
|
|
745
|
+
values: string[];
|
|
746
|
+
};
|
|
747
|
+
type DateRangeFilterValue = {
|
|
748
|
+
type: 'date-range';
|
|
749
|
+
/** ISO date string, e.g. `"2024-01-01"`. */
|
|
750
|
+
from?: string;
|
|
751
|
+
to?: string;
|
|
752
|
+
};
|
|
753
|
+
type NumberFilterValue = {
|
|
754
|
+
type: 'number';
|
|
755
|
+
operator: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'between';
|
|
756
|
+
value?: number;
|
|
757
|
+
valueTo?: number;
|
|
758
|
+
};
|
|
759
|
+
type TextFilterValue = {
|
|
760
|
+
type: 'text';
|
|
761
|
+
operator: 'contains' | 'equals' | 'starts-with' | 'ends-with';
|
|
762
|
+
value: string;
|
|
763
|
+
};
|
|
764
|
+
type BooleanFilterValue = {
|
|
765
|
+
type: 'boolean';
|
|
766
|
+
value: boolean | null;
|
|
767
|
+
};
|
|
768
|
+
type FilterValue = TagFilterValue | DateRangeFilterValue | NumberFilterValue | TextFilterValue | BooleanFilterValue;
|
|
769
|
+
/** An active (added) filter instance with its current value. */
|
|
770
|
+
type ActiveFilter = {
|
|
771
|
+
/** Unique instance id for this filter entry. */
|
|
772
|
+
id: string;
|
|
773
|
+
/** References a `FilterDefinition.id`. */
|
|
774
|
+
definitionId: string;
|
|
775
|
+
value: FilterValue;
|
|
776
|
+
};
|
|
777
|
+
/** Context value exposed by `UITableProvider` for the filter panel. */
|
|
778
|
+
type TTableFilterContext = {
|
|
779
|
+
filterDefinitions: FilterDefinition[];
|
|
780
|
+
activeFilters: ActiveFilter[];
|
|
781
|
+
addFilter: (definitionId: string) => void;
|
|
782
|
+
removeFilter: (filterId: string) => void;
|
|
783
|
+
updateFilter: (filterId: string, value: FilterValue) => void;
|
|
718
784
|
};
|
|
719
785
|
//#endregion
|
|
720
786
|
//#region packages/components/features/tables/components/common.d.ts
|
|
@@ -1037,25 +1103,31 @@ declare const UITableContainer: React.FC<React.PropsWithChildren>;
|
|
|
1037
1103
|
//#endregion
|
|
1038
1104
|
//#region packages/components/features/tables/components/table/filter.d.ts
|
|
1039
1105
|
/**
|
|
1040
|
-
* Collapsible side-panel that lets users toggle column visibility and
|
|
1041
|
-
*
|
|
1106
|
+
* Collapsible side-panel that lets users toggle column visibility and build
|
|
1107
|
+
* row filters without leaving the table view.
|
|
1042
1108
|
*
|
|
1043
1109
|
* The panel collapses to a narrow icon strip when no tab is active and expands
|
|
1044
|
-
* to at least 64 units when the "Columns" or "Filters" tab is selected.
|
|
1045
|
-
*
|
|
1110
|
+
* to at least 64 units when the "Columns" or "Filters" tab is selected.
|
|
1111
|
+
*
|
|
1112
|
+
* Wire filter capability by passing `filterDefinitions` and `onFilterChange` to
|
|
1113
|
+
* the parent `UITableProvider`.
|
|
1046
1114
|
*
|
|
1047
1115
|
* @example
|
|
1048
1116
|
* ```tsx
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1057
|
-
* <
|
|
1058
|
-
*
|
|
1117
|
+
* <UITableProvider
|
|
1118
|
+
* filterDefinitions={[
|
|
1119
|
+
* { id: 'status', label: 'Status', type: 'tag', options: [{ label: 'Active', value: 'active' }] },
|
|
1120
|
+
* { id: 'created', label: 'Created At', type: 'date-range' },
|
|
1121
|
+
* { id: 'amount', label: 'Amount', type: 'number' },
|
|
1122
|
+
* ]}
|
|
1123
|
+
* onFilterChange={filters => console.log(filters)}
|
|
1124
|
+
* >
|
|
1125
|
+
* <ResizablePanelGroup direction="horizontal">
|
|
1126
|
+
* <ResizablePanel><UITable /></ResizablePanel>
|
|
1127
|
+
* <ResizableHandle />
|
|
1128
|
+
* <UITableFilter />
|
|
1129
|
+
* </ResizablePanelGroup>
|
|
1130
|
+
* </UITableProvider>
|
|
1059
1131
|
* ```
|
|
1060
1132
|
*/
|
|
1061
1133
|
declare const UITableFilter: () => react_jsx_runtime346.JSX.Element;
|
|
@@ -1109,6 +1181,8 @@ declare const UITableProvider: <TData extends RowData<TData> = RowData<AnyEntity
|
|
|
1109
1181
|
fetchMoreData,
|
|
1110
1182
|
csvData,
|
|
1111
1183
|
csvFileName,
|
|
1184
|
+
filterDefinitions,
|
|
1185
|
+
onFilterChange,
|
|
1112
1186
|
children
|
|
1113
1187
|
}: React.PropsWithChildren<TableProviderProps<TData, TKey, TColumns>>) => react_jsx_runtime346.JSX.Element;
|
|
1114
1188
|
//#endregion
|
|
@@ -1177,5 +1251,5 @@ declare const UITableTooltipActions: React.FC<{
|
|
|
1177
1251
|
*/
|
|
1178
1252
|
declare const UITableTooltip: React.FC<React.PropsWithChildren>;
|
|
1179
1253
|
//#endregion
|
|
1180
|
-
export { CsvCell, RowData, TTableBodyContext, TTableContext, TTableHeadRowContext, TTableInnerTableContext, TTableInnerWrapperContext, TTableRowContext, TTableVirtualizerContext, TUITableBody, TUITableCell, TUITableCellActions, TUITableCellSelect, TUITableColumn, TUITableEmptyDisplay, TUITableFooter, TUITableHead, TUITableHeadCell, TUITableHeadCellOption, TUITableHeadCellSelect, TUITableHeadRow, TUITableInnerTable, TUITableInnerWrapper, TUITableLoadMore, TUITableRow, TUITableWrapper, TableProviderProps, UITableBadgeDisplay, UITableBody, UITableBooleanDisplay, UITableCell, UITableCellActions, UITableCellSelect, UITableContainer, UITableCurrencyDisplay, UITableDateDisplay, UITableDescriptionDisplay, UITableEmailDisplay, UITableEmptyDisplay, UITableFilter, UITableFooter, UITableHead, UITableHeadCell, UITableHeadCellOption, UITableHeadCellSelect, UITableHeadRow, UITableInnerTable, UITableInnerWrapper, UITableListDisplay, UITableLoadMore, UITableMoreButton, UITableNameDisplay, UITablePermalink, UITablePhoneNumberDisplay, UITableProgressDisplay, UITableProvider, UITableRemoveButton, UITableRow, UITableStatisticDisplay, UITableStatusDisplay, UITableTooltip, UITableTooltipActions, UITableTooltipFilter, UITableUserDataDisplay, UITableWrapper };
|
|
1254
|
+
export { ActiveFilter, BooleanFilterValue, CsvCell, DateRangeFilterValue, FilterDefinition, FilterOption, FilterType, FilterValue, NumberFilterValue, RowData, TTableBodyContext, TTableContext, TTableFilterContext, TTableHeadRowContext, TTableInnerTableContext, TTableInnerWrapperContext, TTableRowContext, TTableVirtualizerContext, TUITableBody, TUITableCell, TUITableCellActions, TUITableCellSelect, TUITableColumn, TUITableEmptyDisplay, TUITableFooter, TUITableHead, TUITableHeadCell, TUITableHeadCellOption, TUITableHeadCellSelect, TUITableHeadRow, TUITableInnerTable, TUITableInnerWrapper, TUITableLoadMore, TUITableRow, TUITableWrapper, TableProviderProps, TagFilterValue, TextFilterValue, UITableBadgeDisplay, UITableBody, UITableBooleanDisplay, UITableCell, UITableCellActions, UITableCellSelect, UITableContainer, UITableCurrencyDisplay, UITableDateDisplay, UITableDescriptionDisplay, UITableEmailDisplay, UITableEmptyDisplay, UITableFilter, UITableFooter, UITableHead, UITableHeadCell, UITableHeadCellOption, UITableHeadCellSelect, UITableHeadRow, UITableInnerTable, UITableInnerWrapper, UITableListDisplay, UITableLoadMore, UITableMoreButton, UITableNameDisplay, UITablePermalink, UITablePhoneNumberDisplay, UITableProgressDisplay, UITableProvider, UITableRemoveButton, UITableRow, UITableStatisticDisplay, UITableStatusDisplay, UITableTooltip, UITableTooltipActions, UITableTooltipFilter, UITableUserDataDisplay, UITableWrapper };
|
|
1181
1255
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../button.variants-DeCyas1F.mjs";import"../../button-C6ybzxxj.mjs";import"../../paragraph-Ch5TvEqL.mjs";import"../../flex-BLMTj7Ev.mjs";import"../../date-CVz9xdCg.mjs";import"../../badge-B8bw2UEY.mjs";import"../../tooltip-Bj0iOG4s.mjs";import"../../avatar-DbxqvCjT.mjs";import"../../separator-BMsbHAVt.mjs";import{A as e,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as L}from"../../tables-
|
|
1
|
+
import"../../button.variants-DeCyas1F.mjs";import"../../button-C6ybzxxj.mjs";import"../../paragraph-Ch5TvEqL.mjs";import"../../flex-BLMTj7Ev.mjs";import"../../date-CVz9xdCg.mjs";import"../../badge-B8bw2UEY.mjs";import"../../tooltip-Bj0iOG4s.mjs";import"../../avatar-DbxqvCjT.mjs";import"../../separator-BMsbHAVt.mjs";import"../../close-BU0kWRVo.mjs";import{A as e,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as L}from"../../tables-iT8uH25j.mjs";import"../../dropdown-menu-DWSfXhHo.mjs";import"../../progress-0cpDwgAJ.mjs";import"../../checkbox-Dzo6oI4y.mjs";import"../../spinner-B3F9W53l.mjs";import"../../resizable-C2Zl-iLF.mjs";import"../../input-6f9JTc79.mjs";import"../../popover-OJXFbqJi.mjs";import"../../select-DrHceSnf.mjs";import"../../label-COqDQDMy.mjs";export{d as UITableBadgeDisplay,j as UITableBody,o as UITableBooleanDisplay,_ as UITableCell,T as UITableCellActions,N as UITableCellSelect,O as UITableContainer,a as UITableCurrencyDisplay,i as UITableDateDisplay,u as UITableDescriptionDisplay,c as UITableEmailDisplay,v as UITableEmptyDisplay,h as UITableFilter,y as UITableFooter,k as UITableHead,E as UITableHeadCell,x as UITableHeadCellOption,b as UITableHeadCellSelect,m as UITableHeadRow,P as UITableInnerTable,L as UITableInnerWrapper,s as UITableListDisplay,g as UITableLoadMore,C as UITableMoreButton,e as UITableNameDisplay,w as UITablePermalink,l as UITablePhoneNumberDisplay,n as UITableProgressDisplay,S as UITableProvider,r as UITableRemoveButton,I as UITableRow,p as UITableStatisticDisplay,F as UITableStatusDisplay,M as UITableTooltip,D as UITableTooltipActions,A as UITableTooltipFilter,t as UITableUserDataDisplay,f as UITableWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../button.variants-tnhb123u.cjs`),require(`../../button-CwDT3m4m.cjs`),require(`../../heading-AKz5ewy-.cjs`),require(`../../paragraph-DN85Huc4.cjs`),require(`../../tooltip-itUmYz9k.cjs`),require(`../../separator-BwZb12bh.cjs`),require(`../../close-DXk_H3Gt.cjs`),require(`../../dialog-o_68LQXd.cjs`),require(`../../command-SHd-d_o0.cjs`),require(`../../checkbox-Di7ACavC.cjs`),require(`../../input-BMOYFJYM.cjs`)
|
|
1
|
+
require(`../../button.variants-tnhb123u.cjs`),require(`../../button-CwDT3m4m.cjs`),require(`../../heading-AKz5ewy-.cjs`),require(`../../paragraph-DN85Huc4.cjs`),require(`../../tooltip-itUmYz9k.cjs`),require(`../../separator-BwZb12bh.cjs`),require(`../../close-DXk_H3Gt.cjs`),require(`../../dialog-o_68LQXd.cjs`),require(`../../command-SHd-d_o0.cjs`),require(`../../checkbox-Di7ACavC.cjs`),require(`../../input-BMOYFJYM.cjs`),require(`../../popover-AEt-aSy3.cjs`),require(`../../select-DzylYFes.cjs`);const e=require(`../../tanstack-form-BUjk7DIz.cjs`);require(`../../calendar-BMXIBCsr.cjs`),require(`../../radio-group-C7FAAawm.cjs`),require(`../../textarea-DZ86A_cm.cjs`),exports.Field=e.o,exports.FieldContent=e.s,exports.FieldContentMain=e.c,exports.FieldError=e.l,exports.FieldGroup=e.u,exports.FieldLabel=e.d,exports.FieldSeparator=e.f,exports.useTanStackFieldContext=e.t,exports.useTanStackForm=e.n,exports.useTanStackFormContext=e.r,exports.withTanStackFieldGroup=e.i,exports.withTanStackForm=e.a;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as withTanStackForm, c as FieldContentMain, d as FieldLabel, f as FieldSeparator, i as withTanStackFieldGroup, l as FieldError, n as useTanStackForm, o as Field, r as useTanStackFormContext, s as FieldContent, t as useTanStackFieldContext, u as FieldGroup } from "../../index-
|
|
1
|
+
import { a as withTanStackForm, c as FieldContentMain, d as FieldLabel, f as FieldSeparator, i as withTanStackFieldGroup, l as FieldError, n as useTanStackForm, o as Field, r as useTanStackFormContext, s as FieldContent, t as useTanStackFieldContext, u as FieldGroup } from "../../index-CkmisxOx.cjs";
|
|
2
2
|
export { Field, FieldContent, FieldContentMain, FieldError, FieldGroup, FieldLabel, FieldSeparator, useTanStackFieldContext, useTanStackForm, useTanStackFormContext, withTanStackFieldGroup, withTanStackForm };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as withTanStackForm, c as FieldContentMain, d as FieldLabel, f as FieldSeparator, i as withTanStackFieldGroup, l as FieldError, n as useTanStackForm, o as Field, r as useTanStackFormContext, s as FieldContent, t as useTanStackFieldContext, u as FieldGroup } from "../../index-
|
|
1
|
+
import { a as withTanStackForm, c as FieldContentMain, d as FieldLabel, f as FieldSeparator, i as withTanStackFieldGroup, l as FieldError, n as useTanStackForm, o as Field, r as useTanStackFormContext, s as FieldContent, t as useTanStackFieldContext, u as FieldGroup } from "../../index-Cyc9v5Az.mjs";
|
|
2
2
|
export { Field, FieldContent, FieldContentMain, FieldError, FieldGroup, FieldLabel, FieldSeparator, useTanStackFieldContext, useTanStackForm, useTanStackFormContext, withTanStackFieldGroup, withTanStackForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../button.variants-DeCyas1F.mjs";import"../../button-C6ybzxxj.mjs";import"../../heading-DN67djxs.mjs";import"../../paragraph-Ch5TvEqL.mjs";import"../../tooltip-Bj0iOG4s.mjs";import"../../separator-BMsbHAVt.mjs";import"../../close-BU0kWRVo.mjs";import"../../dialog-BchwY6-N.mjs";import"../../command-bpcnKEbR.mjs";import"../../checkbox-Dzo6oI4y.mjs";import"../../input-6f9JTc79.mjs";import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../../tanstack-form-
|
|
1
|
+
import"../../button.variants-DeCyas1F.mjs";import"../../button-C6ybzxxj.mjs";import"../../heading-DN67djxs.mjs";import"../../paragraph-Ch5TvEqL.mjs";import"../../tooltip-Bj0iOG4s.mjs";import"../../separator-BMsbHAVt.mjs";import"../../close-BU0kWRVo.mjs";import"../../dialog-BchwY6-N.mjs";import"../../command-bpcnKEbR.mjs";import"../../checkbox-Dzo6oI4y.mjs";import"../../input-6f9JTc79.mjs";import"../../popover-OJXFbqJi.mjs";import"../../select-DrHceSnf.mjs";import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"../../tanstack-form-DtZdrifK.mjs";import"../../calendar-WMJIKojX.mjs";import"../../radio-group-5ktXGXSv.mjs";import"../../textarea-Dd1fBf_4.mjs";export{s as Field,l as FieldContent,t as FieldContentMain,a as FieldError,d as FieldGroup,n as FieldLabel,r as FieldSeparator,u as useTanStackFieldContext,o as useTanStackForm,c as useTanStackFormContext,i as withTanStackFieldGroup,e as withTanStackForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./separator-BMsbHAVt.mjs";import{t}from"./label-
|
|
2
|
-
//# sourceMappingURL=field-
|
|
1
|
+
import{t as e}from"./separator-BMsbHAVt.mjs";import{t}from"./label-COqDQDMy.mjs";import{BanIcon as n}from"lucide-react";import{memo as r,useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{cn as s}from"@customafk/react-toolkit/utils";import{cva as c}from"class-variance-authority";const l=r(({className:e,...t})=>a(`fieldset`,{"data-slot":`field-set`,className:s(`flex flex-col gap-6`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));l.displayName=`FieldSet`;const u=r(({className:e,variant:t=`legend`,...n})=>a(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:s(`mb-3 font-medium`,`data-[variant=legend]:text-base`,`data-[variant=label]:text-sm`,e),...n}));u.displayName=`FieldLegend`;const d=r(({className:e,...t})=>a(`div`,{"data-slot":`field-group`,className:s(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));d.displayName=`FieldGroup`;const f=c(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),p=r(({className:e,orientation:t=`vertical`,...n})=>a(`div`,{"data-slot":`field`,"data-orientation":t,className:s(f({orientation:t}),e),...n}));p.displayName=`Field`;const m=r(({className:e,...t})=>a(`div`,{"data-slot":`field-content`,className:s(`group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug`,e),...t}));m.displayName=`FieldContent`;const h=r(({className:e,...n})=>a(t,{"data-slot":`field-label`,className:s(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`*:data-[slot=field]:p-4`,`has-data-[state=checked]:bg-primary/5`,`has-data-[state=checked]:border-primary`,e),...n}));h.displayName=`FieldLabel`;const g=r(({className:e,...t})=>a(`div`,{"data-slot":`field-label`,className:s(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));g.displayName=`FieldTitle`;const _=r(({className:e,...t})=>a(`p`,{"data-slot":`field-description`,className:s(`text-text-positive-weak text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t}));_.displayName=`FieldDescription`;const v=r(({children:t,className:n,...r})=>o(`div`,{"data-slot":`field-separator`,"data-content":!!t,className:s(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[a(e,{className:`absolute inset-0 top-1/2`}),t&&a(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:t})]}));v.displayName=`FieldSeparator`;const y=r(({className:e,children:t,errors:r,...c})=>{let l=i(()=>t||(r?r?.length===1&&r[0]?.message?o(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:[a(n,{size:14}),a(`p`,{children:r[0].message})]}):a(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(e=>typeof e==`string`?a(`li`,{children:e},e):e?.message?a(`li`,{children:e.message},e.message):null)}):null),[t,r]);return l?a(`div`,{role:`alert`,"data-slot":`field-error`,className:s(`w-full font-normal text-danger text-xs`,e),...c,children:l}):null});y.displayName=`FieldError`;export{d as a,v as c,y as i,l,m as n,h as o,_ as r,u as s,p as t,g as u};
|
|
2
|
+
//# sourceMappingURL=field-C5HOxxiX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-
|
|
1
|
+
{"version":3,"file":"field-C5HOxxiX.mjs","names":[],"sources":["../packages/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { BanIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium', 'data-[variant=legend]:text-base', 'data-[variant=label]:text-sm', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\nconst fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:text-destructive', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'group-data-[disabled=true]/field:opacity-50',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n '*:data-[slot=field]:p-4',\n 'has-data-[state=checked]:bg-primary/5',\n 'has-data-[state=checked]:border-primary',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\nconst FieldSeparator = memo(\n ({\n children,\n className,\n ...props\n }: React.ComponentProps<'div'> & {\n children?: React.ReactNode;\n }) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n }\n);\nFieldSeparator.displayName = 'FieldSeparator';\n\nconst FieldError = memo(\n ({\n className,\n children,\n errors,\n ...props\n }: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>;\n }) => {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <BanIcon size={14} />\n <p>{errors[0].message}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.message}>{error.message}</li>;\n })}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-normal text-danger text-xs', className)} {...props}>\n {content}\n </div>\n );\n }\n);\nFieldError.displayName = 'FieldError';\n\nexport { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle };\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./separator-BwZb12bh.cjs`),n=require(`./label-
|
|
2
|
-
//# sourceMappingURL=field-
|
|
1
|
+
const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./separator-BwZb12bh.cjs`),n=require(`./label-DYsRdKMt.cjs`);let r=require(`lucide-react`),i=require(`react`),a=require(`react/jsx-runtime`),o=require(`@customafk/react-toolkit/utils`),s=require(`class-variance-authority`);const c=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,o.cn)(`flex flex-col gap-6`,`has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));c.displayName=`FieldSet`;const l=(0,i.memo)(({className:e,variant:t=`legend`,...n})=>(0,a.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,o.cn)(`mb-3 font-medium`,`data-[variant=legend]:text-base`,`data-[variant=label]:text-sm`,e),...n}));l.displayName=`FieldLegend`;const u=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(`div`,{"data-slot":`field-group`,className:(0,o.cn)(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));u.displayName=`FieldGroup`;const d=(0,s.cva)(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),f=(0,i.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,a.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,o.cn)(d({orientation:t}),e),...n}));f.displayName=`Field`;const p=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(`div`,{"data-slot":`field-content`,className:(0,o.cn)(`group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug`,e),...t}));p.displayName=`FieldContent`;const m=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(n.t,{"data-slot":`field-label`,className:(0,o.cn)(`group/field-label peer/field-label flex w-fit gap-2 leading-snug`,`group-data-[disabled=true]/field:opacity-50`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`*:data-[slot=field]:p-4`,`has-data-[state=checked]:bg-primary/5`,`has-data-[state=checked]:border-primary`,e),...t}));m.displayName=`FieldLabel`;const h=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(`div`,{"data-slot":`field-label`,className:(0,o.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));h.displayName=`FieldTitle`;const g=(0,i.memo)(({className:e,...t})=>(0,a.jsx)(`p`,{"data-slot":`field-description`,className:(0,o.cn)(`text-text-positive-weak text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...t}));g.displayName=`FieldDescription`;const _=(0,i.memo)(({children:e,className:n,...r})=>(0,a.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,o.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[(0,a.jsx)(t.t,{className:`absolute inset-0 top-1/2`}),e&&(0,a.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));_.displayName=`FieldSeparator`;const v=(0,i.memo)(({className:e,children:t,errors:n,...s})=>{let c=(0,i.useMemo)(()=>t||(n?n?.length===1&&n[0]?.message?(0,a.jsxs)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:[(0,a.jsx)(r.BanIcon,{size:14}),(0,a.jsx)(`p`,{children:n[0].message})]}):(0,a.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:n.map(e=>typeof e==`string`?(0,a.jsx)(`li`,{children:e},e):e?.message?(0,a.jsx)(`li`,{children:e.message},e.message):null)}):null),[t,n]);return c?(0,a.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,o.cn)(`w-full font-normal text-danger text-xs`,e),...s,children:c}):null});v.displayName=`FieldError`,Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return h}});
|
|
2
|
+
//# sourceMappingURL=field-D1wvj5Wj.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-
|
|
1
|
+
{"version":3,"file":"field-D1wvj5Wj.cjs","names":["Label","Separator","BanIcon"],"sources":["../packages/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { BanIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6', 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium', 'data-[variant=legend]:text-base', 'data-[variant=label]:text-sm', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\nconst fieldVariants = cva('group/field flex w-full gap-3 data-[invalid=true]:text-destructive', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex basis-2/5 flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug',\n 'group-data-[disabled=true]/field:opacity-50',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n '*:data-[slot=field]:p-4',\n 'has-data-[state=checked]:bg-primary/5',\n 'has-data-[state=checked]:border-primary',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n 'text-text-positive-weak text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\nconst FieldSeparator = memo(\n ({\n children,\n className,\n ...props\n }: React.ComponentProps<'div'> & {\n children?: React.ReactNode;\n }) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n }\n);\nFieldSeparator.displayName = 'FieldSeparator';\n\nconst FieldError = memo(\n ({\n className,\n children,\n errors,\n ...props\n }: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>;\n }) => {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <BanIcon size={14} />\n <p>{errors[0].message}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.message}>{error.message}</li>;\n })}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-normal text-danger text-xs', className)} {...props}>\n {content}\n </div>\n );\n }\n);\nFieldError.displayName = 'FieldError';\n\nexport { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle };\n"],"mappings":"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"}
|