@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 { __awaiter, __asyncGenerator, __await, __asyncDelegator, __asyncValues } from 'tslib';
4
4
  import * as i1 from '@angular/common';
5
5
  import { DOCUMENT, DatePipe as DatePipe$1, DecimalPipe, CurrencyPipe, PercentPipe, CommonModule } from '@angular/common';
@@ -8,7 +8,6 @@ import { timeYears, timeYear, timeMonths, timeMonth, timeDays, timeDay, timeSund
8
8
  import { timeFormat, utcFormat } from 'd3-time-format';
9
9
  import { defaultsDeep, sortBy, isNumber, flattenDeep, debounce, isEqual, cloneDeep, orderBy, range, toInteger, difference, union, sum } from 'lodash';
10
10
  import Fuse from 'fuse.js';
11
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
12
11
  import { query, style, animate, trigger, transition, group } from '@angular/animations';
13
12
  import * as i2 from '@angular/router';
14
13
  import { RouterModule } from '@angular/router';
@@ -3863,268 +3862,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3863
3862
  DateComponent.Sizes = ['small', 'medium', 'large'];
3864
3863
  })(DateComponent || (DateComponent = {}));
3865
3864
 
3866
- class PhoneFieldComponent extends TextFieldComponent {
3867
- constructor() {
3868
- super(...arguments);
3869
- this.placeholder = '(123) 456-7890';
3870
- this.type = 'tel';
3871
- this.maxLength = 17;
3872
- }
3873
- setText() {
3874
- if (PhoneFieldComponent.clean(this._value) ===
3875
- PhoneFieldComponent.clean(this._text))
3876
- return;
3877
- this._text = PhoneFieldComponent.format(this._value);
3878
- }
3879
- set text(t) {
3880
- this._text = t;
3881
- this.valueChange.emit(PhoneFieldComponent.clean(t));
3882
- }
3883
- get text() {
3884
- return this._text;
3885
- }
3886
- inputBlur() {
3887
- this._text = PhoneFieldComponent.format(this._text);
3888
- this.blur.emit(PhoneFieldComponent.clean(this._text));
3889
- }
3890
- }
3891
- PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3892
- PhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PhoneFieldComponent, selector: "riv-phone-field", inputs: { placeholder: "placeholder", type: "type", maxLength: "maxLength" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3893
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
3894
- type: Component,
3895
- args: [{ selector: 'riv-phone-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"] }]
3896
- }], propDecorators: { placeholder: [{
3897
- type: Input
3898
- }], type: [{
3899
- type: Input
3900
- }], maxLength: [{
3901
- type: Input
3902
- }] } });
3903
- (function (PhoneFieldComponent) {
3904
- function clean(v) {
3905
- const digits = v.replace(/\D/g, '');
3906
- if (digits.length >= 11 && digits[0] === '1') {
3907
- return digits.slice(0, 11);
3908
- }
3909
- return digits.length > 10 ? digits.slice(0, 10) : digits;
3910
- }
3911
- PhoneFieldComponent.clean = clean;
3912
- function format(value) {
3913
- const cleaned = clean(value);
3914
- if (!cleaned)
3915
- return '';
3916
- function formatBody(v) {
3917
- if (v.length <= 3) {
3918
- return v;
3919
- }
3920
- else if (v.length <= 6) {
3921
- return `(${v.slice(0, 3)}) ${v.slice(3)}`;
3922
- }
3923
- else {
3924
- return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
3925
- }
3926
- }
3927
- if (cleaned.length === 11) {
3928
- return `1 ${formatBody(cleaned.slice(1))}`;
3929
- }
3930
- return formatBody(cleaned);
3931
- }
3932
- PhoneFieldComponent.format = format;
3933
- })(PhoneFieldComponent || (PhoneFieldComponent = {}));
3934
-
3935
- class PercentageFieldComponent extends NumberFieldComponent {
3936
- constructor() {
3937
- super(...arguments);
3938
- this.align = 'right';
3939
- }
3940
- }
3941
- PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3942
- PercentageFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PercentageFieldComponent, selector: "riv-percentage-field", inputs: { align: "align" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3943
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
3944
- type: Component,
3945
- args: [{ selector: 'riv-percentage-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"] }]
3946
- }], propDecorators: { align: [{
3947
- type: Input
3948
- }] } });
3949
-
3950
- function toString(value) {
3951
- if (value === null || value === undefined) {
3952
- return '';
3953
- }
3954
- if (typeof value === 'number') {
3955
- return value.toString();
3956
- }
3957
- return value;
3958
- }
3959
- function toNumber(value) {
3960
- if (value === null || value === undefined || value === '') {
3961
- return null;
3962
- }
3963
- if (typeof value === 'string') {
3964
- const parsed = Number(value);
3965
- return isNaN(parsed) ? null : parsed;
3966
- }
3967
- return value;
3968
- }
3969
- function isStringField(component) {
3970
- return (component instanceof TextFieldComponent ||
3971
- component instanceof AlphabeticFieldComponent ||
3972
- component instanceof PhoneFieldComponent);
3973
- }
3974
- /**
3975
- * Directive that adds Angular Forms API compatibility to Design System input
3976
- * components. Implements ControlValueAccessor to enable ngModel and form
3977
- * validation integration.
3978
- *
3979
- * Generally, the simpler `value`/`valueChange` API is sufficient for use cases
3980
- * in new code; there are some older corners of Rivet's codebase that rely
3981
- * heavily on the Angular Forms API, which Rivet's original input components
3982
- * implemented (incompletely/haphazardly), so this directive serves as a bridge
3983
- * for ease of migration to design system input components in those areas.
3984
- *
3985
- * Example usage:
3986
- * ```html
3987
- * <riv-text-field
3988
- * riv-legacy-form-api
3989
- * label="Name"
3990
- * [(ngModel)]="name"
3991
- * #nameModel="ngModel"
3992
- * ></riv-text-field>
3993
- * ```
3994
- */
3995
- class LegacyFormApiDirective {
3996
- constructor(rivTextField, rivNumberField, rivCurrencyField, rivPercentageField, rivAlphabeticField, rivPhoneField) {
3997
- this.rivTextField = rivTextField;
3998
- this.rivNumberField = rivNumberField;
3999
- this.rivCurrencyField = rivCurrencyField;
4000
- this.rivPercentageField = rivPercentageField;
4001
- this.rivAlphabeticField = rivAlphabeticField;
4002
- this.rivPhoneField = rivPhoneField;
4003
- this.hostComponent = null;
4004
- this.onChange = () => { };
4005
- this.onTouched = () => { };
4006
- }
4007
- ngOnInit() {
4008
- this.detectAndBindHostComponent();
4009
- }
4010
- ngOnDestroy() {
4011
- var _a;
4012
- (_a = this.valueChangeSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
4013
- }
4014
- detectAndBindHostComponent() {
4015
- var _a, _b, _c, _d, _e, _f;
4016
- this.hostComponent =
4017
- (_f = (_e = (_d = (_c = (_b = (_a = this.rivTextField) !== null && _a !== void 0 ? _a : this.rivNumberField) !== null && _b !== void 0 ? _b : this.rivCurrencyField) !== null && _c !== void 0 ? _c : this.rivPercentageField) !== null && _d !== void 0 ? _d : this.rivAlphabeticField) !== null && _e !== void 0 ? _e : this.rivPhoneField) !== null && _f !== void 0 ? _f : null;
4018
- if (!this.hostComponent) {
4019
- // eslint-disable-next-line no-console
4020
- console.warn('LegacyFormApi directive: No supported component found as host');
4021
- return;
4022
- }
4023
- if (isStringField(this.hostComponent)) {
4024
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4025
- this.onChange(value);
4026
- this.onTouched();
4027
- });
4028
- }
4029
- else {
4030
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4031
- this.onChange(value);
4032
- this.onTouched();
4033
- });
4034
- }
4035
- }
4036
- /*
4037
- ControlValueAccessor implementation
4038
- ===================================
4039
-
4040
- Note: Setting properties programmatically on Angular components does not
4041
- trigger their ngOnChanges lifecycle hook to run (this only happens when
4042
- changes happen through the templating system), even if those properties are
4043
- `@Input()`s, so we have to call it manually.
4044
- */
4045
- writeValue(value) {
4046
- if (!this.hostComponent) {
4047
- return;
4048
- }
4049
- if (isStringField(this.hostComponent)) {
4050
- const stringValue = toString(value);
4051
- this.hostComponent.value = stringValue;
4052
- this.hostComponent.ngOnChanges({
4053
- value: new SimpleChange(undefined, stringValue, false),
4054
- });
4055
- }
4056
- else {
4057
- const numberValue = toNumber(value);
4058
- this.hostComponent.value = numberValue;
4059
- this.hostComponent.ngOnChanges({
4060
- value: new SimpleChange(undefined, numberValue, false),
4061
- });
4062
- }
4063
- }
4064
- registerOnChange(fn) {
4065
- this.onChange = fn;
4066
- }
4067
- registerOnTouched(fn) {
4068
- this.onTouched = fn;
4069
- }
4070
- setDisabledState(isDisabled) {
4071
- if (!this.hostComponent) {
4072
- return;
4073
- }
4074
- this.hostComponent.disabled = isDisabled;
4075
- this.hostComponent.ngOnChanges({
4076
- disabled: new SimpleChange(undefined, isDisabled, false),
4077
- });
4078
- }
4079
- }
4080
- LegacyFormApiDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, deps: [{ token: TextFieldComponent, host: true, optional: true }, { token: NumberFieldComponent, host: true, optional: true }, { token: CurrencyFieldComponent, host: true, optional: true }, { token: PercentageFieldComponent, host: true, optional: true }, { token: AlphabeticFieldComponent, host: true, optional: true }, { token: PhoneFieldComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4081
- LegacyFormApiDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: LegacyFormApiDirective, selector: "[riv-legacy-form-api]", providers: [
4082
- {
4083
- provide: NG_VALUE_ACCESSOR,
4084
- useExisting: forwardRef(() => LegacyFormApiDirective),
4085
- multi: true,
4086
- },
4087
- ], ngImport: i0 });
4088
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, decorators: [{
4089
- type: Directive,
4090
- args: [{
4091
- selector: '[riv-legacy-form-api]',
4092
- providers: [
4093
- {
4094
- provide: NG_VALUE_ACCESSOR,
4095
- useExisting: forwardRef(() => LegacyFormApiDirective),
4096
- multi: true,
4097
- },
4098
- ],
4099
- }]
4100
- }], ctorParameters: function () {
4101
- return [{ type: TextFieldComponent, decorators: [{
4102
- type: Optional
4103
- }, {
4104
- type: Host
4105
- }] }, { type: NumberFieldComponent, decorators: [{
4106
- type: Optional
4107
- }, {
4108
- type: Host
4109
- }] }, { type: CurrencyFieldComponent, decorators: [{
4110
- type: Optional
4111
- }, {
4112
- type: Host
4113
- }] }, { type: PercentageFieldComponent, decorators: [{
4114
- type: Optional
4115
- }, {
4116
- type: Host
4117
- }] }, { type: AlphabeticFieldComponent, decorators: [{
4118
- type: Optional
4119
- }, {
4120
- type: Host
4121
- }] }, { type: PhoneFieldComponent, decorators: [{
4122
- type: Optional
4123
- }, {
4124
- type: Host
4125
- }] }];
4126
- } });
4127
-
4128
3865
  /**
4129
3866
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
4130
3867
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4646,6 +4383,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4646
4383
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4647
4384
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4648
4385
 
4386
+ class PercentageFieldComponent extends NumberFieldComponent {
4387
+ constructor() {
4388
+ super(...arguments);
4389
+ this.align = 'right';
4390
+ }
4391
+ }
4392
+ PercentageFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4393
+ PercentageFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PercentageFieldComponent, selector: "riv-percentage-field", inputs: { align: "align" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PercentageFieldComponent, decorators: [{
4395
+ type: Component,
4396
+ args: [{ selector: 'riv-percentage-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n [labelActionText]=\"labelActionText\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n type=\"text\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [class.large]=\"size === 'large'\"\n [style.textAlign]=\"align\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n <span class=\"suffix\" [class.large]=\"size === 'large'\">%</span>\n</riv-input-label>\n", styles: [":host{position:relative}.suffix{position:absolute;right:0;font:var(--input-medium);padding:var(--size-small)}.suffix.large{font:var(--input-large)}input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-xlarge) var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.large{font:var(--input-large);padding:var(--size-medium) var(--size-xlarge) var(--size-medium) var(--size-medium)}\n"] }]
4397
+ }], propDecorators: { align: [{
4398
+ type: Input
4399
+ }] } });
4400
+
4401
+ class PhoneFieldComponent extends TextFieldComponent {
4402
+ constructor() {
4403
+ super(...arguments);
4404
+ this.placeholder = '(123) 456-7890';
4405
+ this.type = 'tel';
4406
+ this.maxLength = 17;
4407
+ }
4408
+ setText() {
4409
+ if (PhoneFieldComponent.clean(this._value) ===
4410
+ PhoneFieldComponent.clean(this._text))
4411
+ return;
4412
+ this._text = PhoneFieldComponent.format(this._value);
4413
+ }
4414
+ set text(t) {
4415
+ this._text = t;
4416
+ this.valueChange.emit(PhoneFieldComponent.clean(t));
4417
+ }
4418
+ get text() {
4419
+ return this._text;
4420
+ }
4421
+ inputBlur() {
4422
+ this._text = PhoneFieldComponent.format(this._text);
4423
+ this.blur.emit(PhoneFieldComponent.clean(this._text));
4424
+ }
4425
+ }
4426
+ PhoneFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4427
+ PhoneFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PhoneFieldComponent, selector: "riv-phone-field", inputs: { placeholder: "placeholder", type: "type", maxLength: "maxLength" }, usesInheritance: true, ngImport: i0, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"], dependencies: [{ kind: "directive", type: AutoFocusDirective, selector: "[riv-auto-focus]", inputs: ["riv-auto-focus"] }, { kind: "component", type: InputLabelComponent, selector: "riv-input-label", inputs: ["label", "help", "required", "labelActionText", "errorMessage", "state"], outputs: ["labelAction"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PhoneFieldComponent, decorators: [{
4429
+ type: Component,
4430
+ args: [{ selector: 'riv-phone-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<riv-input-label\n [label]=\"label\"\n [help]=\"help\"\n [required]=\"required\"\n [labelActionText]=\"labelActionText\"\n [state]=\"state\"\n [errorMessage]=\"errorMessage\"\n (labelAction)=\"labelAction.emit($event)\"\n>\n <input\n #input\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [type]=\"type\"\n [required]=\"required\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [value]=\"text\"\n (input)=\"text = input.value\"\n [class.small]=\"size === 'small'\"\n [class.large]=\"size === 'large'\"\n [attr.maxlength]=\"maxLength\"\n [attr.minlength]=\"minLength\"\n [class.warning]=\"state === 'warning'\"\n [class.error]=\"state === 'error'\"\n [riv-auto-focus]=\"autoFocus\"\n autocomplete=\"off\"\n autocorrect=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n (blur)=\"inputBlur()\"\n />\n</riv-input-label>\n", styles: ["input{width:100%;border:var(--border-width) solid var(--border-light);border-radius:var(--border-radius-small);font:var(--input-medium);color:var(--type-light-high-contrast);padding:var(--size-small) var(--size-medium)}input::placeholder{color:var(--type-light-disabled)}input:disabled{color:var(--type-light-disabled);background-color:var(--surface-light-1)}input:read-only{background-color:var(--surface-light-1)}input:focus{outline:none;border:var(--border-width) solid var(--purp-60)}input.warning{border-color:var(--surface-dark-caution)}input.error{border-color:var(--surface-dark-danger);box-shadow:inset 0 0 0 var(--border-width-large) var(--surface-dark-danger)}input.small{font:var(--input-small);padding:var(--size-small) var(--size-medium)}input.large{font:var(--input-large);padding:var(--size-medium)}\n"] }]
4431
+ }], propDecorators: { placeholder: [{
4432
+ type: Input
4433
+ }], type: [{
4434
+ type: Input
4435
+ }], maxLength: [{
4436
+ type: Input
4437
+ }] } });
4438
+ (function (PhoneFieldComponent) {
4439
+ function clean(v) {
4440
+ const digits = v.replace(/\D/g, '');
4441
+ if (digits.length >= 11 && digits[0] === '1') {
4442
+ return digits.slice(0, 11);
4443
+ }
4444
+ return digits.length > 10 ? digits.slice(0, 10) : digits;
4445
+ }
4446
+ PhoneFieldComponent.clean = clean;
4447
+ function format(value) {
4448
+ const cleaned = clean(value);
4449
+ if (!cleaned)
4450
+ return '';
4451
+ function formatBody(v) {
4452
+ if (v.length <= 3) {
4453
+ return v;
4454
+ }
4455
+ else if (v.length <= 6) {
4456
+ return `(${v.slice(0, 3)}) ${v.slice(3)}`;
4457
+ }
4458
+ else {
4459
+ return `(${v.slice(0, 3)}) ${v.slice(3, 6)}-${v.slice(6, 10)}`;
4460
+ }
4461
+ }
4462
+ if (cleaned.length === 11) {
4463
+ return `1 ${formatBody(cleaned.slice(1))}`;
4464
+ }
4465
+ return formatBody(cleaned);
4466
+ }
4467
+ PhoneFieldComponent.format = format;
4468
+ })(PhoneFieldComponent || (PhoneFieldComponent = {}));
4469
+
4649
4470
  class RadioComponent {
4650
4471
  constructor() {
4651
4472
  this.checked = false;
@@ -6941,10 +6762,19 @@ class SimpleTableComponent {
6941
6762
  const allowedTypes = RivTable.ColumnDataTypes.join(', ');
6942
6763
  throw new Error(`Each header cell must define an appropriate dataType, one of ${allowedTypes}`);
6943
6764
  }
6944
- headerCell.alignment = RivTable.getColumnAlignment(dataType, i === 0);
6945
- headerCell.leftPinOffset = runningWidthTotal;
6765
+ const newAlignment = RivTable.getColumnAlignment(dataType, i === 0);
6766
+ const newLeftPinOffset = runningWidthTotal;
6946
6767
  runningWidthTotal += headerCell.width;
6947
- headerCell.cdr.markForCheck();
6768
+ const changed = headerCell.alignment != newAlignment ||
6769
+ headerCell.leftPinOffset != newLeftPinOffset;
6770
+ headerCell.alignment = newAlignment;
6771
+ headerCell.leftPinOffset = newLeftPinOffset;
6772
+ // Only mark for check when changed to prevent infinite cycles
6773
+ if (changed) {
6774
+ queueMicrotask(() => {
6775
+ headerCell.cdr.markForCheck();
6776
+ });
6777
+ }
6948
6778
  });
6949
6779
  const getCellCoordinates = createCellCoordinateCalculator(dataCells.map(dataCell => {
6950
6780
  const element = dataCell.elementRef.nativeElement;
@@ -6957,13 +6787,25 @@ class SimpleTableComponent {
6957
6787
  dataCells.forEach((dataCell, cellIndex) => {
6958
6788
  const bounds = getCellCoordinates(cellIndex);
6959
6789
  const headerCell = headerCells.get(bounds.start.col);
6790
+ let changed = false;
6960
6791
  if (headerCell) {
6792
+ changed =
6793
+ dataCell.alignment != headerCell.alignment ||
6794
+ dataCell.pinned != headerCell.pinned ||
6795
+ dataCell.leftPinOffset != headerCell.leftPinOffset;
6961
6796
  dataCell.alignment = headerCell.alignment;
6962
6797
  dataCell.pinned = headerCell.pinned;
6963
6798
  dataCell.leftPinOffset = headerCell.leftPinOffset;
6964
6799
  }
6965
- dataCell.isLastRow = bounds.end.row === maxRow;
6966
- dataCell.cdr.markForCheck();
6800
+ const newIsLastRow = bounds.end.row === maxRow;
6801
+ changed = changed || dataCell.isLastRow != newIsLastRow;
6802
+ dataCell.isLastRow = newIsLastRow;
6803
+ // Only mark for check when changed to prevent infinite cycles
6804
+ if (changed) {
6805
+ queueMicrotask(() => {
6806
+ dataCell.cdr.markForCheck();
6807
+ });
6808
+ }
6967
6809
  });
6968
6810
  }
6969
6811
  }
@@ -9832,7 +9674,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9832
9674
  IconComponent,
9833
9675
  InputLabelComponent,
9834
9676
  IssueComponent,
9835
- LegacyFormApiDirective,
9836
9677
  LegendItemComponent,
9837
9678
  LinkComponent,
9838
9679
  LoadingComponent,
@@ -9925,7 +9766,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9925
9766
  IconComponent,
9926
9767
  InputLabelComponent,
9927
9768
  IssueComponent,
9928
- LegacyFormApiDirective,
9929
9769
  LegendItemComponent,
9930
9770
  LinkComponent,
9931
9771
  LoadingComponent,
@@ -10022,7 +9862,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10022
9862
  IconComponent,
10023
9863
  InputLabelComponent,
10024
9864
  IssueComponent,
10025
- LegacyFormApiDirective,
10026
9865
  LegendItemComponent,
10027
9866
  LinkComponent,
10028
9867
  LoadingComponent,
@@ -10118,7 +9957,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10118
9957
  IconComponent,
10119
9958
  InputLabelComponent,
10120
9959
  IssueComponent,
10121
- LegacyFormApiDirective,
10122
9960
  LegendItemComponent,
10123
9961
  LinkComponent,
10124
9962
  LoadingComponent,
@@ -10187,5 +10025,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10187
10025
  * Generated bundle index. Do not edit.
10188
10026
  */
10189
10027
 
10190
- export { ANIMATION_CONSTANTS, AllViewsModalComponent, AlphabeticFieldComponent, AutoFocusDirective, BadgeComponent, BannerActionComponent, BannerComponent, ButtonComponent, ButtonGroupComponent, CalloutComponent, CardCheckboxComponent, Chart, ChartComponent, CheckboxComponent, CurrencyFieldComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DateComponent, DatePipe, DateRangeComponent, DaysPipe, DialogComponent, DollarsPipe, DonutComponent, DownloadService, EditViewComponent, FunnelChartComponent, HelpComponent, HighlightComponent, IconComponent, InputLabelComponent, IssueComponent, LegacyFormApiDirective, LegendItemComponent, LinkComponent, LoadingComponent, LoadingCoverComponent, LockedTooltipDirective, MentionsInputComponent, MenuComponent, MenuDividerComponent, MenuItemComponent, MetricComponent, ModalComponent, NotificationBadgeComponent, NumberFieldComponent, NumberPipe, OptionGroupPipe, OverlayDirective, OverlayOutletComponent, PercentageFieldComponent, PercentagePipe, PhoneFieldComponent, ProgressComponent, RadioComponent, RivModule, RivSelect, RivTable, RivViews, SVGTextTruncateDirective, SearchComponent, SelectComponent, SelectNodeComponent, SideSheetComponent, SimpleSelectComponent, SimpleTableCellComponent, SimpleTableComponent, SimpleTableHeaderCellComponent, SimpleTableRowComponent, SizeDirective, SmallCurrencyPipe, SrOnlyComponent, StackedColumnComponent, StackedRowComponent, SwitchCheckboxComponent, TabComponent, TableColumnSettingsComponent, TableColumnSettingsSideSheetComponent, TableComponent, TableCsvExportComponent, TableSearchColumnsComponent, TableSearchComponent, TabsComponent, TextFieldComponent, TextareaFieldComponent, TimeSeriesComponent, ToastActionComponent, ToastComponent, TooltipComponent, TooltipDirective, TrendComponent, TruncateComponent, ValidationMessageComponent, ViewMenuComponent, ViewsComponent, VisibilityDirective, ZeroStateComponent };
10028
+ 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 };
10191
10029
  //# sourceMappingURL=rivet-health-design-system.mjs.map