@rivet-health/design-system 31.9.1 → 32.0.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, 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,270 +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
- 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
-
4221
3956
  /**
4222
3957
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
4223
3958
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4735,6 +4470,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4735
4470
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4736
4471
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4737
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
+
4738
4557
  class RadioComponent {
4739
4558
  constructor() {
4740
4559
  this.checked = false;
@@ -7457,10 +7276,19 @@ class SimpleTableComponent {
7457
7276
  const allowedTypes = RivTable.ColumnDataTypes.join(', ');
7458
7277
  throw new Error(`Each header cell must define an appropriate dataType, one of ${allowedTypes}`);
7459
7278
  }
7460
- headerCell.alignment = RivTable.getColumnAlignment(dataType, i === 0);
7461
- headerCell.leftPinOffset = runningWidthTotal;
7279
+ const newAlignment = RivTable.getColumnAlignment(dataType, i === 0);
7280
+ const newLeftPinOffset = runningWidthTotal;
7462
7281
  runningWidthTotal += headerCell.width;
7463
- headerCell.cdr.markForCheck();
7282
+ const changed = headerCell.alignment != newAlignment ||
7283
+ headerCell.leftPinOffset != newLeftPinOffset;
7284
+ headerCell.alignment = newAlignment;
7285
+ headerCell.leftPinOffset = newLeftPinOffset;
7286
+ // Only mark for check when changed to prevent infinite cycles
7287
+ if (changed) {
7288
+ queueMicrotask(() => {
7289
+ headerCell.cdr.markForCheck();
7290
+ });
7291
+ }
7464
7292
  });
7465
7293
  const getCellCoordinates = createCellCoordinateCalculator(dataCells.map(dataCell => {
7466
7294
  const element = dataCell.elementRef.nativeElement;
@@ -7473,13 +7301,25 @@ class SimpleTableComponent {
7473
7301
  dataCells.forEach((dataCell, cellIndex) => {
7474
7302
  const bounds = getCellCoordinates(cellIndex);
7475
7303
  const headerCell = headerCells.get(bounds.start.col);
7304
+ let changed = false;
7476
7305
  if (headerCell) {
7306
+ changed =
7307
+ dataCell.alignment != headerCell.alignment ||
7308
+ dataCell.pinned != headerCell.pinned ||
7309
+ dataCell.leftPinOffset != headerCell.leftPinOffset;
7477
7310
  dataCell.alignment = headerCell.alignment;
7478
7311
  dataCell.pinned = headerCell.pinned;
7479
7312
  dataCell.leftPinOffset = headerCell.leftPinOffset;
7480
7313
  }
7481
- dataCell.isLastRow = bounds.end.row === maxRow;
7482
- dataCell.cdr.markForCheck();
7314
+ const newIsLastRow = bounds.end.row === maxRow;
7315
+ changed = changed || dataCell.isLastRow != newIsLastRow;
7316
+ dataCell.isLastRow = newIsLastRow;
7317
+ // Only mark for check when changed to prevent infinite cycles
7318
+ if (changed) {
7319
+ queueMicrotask(() => {
7320
+ dataCell.cdr.markForCheck();
7321
+ });
7322
+ }
7483
7323
  });
7484
7324
  }
7485
7325
  }
@@ -10346,7 +10186,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10346
10186
  IconComponent,
10347
10187
  InputLabelComponent,
10348
10188
  IssueComponent,
10349
- LegacyFormApiDirective,
10350
10189
  LegendItemComponent,
10351
10190
  LinkComponent,
10352
10191
  LoadingComponent,
@@ -10439,7 +10278,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
10439
10278
  IconComponent,
10440
10279
  InputLabelComponent,
10441
10280
  IssueComponent,
10442
- LegacyFormApiDirective,
10443
10281
  LegendItemComponent,
10444
10282
  LinkComponent,
10445
10283
  LoadingComponent,
@@ -10536,7 +10374,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10536
10374
  IconComponent,
10537
10375
  InputLabelComponent,
10538
10376
  IssueComponent,
10539
- LegacyFormApiDirective,
10540
10377
  LegendItemComponent,
10541
10378
  LinkComponent,
10542
10379
  LoadingComponent,
@@ -10632,7 +10469,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10632
10469
  IconComponent,
10633
10470
  InputLabelComponent,
10634
10471
  IssueComponent,
10635
- LegacyFormApiDirective,
10636
10472
  LegendItemComponent,
10637
10473
  LinkComponent,
10638
10474
  LoadingComponent,
@@ -10701,5 +10537,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10701
10537
  * Generated bundle index. Do not edit.
10702
10538
  */
10703
10539
 
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 };
10540
+ 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 };
10705
10541
  //# sourceMappingURL=rivet-health-design-system.mjs.map