ng-hub-ui-forms 22.6.0 → 22.7.0
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/README.md +24 -1
- package/fesm2022/ng-hub-ui-forms.mjs +61 -8
- package/fesm2022/ng-hub-ui-forms.mjs.map +1 -1
- package/ng-hub-ui-forms-22.7.0.tgz +0 -0
- package/package.json +1 -1
- package/styles/_tokens.scss +36 -3
- package/types/ng-hub-ui-forms.d.ts +52 -2
- package/ng-hub-ui-forms-22.6.0.tgz +0 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ng-hub-ui-forms",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Accessible, signal-based form fields for Angular (input, textarea, slider, segmented, select, datepicker, file input with drag & drop and upload progress) with automatic error display for controls, FormGroups and FormArrays. Reactive Forms today, Signal Forms ready. Part of the ng-hub-ui family.",
|
|
6
6
|
"author": "Carlos Morcillo <carlos.morcillo@me.com> (https://www.carlosmorcillo.com)",
|
package/styles/_tokens.scss
CHANGED
|
@@ -110,20 +110,53 @@
|
|
|
110
110
|
--hub-file-input-focus-border-color: var(--hub-input-focus-border-color);
|
|
111
111
|
--hub-file-input-focus-box-shadow: var(--hub-input-focus-box-shadow);
|
|
112
112
|
|
|
113
|
-
// Dropzone copy
|
|
113
|
+
// Dropzone copy. The prompt is a row by default (invitation and browse action side by
|
|
114
|
+
// side); `--hub-file-input-prompt-direction: column` stacks them, which is what a
|
|
115
|
+
// dropzone carrying a `dropSubtext` wants.
|
|
114
116
|
--hub-file-input-prompt-color: var(--hub-sys-text-muted, #6c757d);
|
|
115
117
|
--hub-file-input-prompt-font-size: var(--hub-ref-font-size-base, 1rem);
|
|
116
|
-
--hub-file-input-
|
|
117
|
-
|
|
118
|
+
--hub-file-input-prompt-direction: row;
|
|
119
|
+
// `baseline` aligns a row of text; a column prompt wants `center`.
|
|
120
|
+
--hub-file-input-prompt-align: baseline;
|
|
121
|
+
--hub-file-input-prompt-gap: 0.25em;
|
|
122
|
+
--hub-file-input-drop-text-color: inherit;
|
|
123
|
+
--hub-file-input-drop-text-font-size: inherit;
|
|
124
|
+
--hub-file-input-drop-text-font-weight: inherit;
|
|
125
|
+
--hub-file-input-drop-subtext-color: var(--hub-file-input-hint-color);
|
|
126
|
+
--hub-file-input-drop-subtext-font-size: var(--hub-file-input-hint-font-size);
|
|
118
127
|
--hub-file-input-hint-color: var(--hub-sys-text-muted, #6c757d);
|
|
119
128
|
--hub-file-input-hint-font-size: var(--hub-ref-font-size-sm, 0.875rem);
|
|
120
129
|
|
|
130
|
+
// Browse action — a transparent, underlined text affordance by default. Give it a
|
|
131
|
+
// background, padding and a radius to render it as a button instead.
|
|
132
|
+
--hub-file-input-browse-color: var(--hub-sys-color-primary, #0d6efd);
|
|
133
|
+
--hub-file-input-browse-font-weight: var(--hub-ref-font-weight-medium, 500);
|
|
134
|
+
--hub-file-input-browse-font-size: inherit;
|
|
135
|
+
--hub-file-input-browse-text-decoration: underline;
|
|
136
|
+
--hub-file-input-browse-bg: transparent;
|
|
137
|
+
--hub-file-input-browse-hover-bg: var(--hub-file-input-browse-bg);
|
|
138
|
+
--hub-file-input-browse-padding-x: 0;
|
|
139
|
+
--hub-file-input-browse-padding-y: 0;
|
|
140
|
+
--hub-file-input-browse-radius: 0;
|
|
141
|
+
--hub-file-input-browse-gap: var(--hub-ref-space-2, 0.5rem);
|
|
142
|
+
--hub-file-input-browse-margin-top: 0;
|
|
143
|
+
// Optional leading glyph of the browse action — OFF until `-display` is switched on and
|
|
144
|
+
// a mask is supplied, mirroring the leading-icon contract of the rest of the family.
|
|
145
|
+
--hub-file-input-browse-icon: none;
|
|
146
|
+
--hub-file-input-browse-icon-display: none;
|
|
147
|
+
--hub-file-input-browse-icon-size: 1.125em;
|
|
148
|
+
|
|
121
149
|
// Glyphs — every icon is a swappable mask, tinted by its `-color` token. Replace the
|
|
122
150
|
// `url(…)` to change the drawing without touching the template; project an
|
|
123
151
|
// `<ng-template hubFileIcon>` to replace the per-file glyph with a component.
|
|
124
152
|
--hub-file-input-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5'/%3E%3Cpath fill='black' d='M7.646.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 1.707V10.5a.5.5 0 0 1-1 0V1.707L5.354 3.854a.5.5 0 1 1-.708-.708z'/%3E%3C/svg%3E");
|
|
125
153
|
--hub-file-input-icon-size: 2rem;
|
|
126
154
|
--hub-file-input-icon-color: var(--hub-sys-text-muted, #6c757d);
|
|
155
|
+
// The glyph can sit on a medallion: a tinted, rounded surface behind it. Off by default
|
|
156
|
+
// (transparent, square, exactly the glyph's box), so the dropzone renders unchanged.
|
|
157
|
+
--hub-file-input-icon-bg: transparent;
|
|
158
|
+
--hub-file-input-icon-chip-size: var(--hub-file-input-icon-size);
|
|
159
|
+
--hub-file-input-icon-chip-radius: 0;
|
|
127
160
|
--hub-file-input-file-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.414A1.5 1.5 0 0 0 13.56 3.35L10.65.44A1.5 1.5 0 0 0 9.586 0zm5.5 1.5v2a1 1 0 0 0 1 1h2z'/%3E%3C/svg%3E");
|
|
128
161
|
--hub-file-input-file-icon-size: 1.5rem;
|
|
129
162
|
--hub-file-input-file-icon-color: var(--hub-sys-text-muted, #6c757d);
|
|
@@ -319,6 +319,12 @@ interface HubFileItem {
|
|
|
319
319
|
readonly progress: number | null;
|
|
320
320
|
/** The error thrown by the uploader, when `status` is `'error'`. */
|
|
321
321
|
readonly error: unknown | null;
|
|
322
|
+
/**
|
|
323
|
+
* The body the uploader reported on `done` — typically the record the server created, whose id
|
|
324
|
+
* the application needs to reference the stored file. `null` until the upload succeeds, and
|
|
325
|
+
* again after a `retry` restarts it.
|
|
326
|
+
*/
|
|
327
|
+
readonly response: unknown | null;
|
|
322
328
|
}
|
|
323
329
|
/** How the accepted files are previewed below the dropzone. */
|
|
324
330
|
type HubFilePreview = 'none' | 'list' | 'grid';
|
|
@@ -342,6 +348,12 @@ interface HubFileInputLabels {
|
|
|
342
348
|
browse: string;
|
|
343
349
|
/** Invitation rendered inside the dropzone. */
|
|
344
350
|
dropHere: string;
|
|
351
|
+
/**
|
|
352
|
+
* Second line of the invitation, under {@link dropHere}. Empty by default, so it renders
|
|
353
|
+
* nothing. A dropzone that sets it usually stacks the prompt too, with
|
|
354
|
+
* `--hub-file-input-prompt-direction: column`.
|
|
355
|
+
*/
|
|
356
|
+
dropSubtext: string;
|
|
345
357
|
/** Accessible name of the per-file remove button. */
|
|
346
358
|
remove: string;
|
|
347
359
|
/** Text + accessible name of the "remove all" button. */
|
|
@@ -1512,6 +1524,34 @@ declare class HubFileIconDirective {
|
|
|
1512
1524
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HubFileIconDirective, "[hubFileIcon]", never, {}, {}, never, never, true, never>;
|
|
1513
1525
|
}
|
|
1514
1526
|
|
|
1527
|
+
/**
|
|
1528
|
+
* Projects arbitrary markup inside a `<hub-file-input>` dropzone, between the glyph and the
|
|
1529
|
+
* invitation.
|
|
1530
|
+
*
|
|
1531
|
+
* The slot exists for a notice the consumer computes per instance — "2 documents still missing",
|
|
1532
|
+
* a badge, a warning — which neither `dropText` (the invitation) nor `hint` (the constraints
|
|
1533
|
+
* summary, rendered at the bottom) can express, and which is too instance-specific to live in the
|
|
1534
|
+
* global labels.
|
|
1535
|
+
*
|
|
1536
|
+
* Renders nothing when the template is absent, so the dropzone is unchanged for every consumer
|
|
1537
|
+
* that does not project one.
|
|
1538
|
+
*
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```html
|
|
1541
|
+
* <hub-file-input [multiple]="true">
|
|
1542
|
+
* <ng-template hubFileDropzoneNotice>
|
|
1543
|
+
* <strong class="missing">2 documents still missing</strong>
|
|
1544
|
+
* </ng-template>
|
|
1545
|
+
* </hub-file-input>
|
|
1546
|
+
* ```
|
|
1547
|
+
*/
|
|
1548
|
+
declare class HubFileDropzoneNoticeDirective {
|
|
1549
|
+
/** Template reference for the notice. */
|
|
1550
|
+
readonly template: TemplateRef<void>;
|
|
1551
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HubFileDropzoneNoticeDirective, never>;
|
|
1552
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HubFileDropzoneNoticeDirective, "[hubFileDropzoneNotice]", never, {}, {}, never, never, true, never>;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1515
1555
|
/** Context handed to a projected `hubFilePreview` template. */
|
|
1516
1556
|
interface HubFilePreviewContext {
|
|
1517
1557
|
/** The item being rendered. */
|
|
@@ -1644,6 +1684,10 @@ declare class HubFileInputComponent extends HubFieldControl {
|
|
|
1644
1684
|
readonly autoUpload: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1645
1685
|
/** Overrides the "browse" button text coming from the global labels. */
|
|
1646
1686
|
readonly buttonLabel: _angular_core.InputSignal<string | null>;
|
|
1687
|
+
/** Overrides the dropzone invitation coming from the global labels. */
|
|
1688
|
+
readonly dropText: _angular_core.InputSignal<string | null>;
|
|
1689
|
+
/** Overrides the second invitation line coming from the global labels. Pass `''` to hide it. */
|
|
1690
|
+
readonly dropSubtext: _angular_core.InputSignal<string | null>;
|
|
1647
1691
|
/** Overrides the auto-generated hint that summarizes the active constraints. Pass `''` to hide it. */
|
|
1648
1692
|
readonly hint: _angular_core.InputSignal<string | null>;
|
|
1649
1693
|
/** Helper text shown below the control. */
|
|
@@ -1666,6 +1710,8 @@ declare class HubFileInputComponent extends HubFieldControl {
|
|
|
1666
1710
|
protected readonly iconTpt: _angular_core.Signal<HubFileIconDirective | undefined>;
|
|
1667
1711
|
/** Projected per-file preview template, replacing the built-in item rendering. */
|
|
1668
1712
|
protected readonly previewTpt: _angular_core.Signal<HubFilePreviewDirective | undefined>;
|
|
1713
|
+
/** Projected notice rendered between the glyph and the invitation. */
|
|
1714
|
+
protected readonly noticeTpt: _angular_core.Signal<HubFileDropzoneNoticeDirective | undefined>;
|
|
1669
1715
|
/** Whether a drag is currently hovering the dropzone. */
|
|
1670
1716
|
protected readonly isDragging: _angular_core.WritableSignal<boolean>;
|
|
1671
1717
|
/** Latest message for the screen-reader live region. */
|
|
@@ -1680,6 +1726,10 @@ declare class HubFileInputComponent extends HubFieldControl {
|
|
|
1680
1726
|
protected readonly labels: _angular_core.Signal<ng_hub_ui_forms.HubFileInputLabels>;
|
|
1681
1727
|
/** Text of the browse action. */
|
|
1682
1728
|
protected readonly browseLabel: _angular_core.Signal<string>;
|
|
1729
|
+
/** The dropzone invitation. */
|
|
1730
|
+
protected readonly dropTextLabel: _angular_core.Signal<string>;
|
|
1731
|
+
/** The second invitation line. Empty renders nothing. */
|
|
1732
|
+
protected readonly dropSubtextLabel: _angular_core.Signal<string>;
|
|
1683
1733
|
/** The hint summarizing the active constraints. */
|
|
1684
1734
|
protected readonly constraintsHint: _angular_core.Signal<string>;
|
|
1685
1735
|
/** Whether the dropzone currently accepts a drop. */
|
|
@@ -1770,7 +1820,7 @@ declare class HubFileInputComponent extends HubFieldControl {
|
|
|
1770
1820
|
*/
|
|
1771
1821
|
protected previewContext(item: HubFileItem): HubFilePreviewContext;
|
|
1772
1822
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HubFileInputComponent, never>;
|
|
1773
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubFileInputComponent, "hub-file-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "minSize": { "alias": "minSize"; "required": false; "isSignal": true; }; "maxTotalSize": { "alias": "maxTotalSize"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "dragDrop": { "alias": "dragDrop"; "required": false; "isSignal": true; }; "paste": { "alias": "paste"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "allowDuplicates": { "alias": "allowDuplicates"; "required": false; "isSignal": true; }; "capture": { "alias": "capture"; "required": false; "isSignal": true; }; "autoUpload": { "alias": "autoUpload"; "required": false; "isSignal": true; }; "buttonLabel": { "alias": "buttonLabel"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "formText": { "alias": "formText"; "required": false; "isSignal": true; }; "formTextType": { "alias": "formTextType"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "rejected": "rejected"; "fileRemoved": "fileRemoved"; "uploadStateChange": "uploadStateChange"; }, ["iconTpt", "previewTpt"], never, true, never>;
|
|
1823
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HubFileInputComponent, "hub-file-input", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "minSize": { "alias": "minSize"; "required": false; "isSignal": true; }; "maxTotalSize": { "alias": "maxTotalSize"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "dragDrop": { "alias": "dragDrop"; "required": false; "isSignal": true; }; "paste": { "alias": "paste"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "allowDuplicates": { "alias": "allowDuplicates"; "required": false; "isSignal": true; }; "capture": { "alias": "capture"; "required": false; "isSignal": true; }; "autoUpload": { "alias": "autoUpload"; "required": false; "isSignal": true; }; "buttonLabel": { "alias": "buttonLabel"; "required": false; "isSignal": true; }; "dropText": { "alias": "dropText"; "required": false; "isSignal": true; }; "dropSubtext": { "alias": "dropSubtext"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "formText": { "alias": "formText"; "required": false; "isSignal": true; }; "formTextType": { "alias": "formTextType"; "required": false; "isSignal": true; }; "classlist": { "alias": "classlist"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; "rejected": "rejected"; "fileRemoved": "fileRemoved"; "uploadStateChange": "uploadStateChange"; }, ["iconTpt", "previewTpt", "noticeTpt"], never, true, never>;
|
|
1774
1824
|
}
|
|
1775
1825
|
|
|
1776
1826
|
declare class NgOptionComponent implements OnInit {
|
|
@@ -2361,5 +2411,5 @@ interface HubFormControlAdapter {
|
|
|
2361
2411
|
*/
|
|
2362
2412
|
declare const hubFormControlAdapter: HubFormControlAdapter;
|
|
2363
2413
|
|
|
2364
|
-
export { FormTextTypes, HUB_FILE_UPLOADER, HUB_FORMS_CONFIG, HubAutoresizeDirective, HubDatepickerComponent, HubFieldControl, HubFieldsetComponent, HubFileIconDirective, HubFileInputComponent, HubFilePreviewDirective, HubFormComponent, HubFormControl, HubFormTextDirective, HubGroupControl, HubInputComponent, HubInputFormats, HubInputPrefixDirective, HubInputSuffixDirective, HubInvertColorPipe, HubJoinButLastPipe, HubLabelTypes, HubLegendComponent, HubLegendDirective, HubMapPipe, HubOtpInputComponent, HubSafeUrlPipe, HubSegmentedComponent, HubSelectComponent, HubSelectFormats, HubSliderComponent, HubSnakeUpperPipe, HubTextareaComponent, HubUcfirstPipe, HubValidationErrorDirective, NgClearButtonTemplateDirective, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectConfig, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, applyMask, areEqual, camelToSnakeUpper, controlHasMinOrMaxValidator, defaultHubDatepickerConfig, defaultHubDatepickerLabels, defaultHubFileInputLabels, defaultHubFormsConfig, defaultInvalidFeedback, fileKey, formatFileSize, get, getActiveElement, getMinOrMaxValueFromValidator, hubAcceptedFiles, hubAreEqual, hubFormControlAdapter, hubMaxFileSize, hubMaxFiles, hubMaxTotalSize, hubMinFileSize, hubMinFiles, isDefined, isMaskActive, isString, joinButLast, matchesAccept, provideHubFileUploader, provideHubForms, runInZone, toFileArray, uuid };
|
|
2414
|
+
export { FormTextTypes, HUB_FILE_UPLOADER, HUB_FORMS_CONFIG, HubAutoresizeDirective, HubDatepickerComponent, HubFieldControl, HubFieldsetComponent, HubFileDropzoneNoticeDirective, HubFileIconDirective, HubFileInputComponent, HubFilePreviewDirective, HubFormComponent, HubFormControl, HubFormTextDirective, HubGroupControl, HubInputComponent, HubInputFormats, HubInputPrefixDirective, HubInputSuffixDirective, HubInvertColorPipe, HubJoinButLastPipe, HubLabelTypes, HubLegendComponent, HubLegendDirective, HubMapPipe, HubOtpInputComponent, HubSafeUrlPipe, HubSegmentedComponent, HubSelectComponent, HubSelectFormats, HubSliderComponent, HubSnakeUpperPipe, HubTextareaComponent, HubUcfirstPipe, HubValidationErrorDirective, NgClearButtonTemplateDirective, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectConfig, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, applyMask, areEqual, camelToSnakeUpper, controlHasMinOrMaxValidator, defaultHubDatepickerConfig, defaultHubDatepickerLabels, defaultHubFileInputLabels, defaultHubFormsConfig, defaultInvalidFeedback, fileKey, formatFileSize, get, getActiveElement, getMinOrMaxValueFromValidator, hubAcceptedFiles, hubAreEqual, hubFormControlAdapter, hubMaxFileSize, hubMaxFiles, hubMaxTotalSize, hubMinFileSize, hubMinFiles, isDefined, isMaskActive, isString, joinButLast, matchesAccept, provideHubFileUploader, provideHubForms, runInZone, toFileArray, uuid };
|
|
2365
2415
|
export type { FormTextType, HubDateRange, HubDateValue, HubDatepickerConfig, HubDatepickerLabels, HubDatepickerMode, HubFileConstraints, HubFileIconContext, HubFileInputLabels, HubFileItem, HubFilePreview, HubFilePreviewContext, HubFileRejection, HubFileRejectionReason, HubFileStatus, HubFileUploadEvent, HubFileUploader, HubFileValue, HubFormControlAdapter, HubFormControlConfig, HubFormControlHandle, HubFormControlOption, HubFormsConfig, HubGroupErrorTrigger, HubInputFormat, HubLabelType, HubMaskResult, HubOtpMode, HubSegmentedOption, HubSegmentedSize, HubSelectFormat, HubSliderValue };
|
|
Binary file
|