shirkasoft-ui-components 1.3.9 → 1.3.11

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.
@@ -1,4 +1,6 @@
1
- import { LucideX, LucideUpload, LucideTriangleAlert, LucideTrash2, LucideSearch, LucideRefreshCw, LucidePlus, LucidePanelRight, LucideMinimize2, LucideMenu, LucideMaximize2, LucideLogOut, LucideLoaderCircle, LucideLoader, LucideInfo, LucideInbox, LucideGlobe, LucideFunnel, LucideFileText, LucideFileSpreadsheet, LucideFile, LucideEyeOff, LucideEye, LucideEllipsisVertical, LucideDownload, LucideCirclePlus, LucideCircleQuestionMark, LucideChevronsRight, LucideChevronsLeft, LucideChevronRight, LucideChevronLeft, LucideChevronDown, LucideCalendarDays, LucideCheck, LucideArrowUpDown, LucideArrowUp, LucideArrowDown, LucideArrowLeft } from '@lucide/angular';
1
+ import { LucideX, LucideUpload, LucideTriangleAlert, LucideTrash2, LucideSearch, LucideRefreshCw, LucidePlus, LucidePanelRight, LucideMinimize2, LucideMenu, LucideMaximize2, LucideLogOut, LucideLoaderCircle, LucideLoader, LucideInfo, LucideInbox, LucideLanguages, LucideGlobe, LucideFunnel, LucideFileText, LucideFileSpreadsheet, LucideFile, LucideEyeOff, LucideEye, LucideEllipsisVertical, LucideDownload, LucideCirclePlus, LucideCircleQuestionMark, LucideChevronsRight, LucideChevronsLeft, LucideChevronRight, LucideChevronLeft, LucideChevronDown, LucideCalendarDays, LucideCheck, LucideArrowUpDown, LucideArrowUp, LucideArrowDown, LucideArrowLeft } from '@lucide/angular';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, ElementRef, afterNextRender, DestroyRef, Directive } from '@angular/core';
2
4
 
3
5
  /**
4
6
  * Shirkasoft UI Components.
@@ -29,6 +31,7 @@ const ICONS = {
29
31
  'file-text': LucideFileText,
30
32
  filter: LucideFunnel,
31
33
  globe: LucideGlobe,
34
+ languages: LucideLanguages,
32
35
  inbox: LucideInbox,
33
36
  info: LucideInfo,
34
37
  loader: LucideLoader,
@@ -62,9 +65,68 @@ function getIcon(icon, fallback = LucideCircleQuestionMark) {
62
65
  return fallback;
63
66
  }
64
67
 
68
+ /**
69
+ * Shirkasoft UI Components.
70
+ * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
71
+ * Belongs to Shirkasoft.
72
+ */
73
+ /**
74
+ * Moves a floating element (dropdown panel, popup, overlay) to `document.body`
75
+ * so it always renders above the rest of the page.
76
+ *
77
+ * `position: fixed` + a high `z-index` is not enough on its own: an ancestor
78
+ * with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking
79
+ * context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element
80
+ * inside it. Rendering it as a direct child of `body` avoids all of that.
81
+ *
82
+ * The element keeps being managed by Angular (bindings and listeners keep
83
+ * working, and Angular removes it with `node.remove()` when it is hidden).
84
+ * If the anchor lives inside a `.dark` container, the class is copied onto the
85
+ * element so the dark theme (CSS variables, Tailwind `dark:` variants and
86
+ * component `.dark .x` rules) still applies once it is outside the host.
87
+ *
88
+ * Returns a function that removes the element from the DOM; call it when the
89
+ * owner component is destroyed so the element does not stay orphaned in `body`.
90
+ */
91
+ function portalToBody(element, anchor) {
92
+ const doc = element.ownerDocument;
93
+ if (element.parentNode !== doc.body) {
94
+ doc.body.appendChild(element);
95
+ }
96
+ element.classList.toggle('dark', !!anchor?.closest('.dark'));
97
+ return () => element.remove();
98
+ }
99
+ /**
100
+ * Renders the host element in `document.body` (see `portalToBody`) once it is
101
+ * rendered, and removes it when the element or its owner is destroyed.
102
+ *
103
+ * ```html
104
+ * @if (isOpen()) {
105
+ * <div shkPortal class="fixed z-[9999]" [style.top.px]="top">...</div>
106
+ * }
107
+ * ```
108
+ */
109
+ class PortalDirective {
110
+ constructor() {
111
+ this.el = inject(ElementRef);
112
+ let remove = null;
113
+ afterNextRender(() => {
114
+ const node = this.el.nativeElement;
115
+ remove = portalToBody(node, node.parentElement);
116
+ });
117
+ inject(DestroyRef).onDestroy(() => remove?.());
118
+ }
119
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: PortalDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
120
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: PortalDirective, isStandalone: true, selector: "[shkPortal]", ngImport: i0 }); }
121
+ }
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: PortalDirective, decorators: [{
123
+ type: Directive,
124
+ args: [{ selector: '[shkPortal]', standalone: true }]
125
+ }], ctorParameters: () => [] });
126
+
65
127
  /**
66
128
  * Generated bundle index. Do not edit.
67
129
  */
68
130
 
69
- export { ICONS, getIcon };
131
+ export { ICONS, PortalDirective, getIcon, portalToBody };
70
132
  //# sourceMappingURL=shirkasoft-ui-components-utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"shirkasoft-ui-components-utils.mjs","sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/shirkasoft-ui-components-utils.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport {\n LucideArrowDown,\n LucideArrowLeft,\n LucideArrowUp,\n LucideArrowUpDown,\n LucideCalendarDays,\n LucideCheck,\n LucideChevronDown,\n LucideChevronLeft,\n LucideChevronRight,\n LucideChevronsLeft,\n LucideChevronsRight,\n LucideCircleQuestionMark,\n LucideCirclePlus,\n LucideDownload,\n LucideEllipsisVertical,\n LucideEye,\n LucideEyeOff,\n LucideFile,\n LucideFileSpreadsheet,\n LucideFileText,\n LucideFunnel,\n LucideGlobe,\n LucideInbox,\n LucideInfo,\n LucideLoader,\n LucideLoaderCircle,\n LucideLogOut,\n LucideMaximize2,\n LucideMenu,\n LucideMinimize2,\n LucidePanelRight,\n LucidePlus,\n LucideRefreshCw,\n LucideSearch,\n LucideTrash2,\n LucideTriangleAlert,\n LucideUpload,\n LucideX,\n} from '@lucide/angular';\n\n/** Maps the icon names used across the library to their Lucide component. */\nexport const ICONS: Record<string, any> = {\n 'arrow-left': LucideArrowLeft,\n 'arrow-down': LucideArrowDown,\n 'arrow-up': LucideArrowUp,\n 'arrow-up-down': LucideArrowUpDown,\n check: LucideCheck,\n 'calendar-days': LucideCalendarDays,\n 'chevron-down': LucideChevronDown,\n 'chevron-left': LucideChevronLeft,\n 'chevron-right': LucideChevronRight,\n 'chevrons-left': LucideChevronsLeft,\n 'chevrons-right': LucideChevronsRight,\n 'circle-help': LucideCircleQuestionMark,\n 'circle-plus': LucideCirclePlus,\n download: LucideDownload,\n 'ellipsis-vertical': LucideEllipsisVertical,\n eye: LucideEye,\n 'eye-off': LucideEyeOff,\n file: LucideFile,\n 'file-spreadsheet': LucideFileSpreadsheet,\n 'file-text': LucideFileText,\n filter: LucideFunnel,\n globe: LucideGlobe,\n inbox: LucideInbox,\n info: LucideInfo,\n loader: LucideLoader,\n 'loader-circle': LucideLoaderCircle,\n 'log-out': LucideLogOut,\n 'maximize-2': LucideMaximize2,\n menu: LucideMenu,\n 'minimize-2': LucideMinimize2,\n 'panel-right': LucidePanelRight,\n plus: LucidePlus,\n refresh: LucideRefreshCw,\n search: LucideSearch,\n 'trash-2': LucideTrash2,\n 'triangle-alert': LucideTriangleAlert,\n upload: LucideUpload,\n x: LucideX,\n};\n\n/**\n * Resolves the icon passed to a component into a lucide component.\n * Accepts a registered string name, an existing lucide component or a LucideIconData object.\n */\nexport function getIcon(icon?: any, fallback: any = LucideCircleQuestionMark): any {\n if (!icon) return null;\n if (typeof icon === 'string') {\n return ICONS[icon] ?? fallback;\n }\n if (typeof icon === 'function') {\n return icon;\n }\n return fallback;\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;;;AAIG;AA0CH;AACO,MAAM,KA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O,CAAC,IAAU,EAAE,WAAgB,wBAAwB,EAAA;AAC1E,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,IAAI;AACtB,IAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,QAAQ;IAChC;AACA,IAAA,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;AAC9B,QAAA,OAAO,IAAI;IACb;AACA,IAAA,OAAO,QAAQ;AACjB;;ACrGA;;AAEG;;;;"}
1
+ {"version":3,"file":"shirkasoft-ui-components-utils.mjs","sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/portal.ts","../../../projects/ui-components/utils/shirkasoft-ui-components-utils.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport {\n LucideArrowDown,\n LucideArrowLeft,\n LucideArrowUp,\n LucideArrowUpDown,\n LucideCalendarDays,\n LucideCheck,\n LucideChevronDown,\n LucideChevronLeft,\n LucideChevronRight,\n LucideChevronsLeft,\n LucideChevronsRight,\n LucideCircleQuestionMark,\n LucideCirclePlus,\n LucideDownload,\n LucideEllipsisVertical,\n LucideEye,\n LucideEyeOff,\n LucideFile,\n LucideFileSpreadsheet,\n LucideFileText,\n LucideFunnel,\n LucideGlobe,\n LucideLanguages,\n LucideInbox,\n LucideInfo,\n LucideLoader,\n LucideLoaderCircle,\n LucideLogOut,\n LucideMaximize2,\n LucideMenu,\n LucideMinimize2,\n LucidePanelRight,\n LucidePlus,\n LucideRefreshCw,\n LucideSearch,\n LucideTrash2,\n LucideTriangleAlert,\n LucideUpload,\n LucideX,\n} from '@lucide/angular';\n\n/** Maps the icon names used across the library to their Lucide component. */\nexport const ICONS: Record<string, any> = {\n 'arrow-left': LucideArrowLeft,\n 'arrow-down': LucideArrowDown,\n 'arrow-up': LucideArrowUp,\n 'arrow-up-down': LucideArrowUpDown,\n check: LucideCheck,\n 'calendar-days': LucideCalendarDays,\n 'chevron-down': LucideChevronDown,\n 'chevron-left': LucideChevronLeft,\n 'chevron-right': LucideChevronRight,\n 'chevrons-left': LucideChevronsLeft,\n 'chevrons-right': LucideChevronsRight,\n 'circle-help': LucideCircleQuestionMark,\n 'circle-plus': LucideCirclePlus,\n download: LucideDownload,\n 'ellipsis-vertical': LucideEllipsisVertical,\n eye: LucideEye,\n 'eye-off': LucideEyeOff,\n file: LucideFile,\n 'file-spreadsheet': LucideFileSpreadsheet,\n 'file-text': LucideFileText,\n filter: LucideFunnel,\n globe: LucideGlobe,\n languages: LucideLanguages,\n inbox: LucideInbox,\n info: LucideInfo,\n loader: LucideLoader,\n 'loader-circle': LucideLoaderCircle,\n 'log-out': LucideLogOut,\n 'maximize-2': LucideMaximize2,\n menu: LucideMenu,\n 'minimize-2': LucideMinimize2,\n 'panel-right': LucidePanelRight,\n plus: LucidePlus,\n refresh: LucideRefreshCw,\n search: LucideSearch,\n 'trash-2': LucideTrash2,\n 'triangle-alert': LucideTriangleAlert,\n upload: LucideUpload,\n x: LucideX,\n};\n\n/**\n * Resolves the icon passed to a component into a lucide component.\n * Accepts a registered string name, an existing lucide component or a LucideIconData object.\n */\nexport function getIcon(icon?: any, fallback: any = LucideCircleQuestionMark): any {\n if (!icon) return null;\n if (typeof icon === 'string') {\n return ICONS[icon] ?? fallback;\n }\n if (typeof icon === 'function') {\n return icon;\n }\n return fallback;\n}","import { Directive, DestroyRef, ElementRef, afterNextRender, inject } from '@angular/core';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Moves a floating element (dropdown panel, popup, overlay) to `document.body`\n * so it always renders above the rest of the page.\n *\n * `position: fixed` + a high `z-index` is not enough on its own: an ancestor\n * with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking\n * context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element\n * inside it. Rendering it as a direct child of `body` avoids all of that.\n *\n * The element keeps being managed by Angular (bindings and listeners keep\n * working, and Angular removes it with `node.remove()` when it is hidden).\n * If the anchor lives inside a `.dark` container, the class is copied onto the\n * element so the dark theme (CSS variables, Tailwind `dark:` variants and\n * component `.dark .x` rules) still applies once it is outside the host.\n *\n * Returns a function that removes the element from the DOM; call it when the\n * owner component is destroyed so the element does not stay orphaned in `body`.\n */\nexport function portalToBody(element: HTMLElement, anchor?: HTMLElement | null): () => void {\n const doc = element.ownerDocument;\n if (element.parentNode !== doc.body) {\n doc.body.appendChild(element);\n }\n element.classList.toggle('dark', !!anchor?.closest('.dark'));\n return () => element.remove();\n}\n\n/**\n * Renders the host element in `document.body` (see `portalToBody`) once it is\n * rendered, and removes it when the element or its owner is destroyed.\n *\n * ```html\n * @if (isOpen()) {\n * <div shkPortal class=\"fixed z-[9999]\" [style.top.px]=\"top\">...</div>\n * }\n * ```\n */\n@Directive({ selector: '[shkPortal]', standalone: true })\nexport class PortalDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n let remove: (() => void) | null = null;\n afterNextRender(() => {\n const node = this.el.nativeElement;\n remove = portalToBody(node, node.parentElement);\n });\n inject(DestroyRef).onDestroy(() => remove?.());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;;AAIG;AA2CH;AACO,MAAM,KAAK,GAAwB;AACxC,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,UAAU,EAAE,aAAa;AACzB,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,KAAK,EAAE,WAAW;AAClB,IAAA,eAAe,EAAE,kBAAkB;AACnC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,eAAe,EAAE,kBAAkB;AACnC,IAAA,eAA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IAAI,EAAE;;;AC7CxD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shirkasoft-ui-components",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "description": "Angular UI Components Library — themeable via CSS custom properties",
5
5
  "keywords": [
6
6
  "angular",
package/src/theme.css CHANGED
@@ -500,6 +500,15 @@ textarea.shk-control.shk-control-valid:focus {
500
500
  border-color: var(--shk-success-600);
501
501
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--shk-success-600) 22%, transparent);
502
502
  }
503
+ /* Invalid field (validation error): red border in every state and theme.
504
+ Specificity (0,2,1) beats Tailwind `dark:[border-color:…]` utilities. */
505
+ input.shk-control[aria-invalid='true'],
506
+ textarea.shk-control[aria-invalid='true'],
507
+ div.shk-control[aria-invalid='true'],
508
+ div.shk-dropzone[aria-invalid='true'],
509
+ div.shk-dropzone[aria-invalid='true']:hover {
510
+ border-color: var(--shk-error-500);
511
+ }
503
512
  input.shk-control[aria-invalid='true']:focus,
504
513
  textarea.shk-control[aria-invalid='true']:focus,
505
514
  div.shk-control[aria-invalid='true']:focus-within,
@@ -19,6 +19,7 @@ declare class DatePickerComponent implements ControlValueAccessor {
19
19
  private elementRef;
20
20
  private cdr;
21
21
  private destroyRef;
22
+ private injector;
22
23
  private transloco;
23
24
  /** HTML id for the input (for label/for pairing). */
24
25
  id: _angular_core.InputSignal<string>;
@@ -30,8 +31,10 @@ declare class DatePickerComponent implements ControlValueAccessor {
30
31
  label: _angular_core.InputSignal<string>;
31
32
  /** Placeholder of the input. */
32
33
  placeholder: _angular_core.InputSignal<string>;
33
- /** FormGroup used to resolve the control from `label`. */
34
+ /** FormGroup used to resolve the control from `controlName` (or `label`). */
34
35
  formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
36
+ /** Name of the control inside `formGroup`. Takes precedence over `label`. */
37
+ controlName: _angular_core.InputSignal<string>;
35
38
  /** Directly bound FormControl. */
36
39
  control: _angular_core.InputSignal<FormControl<any> | undefined>;
37
40
  /** Disables the picker. */
@@ -58,6 +61,24 @@ declare class DatePickerComponent implements ControlValueAccessor {
58
61
  showSeconds: _angular_core.InputSignal<boolean>;
59
62
  /** Step (in minutes) for the minute selector. */
60
63
  minuteStep: _angular_core.InputSignal<number>;
64
+ /**
65
+ * Format of the value received from and emitted to the form control.
66
+ * Tokens: YYYY, MM, DD, HH, mm, ss (e.g. 'DD-MM-YYYY', 'DD/MM/YYYY HH:mm').
67
+ * Empty (default) keeps the ISO format ('YYYY-MM-DD', 'YYYY-MM', 'YYYY',
68
+ * 'YYYY-MM-DDTHH:mm', 'HH:mm').
69
+ */
70
+ valueFormat: _angular_core.InputSignal<string>;
71
+ /** Overlay (backdrop + calendar), rendered in <body> while open (shkPortal). */
72
+ private overlay;
73
+ /** Field the calendar is anchored to. */
74
+ private anchor;
75
+ /** Calendar panel, measured to place it below or above the field. */
76
+ private panel;
77
+ /** Fixed position of the calendar next to its field (null until measured). */
78
+ panelPosition: _angular_core.WritableSignal<{
79
+ top: number;
80
+ left: number;
81
+ } | null>;
61
82
  /** Whether the dropdown calendar is open. */
62
83
  isOpen: _angular_core.WritableSignal<boolean>;
63
84
  /** Year currently displayed in the calendar. */
@@ -166,6 +187,19 @@ declare class DatePickerComponent implements ControlValueAccessor {
166
187
  constructor();
167
188
  /** Closes the dropdown when clicking outside the component. */
168
189
  onDocumentClick(event: MouseEvent): void;
190
+ /** Keeps the calendar next to its field when the page scrolls or resizes. */
191
+ onViewportChange(): void;
192
+ /**
193
+ * Positions the panel right after Angular renders it. A bare
194
+ * requestAnimationFrame can run before the render (e.g. with eventCoalescing),
195
+ * find no panel and leave the calendar hidden forever.
196
+ */
197
+ private schedulePosition;
198
+ /**
199
+ * Places the calendar right below the field; above it when there is no room
200
+ * below, and always inside the viewport (8px margin).
201
+ */
202
+ private positionPanel;
169
203
  /** Closes the dropdown on Escape. */
170
204
  onEscape(): void;
171
205
  /** Opens/closes the dropdown, syncing the calendar to the current value. */
@@ -298,11 +332,40 @@ declare class DatePickerComponent implements ControlValueAccessor {
298
332
  isSelectedYear(year: number): boolean;
299
333
  isCurrentYear(year: number): boolean;
300
334
  writeValue(value: any): void;
335
+ /**
336
+ * Normalizes an incoming value to the internal ISO string format expected
337
+ * for the current configuration:
338
+ * - date/week: "YYYY-MM-DD" (or "YYYY-MM-DDTHH:mm[:ss]" with showTime)
339
+ * - month: "YYYY-MM"
340
+ * - year: "YYYY"
341
+ * - timeOnly: "HH:mm[:ss]"
342
+ *
343
+ * Accepts ISO strings, `Date` objects, timestamps and day-first strings
344
+ * ("DD-MM-YYYY", "DD/MM/YYYY", "DD.MM.YYYY"; month-first when locale is
345
+ * 'en'). Values that cannot be interpreted are discarded (returns null)
346
+ * instead of breaking the formatted label.
347
+ */
348
+ private normalizeValue;
349
+ /** Matches the tokens supported by `valueFormat`. */
350
+ private static readonly FORMAT_TOKENS;
351
+ /**
352
+ * Parses a string using the `valueFormat` pattern and returns the internal
353
+ * ISO value, or null if it does not match.
354
+ */
355
+ private parseWithFormat;
356
+ /** Converts the internal ISO value to the configured `valueFormat`. */
357
+ private toOutputValue;
358
+ /** Builds the internal value from a Date according to the configuration. */
359
+ private fromDate;
360
+ /** Formats "HH:mm[:ss]" honoring the showSeconds option. */
361
+ private buildTime;
362
+ /** Warns about an unparseable value and discards it. */
363
+ private invalidValue;
301
364
  registerOnChange(fn: any): void;
302
365
  registerOnTouched(fn: any): void;
303
366
  setDisabledState(isDisabled: boolean): void;
304
367
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DatePickerComponent, never>;
305
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "shk-date-picker", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "minValue": { "alias": "minValue"; "required": false; "isSignal": true; }; "maxValue": { "alias": "maxValue"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "timeOnly": { "alias": "timeOnly"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
368
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "shk-date-picker", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "minValue": { "alias": "minValue"; "required": false; "isSignal": true; }; "maxValue": { "alias": "maxValue"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "timeOnly": { "alias": "timeOnly"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
306
369
  }
307
370
 
308
371
  export { DatePickerComponent };
@@ -127,7 +127,10 @@ declare class ModalComponent {
127
127
  private hasRealErrors;
128
128
  /** Marks a form (and all its descendants) as touched. */
129
129
  private markAllAsTouched;
130
- /** True when the component exposes both `onSubmit` and a `form`. */
130
+ /**
131
+ * True when the component exposes `onSubmit`. The `form` is optional:
132
+ * without it, validation is skipped and `onSubmit` runs directly.
133
+ */
131
134
  private isDynamicComponent;
132
135
  /** Unsubscribes outputs and destroys the dynamic component. */
133
136
  private cleanup;
@@ -50,6 +50,7 @@ declare class PriceInputComponent implements ControlValueAccessor {
50
50
  /** Message rendered when the field is in error state. */
51
51
  errorMessage: _angular_core.InputSignal<string>;
52
52
  private destroyRef;
53
+ private transloco;
53
54
  /** Text currently shown in the input (raw while focused, formatted on blur). */
54
55
  displayText: _angular_core.WritableSignal<string>;
55
56
  /** Whether the native input currently has focus. */
@@ -58,6 +59,15 @@ declare class PriceInputComponent implements ControlValueAccessor {
58
59
  private controlDisabled;
59
60
  /** Prevents re-subscribing to the same form control. */
60
61
  private ctrlSubscribed;
62
+ /** Bumped on control status changes / blur so error computeds refresh. */
63
+ private statusTick;
64
+ /**
65
+ * Whether the error state is shown: forced with `showError`, or when the
66
+ * bound `control` is invalid and has been touched or modified.
67
+ */
68
+ hasError: _angular_core.Signal<boolean>;
69
+ /** Message shown under the field: `errorMessage` or one derived from the control errors. */
70
+ errorText: _angular_core.Signal<string>;
61
71
  /** Effective disabled state combining the input and the form binding. */
62
72
  isDisabled: _angular_core.Signal<boolean>;
63
73
  /** Callbacks used by the ControlValueAccessor contract. */
@@ -162,6 +162,8 @@ declare class SelectComponent implements ControlValueAccessor {
162
162
  nextPage(): void;
163
163
  /** Goes to the previous options page when possible. */
164
164
  previousPage(): void;
165
+ /** Whether a node belongs to the component or to its (portaled) dropdown panel. */
166
+ private isInsideComponent;
165
167
  /** Closes the dropdown when a click happens outside the component. */
166
168
  onClickOutside(event: MouseEvent): void;
167
169
  /** Selects a typed free-text value as a new custom entry. */
@@ -1,3 +1,5 @@
1
+ import * as i0 from '@angular/core';
2
+
1
3
  /** Maps the icon names used across the library to their Lucide component. */
2
4
  declare const ICONS: Record<string, any>;
3
5
  /**
@@ -6,4 +8,45 @@ declare const ICONS: Record<string, any>;
6
8
  */
7
9
  declare function getIcon(icon?: any, fallback?: any): any;
8
10
 
9
- export { ICONS, getIcon };
11
+ /**
12
+ * Shirkasoft UI Components.
13
+ * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
14
+ * Belongs to Shirkasoft.
15
+ */
16
+ /**
17
+ * Moves a floating element (dropdown panel, popup, overlay) to `document.body`
18
+ * so it always renders above the rest of the page.
19
+ *
20
+ * `position: fixed` + a high `z-index` is not enough on its own: an ancestor
21
+ * with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking
22
+ * context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element
23
+ * inside it. Rendering it as a direct child of `body` avoids all of that.
24
+ *
25
+ * The element keeps being managed by Angular (bindings and listeners keep
26
+ * working, and Angular removes it with `node.remove()` when it is hidden).
27
+ * If the anchor lives inside a `.dark` container, the class is copied onto the
28
+ * element so the dark theme (CSS variables, Tailwind `dark:` variants and
29
+ * component `.dark .x` rules) still applies once it is outside the host.
30
+ *
31
+ * Returns a function that removes the element from the DOM; call it when the
32
+ * owner component is destroyed so the element does not stay orphaned in `body`.
33
+ */
34
+ declare function portalToBody(element: HTMLElement, anchor?: HTMLElement | null): () => void;
35
+ /**
36
+ * Renders the host element in `document.body` (see `portalToBody`) once it is
37
+ * rendered, and removes it when the element or its owner is destroyed.
38
+ *
39
+ * ```html
40
+ * @if (isOpen()) {
41
+ * <div shkPortal class="fixed z-[9999]" [style.top.px]="top">...</div>
42
+ * }
43
+ * ```
44
+ */
45
+ declare class PortalDirective {
46
+ private readonly el;
47
+ constructor();
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<PortalDirective, never>;
49
+ static ɵdir: i0.ɵɵDirectiveDeclaration<PortalDirective, "[shkPortal]", never, {}, {}, never, never, true, never>;
50
+ }
51
+
52
+ export { ICONS, PortalDirective, getIcon, portalToBody };