@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 * as i1 from '@angular/common';
4
4
  import { DOCUMENT, DatePipe as DatePipe$1, DecimalPipe, CurrencyPipe, PercentPipe, CommonModule } from '@angular/common';
5
5
  import { BehaviorSubject, Subject, merge, scan, startWith, connectable, map, ReplaySubject, distinctUntilChanged, skip, filter, combineLatest, shareReplay, skipUntil, mergeScan, from, share, fromEvent, tap, switchMap, takeUntil, concatWith, of } from 'rxjs';
@@ -7,6 +7,7 @@ import { timeYears, timeYear, timeMonths, timeMonth, timeDays, timeDay, timeSund
7
7
  import { timeFormat, utcFormat } from 'd3-time-format';
8
8
  import { defaultsDeep, sortBy, isNumber, flattenDeep, debounce, isEqual, cloneDeep, orderBy, range, toInteger, difference, union, sum } from 'lodash';
9
9
  import Fuse from 'fuse.js';
10
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
10
11
  import { query, style, animate, trigger, transition, group } from '@angular/animations';
11
12
  import * as i2 from '@angular/router';
12
13
  import { RouterModule } from '@angular/router';
@@ -3953,6 +3954,270 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3953
3954
  DateComponent.Sizes = ['small', 'medium', 'large'];
3954
3955
  })(DateComponent || (DateComponent = {}));
3955
3956
 
3957
+ class PhoneFieldComponent extends TextFieldComponent {
3958
+ constructor() {
3959
+ super(...arguments);
3960
+ this.placeholder = '(123) 456-7890';
3961
+ this.type = 'tel';
3962
+ this.maxLength = 17;
3963
+ }
3964
+ setText() {
3965
+ if (PhoneFieldComponent.clean(this._value) ===
3966
+ PhoneFieldComponent.clean(this._text))
3967
+ return;
3968
+ this._text = PhoneFieldComponent.format(this._value);
3969
+ }
3970
+ set text(t) {
3971
+ this._text = t;
3972
+ this.valueChange.emit(PhoneFieldComponent.clean(t));
3973
+ }
3974
+ get text() {
3975
+ return this._text;
3976
+ }
3977
+ inputBlur() {
3978
+ this._text = PhoneFieldComponent.format(this._text);
3979
+ this.blur.emit(PhoneFieldComponent.clean(this._text));
3980
+ }
3981
+ }
3982
+ PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3983
+ 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 });
3984
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
3985
+ type: Component,
3986
+ 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"] }]
3987
+ }], propDecorators: { placeholder: [{
3988
+ type: Input
3989
+ }], type: [{
3990
+ type: Input
3991
+ }], maxLength: [{
3992
+ type: Input
3993
+ }] } });
3994
+ (function (PhoneFieldComponent) {
3995
+ function clean(v) {
3996
+ const digits = v.replace(/\D/g, '');
3997
+ if (digits.length >= 11 && digits[0] === '1') {
3998
+ return digits.slice(0, 11);
3999
+ }
4000
+ return digits.length > 10 ? digits.slice(0, 10) : digits;
4001
+ }
4002
+ PhoneFieldComponent.clean = clean;
4003
+ function format(value) {
4004
+ const cleaned = clean(value);
4005
+ if (!cleaned)
4006
+ return '';
4007
+ function formatBody(v) {
4008
+ if (v.length <= 3) {
4009
+ return v;
4010
+ }
4011
+ else if (v.length <= 6) {
4012
+ return `(${v.slice(0, 3)}) ${v.slice(3)}`;
4013
+ }
4014
+ else {
4015
+ return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
4016
+ }
4017
+ }
4018
+ if (cleaned.length === 11) {
4019
+ return `1 ${formatBody(cleaned.slice(1))}`;
4020
+ }
4021
+ return formatBody(cleaned);
4022
+ }
4023
+ PhoneFieldComponent.format = format;
4024
+ })(PhoneFieldComponent || (PhoneFieldComponent = {}));
4025
+
4026
+ class PercentageFieldComponent extends NumberFieldComponent {
4027
+ constructor() {
4028
+ super(...arguments);
4029
+ this.align = 'right';
4030
+ }
4031
+ }
4032
+ PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4033
+ 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 });
4034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
4035
+ type: Component,
4036
+ 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"] }]
4037
+ }], propDecorators: { align: [{
4038
+ type: Input
4039
+ }] } });
4040
+
4041
+ function toString(value) {
4042
+ if (value === null || value === undefined) {
4043
+ return '';
4044
+ }
4045
+ if (typeof value === 'number') {
4046
+ return value.toString();
4047
+ }
4048
+ return value;
4049
+ }
4050
+ function toNumber(value) {
4051
+ if (value === null || value === undefined || value === '') {
4052
+ return null;
4053
+ }
4054
+ if (typeof value === 'string') {
4055
+ const parsed = Number(value);
4056
+ return isNaN(parsed) ? null : parsed;
4057
+ }
4058
+ return value;
4059
+ }
4060
+ function isStringField(component) {
4061
+ return (component instanceof TextFieldComponent ||
4062
+ component instanceof AlphabeticFieldComponent ||
4063
+ component instanceof PhoneFieldComponent);
4064
+ }
4065
+ /**
4066
+ * Directive that adds Angular Forms API compatibility to Design System input
4067
+ * components. Implements ControlValueAccessor to enable ngModel and form
4068
+ * validation integration.
4069
+ *
4070
+ * Generally, the simpler `value`/`valueChange` API is sufficient for use cases
4071
+ * in new code; there are some older corners of Rivet's codebase that rely
4072
+ * heavily on the Angular Forms API, which Rivet's original input components
4073
+ * implemented (incompletely/haphazardly), so this directive serves as a bridge
4074
+ * for ease of migration to design system input components in those areas.
4075
+ *
4076
+ * Example usage:
4077
+ * ```html
4078
+ * <riv-text-field
4079
+ * riv-legacy-form-api
4080
+ * label="Name"
4081
+ * [(ngModel)]="name"
4082
+ * #nameModel="ngModel"
4083
+ * ></riv-text-field>
4084
+ * ```
4085
+ */
4086
+ class LegacyFormApiDirective {
4087
+ constructor(rivTextField, rivNumberField, rivCurrencyField, rivPercentageField, rivAlphabeticField, rivPhoneField) {
4088
+ this.rivTextField = rivTextField;
4089
+ this.rivNumberField = rivNumberField;
4090
+ this.rivCurrencyField = rivCurrencyField;
4091
+ this.rivPercentageField = rivPercentageField;
4092
+ this.rivAlphabeticField = rivAlphabeticField;
4093
+ this.rivPhoneField = rivPhoneField;
4094
+ this.hostComponent = null;
4095
+ this.onChange = () => { };
4096
+ this.onTouched = () => { };
4097
+ }
4098
+ ngOnInit() {
4099
+ this.detectAndBindHostComponent();
4100
+ }
4101
+ ngOnDestroy() {
4102
+ this.valueChangeSubscription?.unsubscribe();
4103
+ }
4104
+ detectAndBindHostComponent() {
4105
+ this.hostComponent =
4106
+ this.rivTextField ??
4107
+ this.rivNumberField ??
4108
+ this.rivCurrencyField ??
4109
+ this.rivPercentageField ??
4110
+ this.rivAlphabeticField ??
4111
+ this.rivPhoneField ??
4112
+ null;
4113
+ if (!this.hostComponent) {
4114
+ // eslint-disable-next-line no-console
4115
+ console.warn('LegacyFormApi directive: No supported component found as host');
4116
+ return;
4117
+ }
4118
+ if (isStringField(this.hostComponent)) {
4119
+ this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4120
+ this.onChange(value);
4121
+ this.onTouched();
4122
+ });
4123
+ }
4124
+ else {
4125
+ this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4126
+ this.onChange(value);
4127
+ this.onTouched();
4128
+ });
4129
+ }
4130
+ }
4131
+ /*
4132
+ ControlValueAccessor implementation
4133
+ ===================================
4134
+
4135
+ Note: Setting properties programmatically on Angular components does not
4136
+ trigger their ngOnChanges lifecycle hook to run (this only happens when
4137
+ changes happen through the templating system), even if those properties are
4138
+ `@Input()`s, so we have to call it manually.
4139
+ */
4140
+ writeValue(value) {
4141
+ if (!this.hostComponent) {
4142
+ return;
4143
+ }
4144
+ if (isStringField(this.hostComponent)) {
4145
+ const stringValue = toString(value);
4146
+ this.hostComponent.value = stringValue;
4147
+ this.hostComponent.ngOnChanges({
4148
+ value: new SimpleChange(undefined, stringValue, false),
4149
+ });
4150
+ }
4151
+ else {
4152
+ const numberValue = toNumber(value);
4153
+ this.hostComponent.value = numberValue;
4154
+ this.hostComponent.ngOnChanges({
4155
+ value: new SimpleChange(undefined, numberValue, false),
4156
+ });
4157
+ }
4158
+ }
4159
+ registerOnChange(fn) {
4160
+ this.onChange = fn;
4161
+ }
4162
+ registerOnTouched(fn) {
4163
+ this.onTouched = fn;
4164
+ }
4165
+ setDisabledState(isDisabled) {
4166
+ if (!this.hostComponent) {
4167
+ return;
4168
+ }
4169
+ this.hostComponent.disabled = isDisabled;
4170
+ this.hostComponent.ngOnChanges({
4171
+ disabled: new SimpleChange(undefined, isDisabled, false),
4172
+ });
4173
+ }
4174
+ }
4175
+ 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 });
4176
+ LegacyFormApiDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: LegacyFormApiDirective, selector: "[riv-legacy-form-api]", providers: [
4177
+ {
4178
+ provide: NG_VALUE_ACCESSOR,
4179
+ useExisting: forwardRef(() => LegacyFormApiDirective),
4180
+ multi: true,
4181
+ },
4182
+ ], ngImport: i0 });
4183
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, decorators: [{
4184
+ type: Directive,
4185
+ args: [{
4186
+ selector: '[riv-legacy-form-api]',
4187
+ providers: [
4188
+ {
4189
+ provide: NG_VALUE_ACCESSOR,
4190
+ useExisting: forwardRef(() => LegacyFormApiDirective),
4191
+ multi: true,
4192
+ },
4193
+ ],
4194
+ }]
4195
+ }], ctorParameters: function () { return [{ type: TextFieldComponent, decorators: [{
4196
+ type: Optional
4197
+ }, {
4198
+ type: Host
4199
+ }] }, { type: NumberFieldComponent, decorators: [{
4200
+ type: Optional
4201
+ }, {
4202
+ type: Host
4203
+ }] }, { type: CurrencyFieldComponent, decorators: [{
4204
+ type: Optional
4205
+ }, {
4206
+ type: Host
4207
+ }] }, { type: PercentageFieldComponent, decorators: [{
4208
+ type: Optional
4209
+ }, {
4210
+ type: Host
4211
+ }] }, { type: AlphabeticFieldComponent, decorators: [{
4212
+ type: Optional
4213
+ }, {
4214
+ type: Host
4215
+ }] }, { type: PhoneFieldComponent, decorators: [{
4216
+ type: Optional
4217
+ }, {
4218
+ type: Host
4219
+ }] }]; } });
4220
+
3956
4221
  /**
3957
4222
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
3958
4223
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4470,90 +4735,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4470
4735
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4471
4736
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4472
4737
 
4473
- class PercentageFieldComponent extends NumberFieldComponent {
4474
- constructor() {
4475
- super(...arguments);
4476
- this.align = 'right';
4477
- }
4478
- }
4479
- PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4480
- 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 });
4481
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
4482
- type: Component,
4483
- 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"] }]
4484
- }], propDecorators: { align: [{
4485
- type: Input
4486
- }] } });
4487
-
4488
- class PhoneFieldComponent extends TextFieldComponent {
4489
- constructor() {
4490
- super(...arguments);
4491
- this.placeholder = '(123) 456-7890';
4492
- this.type = 'tel';
4493
- this.maxLength = 17;
4494
- }
4495
- setText() {
4496
- if (PhoneFieldComponent.clean(this._value) ===
4497
- PhoneFieldComponent.clean(this._text))
4498
- return;
4499
- this._text = PhoneFieldComponent.format(this._value);
4500
- }
4501
- set text(t) {
4502
- this._text = t;
4503
- this.valueChange.emit(PhoneFieldComponent.clean(t));
4504
- }
4505
- get text() {
4506
- return this._text;
4507
- }
4508
- inputBlur() {
4509
- this._text = PhoneFieldComponent.format(this._text);
4510
- this.blur.emit(PhoneFieldComponent.clean(this._text));
4511
- }
4512
- }
4513
- PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4514
- 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 });
4515
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
4516
- type: Component,
4517
- 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"] }]
4518
- }], propDecorators: { placeholder: [{
4519
- type: Input
4520
- }], type: [{
4521
- type: Input
4522
- }], maxLength: [{
4523
- type: Input
4524
- }] } });
4525
- (function (PhoneFieldComponent) {
4526
- function clean(v) {
4527
- const digits = v.replace(/\D/g, '');
4528
- if (digits.length >= 11 && digits[0] === '1') {
4529
- return digits.slice(0, 11);
4530
- }
4531
- return digits.length > 10 ? digits.slice(0, 10) : digits;
4532
- }
4533
- PhoneFieldComponent.clean = clean;
4534
- function format(value) {
4535
- const cleaned = clean(value);
4536
- if (!cleaned)
4537
- return '';
4538
- function formatBody(v) {
4539
- if (v.length <= 3) {
4540
- return v;
4541
- }
4542
- else if (v.length <= 6) {
4543
- return `(${v.slice(0, 3)}) ${v.slice(3)}`;
4544
- }
4545
- else {
4546
- return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
4547
- }
4548
- }
4549
- if (cleaned.length === 11) {
4550
- return `1 ${formatBody(cleaned.slice(1))}`;
4551
- }
4552
- return formatBody(cleaned);
4553
- }
4554
- PhoneFieldComponent.format = format;
4555
- })(PhoneFieldComponent || (PhoneFieldComponent = {}));
4556
-
4557
4738
  class RadioComponent {
4558
4739
  constructor() {
4559
4740
  this.checked = false;
@@ -10165,12 +10346,14 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10165
10346
  IconComponent,
10166
10347
  InputLabelComponent,
10167
10348
  IssueComponent,
10349
+ LegacyFormApiDirective,
10168
10350
  LegendItemComponent,
10169
10351
  LinkComponent,
10170
10352
  LoadingComponent,
10171
10353
  LoadingCoverComponent,
10172
10354
  LockedTooltipDirective,
10173
10355
  LockScrollDirective,
10356
+ MentionsInputComponent,
10174
10357
  MenuComponent,
10175
10358
  MenuDividerComponent,
10176
10359
  MenuItemComponent,
@@ -10214,7 +10397,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10214
10397
  TabsComponent,
10215
10398
  TextareaFieldComponent,
10216
10399
  TextFieldComponent,
10217
- MentionsInputComponent,
10218
10400
  TimeSeriesComponent,
10219
10401
  ToastActionComponent,
10220
10402
  ToastComponent,
@@ -10257,11 +10439,13 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10257
10439
  IconComponent,
10258
10440
  InputLabelComponent,
10259
10441
  IssueComponent,
10442
+ LegacyFormApiDirective,
10260
10443
  LegendItemComponent,
10261
10444
  LinkComponent,
10262
10445
  LoadingComponent,
10263
10446
  LoadingCoverComponent,
10264
10447
  LockedTooltipDirective,
10448
+ MentionsInputComponent,
10265
10449
  MenuComponent,
10266
10450
  MenuDividerComponent,
10267
10451
  MenuItemComponent,
@@ -10303,7 +10487,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10303
10487
  TabsComponent,
10304
10488
  TextareaFieldComponent,
10305
10489
  TextFieldComponent,
10306
- MentionsInputComponent,
10307
10490
  TimeSeriesComponent,
10308
10491
  ToastActionComponent,
10309
10492
  ToastComponent,
@@ -10353,12 +10536,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10353
10536
  IconComponent,
10354
10537
  InputLabelComponent,
10355
10538
  IssueComponent,
10539
+ LegacyFormApiDirective,
10356
10540
  LegendItemComponent,
10357
10541
  LinkComponent,
10358
10542
  LoadingComponent,
10359
10543
  LoadingCoverComponent,
10360
10544
  LockedTooltipDirective,
10361
10545
  LockScrollDirective,
10546
+ MentionsInputComponent,
10362
10547
  MenuComponent,
10363
10548
  MenuDividerComponent,
10364
10549
  MenuItemComponent,
@@ -10402,7 +10587,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10402
10587
  TabsComponent,
10403
10588
  TextareaFieldComponent,
10404
10589
  TextFieldComponent,
10405
- MentionsInputComponent,
10406
10590
  TimeSeriesComponent,
10407
10591
  ToastActionComponent,
10408
10592
  ToastComponent,
@@ -10448,11 +10632,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10448
10632
  IconComponent,
10449
10633
  InputLabelComponent,
10450
10634
  IssueComponent,
10635
+ LegacyFormApiDirective,
10451
10636
  LegendItemComponent,
10452
10637
  LinkComponent,
10453
10638
  LoadingComponent,
10454
10639
  LoadingCoverComponent,
10455
10640
  LockedTooltipDirective,
10641
+ MentionsInputComponent,
10456
10642
  MenuComponent,
10457
10643
  MenuDividerComponent,
10458
10644
  MenuItemComponent,
@@ -10494,7 +10680,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10494
10680
  TabsComponent,
10495
10681
  TextareaFieldComponent,
10496
10682
  TextFieldComponent,
10497
- MentionsInputComponent,
10498
10683
  TimeSeriesComponent,
10499
10684
  ToastActionComponent,
10500
10685
  ToastComponent,
@@ -10516,5 +10701,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10516
10701
  * Generated bundle index. Do not edit.
10517
10702
  */
10518
10703
 
10519
- 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 };
10704
+ 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 };
10520
10705
  //# sourceMappingURL=rivet-health-design-system.mjs.map