@rivet-health/design-system 31.8.2 → 31.9.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, ViewEncapsulation, ContentChildren, TemplateRef, NgModule } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, Injectable, Inject, Pipe, Directive, Input, EventEmitter, Output, ViewChild, ViewContainerRef, HostListener, Self, HostBinding, Optional, ContentChild, ElementRef, SimpleChange, forwardRef, Host, ViewEncapsulation, ContentChildren, TemplateRef, NgModule } from '@angular/core';
3
3
  import { __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,6 +8,7 @@ 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';
11
12
  import { query, style, animate, trigger, transition, group } from '@angular/animations';
12
13
  import * as i2 from '@angular/router';
13
14
  import { RouterModule } from '@angular/router';
@@ -3862,6 +3863,272 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
3862
3863
  DateComponent.Sizes = ['small', 'medium', 'large'];
3863
3864
  })(DateComponent || (DateComponent = {}));
3864
3865
 
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
+
3865
4132
  /**
3866
4133
  * A rich text input component that allows users to type text and mention other users by typing `@` followed by a name.
3867
4134
  * Uses a `contenteditable` div instead of a traditional input/textarea.
@@ -4383,90 +4650,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
4383
4650
  MentionsInputComponent.contentToPlainText = contentToPlainText;
4384
4651
  })(MentionsInputComponent || (MentionsInputComponent = {}));
4385
4652
 
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
-
4470
4653
  class RadioComponent {
4471
4654
  constructor() {
4472
4655
  this.checked = false;
@@ -9653,12 +9836,14 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9653
9836
  IconComponent,
9654
9837
  InputLabelComponent,
9655
9838
  IssueComponent,
9839
+ LegacyFormApiDirective,
9656
9840
  LegendItemComponent,
9657
9841
  LinkComponent,
9658
9842
  LoadingComponent,
9659
9843
  LoadingCoverComponent,
9660
9844
  LockedTooltipDirective,
9661
9845
  LockScrollDirective,
9846
+ MentionsInputComponent,
9662
9847
  MenuComponent,
9663
9848
  MenuDividerComponent,
9664
9849
  MenuItemComponent,
@@ -9702,7 +9887,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9702
9887
  TabsComponent,
9703
9888
  TextareaFieldComponent,
9704
9889
  TextFieldComponent,
9705
- MentionsInputComponent,
9706
9890
  TimeSeriesComponent,
9707
9891
  ToastActionComponent,
9708
9892
  ToastComponent,
@@ -9745,11 +9929,13 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9745
9929
  IconComponent,
9746
9930
  InputLabelComponent,
9747
9931
  IssueComponent,
9932
+ LegacyFormApiDirective,
9748
9933
  LegendItemComponent,
9749
9934
  LinkComponent,
9750
9935
  LoadingComponent,
9751
9936
  LoadingCoverComponent,
9752
9937
  LockedTooltipDirective,
9938
+ MentionsInputComponent,
9753
9939
  MenuComponent,
9754
9940
  MenuDividerComponent,
9755
9941
  MenuItemComponent,
@@ -9791,7 +9977,6 @@ RivModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.
9791
9977
  TabsComponent,
9792
9978
  TextareaFieldComponent,
9793
9979
  TextFieldComponent,
9794
- MentionsInputComponent,
9795
9980
  TimeSeriesComponent,
9796
9981
  ToastActionComponent,
9797
9982
  ToastComponent,
@@ -9841,12 +10026,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9841
10026
  IconComponent,
9842
10027
  InputLabelComponent,
9843
10028
  IssueComponent,
10029
+ LegacyFormApiDirective,
9844
10030
  LegendItemComponent,
9845
10031
  LinkComponent,
9846
10032
  LoadingComponent,
9847
10033
  LoadingCoverComponent,
9848
10034
  LockedTooltipDirective,
9849
10035
  LockScrollDirective,
10036
+ MentionsInputComponent,
9850
10037
  MenuComponent,
9851
10038
  MenuDividerComponent,
9852
10039
  MenuItemComponent,
@@ -9890,7 +10077,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9890
10077
  TabsComponent,
9891
10078
  TextareaFieldComponent,
9892
10079
  TextFieldComponent,
9893
- MentionsInputComponent,
9894
10080
  TimeSeriesComponent,
9895
10081
  ToastActionComponent,
9896
10082
  ToastComponent,
@@ -9936,11 +10122,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9936
10122
  IconComponent,
9937
10123
  InputLabelComponent,
9938
10124
  IssueComponent,
10125
+ LegacyFormApiDirective,
9939
10126
  LegendItemComponent,
9940
10127
  LinkComponent,
9941
10128
  LoadingComponent,
9942
10129
  LoadingCoverComponent,
9943
10130
  LockedTooltipDirective,
10131
+ MentionsInputComponent,
9944
10132
  MenuComponent,
9945
10133
  MenuDividerComponent,
9946
10134
  MenuItemComponent,
@@ -9982,7 +10170,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9982
10170
  TabsComponent,
9983
10171
  TextareaFieldComponent,
9984
10172
  TextFieldComponent,
9985
- MentionsInputComponent,
9986
10173
  TimeSeriesComponent,
9987
10174
  ToastActionComponent,
9988
10175
  ToastComponent,
@@ -10004,5 +10191,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
10004
10191
  * Generated bundle index. Do not edit.
10005
10192
  */
10006
10193
 
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 };
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 };
10008
10195
  //# sourceMappingURL=rivet-health-design-system.mjs.map