@rivet-health/design-system 31.8.2 → 31.9.1

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, Injectable, Inject, Pipe, Directive, Input, EventEmitter, Output, ViewChild, ViewContainerRef, HostListener, Self, HostBinding, Optional, ContentChild, ElementRef, ViewEncapsulation, ContentChildren, TemplateRef, NgModule } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Injectable, Inject, Pipe, Directive, Input, EventEmitter, Output, ViewChild, ViewContainerRef, HostListener, Self, HostBinding, Optional, ContentChild, ElementRef, SimpleChange, forwardRef, Host, ViewEncapsulation, ContentChildren, TemplateRef, NgModule } from '@angular/core';
3
3
  import { __awaiter, __asyncGenerator, __await, __asyncDelegator, __asyncValues } from 'tslib';
4
4
  import * as i1 from '@angular/common';
5
5
  import { DOCUMENT, DatePipe as DatePipe$1, DecimalPipe, CurrencyPipe, PercentPipe, CommonModule } from '@angular/common';
@@ -8,6 +8,7 @@ import { timeYears, timeYear, timeMonths, timeMonth, timeDays, timeDay, timeSund
8
8
  import { timeFormat, utcFormat } from 'd3-time-format';
9
9
  import { defaultsDeep, sortBy, isNumber, flattenDeep, debounce, isEqual, cloneDeep, orderBy, range, toInteger, difference, union, sum } from 'lodash';
10
10
  import Fuse from 'fuse.js';
11
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
11
12
  import { query, style, animate, trigger, transition, group } from '@angular/animations';
12
13
  import * as i2 from '@angular/router';
13
14
  import { RouterModule } from '@angular/router';
@@ -3862,6 +3863,268 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3862
3863
  DateComponent.Sizes = ['small', 'medium', 'large'];
3863
3864
  })(DateComponent || (DateComponent = {}));
3864
3865
 
3866
+ class PhoneFieldComponent extends TextFieldComponent {
3867
+ constructor() {
3868
+ super(...arguments);
3869
+ this.placeholder = '(123) 456-7890';
3870
+ this.type = 'tel';
3871
+ this.maxLength = 17;
3872
+ }
3873
+ setText() {
3874
+ if (PhoneFieldComponent.clean(this._value) ===
3875
+ PhoneFieldComponent.clean(this._text))
3876
+ return;
3877
+ this._text = PhoneFieldComponent.format(this._value);
3878
+ }
3879
+ set text(t) {
3880
+ this._text = t;
3881
+ this.valueChange.emit(PhoneFieldComponent.clean(t));
3882
+ }
3883
+ get text() {
3884
+ return this._text;
3885
+ }
3886
+ inputBlur() {
3887
+ this._text = PhoneFieldComponent.format(this._text);
3888
+ this.blur.emit(PhoneFieldComponent.clean(this._text));
3889
+ }
3890
+ }
3891
+ PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3892
+ PhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PhoneFieldComponent, selector: "riv-phone-field", inputs: { placeholder: "placeholder", type: "type", maxLength: "maxLength" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3893
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
3894
+ type: Component,
3895
+ args: [{ selector: 'riv-phone-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"] }]
3896
+ }], propDecorators: { placeholder: [{
3897
+ type: Input
3898
+ }], type: [{
3899
+ type: Input
3900
+ }], maxLength: [{
3901
+ type: Input
3902
+ }] } });
3903
+ (function (PhoneFieldComponent) {
3904
+ function clean(v) {
3905
+ const digits = v.replace(/\D/g, '');
3906
+ if (digits.length >= 11 && digits[0] === '1') {
3907
+ return digits.slice(0, 11);
3908
+ }
3909
+ return digits.length > 10 ? digits.slice(0, 10) : digits;
3910
+ }
3911
+ PhoneFieldComponent.clean = clean;
3912
+ function format(value) {
3913
+ const cleaned = clean(value);
3914
+ if (!cleaned)
3915
+ return '';
3916
+ function formatBody(v) {
3917
+ if (v.length <= 3) {
3918
+ return v;
3919
+ }
3920
+ else if (v.length <= 6) {
3921
+ return `(${v.slice(0, 3)}) ${v.slice(3)}`;
3922
+ }
3923
+ else {
3924
+ return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
3925
+ }
3926
+ }
3927
+ if (cleaned.length === 11) {
3928
+ return `1 ${formatBody(cleaned.slice(1))}`;
3929
+ }
3930
+ return formatBody(cleaned);
3931
+ }
3932
+ PhoneFieldComponent.format = format;
3933
+ })(PhoneFieldComponent || (PhoneFieldComponent = {}));
3934
+
3935
+ class PercentageFieldComponent extends NumberFieldComponent {
3936
+ constructor() {
3937
+ super(...arguments);
3938
+ this.align = 'right';
3939
+ }
3940
+ }
3941
+ PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3942
+ PercentageFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PercentageFieldComponent, selector: "riv-percentage-field", inputs: { align: "align" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3943
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
3944
+ type: Component,
3945
+ args: [{ selector: 'riv-percentage-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"] }]
3946
+ }], propDecorators: { align: [{
3947
+ type: Input
3948
+ }] } });
3949
+
3950
+ function toString(value) {
3951
+ if (value === null || value === undefined) {
3952
+ return '';
3953
+ }
3954
+ if (typeof value === 'number') {
3955
+ return value.toString();
3956
+ }
3957
+ return value;
3958
+ }
3959
+ function toNumber(value) {
3960
+ if (value === null || value === undefined || value === '') {
3961
+ return null;
3962
+ }
3963
+ if (typeof value === 'string') {
3964
+ const parsed = Number(value);
3965
+ return isNaN(parsed) ? null : parsed;
3966
+ }
3967
+ return value;
3968
+ }
3969
+ function isStringField(component) {
3970
+ return (component instanceof TextFieldComponent ||
3971
+ component instanceof AlphabeticFieldComponent ||
3972
+ component instanceof PhoneFieldComponent);
3973
+ }
3974
+ /**
3975
+ * Directive that adds Angular Forms API compatibility to Design System input
3976
+ * components. Implements ControlValueAccessor to enable ngModel and form
3977
+ * validation integration.
3978
+ *
3979
+ * Generally, the simpler `value`/`valueChange` API is sufficient for use cases
3980
+ * in new code; there are some older corners of Rivet's codebase that rely
3981
+ * heavily on the Angular Forms API, which Rivet's original input components
3982
+ * implemented (incompletely/haphazardly), so this directive serves as a bridge
3983
+ * for ease of migration to design system input components in those areas.
3984
+ *
3985
+ * Example usage:
3986
+ * ```html
3987
+ * <riv-text-field
3988
+ * riv-legacy-form-api
3989
+ * label="Name"
3990
+ * [(ngModel)]="name"
3991
+ * #nameModel="ngModel"
3992
+ * ></riv-text-field>
3993
+ * ```
3994
+ */
3995
+ class LegacyFormApiDirective {
3996
+ constructor(rivTextField, rivNumberField, rivCurrencyField, rivPercentageField, rivAlphabeticField, rivPhoneField) {
3997
+ this.rivTextField = rivTextField;
3998
+ this.rivNumberField = rivNumberField;
3999
+ this.rivCurrencyField = rivCurrencyField;
4000
+ this.rivPercentageField = rivPercentageField;
4001
+ this.rivAlphabeticField = rivAlphabeticField;
4002
+ this.rivPhoneField = rivPhoneField;
4003
+ this.hostComponent = null;
4004
+ this.onChange = () => { };
4005
+ this.onTouched = () => { };
4006
+ }
4007
+ ngOnInit() {
4008
+ this.detectAndBindHostComponent();
4009
+ }
4010
+ ngOnDestroy() {
4011
+ var _a;
4012
+ (_a = this.valueChangeSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
4013
+ }
4014
+ detectAndBindHostComponent() {
4015
+ var _a, _b, _c, _d, _e, _f;
4016
+ this.hostComponent =
4017
+ (_f = (_e = (_d = (_c = (_b = (_a = this.rivTextField) !== null && _a !== void 0 ? _a : this.rivNumberField) !== null && _b !== void 0 ? _b : this.rivCurrencyField) !== null && _c !== void 0 ? _c : this.rivPercentageField) !== null && _d !== void 0 ? _d : this.rivAlphabeticField) !== null && _e !== void 0 ? _e : this.rivPhoneField) !== null && _f !== void 0 ? _f : null;
4018
+ if (!this.hostComponent) {
4019
+ // eslint-disable-next-line no-console
4020
+ console.warn('LegacyFormApi directive: No supported component found as host');
4021
+ return;
4022
+ }
4023
+ if (isStringField(this.hostComponent)) {
4024
+ this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4025
+ this.onChange(value);
4026
+ this.onTouched();
4027
+ });
4028
+ }
4029
+ else {
4030
+ this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4031
+ this.onChange(value);
4032
+ this.onTouched();
4033
+ });
4034
+ }
4035
+ }
4036
+ /*
4037
+ ControlValueAccessor implementation
4038
+ ===================================
4039
+
4040
+ Note: Setting properties programmatically on Angular components does not
4041
+ trigger their ngOnChanges lifecycle hook to run (this only happens when
4042
+ changes happen through the templating system), even if those properties are
4043
+ `@Input()`s, so we have to call it manually.
4044
+ */
4045
+ writeValue(value) {
4046
+ if (!this.hostComponent) {
4047
+ return;
4048
+ }
4049
+ if (isStringField(this.hostComponent)) {
4050
+ const stringValue = toString(value);
4051
+ this.hostComponent.value = stringValue;
4052
+ this.hostComponent.ngOnChanges({
4053
+ value: new SimpleChange(undefined, stringValue, false),
4054
+ });
4055
+ }
4056
+ else {
4057
+ const numberValue = toNumber(value);
4058
+ this.hostComponent.value = numberValue;
4059
+ this.hostComponent.ngOnChanges({
4060
+ value: new SimpleChange(undefined, numberValue, false),
4061
+ });
4062
+ }
4063
+ }
4064
+ registerOnChange(fn) {
4065
+ this.onChange = fn;
4066
+ }
4067
+ registerOnTouched(fn) {
4068
+ this.onTouched = fn;
4069
+ }
4070
+ setDisabledState(isDisabled) {
4071
+ if (!this.hostComponent) {
4072
+ return;
4073
+ }
4074
+ this.hostComponent.disabled = isDisabled;
4075
+ this.hostComponent.ngOnChanges({
4076
+ disabled: new SimpleChange(undefined, isDisabled, false),
4077
+ });
4078
+ }
4079
+ }
4080
+ LegacyFormApiDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, deps: [{ token: TextFieldComponent, host: true, optional: true }, { token: NumberFieldComponent, host: true, optional: true }, { token: CurrencyFieldComponent, host: true, optional: true }, { token: PercentageFieldComponent, host: true, optional: true }, { token: AlphabeticFieldComponent, host: true, optional: true }, { token: PhoneFieldComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4081
+ LegacyFormApiDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: LegacyFormApiDirective, selector: "[riv-legacy-form-api]", providers: [
4082
+ {
4083
+ provide: NG_VALUE_ACCESSOR,
4084
+ useExisting: forwardRef(() => LegacyFormApiDirective),
4085
+ multi: true,
4086
+ },
4087
+ ], ngImport: i0 });
4088
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, decorators: [{
4089
+ type: Directive,
4090
+ args: [{
4091
+ selector: '[riv-legacy-form-api]',
4092
+ providers: [
4093
+ {
4094
+ provide: NG_VALUE_ACCESSOR,
4095
+ useExisting: forwardRef(() => LegacyFormApiDirective),
4096
+ multi: true,
4097
+ },
4098
+ ],
4099
+ }]
4100
+ }], ctorParameters: function () {
4101
+ return [{ type: TextFieldComponent, decorators: [{
4102
+ type: Optional
4103
+ }, {
4104
+ type: Host
4105
+ }] }, { type: NumberFieldComponent, decorators: [{
4106
+ type: Optional
4107
+ }, {
4108
+ type: Host
4109
+ }] }, { type: CurrencyFieldComponent, decorators: [{
4110
+ type: Optional
4111
+ }, {
4112
+ type: Host
4113
+ }] }, { type: PercentageFieldComponent, decorators: [{
4114
+ type: Optional
4115
+ }, {
4116
+ type: Host
4117
+ }] }, { type: AlphabeticFieldComponent, decorators: [{
4118
+ type: Optional
4119
+ }, {
4120
+ type: Host
4121
+ }] }, { type: PhoneFieldComponent, decorators: [{
4122
+ type: Optional
4123
+ }, {
4124
+ type: Host
4125
+ }] }];
4126
+ } });
4127
+
3865
4128
  /**
3866
4129
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
3867
4130
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4383,90 +4646,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4383
4646
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4384
4647
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4385
4648
 
4386
- class PercentageFieldComponent extends NumberFieldComponent {
4387
- constructor() {
4388
- super(...arguments);
4389
- this.align = 'right';
4390
- }
4391
- }
4392
- PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4393
- PercentageFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PercentageFieldComponent, selector: "riv-percentage-field", inputs: { align: "align" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
4395
- type: Component,
4396
- args: [{ selector: 'riv-percentage-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"] }]
4397
- }], propDecorators: { align: [{
4398
- type: Input
4399
- }] } });
4400
-
4401
- class PhoneFieldComponent extends TextFieldComponent {
4402
- constructor() {
4403
- super(...arguments);
4404
- this.placeholder = '(123) 456-7890';
4405
- this.type = 'tel';
4406
- this.maxLength = 17;
4407
- }
4408
- setText() {
4409
- if (PhoneFieldComponent.clean(this._value) ===
4410
- PhoneFieldComponent.clean(this._text))
4411
- return;
4412
- this._text = PhoneFieldComponent.format(this._value);
4413
- }
4414
- set text(t) {
4415
- this._text = t;
4416
- this.valueChange.emit(PhoneFieldComponent.clean(t));
4417
- }
4418
- get text() {
4419
- return this._text;
4420
- }
4421
- inputBlur() {
4422
- this._text = PhoneFieldComponent.format(this._text);
4423
- this.blur.emit(PhoneFieldComponent.clean(this._text));
4424
- }
4425
- }
4426
- PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4427
- PhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PhoneFieldComponent, selector: "riv-phone-field", inputs: { placeholder: "placeholder", type: "type", maxLength: "maxLength" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4428
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
4429
- type: Component,
4430
- args: [{ selector: 'riv-phone-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"] }]
4431
- }], propDecorators: { placeholder: [{
4432
- type: Input
4433
- }], type: [{
4434
- type: Input
4435
- }], maxLength: [{
4436
- type: Input
4437
- }] } });
4438
- (function (PhoneFieldComponent) {
4439
- function clean(v) {
4440
- const digits = v.replace(/\D/g, '');
4441
- if (digits.length >= 11 && digits[0] === '1') {
4442
- return digits.slice(0, 11);
4443
- }
4444
- return digits.length > 10 ? digits.slice(0, 10) : digits;
4445
- }
4446
- PhoneFieldComponent.clean = clean;
4447
- function format(value) {
4448
- const cleaned = clean(value);
4449
- if (!cleaned)
4450
- return '';
4451
- function formatBody(v) {
4452
- if (v.length <= 3) {
4453
- return v;
4454
- }
4455
- else if (v.length <= 6) {
4456
- return `(${v.slice(0, 3)}) ${v.slice(3)}`;
4457
- }
4458
- else {
4459
- return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
4460
- }
4461
- }
4462
- if (cleaned.length === 11) {
4463
- return `1 ${formatBody(cleaned.slice(1))}`;
4464
- }
4465
- return formatBody(cleaned);
4466
- }
4467
- PhoneFieldComponent.format = format;
4468
- })(PhoneFieldComponent || (PhoneFieldComponent = {}));
4469
-
4470
4649
  class RadioComponent {
4471
4650
  constructor() {
4472
4651
  this.checked = false;
@@ -9653,12 +9832,14 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9653
9832
  IconComponent,
9654
9833
  InputLabelComponent,
9655
9834
  IssueComponent,
9835
+ LegacyFormApiDirective,
9656
9836
  LegendItemComponent,
9657
9837
  LinkComponent,
9658
9838
  LoadingComponent,
9659
9839
  LoadingCoverComponent,
9660
9840
  LockedTooltipDirective,
9661
9841
  LockScrollDirective,
9842
+ MentionsInputComponent,
9662
9843
  MenuComponent,
9663
9844
  MenuDividerComponent,
9664
9845
  MenuItemComponent,
@@ -9702,7 +9883,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9702
9883
  TabsComponent,
9703
9884
  TextareaFieldComponent,
9704
9885
  TextFieldComponent,
9705
- MentionsInputComponent,
9706
9886
  TimeSeriesComponent,
9707
9887
  ToastActionComponent,
9708
9888
  ToastComponent,
@@ -9745,11 +9925,13 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9745
9925
  IconComponent,
9746
9926
  InputLabelComponent,
9747
9927
  IssueComponent,
9928
+ LegacyFormApiDirective,
9748
9929
  LegendItemComponent,
9749
9930
  LinkComponent,
9750
9931
  LoadingComponent,
9751
9932
  LoadingCoverComponent,
9752
9933
  LockedTooltipDirective,
9934
+ MentionsInputComponent,
9753
9935
  MenuComponent,
9754
9936
  MenuDividerComponent,
9755
9937
  MenuItemComponent,
@@ -9791,7 +9973,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9791
9973
  TabsComponent,
9792
9974
  TextareaFieldComponent,
9793
9975
  TextFieldComponent,
9794
- MentionsInputComponent,
9795
9976
  TimeSeriesComponent,
9796
9977
  ToastActionComponent,
9797
9978
  ToastComponent,
@@ -9841,12 +10022,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9841
10022
  IconComponent,
9842
10023
  InputLabelComponent,
9843
10024
  IssueComponent,
10025
+ LegacyFormApiDirective,
9844
10026
  LegendItemComponent,
9845
10027
  LinkComponent,
9846
10028
  LoadingComponent,
9847
10029
  LoadingCoverComponent,
9848
10030
  LockedTooltipDirective,
9849
10031
  LockScrollDirective,
10032
+ MentionsInputComponent,
9850
10033
  MenuComponent,
9851
10034
  MenuDividerComponent,
9852
10035
  MenuItemComponent,
@@ -9890,7 +10073,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9890
10073
  TabsComponent,
9891
10074
  TextareaFieldComponent,
9892
10075
  TextFieldComponent,
9893
- MentionsInputComponent,
9894
10076
  TimeSeriesComponent,
9895
10077
  ToastActionComponent,
9896
10078
  ToastComponent,
@@ -9936,11 +10118,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9936
10118
  IconComponent,
9937
10119
  InputLabelComponent,
9938
10120
  IssueComponent,
10121
+ LegacyFormApiDirective,
9939
10122
  LegendItemComponent,
9940
10123
  LinkComponent,
9941
10124
  LoadingComponent,
9942
10125
  LoadingCoverComponent,
9943
10126
  LockedTooltipDirective,
10127
+ MentionsInputComponent,
9944
10128
  MenuComponent,
9945
10129
  MenuDividerComponent,
9946
10130
  MenuItemComponent,
@@ -9982,7 +10166,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9982
10166
  TabsComponent,
9983
10167
  TextareaFieldComponent,
9984
10168
  TextFieldComponent,
9985
- MentionsInputComponent,
9986
10169
  TimeSeriesComponent,
9987
10170
  ToastActionComponent,
9988
10171
  ToastComponent,
@@ -10004,5 +10187,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10004
10187
  * Generated bundle index. Do not edit.
10005
10188
  */
10006
10189
 
10007
- export { ANIMATION_CONSTANTS, AllViewsModalComponent, AlphabeticFieldComponent, AutoFocusDirective, BadgeComponent, BannerActionComponent, BannerComponent, ButtonComponent, ButtonGroupComponent, CalloutComponent, CardCheckboxComponent, Chart, ChartComponent, CheckboxComponent, CurrencyFieldComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DateComponent, DatePipe, DateRangeComponent, DaysPipe, DialogComponent, DollarsPipe, DonutComponent, DownloadService, EditViewComponent, FunnelChartComponent, HelpComponent, HighlightComponent, IconComponent, InputLabelComponent, IssueComponent, LegendItemComponent, LinkComponent, LoadingComponent, LoadingCoverComponent, LockedTooltipDirective, MentionsInputComponent, MenuComponent, MenuDividerComponent, MenuItemComponent, MetricComponent, ModalComponent, NotificationBadgeComponent, NumberFieldComponent, NumberPipe, OptionGroupPipe, OverlayDirective, OverlayOutletComponent, PercentageFieldComponent, PercentagePipe, PhoneFieldComponent, ProgressComponent, RadioComponent, RivModule, RivSelect, RivTable, RivViews, SVGTextTruncateDirective, SearchComponent, SelectComponent, SelectNodeComponent, SideSheetComponent, SimpleSelectComponent, SimpleTableCellComponent, SimpleTableComponent, SimpleTableHeaderCellComponent, SimpleTableRowComponent, SizeDirective, SmallCurrencyPipe, SrOnlyComponent, StackedColumnComponent, StackedRowComponent, SwitchCheckboxComponent, TabComponent, TableColumnSettingsComponent, TableColumnSettingsSideSheetComponent, TableComponent, TableCsvExportComponent, TableSearchColumnsComponent, TableSearchComponent, TabsComponent, TextFieldComponent, TextareaFieldComponent, TimeSeriesComponent, ToastActionComponent, ToastComponent, TooltipComponent, TooltipDirective, TrendComponent, TruncateComponent, ValidationMessageComponent, ViewMenuComponent, ViewsComponent, VisibilityDirective, ZeroStateComponent };
10190
+ export { ANIMATION_CONSTANTS, AllViewsModalComponent, AlphabeticFieldComponent, AutoFocusDirective, BadgeComponent, BannerActionComponent, BannerComponent, ButtonComponent, ButtonGroupComponent, CalloutComponent, CardCheckboxComponent, Chart, ChartComponent, CheckboxComponent, CurrencyFieldComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DateComponent, DatePipe, DateRangeComponent, DaysPipe, DialogComponent, DollarsPipe, DonutComponent, DownloadService, EditViewComponent, FunnelChartComponent, HelpComponent, HighlightComponent, IconComponent, InputLabelComponent, IssueComponent, LegacyFormApiDirective, LegendItemComponent, LinkComponent, LoadingComponent, LoadingCoverComponent, LockedTooltipDirective, MentionsInputComponent, MenuComponent, MenuDividerComponent, MenuItemComponent, MetricComponent, ModalComponent, NotificationBadgeComponent, NumberFieldComponent, NumberPipe, OptionGroupPipe, OverlayDirective, OverlayOutletComponent, PercentageFieldComponent, PercentagePipe, PhoneFieldComponent, ProgressComponent, RadioComponent, RivModule, RivSelect, RivTable, RivViews, SVGTextTruncateDirective, SearchComponent, SelectComponent, SelectNodeComponent, SideSheetComponent, SimpleSelectComponent, SimpleTableCellComponent, SimpleTableComponent, SimpleTableHeaderCellComponent, SimpleTableRowComponent, SizeDirective, SmallCurrencyPipe, SrOnlyComponent, StackedColumnComponent, StackedRowComponent, SwitchCheckboxComponent, TabComponent, TableColumnSettingsComponent, TableColumnSettingsSideSheetComponent, TableComponent, TableCsvExportComponent, TableSearchColumnsComponent, TableSearchComponent, TabsComponent, TextFieldComponent, TextareaFieldComponent, TimeSeriesComponent, ToastActionComponent, ToastComponent, TooltipComponent, TooltipDirective, TrendComponent, TruncateComponent, ValidationMessageComponent, ViewMenuComponent, ViewsComponent, VisibilityDirective, ZeroStateComponent };
10008
10191
  //# sourceMappingURL=rivet-health-design-system.mjs.map