@sito/dashboard 0.0.67 → 0.0.68
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/{FileInput-DCR_Pyqe.js → FileInput-DNoJELoS.js} +18 -18
- package/dist/FileInput-YvKQ-wok.cjs +1 -0
- package/dist/FiltersProvider-BlHv12dU.cjs +1 -0
- package/dist/{FiltersProvider-CY2fsw_F.js → FiltersProvider-gfC9gS8u.js} +5 -5
- package/dist/FiltersProvider.cjs +1 -1
- package/dist/FiltersProvider.js +1 -1
- package/dist/Form.cjs +1 -1
- package/dist/Form.js +2 -2
- package/dist/{Table-BtZGG0d7.js → Table-B5vsXjAq.js} +399 -375
- package/dist/Table-DgFzKIJZ.cjs +1 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.css +1 -1
- package/dist/Table.js +1 -1
- package/dist/TableOptions.cjs +1 -1
- package/dist/TableOptions.js +1 -1
- package/dist/TableOptionsProvider-CDLZ4TXE.cjs +1 -0
- package/dist/TableOptionsProvider-HHCDcRbO.js +55 -0
- package/dist/TextInput-C27RFuya.cjs +1 -0
- package/dist/TextInput-DPYxzgm3.js +335 -0
- package/dist/TextInput.css +1 -1
- package/dist/Translation.cjs +1 -1
- package/dist/Translation.js +1 -1
- package/dist/{TranslationProvider-COebIyxr.js → TranslationProvider-BR4s--Vu.js} +2 -2
- package/dist/TranslationProvider-Czr0WIDH.cjs +1 -0
- package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +2 -0
- package/dist/components/Form/CheckInput/CheckInput.test.d.ts +1 -0
- package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +1 -0
- package/dist/components/Form/TextInput/TextInput.stories.d.ts +2 -0
- package/dist/components/Table/Table.stories.d.ts +2 -0
- package/dist/components/Table/components/Footer/Navigation.test.d.ts +1 -0
- package/dist/components/Table/components/TableHeader/TableHeader.test.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +6 -6
- package/dist/providers/FiltersProvider/FiltersProvider.test.d.ts +1 -0
- package/dist/providers/Translation/TranslationProvider.d.ts +5 -4
- package/dist/providers/Translation/TranslationProvider.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/FileInput-Ch-GCxrS.cjs +0 -1
- package/dist/FiltersProvider-CYqLFEI9.cjs +0 -1
- package/dist/Table-DjIhOMXQ.cjs +0 -1
- package/dist/TableOptionsProvider-BchUDA3B.cjs +0 -1
- package/dist/TableOptionsProvider-BfQS8l1N.js +0 -50
- package/dist/TextInput-BqW5YX-3.js +0 -320
- package/dist/TextInput-CY1fh4mf.cjs +0 -1
- package/dist/TranslationProvider-51Pc9Xrr.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,9 @@ declare const meta: Meta<typeof TextInput>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof TextInput>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const Placeholder: Story;
|
|
7
8
|
export declare const WithHelperText: Story;
|
|
8
9
|
export declare const ErrorState: Story;
|
|
10
|
+
export declare const SuccessState: Story;
|
|
9
11
|
export declare const WithController: Story;
|
|
10
12
|
export declare const Controlled: Story;
|
|
@@ -16,3 +16,5 @@ export declare const WithMultipleActions: Story;
|
|
|
16
16
|
export declare const WithStickyAndDropdownActions: Story;
|
|
17
17
|
export declare const WithExpandableRows: Story;
|
|
18
18
|
export declare const WithMultipleExpandableRows: Story;
|
|
19
|
+
export declare const WithPagination: Story;
|
|
20
|
+
export declare const WithCompleteFeatures: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var b=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./lib.cjs"),s=require("./query-81BrXp3i.cjs"),e=require("./Table-
|
|
1
|
+
var b=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./lib.cjs"),s=require("./query-81BrXp3i.cjs"),e=require("./Table-DgFzKIJZ.cjs"),a=require("./Badge-Z78MlGoQ.cjs"),u=require("./Button-BlYa3uPc.cjs"),p=require("./Chip-D17UJHW6.cjs"),c=require("./Dropdown-CAxauIXt.cjs"),t=require("./TextInput-C27RFuya.cjs"),d=require("./FileInput-YvKQ-wok.cjs"),C=require("./IconButton-CVnmT2E9.cjs"),T=require("./Loading-CNECRan-.cjs"),r=require("./Filters-Dyee8QYH.cjs"),F=require("./Close-O9P7wJGf.cjs"),v=require("./File-_Hjw2d3F.cjs"),h=require("./Tooltip-BSKAgRkc.cjs"),o=require("./FiltersProvider-BlHv12dU.cjs"),i=require("./TableOptionsProvider-CDLZ4TXE.cjs"),n=require("./TranslationProvider-Czr0WIDH.cjs");exports.FilterTypes=l.FilterTypes;exports.SortOrder=s.SortOrder;exports.Action=e.Action;exports.Actions=e.Actions;exports.ActionsDropdown=e.ActionsDropdown;exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;exports.Badge=a.Badge;exports.Button=u.Button;exports.Chip=p.Chip;exports.Dropdown=c.Dropdown;exports.AutocompleteInput=t.AutocompleteInput;exports.CheckInput=t.CheckInput;exports.SelectInput=t.SelectInput;exports.State=t.State;exports.TextInput=t.TextInput;exports.helperTextStateClassName=t.helperTextStateClassName;exports.inputStateClassName=t.inputStateClassName;exports.labelStateClassName=t.labelStateClassName;exports.FileInput=d.FileInput;exports.IconButton=C.IconButton;exports.Loading=T.Loading;exports.ChevronDown=r.ChevronDown;exports.ChevronLeft=r.ChevronLeft;exports.ChevronRight=r.ChevronRight;exports.ChevronUp=r.ChevronUp;exports.Ellipsis=r.Ellipsis;exports.Filters=r.Filters;exports.Close=F.Close;exports.File=v.File;exports.Tooltip=h.Tooltip;exports.FiltersActions=o.FiltersActions;exports.FiltersProvider=o.FiltersProvider;exports.filtersReducer=o.filtersReducer;exports.initializer=o.initializer;exports.useFilters=o.useFilters;exports.TableOptionsProvider=i.TableOptionsProvider;exports.useTableOptions=i.useTableOptions;exports.TranslationProvider=n.TranslationProvider;exports.useTranslation=n.useTranslation;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-blue-800:oklch(42.4% .199 265.638);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-semibold:600;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.relative{position:relative}.static{position:static}.sticky{position:sticky}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.container{width:100%}@media(min-width:28rem){.container{max-width:28rem}}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-2{margin-top:calc(var(--spacing) * 2)}.\!hidden{display:none!important}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.table-row{display:table-row}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-full{width:100%}.w-px{width:1px}.max-w-sm{max-width:var(--container-sm)}.min-w-48{min-width:calc(var(--spacing) * 48)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.stroke-blue-800{stroke:var(--color-blue-800)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.p-10{padding:calc(var(--spacing) * 10)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-gray-500{color:var(--color-gray-500)}.capitalize{text-transform:capitalize}.opacity-70{opacity:.7}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.input-normal{border-color:var(--color-border,#ccc);color:var(--color-text,#0d0d0d)}.input-normal:focus{border-color:var(--color-primary,#041e42)}.input-label-error{color:var(--color-secondary,#cd212a)}.input-label-good{color:var(--color-bg-success,#1d9a5b)}.input-label-normal{color:var(--color-text-muted,#4d4d4d)}.input-label-normal:is(:where(.peer):focus~*){color:var(--color-primary,#041e42)}.input-helper-text-error{color:var(--color-bg-error,#c14444)}.input-helper-text-good{color:var(--color-bg-success,#1d9a5b)}.input-helper-text-normal{color:var(--color-text-muted,#4d4d4d)}.autocomplete-suggestions-container{background-color:var(--color-base-light,#fff)}.autocomplete-suggestion-item:hover{background-color:var(--color-base-dark,#e6e6e6)}.autocomplete-delete-button{color:var(--color-text,#0d0d0d)}@media(hover:hover){.autocomplete-delete-button:hover{color:var(--color-secondary,#cd212a)}}.chip-main{background-color:var(--color-base-dark,#e6e6e6);color:var(--color-text,#0d0d0d)}.chip-delete-button:hover{color:var(--color-secondary,#cd212a)}.badge-main{background-color:var(--color-bg-error,#c14444);color:var(--color-error,#fbfbfb)}.table-loading{background-color:var(--color-base-light,#fff)}.table-row{border-bottom-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff)}.table-headers-row{background-color:var(--color-base,#f2f2f2);color:var(--color-text-muted,#4d4d4d)}.table-content{color:var(--color-text-muted,#4d4d4d)}.table-row-cell.basic{color:var(--color-text,#0d0d0d)}.table-navigation-buttons:disabled{color:var(--color-text-muted,#4d4d4d)}.filter-popup{background-color:var(--color-base-light,#fff)}.filter-dropdown-submit,.filter-dropdown-cancel{border-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff);color:var(--color-text-muted,#4d4d4d)}@media(hover:hover){:is(.filter-dropdown-submit,.filter-dropdown-cancel):hover{border-color:var(--color-text-muted,#4d4d4d);color:var(--color-text,#0d0d0d)}}.filter-dropdown-trigger{border-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff);color:var(--color-text-muted,#4d4d4d)}@media(hover:hover){.filter-dropdown-trigger:hover{border-color:var(--color-text-muted,#4d4d4d);color:var(--color-text,#0d0d0d)}}.filter-title{color:var(--color-text-muted,#4d4d4d)}.filter-footer{border-color:var(--color-border,#ccc);background-color:var(--color-base,#f2f2f2)}.table-headers-cell{border-color:var(--color-border,#ccc)}@media(hover:hover){.table-headers-cell:hover{background-color:var(--color-base-dark,#e6e6e6)}}
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-blue-800:oklch(42.4% .199 265.638);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-semibold:600;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.visible{visibility:visible}.relative{position:relative}.static{position:static}.sticky{position:sticky}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.container{width:100%}@media(min-width:28rem){.container{max-width:28rem}}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mt-2{margin-top:calc(var(--spacing) * 2)}.\!hidden{display:none!important}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.table-row{display:table-row}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-full{width:100%}.w-px{width:1px}.max-w-sm{max-width:var(--container-sm)}.min-w-48{min-width:calc(var(--spacing) * 48)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.stroke-blue-800{stroke:var(--color-blue-800)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.p-10{padding:calc(var(--spacing) * 10)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-gray-500{color:var(--color-gray-500)}.capitalize{text-transform:capitalize}.opacity-70{opacity:.7}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.input-error{border-color:var(--color-bg-error,#c14444);color:var(--color-bg-error,#c14444)}.input-error:focus{border-color:var(--color-bg-error,#c14444)}.input-good{border-color:var(--color-bg-success,#1d9a5b);color:var(--color-bg-success,#1d9a5b)}.input-good:focus{border-color:var(--color-bg-success,#1d9a5b)}.input-normal{border-color:var(--color-border,#ccc);color:var(--color-text,#0d0d0d)}.input-normal:focus{border-color:var(--color-primary,#041e42)}.input-label-error{color:var(--color-secondary,#cd212a)}.input-label-good{color:var(--color-bg-success,#1d9a5b)}.input-label-normal{color:var(--color-text-muted,#4d4d4d)}.input-label-normal:is(:where(.peer):focus~*){color:var(--color-primary,#041e42)}.input-helper-text-error{color:var(--color-bg-error,#c14444)}.input-helper-text-good{color:var(--color-bg-success,#1d9a5b)}.input-helper-text-normal{color:var(--color-text-muted,#4d4d4d)}.autocomplete-suggestions-container{background-color:var(--color-base-light,#fff)}.autocomplete-suggestion-item:hover{background-color:var(--color-base-dark,#e6e6e6)}.autocomplete-delete-button{color:var(--color-text,#0d0d0d)}@media(hover:hover){.autocomplete-delete-button:hover{color:var(--color-secondary,#cd212a)}}.chip-main{background-color:var(--color-base-dark,#e6e6e6);color:var(--color-text,#0d0d0d)}.chip-delete-button:hover{color:var(--color-secondary,#cd212a)}.badge-main{background-color:var(--color-bg-error,#c14444);color:var(--color-error,#fbfbfb)}.table-loading{background-color:var(--color-base-light,#fff)}.table-row{border-bottom-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff)}.table-headers-row{background-color:var(--color-base,#f2f2f2);color:var(--color-text-muted,#4d4d4d)}.table-content{color:var(--color-text-muted,#4d4d4d)}.table-row-cell.basic{color:var(--color-text,#0d0d0d)}.table-navigation-buttons:disabled{color:var(--color-text-muted,#4d4d4d)}.filter-popup{background-color:var(--color-base-light,#fff)}.filter-title{color:var(--color-text-muted,#4d4d4d)}.filter-footer{border-color:var(--color-border,#ccc);background-color:var(--color-base-dark,#e6e6e6)}.table-headers-cell{border-color:var(--color-border,#ccc)}@media(hover:hover){.table-headers-cell:hover{background-color:var(--color-base-dark,#e6e6e6)}}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
2
|
import { FilterTypes as o } from "./lib.js";
|
|
3
3
|
import { S as t } from "./query-CwuehjY1.js";
|
|
4
|
-
import { h as p, i as n, j as l, A as m, a as f, C as x, b as C, F as u, c as T, N as F, P as c, R as d, d as h, g as S, T as b, e as v, f as A, r as g } from "./Table-
|
|
4
|
+
import { h as p, i as n, j as l, A as m, a as f, C as x, b as C, F as u, c as T, N as F, P as c, R as d, d as h, g as S, T as b, e as v, f as A, r as g } from "./Table-B5vsXjAq.js";
|
|
5
5
|
import { B } from "./Badge-CIeYthEy.js";
|
|
6
6
|
import { B as D } from "./Button-D73-swfo.js";
|
|
7
7
|
import { C as P } from "./Chip-C5ogKbFn.js";
|
|
8
8
|
import { D as O } from "./Dropdown-CbaxuMbk.js";
|
|
9
|
-
import { A as E, C as L, S as z, a as j, T as k, h as H, i as U, l as q } from "./TextInput-
|
|
10
|
-
import { F as J } from "./FileInput-
|
|
9
|
+
import { A as E, C as L, S as z, a as j, T as k, h as H, i as U, l as q } from "./TextInput-DPYxzgm3.js";
|
|
10
|
+
import { F as J } from "./FileInput-DNoJELoS.js";
|
|
11
11
|
import { I as M } from "./IconButton-BpsTEj0z.js";
|
|
12
12
|
import { L as V } from "./Loading-B_c_4XLr.js";
|
|
13
13
|
import { C as X, a as Y, b as Z, c as _, E as $, F as aa } from "./Filters-DL5jd8ps.js";
|
|
14
14
|
import { C as sa } from "./Close-rKC9AcNX.js";
|
|
15
15
|
import { F as ra } from "./File-BuJndWMv.js";
|
|
16
16
|
import { T as ia } from "./Tooltip-B4E-FRwY.js";
|
|
17
|
-
import { a as na, F as la, f as ma, i as fa, u as xa } from "./FiltersProvider-
|
|
18
|
-
import { T as ua, u as Ta } from "./TableOptionsProvider-
|
|
19
|
-
import { T as ca, u as da } from "./TranslationProvider-
|
|
17
|
+
import { a as na, F as la, f as ma, i as fa, u as xa } from "./FiltersProvider-gfC9gS8u.js";
|
|
18
|
+
import { T as ua, u as Ta } from "./TableOptionsProvider-HHCDcRbO.js";
|
|
19
|
+
import { T as ca, u as da } from "./TranslationProvider-BR4s--Vu.js";
|
|
20
20
|
export {
|
|
21
21
|
p as Action,
|
|
22
22
|
n as Actions,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { TFunction, TranslationProviderPropsType } from './types';
|
|
2
|
+
type TranslationContextType = {
|
|
3
|
+
t: TFunction;
|
|
4
|
+
language: string;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* Renders the TranslationProvider component.
|
|
4
8
|
* @param props - props parameter.
|
|
@@ -9,8 +13,5 @@ declare function TranslationProvider(props: TranslationProviderPropsType): impor
|
|
|
9
13
|
* Provides the useTranslation hook.
|
|
10
14
|
* @returns Function result.
|
|
11
15
|
*/
|
|
12
|
-
declare const useTranslation: () =>
|
|
13
|
-
t: TFunction;
|
|
14
|
-
language: string;
|
|
15
|
-
};
|
|
16
|
+
declare const useTranslation: () => TranslationContextType;
|
|
16
17
|
export { TranslationProvider, useTranslation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var D=require("./FileInput.css");const e=require("react/jsx-runtime"),n=require("react"),C=require("./Tooltip-BSKAgRkc.cjs"),T=require("./File-_Hjw2d3F.cjs"),w=require("./Chip-D17UJHW6.cjs"),y=require("./IconButton-CVnmT2E9.cjs"),R=require("./Close-O9P7wJGf.cjs");function j(s,i=25){if(s.length<=i)return s;const a=s.lastIndexOf(".");if(a===-1)return s.slice(0,i-3)+"...";const h=s.slice(0,a),r=s.slice(a),p=i-r.length-3;return h.slice(0,p)+"..."+r}const B=n.forwardRef(function(s,i){const{children:a,label:h,containerClassName:r="",inputClassName:p="",labelClassName:N="",helperText:m="",helperTextClassName:g="",iconClassName:b="",multiple:q=!1,onChange:x,onClear:o,...d}=s,[t,f]=n.useState([]),k=n.useCallback(l=>{if(l.target.files){const c=Array.from(l.target.files);f(u=>[...u,...c])}x?.(l)},[x]),v=n.useCallback(l=>{f(c=>{const u=c.filter((A,$)=>$!==l);return u.length===0&&o?.(),u})},[o]),F=n.useCallback(()=>{f([]),o?.()},[o]),I=n.useCallback(l=>{l.currentTarget.value=""},[]);return e.jsxs("div",{className:`file-input-container ${r}`,children:[t.length===0&&e.jsxs("label",{htmlFor:d.name,className:`${N}`,children:[h,e.jsx("input",{type:"file",ref:i,multiple:q,onClick:I,onChange:k,className:`file-input ${p}`,...d}),d.required?" *":""]}),t.length>1&&e.jsx("ul",{className:"file-preview-list",children:t.map((l,c)=>e.jsx("li",{children:e.jsx(C.Tooltip,{content:l.name,children:e.jsx(w.Chip,{text:j(l.name,25),onDelete:()=>v(c)})})},`${l.name}-${l.lastModified}`))}),t.length===1&&e.jsxs("div",{className:"file-preview",children:[e.jsx(T.File,{className:`file-icon ${b}`}),e.jsx(C.Tooltip,{content:t[0]?.name??"",children:e.jsx("span",{className:"file-preview-name",children:j(t[0]?.name??"",25)})}),e.jsx(y.IconButton,{icon:e.jsx(R.Close,{}),onClick:F,type:"button"})]}),a,!!m&&e.jsx("p",{className:`file-input-helper-text ${g}`,children:m})]})});exports.FileInput=B;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const p=require("react/jsx-runtime"),i=require("react"),f=require("./TableOptionsProvider-BchUDA3B.cjs");var n=(e=>(e[e.update=0]="update",e[e.reset=1]="reset",e))(n||{});const u=e=>{if(e){const t={};return Object.keys(e)?.forEach(s=>{t[s]={value:e[s]}}),t}return{}};function a(e,t){const{type:r}=t;switch(r){case n.reset:return{};case n.update:{const{toUpdate:s}=t;return{...e,...s}}default:return e}}const d=i.createContext({}),v=e=>{const{children:t}=e,{filters:r}=f.useTableOptions(),[s,o]=i.useReducer(a,u(r));i.useEffect(()=>{o({type:n.reset});const c=u(r);Object.keys(c).length&&o({type:n.update,toUpdate:c})},[r]);const l={currentFilters:s,setCurrentFilters:o};return p.jsx(d.Provider,{value:l,children:t})},x=()=>{const e=i.useContext(d);if(e===void 0)throw new Error("tableOptionsContext must be used within a Provider");return e};exports.FiltersActions=n;exports.FiltersProvider=v;exports.filtersReducer=a;exports.initializer=u;exports.useFilters=x;
|
package/dist/Table-DjIhOMXQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Ee=require("./Table.css");const e=require("react/jsx-runtime"),o=require("react"),w=require("./FiltersProvider-CYqLFEI9.cjs"),xe=require("./Badge-Z78MlGoQ.cjs"),B=require("./Filters-Dyee8QYH.cjs"),z=require("./lib.cjs"),A=require("./TranslationProvider-51Pc9Xrr.cjs"),$=require("./TextInput-CY1fh4mf.cjs"),_=require("./TableOptionsProvider-BchUDA3B.cjs"),J=require("./Chip-D17UJHW6.cjs"),L=require("./IconButton-CVnmT2E9.cjs"),G=require("./Tooltip-BSKAgRkc.cjs"),be=require("./query-81BrXp3i.cjs"),fe=require("./Button-BlYa3uPc.cjs"),je=require("./Dropdown-CAxauIXt.cjs"),ge=require("./Loading-CNECRan-.cjs");function K(s){const{id:t,icon:r,tooltip:n,onClick:l,children:a,hidden:p=!1,disabled:i=!1,showText:d=!1,showTooltips:c=!0,className:h=""}=s;return p?null:e.jsxs("button",{id:t,className:`action ${d?"text-action":"icon-action"} ${h}`,disabled:i,onClick:()=>l?.(),"aria-disabled":i,"data-tooltip-id":"tooltip","data-tooltip-content":c?n:"",children:[r," ",d&&n,a]})}function Q(s){const{actions:t=[],className:r="",itemClassName:n="",actionClassName:l="",showTooltips:a=!0,showActionTexts:p=!1}=s;return e.jsx("ul",{className:`actions-container ${r}`,children:t.map(i=>e.jsx("li",{className:`actions-container-item ${n}`,children:e.jsx(K,{showTooltips:a,showText:p,className:l,...i})},i.id))})}const Y=s=>{const{actions:t=[],className:r=""}=s,{t:n}=A.useTranslation(),[l,a]=o.useState(!1),[p,i]=o.useState(null);return e.jsxs("div",{className:`actions-dropdown ${r}`,children:[e.jsx(L.IconButton,{icon:e.jsx(B.Ellipsis,{}),onClick:d=>{i(d.currentTarget),a(c=>!c)},className:"actions-dropdown-trigger","data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),e.jsx(je.Dropdown,{open:l,onClose:()=>a(!1),anchorEl:p,children:e.jsx(Q,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function Z(s){return[...s].sort((t,r)=>(r.pos??0)-(t.pos??0)).filter(t=>t.display!=="none")}function ee(s){const{t}=A.useTranslation(),{entity:r="",columns:n=[],hasAction:l=!0,onSortCallback:a,selectionState:p,onToggleAllRows:i}=s,d=o.useRef(null);o.useEffect(()=>{d.current&&(d.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:c,sortingOrder:h,sortingBy:x}=_.useTableOptions(),b=o.useMemo(()=>Z(n).map(u=>({id:u.key,label:u.label,className:u.className??"",sortable:u.sortable??!0,sortOptions:u.sortOptions})),[n,r,t]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:i?e.jsx("input",{type:"checkbox",ref:d,checked:p?.allSelected??!1,onChange:i,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),b.map(u=>e.jsx("th",{scope:"col",className:`table-headers-column ${u.className}`,children:e.jsxs(fe.Button,{disabled:!u.sortable,onClick:()=>c(u.id,a),className:"table-headers-cell",children:[e.jsx("span",{className:"table-headers-label",children:u.label}),u.sortable&&x===u.id&&e.jsx("span",{children:h===be.SortOrder.ASC?u.sortOptions?.icons?.asc??e.jsx(B.ChevronUp,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"}):u.sortOptions?.icons?.desc??e.jsx(B.ChevronDown,{className:u.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},u.id))]})})}const te=s=>{const{items:t,text:r,id:n,onClearFilter:l}=s;return e.jsx(J.Chip,{text:`${r}: ${t.map(a=>a.value??a.name).join(", ")}`,onDelete:()=>l(n)})},se=s=>{const{end:t,start:r,text:n,id:l,onClearFilter:a}=s;return e.jsx(J.Chip,{text:`${n}: ${r||"♾️"} - ${t||"♾️"}`,onDelete:()=>a(l)})},ne=s=>{const{filtersDefinition:t}=s,r=o.useMemo(()=>{const i={};return t.forEach(d=>{i[d.propertyName]=d.label??d.propertyName}),i},[t]),{filters:n,clearFilters:l}=_.useTableOptions(),a=o.useMemo(()=>Object.keys(n),[n]),p=o.useCallback(i=>n[i]?.end||n[i]?.start?e.jsx(se,{id:i,text:r[i],start:n[i].start,end:n[i].end,onClearFilter:l}):Array.isArray(n[i])?e.jsx(te,{id:i,text:r[i],items:n[i],onClearFilter:l}):e.jsx(J.Chip,{text:`${r[i]}: ${n[i]?.value??n[i]?.name??n[i]}`,onDelete:()=>l(i)}),[n,r]);return e.jsx("ul",{className:"active-filters-main",children:a?.map(i=>e.jsx("li",{children:p(i)},i))})};function Ce(s){const{propertyName:t,label:r,placeholder:n,options:l,multiple:a=!0}=s,{currentFilters:p,setCurrentFilters:i}=w.useFilters(),d=o.useMemo(()=>p[t]??l[0],[p]),c=o.useCallback(h=>{i({type:w.FiltersActions.update,toUpdate:{[t]:{value:h}}})},[a]);return e.jsx($.AutocompleteInput,{value:d?.value,label:r,options:l,multiple:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:c,placeholder:n})}const Ne=s=>{const{propertyName:t,label:r}=s,{currentFilters:n,setCurrentFilters:l}=w.useFilters(),a=o.useMemo(()=>n[t]?.value??"",[n]),p=o.useCallback(i=>{l({type:w.FiltersActions.update,toUpdate:{[t]:{value:i.target.checked}}})},[]);return e.jsx($.CheckInput,{label:r,checked:a??!1,onChange:p})};function Te(s){const{propertyName:t,options:r,label:n,placeholder:l}=s,{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useMemo(()=>a[t]?.value??r[0],[a]),d=o.useCallback(c=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:c.target.value}}})},[]);return e.jsx($.SelectInput,{value:i,label:n,options:r,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:d,placeholder:l})}const ve=s=>{const{propertyName:t,label:r,placeholder:n}=s,{currentFilters:l,setCurrentFilters:a}=w.useFilters(),p=o.useMemo(()=>l[t]?.value??"",[l]),i=o.useCallback(d=>{a({type:w.FiltersActions.update,toUpdate:{[t]:{value:d.target.value}}})},[]);return e.jsx($.TextInput,{value:p??"",label:r,onChange:i,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:n})},X=s=>{const{propertyName:t,label:r,inputType:n}=s,{t:l}=A.useTranslation(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),i=o.useRef(null),d=o.useRef(null),c=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{end:d?.current?.value??null,start:x.target.value}}}})},[]),h=o.useCallback(x=>{p({type:w.FiltersActions.update,toUpdate:{[t]:{value:{start:i?.current?.value??null,end:x.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:r}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx($.TextInput,{value:a[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:n,ref:i,onChange:c,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx($.TextInput,{value:a[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:n,ref:d,onChange:h,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},le=s=>{switch(s.type){case z.FilterTypes.text:return e.jsx(ve,{...s});case z.FilterTypes.number:return e.jsx(X,{...s,inputType:"number"});case z.FilterTypes.date:return e.jsx(X,{...s,inputType:"date"});case z.FilterTypes.select:return e.jsx(Te,{...s});case z.FilterTypes.autocomplete:return e.jsx(Ce,{...s});case z.FilterTypes.check:return e.jsx(Ne,{...s})}return e.jsx(e.Fragment,{})},ae=s=>{const{filters:t=[],show:r,handleShow:n}=s,{onFilterApply:l}=_.useTableOptions(),{currentFilters:a,setCurrentFilters:p}=w.useFilters(),{t:i}=A.useTranslation(),d=o.useRef(null);return o.useEffect(()=>{const c=({target:x})=>{d.current&&(x?.closest(".filter-dropdown-trigger")||!r||d.current.contains(x)||n(!1))},h=({code:x})=>{!r||x!=="Escape"||n(!1)};return document.addEventListener("click",c),document.addEventListener("keydown",h),()=>{document.removeEventListener("click",c),document.removeEventListener("keydown",h)}},[n,r]),e.jsx("div",{className:`filter-dropdown-backdrop ${r?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:d,children:[e.jsx("div",{className:"filter-title",children:i("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(c=>e.jsx("li",{className:"filter-container-item",children:le(c)},c.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx("button",{onClick:()=>p({type:w.FiltersActions.reset,filters:t}),className:"filter-dropdown-button small filter-dropdown-cancel",children:i("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx("button",{className:"filter-dropdown-button small filter-dropdown-submit",onClick:()=>{n(!1),l(a)},children:i("_accessibility:buttons.applyFilters")})})]})})]})})},re=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,pageSizes:n,currentPage:l}=_.useTableOptions(),a=(l+1)*r>t?t:(l+1)*r;return e.jsxs("div",{className:"table-navigation-sizes",children:[n[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*r+1," - ",a," ",s("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function we(){const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions(),a=o.useMemo(()=>{const p=Math.ceil(t/r);return Array.from({length:p},(i,d)=>({id:d,value:d+1}))},[t,r]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:s("_accessibility:components.table.jumpToPage")}),e.jsx($.SelectInput,{value:n,options:a,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ie=()=>{const{t:s}=A.useTranslation(),{total:t,pageSize:r,currentPage:n,setCurrentPage:l}=_.useTableOptions();return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(L.IconButton,{icon:e.jsx(B.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:n===0,"aria-label":s("_accessibility:buttons.previous"),name:s("_accessibility:buttons.previous"),onClick:()=>l(n-1)}),e.jsx(L.IconButton,{icon:e.jsx(B.ChevronRight,{className:"table-navigation-icon"}),disabled:Math.floor(t/((n+1)*r))===0,className:"table-navigation-buttons",name:s("_accessibility:buttons.next"),"aria-label":s("_accessibility:buttons.next"),onClick:()=>l(n+1)})]})};function oe(){const{t:s}=A.useTranslation(),{pageSizes:t,pageSize:r,setPageSize:n}=_.useTableOptions(),l=o.useMemo(()=>t?.map(a=>({id:a,value:a})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:s("_accessibility:components.table.pageSizes")}),e.jsx($.SelectInput,{value:r,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:a=>n(Number(a.target.value))})]})}function ce(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(we,{}),e.jsx(oe,{}),e.jsx(re,{}),e.jsx(ie,{})]})}const ye=s=>s,ue=s=>{const{t}=A.useTranslation(),{columns:r,softDeleteProperty:n="deletedAt",data:l,actions:a,selectedRows:p,expandedRows:i=[],onRowSelectionChange:d,onRowExpand:c}=s,h=o.useMemo(()=>Z(r),[r]),x=o.useMemo(()=>new Map(i.map(b=>[b.rowId,b])),[i]);return l?.map(b=>{const u=p.has(b.id),T=x.get(b.id),S=!!T,P=h.length+1+(a?1:0);return e.jsxs(o.Fragment,{children:[e.jsxs("tr",{className:`table-row ${c?"expandable":""} ${b[n]?"deleted-class":""} ${u?"selected":""} ${S?"expanded":""}`,onClick:()=>c?.(b),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:u,onClick:C=>C.stopPropagation(),onChange:()=>d(b),"aria-label":t("_accessibility:components.table.selectRow")})}),a?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const C=a(b).filter(j=>!j.hidden),O=C.filter(j=>j.sticky),k=C.filter(j=>!j.sticky);return e.jsxs(e.Fragment,{children:[O.map(j=>e.jsx(G.Tooltip,{content:j.tooltip,children:e.jsx(L.IconButton,{icon:j.icon,className:"row-table-action",onClick:E=>{E.stopPropagation(),j.onClick(b)}})},j.id)),k.length>0&&e.jsx(Y,{actions:k})]})})()})}):null,h?.map((C,O)=>e.jsx("td",{className:`table-row-cell ${O===0?"basic":""} ${C.className??""}`,children:C.renderBody?C.renderBody(b[C.key],b):ye(b[C.key])},C.key))]}),S&&T?.content!==null&&typeof T?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:P,children:e.jsx("div",{className:`table-row-expanded-content ${T.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:T.content})})})})]},b.id)})};function de(){const{t:s}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:s("_accessibility:components.table.empty")})})}const pe=s=>{const{columns:t,title:r,isLoading:n,toolbar:l,filterOptions:a}=s,{countOfFilters:p}=_.useTableOptions(),{t:i}=A.useTranslation(),d=o.useMemo(()=>t?t.sort((u,T)=>(T.pos??0)-(u.pos??0)).filter(u=>!!u.filterOptions).map(u=>({...u.filterOptions,label:u.filterOptions?.label??u.label,propertyName:u.key})):[],[t]),[c,h]=o.useState(!1),x=o.useCallback(u=>{a?.dropdown?.setOpened?a.dropdown.setOpened(u??!1):h(u??!1)},[a]),b=o.useMemo(()=>a?.dropdown?.opened??c,[a,c]);return e.jsxs("div",{className:`table-header ${b?"showing-filters":""}`,children:[e.jsxs("div",{children:[r&&e.jsx("h1",{className:"table-header-title",children:r}),n?null:e.jsxs("div",{className:"table-header-content",children:[l,a?.button?.hide!==!0&&e.jsxs(L.IconButton,{icon:a?.button?.icon??e.jsx(B.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>x(!b),"aria-expanded":b,children:[e.jsx(xe.Badge,{count:p,className:`${p>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:i("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),!!d&&!!d.length&&e.jsx(ae,{filters:d,show:b,handleShow:x,options:a}),e.jsx(ne,{filtersDefinition:d})]})};function me({count:s,multiActions:t,onActionClick:r}){const{t:n}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:n("_accessibility:components.table.selectedCount",{count:s})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(G.Tooltip,{content:l.tooltip,children:e.jsx(L.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>r(l),disabled:l.disabled})},l.id))})]})}const H=220;function Se({data:s,allowMultipleExpandedRows:t,controlledExpandedRowId:r,onExpandedRowChange:n,onRowExpand:l,findRowById:a}){const[p,i]=o.useState(null),[d,c]=o.useState(null),[h,x]=o.useState(null),[b,u]=o.useState(null),[T,S]=o.useState(!1),[P,C]=o.useState(new Set),[O,k]=o.useState([]),j=o.useRef(null),E=o.useRef(null),I=o.useRef(new Map),F=typeof r<"u",R=t&&!F,N=F?r??null:p,D=o.useCallback(()=>{E.current&&(clearTimeout(E.current),E.current=null)},[]),y=o.useCallback(m=>{if(typeof m<"u"){const f=I.current.get(m);if(!f)return;clearTimeout(f),I.current.delete(m);return}I.current.forEach(f=>clearTimeout(f)),I.current.clear()},[]),V=o.useCallback(m=>{y(m),k(f=>f.some(v=>v.rowId===m)?f.map(v=>v.rowId===m?{...v,isVisible:!1}:v):f),I.current.set(m,setTimeout(()=>{k(f=>f.filter(g=>g.rowId!==m)),I.current.delete(m)},H))},[y]),W=o.useCallback((m,f)=>{y(m),k(g=>g.some(M=>M.rowId===m)?g.map(M=>M.rowId===m?{...M,content:f,isVisible:!1}:M):[...g,{rowId:m,content:f,isVisible:!1}]),requestAnimationFrame(()=>{k(g=>g.map(v=>v.rowId===m?{...v,isVisible:!0}:v))})},[y]);o.useEffect(()=>{if(!R)return;const m=new Set(s.map(f=>f.id));C(f=>{const g=new Set;return f.forEach(v=>{if(m.has(v)){g.add(v);return}y(v)}),g}),k(f=>(f.forEach(g=>{m.has(g.rowId)||y(g.rowId)}),f.filter(g=>m.has(g.rowId))))},[s,R,y]),o.useEffect(()=>{if(R)return;if(N===null){c(null),F&&(j.current=null);return}a(N)||(F||i(null),c(null),F&&(j.current=null))},[s,N,a,F,R]),o.useEffect(()=>{if(!R){if(D(),N===null||d===null){if(h===null){S(!1),u(null);return}S(!1),E.current=setTimeout(()=>{x(null),u(null),E.current=null},H);return}if(h===null){x(N),u(d),requestAnimationFrame(()=>S(!0));return}if(h===N){u(d),requestAnimationFrame(()=>S(!0));return}S(!1),E.current=setTimeout(()=>{x(N),u(d),requestAnimationFrame(()=>S(!0)),E.current=null},H)}},[D,d,N,R,h]),o.useEffect(()=>()=>{D(),y()},[D,y]),o.useEffect(()=>{if(!F)return;if(N===null){c(null),j.current=null;return}const m=a(N);if(!m){c(null),j.current=null;return}const f=j.current;c(l?.(m,f)??null),j.current=m},[N,a,F,l]);const he=o.useCallback(m=>{if(R){if(P.has(m.id)){C(U=>{const q=new Set(U);return q.delete(m.id),q}),V(m.id),n?.(null,m);return}C(U=>{const q=new Set(U);return q.add(m.id),q});const M=l?.(m,null)??null;M!==null&&typeof M<"u"?W(m.id,M):(y(m.id),k(U=>U.filter(q=>q.rowId!==m.id))),n?.(m,null);return}const f=N===m.id,g=f?m:a(N);if(F){n?.(f?null:m,g);return}if(f){i(null),c(null),n?.(null,m);return}i(m.id),c(l?.(m,g)??null),n?.(m,g)},[N,V,y,W,a,P,F,R,n,l]);return{expandedRowsToRender:o.useMemo(()=>R?O:h===null||b===null||typeof b>"u"?[]:[{rowId:h,content:b,isVisible:T}],[T,R,b,h,O]),onRowExpandChange:he}}function Fe({actions:s,selectedRowsData:t}){const r=o.useMemo(()=>!s||!t.length?[]:t.reduce((l,a,p)=>{const i=s(a).filter(c=>c.multiple&&!c.hidden);if(p===0)return i;const d=new Map(l.map(c=>[c.id,c]));return i.reduce((c,h)=>{const x=d.get(h.id);return x&&c.push({...x,...h,disabled:h.disabled||x.disabled}),c},[])},[]),[s,t]),n=o.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(a=>l.onClick(a))}},[t]);return{multiActions:r,handleMultipleActionClick:n}}function Re({data:s,onRowSelect:t,onSelectedRowsChange:r}){const[n,l]=o.useState(new Set),a=o.useMemo(()=>s?.filter(c=>n.has(c.id))??[],[s,n]);o.useEffect(()=>{if(!s?.length){l(new Set);return}l(c=>{const h=new Set,x=new Set(s.map(b=>b.id));return c.forEach(b=>{x.has(b)&&h.add(b)}),h})},[s]),o.useEffect(()=>{r&&r(a)},[a,r]);const p=o.useCallback(c=>{l(h=>{const x=new Set(h);return x.has(c.id)?(x.delete(c.id),t?.(c,!1)):(x.add(c.id),t?.(c,!0)),x})},[t]),i=o.useCallback(()=>{l(c=>{const h=new Set(c),x=s??[],b=x.every(u=>h.has(u.id));return x.forEach(u=>{const T=h.has(u.id);b?T&&(h.delete(u.id),t?.(u,!1)):T||(h.add(u.id),t?.(u,!0))}),h})},[s,t]),d=o.useMemo(()=>{if(!s?.length)return{allSelected:!1,hasSomeSelected:!1};const c=s.every(x=>n.has(x.id)),h=s.some(x=>n.has(x.id));return{allSelected:c,hasSomeSelected:h}},[s,n]);return{selectedRows:n,selectedRowsData:a,selectionState:d,onRowSelectionChange:p,onToggleAllRows:i}}function Ae(s){const{data:t,onSort:r,entity:n="",isLoading:l=!1,actions:a,columns:p=[],contentClassName:i="",className:d="",softDeleteProperty:c="deletedAt",onRowSelect:h,onSelectedRowsChange:x,allowMultipleExpandedRows:b=!1,expandedRowId:u,onExpandedRowChange:T,onRowExpand:S,...P}=s,C=o.useMemo(()=>!t?.length,[t]),O=o.useCallback(V=>V===null?null:t.find(W=>W.id===V)??null,[t]),{selectedRows:k,selectedRowsData:j,selectionState:E,onRowSelectionChange:I,onToggleAllRows:F}=Re({data:t,onRowSelect:h,onSelectedRowsChange:x}),{expandedRowsToRender:R,onRowExpandChange:N}=Se({data:t,allowMultipleExpandedRows:b,controlledExpandedRowId:u,onExpandedRowChange:T,onRowExpand:S,findRowById:O}),{multiActions:D,handleMultipleActionClick:y}=Fe({actions:a,selectedRowsData:j});return e.jsx(w.FiltersProvider,{children:e.jsxs("div",{className:`${d} table-main`,children:[e.jsx(pe,{columns:p,isLoading:l,...P}),l?e.jsx(ge.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:C?e.jsx(de,{}):e.jsxs(e.Fragment,{children:[!!j.length&&e.jsx(me,{count:j.length,multiActions:D,onActionClick:y}),e.jsx("div",{className:`${i} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(ee,{entity:n,columns:p,onSortCallback:r,hasAction:!!a,selectionState:E,onToggleAllRows:F}),e.jsx("tbody",{children:e.jsx(ue,{data:t,actions:a,columns:p,softDeleteProperty:c,selectedRows:k,expandedRows:R,onRowSelectionChange:I,onRowExpand:S?N:void 0})})]})}),e.jsx(ce,{})]})})]})})}exports.Action=K;exports.Actions=Q;exports.ActionsDropdown=Y;exports.ActiveFilters=ne;exports.ArrayChip=te;exports.Columns=ee;exports.CountOfTotal=re;exports.FilterDropdown=ae;exports.Footer=ce;exports.Navigation=ie;exports.PageSize=oe;exports.RangeChip=se;exports.Rows=ue;exports.Table=Ae;exports.TableEmpty=de;exports.TableHeader=pe;exports.TableSelectionBar=me;exports.renderFilterComponent=le;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const j=require("react/jsx-runtime"),c=require("./query-81BrXp3i.cjs"),e=require("react"),k=[20,50,100],O=e.createContext({}),q=o=>{const{children:p}=o,[C,b]=e.useState(0),[g,v]=e.useState(20),[f,x]=e.useState(0),[u,d]=e.useState("id"),[n,S]=e.useState(c.SortOrder.DESC),[r,l]=e.useState({}),P=e.useCallback((t,i)=>{let s=n;u===t&&(n===c.SortOrder.ASC?s=c.SortOrder.DESC:s=c.SortOrder.ASC),d(t),S(s),i&&i(t,s)},[u,n]),T=e.useCallback(t=>{const i=Object.entries(t).reduce((s,[F,a])=>(a&&typeof a.value<"u"&&a.value!==null&&(s[F]=a.value),s),{});l(i)},[]),h=e.useCallback(t=>{t?(delete r[t.toLowerCase()],l({...r})):l({})},[r]),w=e.useMemo(()=>Object.keys(r).length,[r]),y={onSort:P,total:C,setTotal:b,sortingBy:u,setSortingBy:d,sortingOrder:n,setSortingOrder:S,pageSize:g,pageSizes:k,setPageSize:v,currentPage:f,setCurrentPage:x,filters:r,onFilterApply:T,clearFilters:h,countOfFilters:w};return j.jsx(O.Provider,{value:y,children:p})},m=()=>{const o=e.useContext(O);if(o===void 0)throw new Error("tableOptionsContext must be used within a Provider");return o};exports.TableOptionsProvider=q;exports.useTableOptions=m;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { jsx as j } from "react/jsx-runtime";
|
|
2
|
-
import { S as a } from "./query-CwuehjY1.js";
|
|
3
|
-
import { useState as s, useCallback as d, useMemo as z, createContext as A, useContext as E } from "react";
|
|
4
|
-
const k = [20, 50, 100], g = A({}), M = (r) => {
|
|
5
|
-
const { children: O } = r, [f, C] = s(0), [m, v] = s(20), [b, x] = s(0), [l, p] = s("id"), [n, S] = s(a.DESC), [o, u] = s({}), P = d(
|
|
6
|
-
(e, i) => {
|
|
7
|
-
let t = n;
|
|
8
|
-
l === e && (n === a.ASC ? t = a.DESC : t = a.ASC), p(e), S(t), i && i(e, t);
|
|
9
|
-
},
|
|
10
|
-
[l, n]
|
|
11
|
-
), h = d((e) => {
|
|
12
|
-
const i = Object.entries(e).reduce(
|
|
13
|
-
(t, [y, c]) => (c && typeof c.value < "u" && c.value !== null && (t[y] = c.value), t),
|
|
14
|
-
{}
|
|
15
|
-
);
|
|
16
|
-
u(i);
|
|
17
|
-
}, []), w = d(
|
|
18
|
-
(e) => {
|
|
19
|
-
e ? (delete o[e.toLowerCase()], u({ ...o })) : u({});
|
|
20
|
-
},
|
|
21
|
-
[o]
|
|
22
|
-
), F = z(() => Object.keys(o).length, [o]), T = {
|
|
23
|
-
onSort: P,
|
|
24
|
-
total: f,
|
|
25
|
-
setTotal: C,
|
|
26
|
-
sortingBy: l,
|
|
27
|
-
setSortingBy: p,
|
|
28
|
-
sortingOrder: n,
|
|
29
|
-
setSortingOrder: S,
|
|
30
|
-
pageSize: m,
|
|
31
|
-
pageSizes: k,
|
|
32
|
-
setPageSize: v,
|
|
33
|
-
currentPage: b,
|
|
34
|
-
setCurrentPage: x,
|
|
35
|
-
filters: o,
|
|
36
|
-
onFilterApply: h,
|
|
37
|
-
clearFilters: w,
|
|
38
|
-
countOfFilters: F
|
|
39
|
-
};
|
|
40
|
-
return /* @__PURE__ */ j(g.Provider, { value: T, children: O });
|
|
41
|
-
}, q = () => {
|
|
42
|
-
const r = E(g);
|
|
43
|
-
if (r === void 0)
|
|
44
|
-
throw new Error("tableOptionsContext must be used within a Provider");
|
|
45
|
-
return r;
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
M as T,
|
|
49
|
-
q as u
|
|
50
|
-
};
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import "./TextInput.css";
|
|
2
|
-
import { jsxs as g, jsx as n, Fragment as z } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as S, useState as w, useEffect as R, useMemo as G, useRef as I, useCallback as k, useLayoutEffect as J } from "react";
|
|
4
|
-
import { C as E } from "./Chip-C5ogKbFn.js";
|
|
5
|
-
import { I as K } from "./IconButton-BpsTEj0z.js";
|
|
6
|
-
import { C as Q } from "./Close-rKC9AcNX.js";
|
|
7
|
-
const le = S(function(a, m) {
|
|
8
|
-
const {
|
|
9
|
-
state: h,
|
|
10
|
-
value: e,
|
|
11
|
-
onChange: l,
|
|
12
|
-
options: u = [],
|
|
13
|
-
name: p = "",
|
|
14
|
-
id: f = "",
|
|
15
|
-
label: i = "",
|
|
16
|
-
containerClassName: C = "",
|
|
17
|
-
inputContainerClassName: c = "",
|
|
18
|
-
helperText: x = "",
|
|
19
|
-
placeholder: y = "",
|
|
20
|
-
multiple: r = !1,
|
|
21
|
-
...N
|
|
22
|
-
} = a, [v, o] = w("");
|
|
23
|
-
R(() => {
|
|
24
|
-
if (!r && e && !Array.isArray(e)) {
|
|
25
|
-
o(String(e.value ?? e.name ?? ""));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
o("");
|
|
29
|
-
}, [r, e]);
|
|
30
|
-
const [T, $] = w(!1), A = G(
|
|
31
|
-
() => u.filter((t) => {
|
|
32
|
-
const s = String(t.value ?? t.name).toLowerCase().includes(v?.toLowerCase());
|
|
33
|
-
return Array.isArray(e) && e.length ? s && !e.some((d) => d.id === t.id) : e && !Array.isArray(e) ? s && e.id !== t.id : s;
|
|
34
|
-
}),
|
|
35
|
-
[u, e, v]
|
|
36
|
-
), b = I(null), q = I(null), [B, M] = w(!1), D = I(null);
|
|
37
|
-
R(() => {
|
|
38
|
-
const t = (d) => {
|
|
39
|
-
b.current && !b.current.contains(d.target) && $(!1);
|
|
40
|
-
}, s = (d) => {
|
|
41
|
-
d.key === "Escape" && $(!1);
|
|
42
|
-
};
|
|
43
|
-
return document.addEventListener("mousedown", t), document.addEventListener("keydown", s), () => {
|
|
44
|
-
document.removeEventListener("mousedown", t), document.removeEventListener("keydown", s);
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
const O = k((t) => {
|
|
48
|
-
o(t.target.value);
|
|
49
|
-
}, []), F = k(
|
|
50
|
-
(t) => {
|
|
51
|
-
t ? r ? (o(""), Array.isArray(e) && e.length ? l([...e, t]) : l([t])) : (o(String(t.name ?? t.value ?? "")), l(t)) : l(null), $(!1);
|
|
52
|
-
},
|
|
53
|
-
[r, l, e]
|
|
54
|
-
), P = k(
|
|
55
|
-
(t) => {
|
|
56
|
-
if (!Array.isArray(e)) {
|
|
57
|
-
l(null);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const s = e.filter((d, _) => _ !== t);
|
|
61
|
-
s.length ? l(s) : l(null);
|
|
62
|
-
},
|
|
63
|
-
[l, e]
|
|
64
|
-
), U = k(() => {
|
|
65
|
-
Array.isArray(e) && l([e[0]]);
|
|
66
|
-
}, [l, e]);
|
|
67
|
-
return J(() => {
|
|
68
|
-
const t = D.current?.offsetWidth ?? 0, s = b.current?.offsetWidth ?? 0;
|
|
69
|
-
M(t > s * 0.4);
|
|
70
|
-
}, [e]), /* @__PURE__ */ g(
|
|
71
|
-
"div",
|
|
72
|
-
{
|
|
73
|
-
className: `autocomplete-input-container ${C}`,
|
|
74
|
-
ref: b,
|
|
75
|
-
children: [
|
|
76
|
-
/* @__PURE__ */ g("div", { className: "autocomplete-value-input-container", children: [
|
|
77
|
-
/* @__PURE__ */ n(
|
|
78
|
-
X,
|
|
79
|
-
{
|
|
80
|
-
state: h,
|
|
81
|
-
name: p,
|
|
82
|
-
id: f,
|
|
83
|
-
value: v,
|
|
84
|
-
onChange: O,
|
|
85
|
-
placeholder: y,
|
|
86
|
-
helperText: x,
|
|
87
|
-
onFocus: () => $(!0),
|
|
88
|
-
label: i,
|
|
89
|
-
containerClassName: `autocomplete-text-input ${c}`,
|
|
90
|
-
ref: m ?? q,
|
|
91
|
-
...N,
|
|
92
|
-
children: !r && e && !Array.isArray(e) && (e.value || e.name) && /* @__PURE__ */ n(
|
|
93
|
-
K,
|
|
94
|
-
{
|
|
95
|
-
icon: /* @__PURE__ */ n(Q, {}),
|
|
96
|
-
className: "autocomplete-delete-button",
|
|
97
|
-
onClick: (t) => {
|
|
98
|
-
F(), t.stopPropagation();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
r && Array.isArray(e) && e.length ? /* @__PURE__ */ n("ul", { ref: D, className: "autocomplete-value-container", children: B ? /* @__PURE__ */ g(z, { children: [
|
|
105
|
-
/* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
106
|
-
E,
|
|
107
|
-
{
|
|
108
|
-
text: e[0]?.value ?? e[0]?.name,
|
|
109
|
-
onDelete: (t) => {
|
|
110
|
-
P(0), t.stopPropagation();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
) }),
|
|
114
|
-
e.length > 1 && /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
115
|
-
E,
|
|
116
|
-
{
|
|
117
|
-
text: `+${e.length - 1}`,
|
|
118
|
-
onDelete: (t) => {
|
|
119
|
-
U(), t.stopPropagation();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
) })
|
|
123
|
-
] }) : e.map((t, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
|
|
124
|
-
E,
|
|
125
|
-
{
|
|
126
|
-
text: String(t.value ?? t.name),
|
|
127
|
-
onDelete: (d) => {
|
|
128
|
-
P(s), d.stopPropagation();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
) }, t.id ?? t.value ?? t.name)) }) : null
|
|
132
|
-
] }),
|
|
133
|
-
T && /* @__PURE__ */ n(
|
|
134
|
-
"ul",
|
|
135
|
-
{
|
|
136
|
-
className: "autocomplete-suggestions-container",
|
|
137
|
-
style: { width: b.current?.offsetWidth },
|
|
138
|
-
children: A.map((t) => /* @__PURE__ */ n(
|
|
139
|
-
"li",
|
|
140
|
-
{
|
|
141
|
-
className: "autocomplete-suggestion-item",
|
|
142
|
-
onClick: (s) => {
|
|
143
|
-
F(t), s.stopPropagation();
|
|
144
|
-
},
|
|
145
|
-
children: t.value ?? t.name
|
|
146
|
-
},
|
|
147
|
-
t.id ?? t.value ?? t.name
|
|
148
|
-
))
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}), re = S(function(a, m) {
|
|
155
|
-
const {
|
|
156
|
-
checked: h,
|
|
157
|
-
onChange: e,
|
|
158
|
-
name: l = "",
|
|
159
|
-
id: u = "",
|
|
160
|
-
label: p = "",
|
|
161
|
-
containerClassName: f = "",
|
|
162
|
-
inputClassName: i = "",
|
|
163
|
-
labelClassName: C = "",
|
|
164
|
-
...c
|
|
165
|
-
} = a;
|
|
166
|
-
return /* @__PURE__ */ g("label", { className: `input-check-container ${f}`, children: [
|
|
167
|
-
/* @__PURE__ */ n(
|
|
168
|
-
"input",
|
|
169
|
-
{
|
|
170
|
-
id: u,
|
|
171
|
-
ref: m,
|
|
172
|
-
name: l,
|
|
173
|
-
type: "checkbox",
|
|
174
|
-
checked: h,
|
|
175
|
-
onChange: e,
|
|
176
|
-
className: `input-check ${i}`,
|
|
177
|
-
...c
|
|
178
|
-
}
|
|
179
|
-
),
|
|
180
|
-
/* @__PURE__ */ n("span", { className: `input-check-label ${C}`, children: p })
|
|
181
|
-
] });
|
|
182
|
-
});
|
|
183
|
-
var L = /* @__PURE__ */ ((a) => (a.error = "error", a.good = "good", a.default = "default", a))(L || {});
|
|
184
|
-
const W = (a) => {
|
|
185
|
-
switch (a) {
|
|
186
|
-
case "error":
|
|
187
|
-
return "input-error";
|
|
188
|
-
case "good":
|
|
189
|
-
return "input-good";
|
|
190
|
-
default:
|
|
191
|
-
return "input-normal";
|
|
192
|
-
}
|
|
193
|
-
}, j = (a) => {
|
|
194
|
-
switch (a) {
|
|
195
|
-
case "error":
|
|
196
|
-
return "input-label-error";
|
|
197
|
-
case "good":
|
|
198
|
-
return "input-label-good";
|
|
199
|
-
default:
|
|
200
|
-
return "input-label-normal";
|
|
201
|
-
}
|
|
202
|
-
}, H = (a) => {
|
|
203
|
-
switch (a) {
|
|
204
|
-
case "error":
|
|
205
|
-
return "input-helper-text-error";
|
|
206
|
-
case "good":
|
|
207
|
-
return "input-helper-text-good";
|
|
208
|
-
default:
|
|
209
|
-
return "input-helper-text-normal";
|
|
210
|
-
}
|
|
211
|
-
}, se = S(function(a, m) {
|
|
212
|
-
const {
|
|
213
|
-
value: h,
|
|
214
|
-
onChange: e,
|
|
215
|
-
options: l,
|
|
216
|
-
containerClassName: u = "",
|
|
217
|
-
inputClassName: p = "",
|
|
218
|
-
labelClassName: f = "",
|
|
219
|
-
helperText: i = "",
|
|
220
|
-
helperTextClassName: C = "",
|
|
221
|
-
label: c = "",
|
|
222
|
-
name: x = "",
|
|
223
|
-
id: y = "",
|
|
224
|
-
state: r = L.default,
|
|
225
|
-
children: N,
|
|
226
|
-
...v
|
|
227
|
-
} = a;
|
|
228
|
-
return /* @__PURE__ */ g("div", { className: `select-input-container ${u}`, children: [
|
|
229
|
-
/* @__PURE__ */ n(
|
|
230
|
-
"select",
|
|
231
|
-
{
|
|
232
|
-
...v,
|
|
233
|
-
id: y,
|
|
234
|
-
ref: m,
|
|
235
|
-
name: x,
|
|
236
|
-
value: h,
|
|
237
|
-
onChange: e,
|
|
238
|
-
className: `select-input ${W(r)} peer ${p}`,
|
|
239
|
-
children: l?.map((o) => /* @__PURE__ */ n("option", { value: o.id, children: o.value ?? o.name ?? o.id }, o.id))
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
/* @__PURE__ */ n(
|
|
243
|
-
"label",
|
|
244
|
-
{
|
|
245
|
-
htmlFor: y,
|
|
246
|
-
className: `select-input-label ${j(r)} ${f}`,
|
|
247
|
-
children: c
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
N,
|
|
251
|
-
i && /* @__PURE__ */ n(
|
|
252
|
-
"p",
|
|
253
|
-
{
|
|
254
|
-
className: `select-input-helper-text ${H(r)} ${C}`,
|
|
255
|
-
children: i
|
|
256
|
-
}
|
|
257
|
-
)
|
|
258
|
-
] });
|
|
259
|
-
}), V = (a) => a == null ? !1 : Array.isArray(a) ? a.length > 0 : `${a}`.length > 0, X = S(function(a, m) {
|
|
260
|
-
const {
|
|
261
|
-
children: h,
|
|
262
|
-
state: e = L.default,
|
|
263
|
-
label: l = "",
|
|
264
|
-
containerClassName: u = "",
|
|
265
|
-
inputClassName: p = "",
|
|
266
|
-
labelClassName: f = "",
|
|
267
|
-
helperText: i = "",
|
|
268
|
-
helperTextClassName: C = "",
|
|
269
|
-
value: c,
|
|
270
|
-
defaultValue: x,
|
|
271
|
-
onChange: y,
|
|
272
|
-
...r
|
|
273
|
-
} = a, N = c !== void 0, [v, o] = w(
|
|
274
|
-
() => V(x)
|
|
275
|
-
), T = N ? V(c) : v, $ = (A) => {
|
|
276
|
-
N || o(A.currentTarget.value.length > 0), y?.(A);
|
|
277
|
-
};
|
|
278
|
-
return /* @__PURE__ */ g("div", { className: `text-input-container ${u}`, children: [
|
|
279
|
-
/* @__PURE__ */ n(
|
|
280
|
-
"input",
|
|
281
|
-
{
|
|
282
|
-
ref: m,
|
|
283
|
-
defaultValue: x,
|
|
284
|
-
onChange: $,
|
|
285
|
-
...N ? { value: c } : {},
|
|
286
|
-
className: `text-input ${W(e)} ${p} ${T ? "has-value" : ""} ${r.placeholder ? "has-placeholder" : ""}`,
|
|
287
|
-
...r
|
|
288
|
-
}
|
|
289
|
-
),
|
|
290
|
-
!!l && /* @__PURE__ */ g(
|
|
291
|
-
"label",
|
|
292
|
-
{
|
|
293
|
-
htmlFor: r.id,
|
|
294
|
-
className: `text-input-label ${j(e)} ${f}`,
|
|
295
|
-
children: [
|
|
296
|
-
l,
|
|
297
|
-
r.required ? " *" : ""
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
),
|
|
301
|
-
h,
|
|
302
|
-
!!i && /* @__PURE__ */ n(
|
|
303
|
-
"p",
|
|
304
|
-
{
|
|
305
|
-
className: `text-input-helper-text ${H(e)} ${C}`,
|
|
306
|
-
children: i
|
|
307
|
-
}
|
|
308
|
-
)
|
|
309
|
-
] });
|
|
310
|
-
});
|
|
311
|
-
export {
|
|
312
|
-
le as A,
|
|
313
|
-
re as C,
|
|
314
|
-
se as S,
|
|
315
|
-
X as T,
|
|
316
|
-
L as a,
|
|
317
|
-
H as h,
|
|
318
|
-
W as i,
|
|
319
|
-
j as l
|
|
320
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var G=require("./TextInput.css");const a=require("react/jsx-runtime"),l=require("react"),k=require("./Chip-D17UJHW6.cjs"),M=require("./IconButton-CVnmT2E9.cjs"),O=require("./Close-O9P7wJGf.cjs"),U=l.forwardRef(function(n,p){const{state:m,value:e,onChange:r,options:d=[],name:f="",id:x="",label:u="",containerClassName:C="",inputContainerClassName:i="",helperText:g="",placeholder:j="",multiple:s=!1,...N}=n,[v,c]=l.useState("");l.useEffect(()=>{if(!s&&e&&!Array.isArray(e)){c(String(e.value??e.name??""));return}c("")},[s,e]);const[S,b]=l.useState(!1),$=l.useMemo(()=>d.filter(t=>{const o=String(t.value??t.name).toLowerCase().includes(v?.toLowerCase());return Array.isArray(e)&&e.length?o&&!e.some(h=>h.id===t.id):e&&!Array.isArray(e)?o&&e.id!==t.id:o}),[d,e,v]),y=l.useRef(null),F=l.useRef(null),[P,V]=l.useState(!1),R=l.useRef(null);l.useEffect(()=>{const t=h=>{y.current&&!y.current.contains(h.target)&&b(!1)},o=h=>{h.key==="Escape"&&b(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",o)}},[]);const W=l.useCallback(t=>{c(t.target.value)},[]),E=l.useCallback(t=>{t?s?(c(""),Array.isArray(e)&&e.length?r([...e,t]):r([t])):(c(String(t.name??t.value??"")),r(t)):r(null),b(!1)},[s,r,e]),L=l.useCallback(t=>{if(!Array.isArray(e)){r(null);return}const o=e.filter((h,H)=>H!==t);o.length?r(o):r(null)},[r,e]),B=l.useCallback(()=>{Array.isArray(e)&&r([e[0]])},[r,e]);return l.useLayoutEffect(()=>{const t=R.current?.offsetWidth??0,o=y.current?.offsetWidth??0;V(t>o*.4)},[e]),a.jsxs("div",{className:`autocomplete-input-container ${C}`,ref:y,children:[a.jsxs("div",{className:"autocomplete-value-input-container",children:[a.jsx(D,{state:m,name:f,id:x,value:v,onChange:W,placeholder:j,helperText:g,onFocus:()=>b(!0),label:u,containerClassName:`autocomplete-text-input ${i}`,ref:p??F,...N,children:!s&&e&&!Array.isArray(e)&&(e.value||e.name)&&a.jsx(M.IconButton,{icon:a.jsx(O.Close,{}),className:"autocomplete-delete-button",onClick:t=>{E(),t.stopPropagation()}})}),s&&Array.isArray(e)&&e.length?a.jsx("ul",{ref:R,className:"autocomplete-value-container",children:P?a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(k.Chip,{text:e[0]?.value??e[0]?.name,onDelete:t=>{L(0),t.stopPropagation()}})}),e.length>1&&a.jsx("li",{children:a.jsx(k.Chip,{text:`+${e.length-1}`,onDelete:t=>{B(),t.stopPropagation()}})})]}):e.map((t,o)=>a.jsx("li",{children:a.jsx(k.Chip,{text:String(t.value??t.name),onDelete:h=>{L(o),h.stopPropagation()}})},t.id??t.value??t.name))}):null]}),S&&a.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:y.current?.offsetWidth},children:$.map(t=>a.jsx("li",{className:"autocomplete-suggestion-item",onClick:o=>{E(t),o.stopPropagation()},children:t.value??t.name},t.id??t.value??t.name))})]})}),_=l.forwardRef(function(n,p){const{checked:m,onChange:e,name:r="",id:d="",label:f="",containerClassName:x="",inputClassName:u="",labelClassName:C="",...i}=n;return a.jsxs("label",{className:`input-check-container ${x}`,children:[a.jsx("input",{id:d,ref:p,name:r,type:"checkbox",checked:m,onChange:e,className:`input-check ${u}`,...i}),a.jsx("span",{className:`input-check-label ${C}`,children:f})]})});var A=(n=>(n.error="error",n.good="good",n.default="default",n))(A||{});const w=n=>{switch(n){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},I=n=>{switch(n){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},T=n=>{switch(n){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},z=l.forwardRef(function(n,p){const{value:m,onChange:e,options:r,containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",label:i="",name:g="",id:j="",state:s=A.default,children:N,...v}=n;return a.jsxs("div",{className:`select-input-container ${d}`,children:[a.jsx("select",{...v,id:j,ref:p,name:g,value:m,onChange:e,className:`select-input ${w(s)} peer ${f}`,children:r?.map(c=>a.jsx("option",{value:c.id,children:c.value??c.name??c.id},c.id))}),a.jsx("label",{htmlFor:j,className:`select-input-label ${I(s)} ${x}`,children:i}),N,u&&a.jsx("p",{className:`select-input-helper-text ${T(s)} ${C}`,children:u})]})}),q=n=>n==null?!1:Array.isArray(n)?n.length>0:`${n}`.length>0,D=l.forwardRef(function(n,p){const{children:m,state:e=A.default,label:r="",containerClassName:d="",inputClassName:f="",labelClassName:x="",helperText:u="",helperTextClassName:C="",value:i,defaultValue:g,onChange:j,...s}=n,N=i!==void 0,[v,c]=l.useState(()=>q(g)),S=N?q(i):v,b=$=>{N||c($.currentTarget.value.length>0),j?.($)};return a.jsxs("div",{className:`text-input-container ${d}`,children:[a.jsx("input",{ref:p,defaultValue:g,onChange:b,...N?{value:i}:{},className:`text-input ${w(e)} ${f} ${S?"has-value":""} ${s.placeholder?"has-placeholder":""}`,...s}),!!r&&a.jsxs("label",{htmlFor:s.id,className:`text-input-label ${I(e)} ${x}`,children:[r,s.required?" *":""]}),m,!!u&&a.jsx("p",{className:`text-input-helper-text ${T(e)} ${C}`,children:u})]})});exports.AutocompleteInput=U;exports.CheckInput=_;exports.SelectInput=z;exports.State=A;exports.TextInput=D;exports.helperTextStateClassName=T;exports.inputStateClassName=w;exports.labelStateClassName=I;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("react/jsx-runtime"),n=require("react"),r=n.createContext({});function a(t){const{children:e,t:o,language:s}=t;return i.jsx(r.Provider,{value:{t:o,language:s},children:e})}const u=()=>{const t=n.useContext(r);if(t===void 0)throw new Error("translationContext must be used within a Provider");return t};exports.TranslationProvider=a;exports.useTranslation=u;
|