@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 { __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,272 +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
- this.hostComponent =
4016
- this.rivTextField ||
4017
- this.rivNumberField ||
4018
- this.rivCurrencyField ||
4019
- this.rivPercentageField ||
4020
- this.rivAlphabeticField ||
4021
- this.rivPhoneField;
4022
- if (!this.hostComponent) {
4023
- // eslint-disable-next-line no-console
4024
- console.warn('LegacyFormApi directive: No supported component found as host');
4025
- return;
4026
- }
4027
- if (isStringField(this.hostComponent)) {
4028
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4029
- this.onChange(value);
4030
- this.onTouched();
4031
- });
4032
- }
4033
- else {
4034
- this.valueChangeSubscription = this.hostComponent.valueChange.subscribe((value) => {
4035
- this.onChange(value);
4036
- this.onTouched();
4037
- });
4038
- }
4039
- }
4040
- /*
4041
- ControlValueAccessor implementation
4042
- ===================================
4043
-
4044
- Note: Setting properties programmatically on Angular components does not
4045
- trigger their ngOnChanges lifecycle hook to run (this only happens when
4046
- changes happen through the templating system), even if those properties are
4047
- `@Input()`s, so we have to call it manually.
4048
- */
4049
- writeValue(value) {
4050
- if (!this.hostComponent) {
4051
- return;
4052
- }
4053
- if (isStringField(this.hostComponent)) {
4054
- const stringValue = toString(value);
4055
- this.hostComponent.value = stringValue;
4056
- this.hostComponent.ngOnChanges({
4057
- value: new SimpleChange(undefined, stringValue, false),
4058
- });
4059
- }
4060
- else {
4061
- const numberValue = toNumber(value);
4062
- this.hostComponent.value = numberValue;
4063
- this.hostComponent.ngOnChanges({
4064
- value: new SimpleChange(undefined, numberValue, false),
4065
- });
4066
- }
4067
- }
4068
- registerOnChange(fn) {
4069
- this.onChange = fn;
4070
- }
4071
- registerOnTouched(fn) {
4072
- this.onTouched = fn;
4073
- }
4074
- setDisabledState(isDisabled) {
4075
- if (!this.hostComponent) {
4076
- return;
4077
- }
4078
- this.hostComponent.disabled = isDisabled;
4079
- this.hostComponent.ngOnChanges({
4080
- disabled: new SimpleChange(undefined, isDisabled, false),
4081
- });
4082
- }
4083
- }
4084
- 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 });
4085
- LegacyFormApiDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: LegacyFormApiDirective, selector: "[riv-legacy-form-api]", providers: [
4086
- {
4087
- provide: NG_VALUE_ACCESSOR,
4088
- useExisting: forwardRef(() => LegacyFormApiDirective),
4089
- multi: true,
4090
- },
4091
- ], ngImport: i0 });
4092
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LegacyFormApiDirective, decorators: [{
4093
- type: Directive,
4094
- args: [{
4095
- selector: '[riv-legacy-form-api]',
4096
- providers: [
4097
- {
4098
- provide: NG_VALUE_ACCESSOR,
4099
- useExisting: forwardRef(() => LegacyFormApiDirective),
4100
- multi: true,
4101
- },
4102
- ],
4103
- }]
4104
- }], ctorParameters: function () {
4105
- return [{ type: TextFieldComponent, decorators: [{
4106
- type: Optional
4107
- }, {
4108
- type: Host
4109
- }] }, { type: NumberFieldComponent, decorators: [{
4110
- type: Optional
4111
- }, {
4112
- type: Host
4113
- }] }, { type: CurrencyFieldComponent, decorators: [{
4114
- type: Optional
4115
- }, {
4116
- type: Host
4117
- }] }, { type: PercentageFieldComponent, decorators: [{
4118
- type: Optional
4119
- }, {
4120
- type: Host
4121
- }] }, { type: AlphabeticFieldComponent, decorators: [{
4122
- type: Optional
4123
- }, {
4124
- type: Host
4125
- }] }, { type: PhoneFieldComponent, decorators: [{
4126
- type: Optional
4127
- }, {
4128
- type: Host
4129
- }] }];
4130
- } });
4131
-
4132
3865
  /**
4133
3866
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
4134
3867
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4650,6 +4383,90 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4650
4383
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4651
4384
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4652
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
+
4653
4470
  class RadioComponent {
4654
4471
  constructor() {
4655
4472
  this.checked = false;
@@ -9836,7 +9653,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9836
9653
  IconComponent,
9837
9654
  InputLabelComponent,
9838
9655
  IssueComponent,
9839
- LegacyFormApiDirective,
9840
9656
  LegendItemComponent,
9841
9657
  LinkComponent,
9842
9658
  LoadingComponent,
@@ -9929,7 +9745,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9929
9745
  IconComponent,
9930
9746
  InputLabelComponent,
9931
9747
  IssueComponent,
9932
- LegacyFormApiDirective,
9933
9748
  LegendItemComponent,
9934
9749
  LinkComponent,
9935
9750
  LoadingComponent,
@@ -10026,7 +9841,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10026
9841
  IconComponent,
10027
9842
  InputLabelComponent,
10028
9843
  IssueComponent,
10029
- LegacyFormApiDirective,
10030
9844
  LegendItemComponent,
10031
9845
  LinkComponent,
10032
9846
  LoadingComponent,
@@ -10122,7 +9936,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10122
9936
  IconComponent,
10123
9937
  InputLabelComponent,
10124
9938
  IssueComponent,
10125
- LegacyFormApiDirective,
10126
9939
  LegendItemComponent,
10127
9940
  LinkComponent,
10128
9941
  LoadingComponent,
@@ -10191,5 +10004,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10191
10004
  * Generated bundle index. Do not edit.
10192
10005
  */
10193
10006
 
10194
- 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 };
10007
+ export { ANIMATION_CONSTANTS, AllViewsModalComponent, AlphabeticFieldComponent, AutoFocusDirective, BadgeComponent, BannerActionComponent, BannerComponent, ButtonComponent, ButtonGroupComponent, CalloutComponent, CardCheckboxComponent, Chart, ChartComponent, CheckboxComponent, CurrencyFieldComponent, DataTableCellComponent, DataTableComponent, DataTableHeaderCellComponent, DataTableRowComponent, DateComponent, DatePipe, DateRangeComponent, DaysPipe, DialogComponent, DollarsPipe, DonutComponent, DownloadService, EditViewComponent, FunnelChartComponent, HelpComponent, HighlightComponent, IconComponent, InputLabelComponent, IssueComponent, LegendItemComponent, LinkComponent, LoadingComponent, LoadingCoverComponent, LockedTooltipDirective, MentionsInputComponent, MenuComponent, MenuDividerComponent, MenuItemComponent, MetricComponent, ModalComponent, NotificationBadgeComponent, NumberFieldComponent, NumberPipe, OptionGroupPipe, OverlayDirective, OverlayOutletComponent, PercentageFieldComponent, PercentagePipe, PhoneFieldComponent, ProgressComponent, RadioComponent, RivModule, RivSelect, RivTable, RivViews, SVGTextTruncateDirective, SearchComponent, SelectComponent, SelectNodeComponent, SideSheetComponent, SimpleSelectComponent, SimpleTableCellComponent, SimpleTableComponent, SimpleTableHeaderCellComponent, SimpleTableRowComponent, SizeDirective, SmallCurrencyPipe, SrOnlyComponent, StackedColumnComponent, StackedRowComponent, SwitchCheckboxComponent, TabComponent, TableColumnSettingsComponent, TableColumnSettingsSideSheetComponent, TableComponent, TableCsvExportComponent, TableSearchColumnsComponent, TableSearchComponent, TabsComponent, TextFieldComponent, TextareaFieldComponent, TimeSeriesComponent, ToastActionComponent, ToastComponent, TooltipComponent, TooltipDirective, TrendComponent, TruncateComponent, ValidationMessageComponent, ViewMenuComponent, ViewsComponent, VisibilityDirective, ZeroStateComponent };
10195
10008
  //# sourceMappingURL=rivet-health-design-system.mjs.map