@rivet-health/design-system 31.9.0 → 32.0.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.
@@ -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, SimpleChange, forwardRef, Host, 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, 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,7 +7,6 @@ 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';
11
10
  import { query, style, animate, trigger, transition, group } from '@angular/animations';
12
11
  import * as i2 from '@angular/router';
13
12
  import { RouterModule } from '@angular/router';
@@ -3954,269 +3953,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3954
3953
  DateComponent.Sizes = ['small', 'medium', 'large'];
3955
3954
  })(DateComponent || (DateComponent = {}));
3956
3955
 
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
- if (!this.hostComponent) {
4113
- // eslint-disable-next-line no-console
4114
- console.warn('LegacyFormApi directive: No supported component found as host');
4115
- return;
4116
- }
4117
- if (isStringField(this.hostComponent)) {
4118
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4119
- this.onChange(value);
4120
- this.onTouched();
4121
- });
4122
- }
4123
- else {
4124
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4125
- this.onChange(value);
4126
- this.onTouched();
4127
- });
4128
- }
4129
- }
4130
- /*
4131
- ControlValueAccessor implementation
4132
- ===================================
4133
-
4134
- Note: Setting properties programmatically on Angular components does not
4135
- trigger their ngOnChanges lifecycle hook to run (this only happens when
4136
- changes happen through the templating system), even if those properties are
4137
- `@Input()`s, so we have to call it manually.
4138
- */
4139
- writeValue(value) {
4140
- if (!this.hostComponent) {
4141
- return;
4142
- }
4143
- if (isStringField(this.hostComponent)) {
4144
- const stringValue = toString(value);
4145
- this.hostComponent.value = stringValue;
4146
- this.hostComponent.ngOnChanges({
4147
- value: new SimpleChange(undefined, stringValue, false),
4148
- });
4149
- }
4150
- else {
4151
- const numberValue = toNumber(value);
4152
- this.hostComponent.value = numberValue;
4153
- this.hostComponent.ngOnChanges({
4154
- value: new SimpleChange(undefined, numberValue, false),
4155
- });
4156
- }
4157
- }
4158
- registerOnChange(fn) {
4159
- this.onChange = fn;
4160
- }
4161
- registerOnTouched(fn) {
4162
- this.onTouched = fn;
4163
- }
4164
- setDisabledState(isDisabled) {
4165
- if (!this.hostComponent) {
4166
- return;
4167
- }
4168
- this.hostComponent.disabled = isDisabled;
4169
- this.hostComponent.ngOnChanges({
4170
- disabled: new SimpleChange(undefined, isDisabled, false),
4171
- });
4172
- }
4173
- }
4174
- 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 });
4175
- LegacyFormApiDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: LegacyFormApiDirective, selector: "[riv-legacy-form-api]", providers: [
4176
- {
4177
- provide: NG_VALUE_ACCESSOR,
4178
- useExisting: forwardRef(() => LegacyFormApiDirective),
4179
- multi: true,
4180
- },
4181
- ], ngImport: i0 });
4182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, decorators: [{
4183
- type: Directive,
4184
- args: [{
4185
- selector: '[riv-legacy-form-api]',
4186
- providers: [
4187
- {
4188
- provide: NG_VALUE_ACCESSOR,
4189
- useExisting: forwardRef(() => LegacyFormApiDirective),
4190
- multi: true,
4191
- },
4192
- ],
4193
- }]
4194
- }], ctorParameters: function () { return [{ type: TextFieldComponent, decorators: [{
4195
- type: Optional
4196
- }, {
4197
- type: Host
4198
- }] }, { type: NumberFieldComponent, decorators: [{
4199
- type: Optional
4200
- }, {
4201
- type: Host
4202
- }] }, { type: CurrencyFieldComponent, decorators: [{
4203
- type: Optional
4204
- }, {
4205
- type: Host
4206
- }] }, { type: PercentageFieldComponent, decorators: [{
4207
- type: Optional
4208
- }, {
4209
- type: Host
4210
- }] }, { type: AlphabeticFieldComponent, decorators: [{
4211
- type: Optional
4212
- }, {
4213
- type: Host
4214
- }] }, { type: PhoneFieldComponent, decorators: [{
4215
- type: Optional
4216
- }, {
4217
- type: Host
4218
- }] }]; } });
4219
-
4220
3956
  /**
4221
3957
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
4222
3958
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4734,6 +4470,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4734
4470
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4735
4471
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4736
4472
 
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
+
4737
4557
  class RadioComponent {
4738
4558
  constructor() {
4739
4559
  this.checked = false;
@@ -10345,7 +10165,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10345
10165
  IconComponent,
10346
10166
  InputLabelComponent,
10347
10167
  IssueComponent,
10348
- LegacyFormApiDirective,
10349
10168
  LegendItemComponent,
10350
10169
  LinkComponent,
10351
10170
  LoadingComponent,
@@ -10438,7 +10257,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10438
10257
  IconComponent,
10439
10258
  InputLabelComponent,
10440
10259
  IssueComponent,
10441
- LegacyFormApiDirective,
10442
10260
  LegendItemComponent,
10443
10261
  LinkComponent,
10444
10262
  LoadingComponent,
@@ -10535,7 +10353,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10535
10353
  IconComponent,
10536
10354
  InputLabelComponent,
10537
10355
  IssueComponent,
10538
- LegacyFormApiDirective,
10539
10356
  LegendItemComponent,
10540
10357
  LinkComponent,
10541
10358
  LoadingComponent,
@@ -10631,7 +10448,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10631
10448
  IconComponent,
10632
10449
  InputLabelComponent,
10633
10450
  IssueComponent,
10634
- LegacyFormApiDirective,
10635
10451
  LegendItemComponent,
10636
10452
  LinkComponent,
10637
10453
  LoadingComponent,
@@ -10700,5 +10516,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10700
10516
  * Generated bundle index. Do not edit.
10701
10517
  */
10702
10518
 
10703
- 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 };
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
10520
  //# sourceMappingURL=rivet-health-design-system.mjs.map