carbon-components-angular 5.28.5 → 5.29.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.
- package/docs/documentation/classes/NumberChange.html +5 -0
- package/docs/documentation/components/ComboBox.html +1 -1
- package/docs/documentation/components/NumberComponent.html +105 -64
- package/docs/documentation/components/TableCheckbox.html +24 -22
- package/docs/documentation/components/TableHeadCheckbox.html +20 -18
- package/docs/documentation/components/Toggle.html +37 -31
- package/docs/documentation/coverage.html +3 -3
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboBoxModule.html +4 -4
- package/docs/documentation/modules/ContentSwitcherModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ContentSwitcherModule.html +4 -4
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +37 -41
- package/docs/documentation/modules/DatePickerInputModule.html +37 -41
- package/docs/documentation/modules/DatePickerModule/dependencies.svg +38 -38
- package/docs/documentation/modules/DatePickerModule.html +38 -38
- package/docs/documentation/modules/GridModule/dependencies.svg +60 -60
- package/docs/documentation/modules/GridModule.html +60 -60
- package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LoadingModule.html +4 -4
- package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NFormsModule.html +4 -4
- package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NumberModule.html +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +4 -4
- package/docs/documentation/modules/RadioModule.html +4 -4
- package/docs/documentation/modules/SelectModule/dependencies.svg +58 -58
- package/docs/documentation/modules/SelectModule.html +58 -58
- package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SliderModule.html +4 -4
- package/docs/documentation/modules/TableModule/dependencies.svg +216 -216
- package/docs/documentation/modules/TableModule.html +216 -216
- package/docs/documentation/modules/TabsModule/dependencies.svg +69 -69
- package/docs/documentation/modules/TabsModule.html +69 -69
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +100 -100
- package/docs/documentation/modules/TilesModule.html +100 -100
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TimePickerModule.html +4 -4
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +42 -46
- package/docs/documentation/modules/TimePickerSelectModule.html +42 -46
- package/docs/documentation/modules/ToggleModule/dependencies.svg +20 -20
- package/docs/documentation/modules/ToggleModule.html +20 -20
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +38 -38
- package/docs/documentation/modules/ToggletipModule.html +38 -38
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +34 -34
- package/docs/documentation/modules/TreeviewModule.html +34 -34
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +146 -135
- package/docs/storybook/{5868.7630f57b.iframe.bundle.js → 5868.06f13966.iframe.bundle.js} +1 -1
- package/docs/storybook/{icon-icon-stories.fb7a98ad.iframe.bundle.js → icon-icon-stories.7926f3ba.iframe.bundle.js} +1 -1
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/main.f423084e.iframe.bundle.js +1 -0
- package/docs/storybook/{number-input-number-stories.9417488b.iframe.bundle.js → number-input-number-stories.a1953960.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.8999107e.iframe.bundle.js → runtime~main.c24c8c1d.iframe.bundle.js} +1 -1
- package/esm2020/combobox/combobox.component.mjs +1 -1
- package/esm2020/number-input/number.component.mjs +13 -2
- package/esm2020/table/cell/table-checkbox.component.mjs +7 -5
- package/esm2020/table/head/table-head-checkbox.component.mjs +5 -3
- package/esm2020/toggle/toggle.component.mjs +6 -1
- package/fesm2015/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-number-input.mjs +12 -1
- package/fesm2015/carbon-components-angular-number-input.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-table.mjs +10 -6
- package/fesm2015/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-toggle.mjs +5 -0
- package/fesm2015/carbon-components-angular-toggle.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-number-input.mjs +12 -1
- package/fesm2020/carbon-components-angular-number-input.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-table.mjs +10 -6
- package/fesm2020/carbon-components-angular-table.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-toggle.mjs +5 -0
- package/fesm2020/carbon-components-angular-toggle.mjs.map +1 -1
- package/number-input/number.component.d.ts +5 -1
- package/package.json +1 -1
- package/toggle/toggle.component.d.ts +5 -0
- package/docs/storybook/main.2d2aa1ba.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -6889,12 +6889,12 @@
|
|
|
6889
6889
|
},
|
|
6890
6890
|
{
|
|
6891
6891
|
"name": "NumberChange",
|
|
6892
|
-
"id": "class-NumberChange-
|
|
6892
|
+
"id": "class-NumberChange-2f449d61d6c7a726610fa6f48642317885ec439e1e43c3e9d823cc6cf84fcb1fe78637ea04c8a663b32884c4cb5f96f153184844b5d4aa49daeaf562fc1c47fd",
|
|
6893
6893
|
"file": "src/number-input/number.component.ts",
|
|
6894
6894
|
"deprecated": false,
|
|
6895
6895
|
"deprecationMessage": "",
|
|
6896
6896
|
"type": "class",
|
|
6897
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
6897
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
6898
6898
|
"inputsClass": [],
|
|
6899
6899
|
"outputsClass": [],
|
|
6900
6900
|
"properties": [
|
|
@@ -22614,7 +22614,7 @@
|
|
|
22614
22614
|
},
|
|
22615
22615
|
{
|
|
22616
22616
|
"name": "ComboBox",
|
|
22617
|
-
"id": "component-ComboBox-
|
|
22617
|
+
"id": "component-ComboBox-ea87abde056d48acdd4defa7cadba6b200f40fb98c6840f796f15e02b907c03703086503bb2e4166713af9e5162fa943d501d56ed916e0ea112967e6bb5c7d20",
|
|
22618
22618
|
"file": "src/combobox/combobox.component.ts",
|
|
22619
22619
|
"encapsulation": [],
|
|
22620
22620
|
"entryComponents": [],
|
|
@@ -23747,7 +23747,7 @@
|
|
|
23747
23747
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ComboBoxModule } from 'carbon-components-angular';</code></pre></div><p>ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide "pills" of selected items.</p>\n<p><a href=\"../../?path=/story/components-combobox--basic\">See demo</a></p>\n",
|
|
23748
23748
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ComboBoxModule } from 'carbon-components-angular';\n```\n\nComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide \"pills\" of selected items.\n\n[See demo](../../?path=/story/components-combobox--basic)\n",
|
|
23749
23749
|
"type": "component",
|
|
23750
|
-
"sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\n * ```\n *\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div class=\"cds--list-box__wrapper\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"labelId\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `dropdown-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `dropdown-label-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\t@HostBinding(\"style.display\") display = \"block\";\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\toutsideClick = this._outsideClick.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif (this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis.propagateChangeCallback(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.selected.emit(event);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.preventDefault();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.items = this.items;\n\t\tthis.updatePills();\n\t\t// clearSelected can only fire on type=multi\n\t\t// so we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\t\tthis.propagateChangeCallback(selected);\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\t\t\n\t\tif (this.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Handles clicks outside of the `Dropdown` list.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n}\n",
|
|
23750
|
+
"sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\n * ```\n *\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div class=\"cds--list-box__wrapper\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"labelId\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `dropdown-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `dropdown-label-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\t@HostBinding(\"style.display\") display = \"block\";\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\toutsideClick = this._outsideClick.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif (this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis.propagateChangeCallback(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.selected.emit(event);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.propagateChangeCallback(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis.propagateChangeCallback(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.preventDefault();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.items = this.items;\n\t\tthis.updatePills();\n\t\t// clearSelected can only fire on type=multi\n\t\t// so we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\t\tthis.propagateChangeCallback(selected);\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\n\t\tif (this.disabled) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Handles clicks outside of the `Dropdown` list.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n}\n",
|
|
23751
23751
|
"assetsDirs": [],
|
|
23752
23752
|
"styleUrlsData": "",
|
|
23753
23753
|
"stylesData": "",
|
|
@@ -36149,7 +36149,7 @@
|
|
|
36149
36149
|
},
|
|
36150
36150
|
{
|
|
36151
36151
|
"name": "ManyIconDemo",
|
|
36152
|
-
"id": "component-ManyIconDemo-
|
|
36152
|
+
"id": "component-ManyIconDemo-4dc8e54ce44830aee1cad09a9f037497b8b861fd6a6917d49f10cb673a952246016d4f9aa756b8df7073ec4aaacde3c7bb6715519b386351ec01a88ad4740482",
|
|
36153
36153
|
"file": "src/icon/stories/many-icons-demo.component.ts",
|
|
36154
36154
|
"encapsulation": [],
|
|
36155
36155
|
"entryComponents": [],
|
|
@@ -36189,7 +36189,7 @@
|
|
|
36189
36189
|
"description": "",
|
|
36190
36190
|
"rawdescription": "\n",
|
|
36191
36191
|
"type": "component",
|
|
36192
|
-
"sourceCode": "import { Component, OnInit } from \"@angular/core\";\nimport * as Icons from \"@carbon/icons\";\n\nimport { IconService } from \"../\";\n\n@Component({\n\tselector: \"app-demo-many-icon\",\n\ttemplate: `\n\t\t<table>\n\t\t\t<tr *ngFor=\"let group of groupedIcons\">\n\t\t\t\t<td *ngFor=\"let icon of group\">\n\t\t\t\t\t<svg [cdsIcon]=\"icon.name\" [size]=\"icon.size\"></svg>\n\t\t\t\t\t<div>name: <code>{{icon.name}}</code></div>\n\t\t\t\t\t<div>size: <code>{{icon.size}}</code></div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t`,\n\tstyles: [\n\t\t`\n\t\t\ttd {\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tpadding: 10px 0;\n\t\t\t}\n\t\t`\n\t]\n})\nexport class ManyIconDemo implements OnInit {\n\tgroupedIcons: any = [];\n\n\tconstructor(protected iconService: IconService) { }\n\n\tngOnInit() {\n\t\tconst iconMap = new Map();\n\t\tfor (const descriptor of Object.values(Icons)) {\n\t\t\tthis.iconService.register(descriptor as any);\n\t\t\tif (typeof descriptor === \"object\" && descriptor) {\n\t\t\t\tif (!iconMap.has(descriptor[\"name\"])) {\n\t\t\t\t\ticonMap.set(descriptor[\"name\"], []);\n\t\t\t\t}\n\t\t\t\ticonMap.get(descriptor[\"name\"]).push(descriptor);\n\t\t\t}\n\t\t}\n\t\tthis.groupedIcons = Array.from(iconMap.values());\n\t}\n}\n",
|
|
36192
|
+
"sourceCode": "import { Component, OnInit } from \"@angular/core\";\nimport * as Icons from \"@carbon/icons\";\n\nimport { IconService } from \"../\";\n\n@Component({\n\tselector: \"app-demo-many-icon\",\n\ttemplate: `\n\t\t<table>\n\t\t\t<tr *ngFor=\"let group of groupedIcons\">\n\t\t\t\t<td *ngFor=\"let icon of group\">\n\t\t\t\t\t<svg [cdsIcon]=\"icon.name\" [size]=\"icon.size\"></svg>\n\t\t\t\t\t<div>name: <code>{{icon.name}}</code></div>\n\t\t\t\t\t<div>size: <code>{{icon.size}}</code></div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t`,\n\tstyles: [\n\t\t`\n\t\t\ttd {\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tpadding: 10px 0;\n\t\t\t}\n\t\t`\n\t]\n})\nexport class ManyIconDemo implements OnInit {\n\tgroupedIcons: any = [];\n\n\tconstructor(protected iconService: IconService) { }\n\n\tngOnInit() {\n\t\tconst iconMap = new Map();\n\t\tfor (const descriptor of Object.values(Icons)) {\n\t\t\tthis.iconService.register(descriptor as any);\n\t\t\tif (typeof descriptor === \"object\" && descriptor) {\n\t\t\t\tif (!iconMap.has(descriptor[\"name\"])) {\n\t\t\t\t\ticonMap.set(descriptor[\"name\"], []);\n\t\t\t\t}\n\t\t\t\ticonMap.get(descriptor[\"name\"]).push(descriptor);\n\t\t\t}\n\t\t}\n\t\t// Render after a delay to prevent page from freezing\n\t\tsetTimeout(() => {\n\t\t\tthis.groupedIcons = Array.from(iconMap.values());\n\t\t}, 1000);\n\t}\n}\n",
|
|
36193
36193
|
"assetsDirs": [],
|
|
36194
36194
|
"styleUrlsData": "",
|
|
36195
36195
|
"stylesData": "\n\t\t\ttd {\n\t\t\t\twhite-space: nowrap;\n\t\t\t\tpadding: 10px 0;\n\t\t\t}\n\t\t\n",
|
|
@@ -37839,7 +37839,7 @@
|
|
|
37839
37839
|
},
|
|
37840
37840
|
{
|
|
37841
37841
|
"name": "NumberComponent",
|
|
37842
|
-
"id": "component-NumberComponent-
|
|
37842
|
+
"id": "component-NumberComponent-2f449d61d6c7a726610fa6f48642317885ec439e1e43c3e9d823cc6cf84fcb1fe78637ea04c8a663b32884c4cb5f96f153184844b5d4aa49daeaf562fc1c47fd",
|
|
37843
37843
|
"file": "src/number-input/number.component.ts",
|
|
37844
37844
|
"encapsulation": [],
|
|
37845
37845
|
"entryComponents": [],
|
|
@@ -37854,7 +37854,7 @@
|
|
|
37854
37854
|
"selector": "cds-number, ibm-number",
|
|
37855
37855
|
"styleUrls": [],
|
|
37856
37856
|
"styles": [],
|
|
37857
|
-
"template": "<div\n\tdata-numberinput\n\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\tclass=\"cds--number\"\n\t[ngClass]=\"{\n\t\t'cds--number--light': theme === 'light',\n\t\t'cds--number--nolabel': !label,\n\t\t'cds--number--helpertext': helperText,\n\t\t'cds--skeleton' : skeleton,\n\t\t'cds--number--sm': size === 'sm',\n\t\t'cds--number--md': size === 'md',\n\t\t'cds--number--lg': size === 'lg'\n\t}\">\n\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t<label\n\t\t*ngIf=\"!skeleton && label\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--number__input-wrapper\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t}\">\n\t\t<input\n\t\t\ttype=\"number\"\n\t\t\t[id]=\"id\"\n\t\t\t[value]=\"value\"\n\t\t\t[attr.min]=\"min\"\n\t\t\t[attr.max]=\"max\"\n\t\t\t[attr.step]=\"step\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[required]=\"required\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t<svg\n\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--number__invalid\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t</svg>\n\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t<button\n\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t<button\n\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t</div>\n\t</div>\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n</div>\n\t",
|
|
37857
|
+
"template": "<div\n\tdata-numberinput\n\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\tclass=\"cds--number\"\n\t[ngClass]=\"{\n\t\t'cds--number--light': theme === 'light',\n\t\t'cds--number--nolabel': !label,\n\t\t'cds--number--helpertext': helperText,\n\t\t'cds--skeleton' : skeleton,\n\t\t'cds--number--sm': size === 'sm',\n\t\t'cds--number--md': size === 'md',\n\t\t'cds--number--lg': size === 'lg'\n\t}\">\n\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t<label\n\t\t*ngIf=\"!skeleton && label\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--number__input-wrapper\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t}\">\n\t\t<input\n\t\t\ttype=\"number\"\n\t\t\t[id]=\"id\"\n\t\t\t[value]=\"value\"\n\t\t\t[attr.min]=\"min\"\n\t\t\t[attr.max]=\"max\"\n\t\t\t[attr.step]=\"step\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[required]=\"required\"\n\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t[placeholder]=\"placeholder\"\n\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t<svg\n\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--number__invalid\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t</svg>\n\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t<button\n\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t<button\n\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\taria-live=\"polite\"\n\t\t\t\taria-atomic=\"true\"\n\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t</div>\n\t</div>\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n</div>\n\t",
|
|
37858
37858
|
"templateUrl": [],
|
|
37859
37859
|
"viewProviders": [],
|
|
37860
37860
|
"hostDirectives": [],
|
|
@@ -37865,7 +37865,7 @@
|
|
|
37865
37865
|
"deprecationMessage": "",
|
|
37866
37866
|
"rawdescription": "\n\nSets the arialabel for input\n",
|
|
37867
37867
|
"description": "<p>Sets the arialabel for input</p>\n",
|
|
37868
|
-
"line":
|
|
37868
|
+
"line": 244,
|
|
37869
37869
|
"type": "string",
|
|
37870
37870
|
"decorators": []
|
|
37871
37871
|
},
|
|
@@ -37873,7 +37873,7 @@
|
|
|
37873
37873
|
"name": "decrementLabel",
|
|
37874
37874
|
"deprecated": false,
|
|
37875
37875
|
"deprecationMessage": "",
|
|
37876
|
-
"line":
|
|
37876
|
+
"line": 251,
|
|
37877
37877
|
"type": "string | Observable",
|
|
37878
37878
|
"decorators": []
|
|
37879
37879
|
},
|
|
@@ -37884,7 +37884,7 @@
|
|
|
37884
37884
|
"deprecationMessage": "",
|
|
37885
37885
|
"rawdescription": "\n\nSet to `true` for a disabled number input.\n",
|
|
37886
37886
|
"description": "<p>Set to <code>true</code> for a disabled number input.</p>\n",
|
|
37887
|
-
"line":
|
|
37887
|
+
"line": 166,
|
|
37888
37888
|
"type": "boolean",
|
|
37889
37889
|
"decorators": []
|
|
37890
37890
|
},
|
|
@@ -37894,7 +37894,7 @@
|
|
|
37894
37894
|
"deprecationMessage": "",
|
|
37895
37895
|
"rawdescription": "\n\nSets the optional helper text.\n",
|
|
37896
37896
|
"description": "<p>Sets the optional helper text.</p>\n",
|
|
37897
|
-
"line":
|
|
37897
|
+
"line": 220,
|
|
37898
37898
|
"type": "string | TemplateRef<any>",
|
|
37899
37899
|
"decorators": []
|
|
37900
37900
|
},
|
|
@@ -37905,7 +37905,7 @@
|
|
|
37905
37905
|
"deprecationMessage": "",
|
|
37906
37906
|
"rawdescription": "\n\nThe unique id for the number component.\n",
|
|
37907
37907
|
"description": "<p>The unique id for the number component.</p>\n",
|
|
37908
|
-
"line":
|
|
37908
|
+
"line": 178,
|
|
37909
37909
|
"type": "string",
|
|
37910
37910
|
"decorators": []
|
|
37911
37911
|
},
|
|
@@ -37913,7 +37913,7 @@
|
|
|
37913
37913
|
"name": "incrementLabel",
|
|
37914
37914
|
"deprecated": false,
|
|
37915
37915
|
"deprecationMessage": "",
|
|
37916
|
-
"line":
|
|
37916
|
+
"line": 260,
|
|
37917
37917
|
"type": "string | Observable",
|
|
37918
37918
|
"decorators": []
|
|
37919
37919
|
},
|
|
@@ -37924,7 +37924,7 @@
|
|
|
37924
37924
|
"deprecationMessage": "",
|
|
37925
37925
|
"rawdescription": "\n\nSet to `true` for an invalid number component.\n",
|
|
37926
37926
|
"description": "<p>Set to <code>true</code> for an invalid number component.</p>\n",
|
|
37927
|
-
"line":
|
|
37927
|
+
"line": 174,
|
|
37928
37928
|
"type": "boolean",
|
|
37929
37929
|
"decorators": []
|
|
37930
37930
|
},
|
|
@@ -37934,7 +37934,7 @@
|
|
|
37934
37934
|
"deprecationMessage": "",
|
|
37935
37935
|
"rawdescription": "\n\nSets the invalid text.\n",
|
|
37936
37936
|
"description": "<p>Sets the invalid text.</p>\n",
|
|
37937
|
-
"line":
|
|
37937
|
+
"line": 224,
|
|
37938
37938
|
"type": "string | TemplateRef<any>",
|
|
37939
37939
|
"decorators": []
|
|
37940
37940
|
},
|
|
@@ -37944,7 +37944,7 @@
|
|
|
37944
37944
|
"deprecationMessage": "",
|
|
37945
37945
|
"rawdescription": "\n\nSets the text inside the `label` tag.\n",
|
|
37946
37946
|
"description": "<p>Sets the text inside the <code>label</code> tag.</p>\n",
|
|
37947
|
-
"line":
|
|
37947
|
+
"line": 216,
|
|
37948
37948
|
"type": "string | TemplateRef<any>",
|
|
37949
37949
|
"decorators": []
|
|
37950
37950
|
},
|
|
@@ -37955,7 +37955,7 @@
|
|
|
37955
37955
|
"deprecationMessage": "",
|
|
37956
37956
|
"rawdescription": "\n\nSets the max attribute on the `input` element.\n",
|
|
37957
37957
|
"description": "<p>Sets the max attribute on the <code>input</code> element.</p>\n",
|
|
37958
|
-
"line":
|
|
37958
|
+
"line": 212,
|
|
37959
37959
|
"type": "any",
|
|
37960
37960
|
"decorators": []
|
|
37961
37961
|
},
|
|
@@ -37966,7 +37966,7 @@
|
|
|
37966
37966
|
"deprecationMessage": "",
|
|
37967
37967
|
"rawdescription": "\n\nSets the min attribute on the `input` element.\n",
|
|
37968
37968
|
"description": "<p>Sets the min attribute on the <code>input</code> element.</p>\n",
|
|
37969
|
-
"line":
|
|
37969
|
+
"line": 208,
|
|
37970
37970
|
"type": "any",
|
|
37971
37971
|
"decorators": []
|
|
37972
37972
|
},
|
|
@@ -37977,7 +37977,7 @@
|
|
|
37977
37977
|
"deprecationMessage": "",
|
|
37978
37978
|
"rawdescription": "\n\nSets the placeholder attribute on the `input` element.\n",
|
|
37979
37979
|
"description": "<p>Sets the placeholder attribute on the <code>input</code> element.</p>\n",
|
|
37980
|
-
"line":
|
|
37980
|
+
"line": 182,
|
|
37981
37981
|
"type": "string",
|
|
37982
37982
|
"decorators": []
|
|
37983
37983
|
},
|
|
@@ -37987,17 +37987,28 @@
|
|
|
37987
37987
|
"deprecationMessage": "",
|
|
37988
37988
|
"rawdescription": "\n\nIf `step` is a decimal, we may want precision to be set to go around floating point precision.\n",
|
|
37989
37989
|
"description": "<p>If <code>step</code> is a decimal, we may want precision to be set to go around floating point precision.</p>\n",
|
|
37990
|
-
"line":
|
|
37990
|
+
"line": 232,
|
|
37991
37991
|
"type": "number",
|
|
37992
37992
|
"decorators": []
|
|
37993
37993
|
},
|
|
37994
|
+
{
|
|
37995
|
+
"name": "readonly",
|
|
37996
|
+
"defaultValue": "false",
|
|
37997
|
+
"deprecated": false,
|
|
37998
|
+
"deprecationMessage": "",
|
|
37999
|
+
"rawdescription": "\n\nSet to `true` for readonly state.\n",
|
|
38000
|
+
"description": "<p>Set to <code>true</code> for readonly state.</p>\n",
|
|
38001
|
+
"line": 157,
|
|
38002
|
+
"type": "boolean",
|
|
38003
|
+
"decorators": []
|
|
38004
|
+
},
|
|
37994
38005
|
{
|
|
37995
38006
|
"name": "required",
|
|
37996
38007
|
"deprecated": false,
|
|
37997
38008
|
"deprecationMessage": "",
|
|
37998
38009
|
"rawdescription": "\n\nReflects the required attribute of the `input` element.\n",
|
|
37999
38010
|
"description": "<p>Reflects the required attribute of the <code>input</code> element.</p>\n",
|
|
38000
|
-
"line":
|
|
38011
|
+
"line": 190,
|
|
38001
38012
|
"type": "boolean",
|
|
38002
38013
|
"decorators": []
|
|
38003
38014
|
},
|
|
@@ -38008,7 +38019,7 @@
|
|
|
38008
38019
|
"deprecationMessage": "",
|
|
38009
38020
|
"rawdescription": "\n\nNumber input field render size\n",
|
|
38010
38021
|
"description": "<p>Number input field render size</p>\n",
|
|
38011
|
-
"line":
|
|
38022
|
+
"line": 186,
|
|
38012
38023
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
38013
38024
|
"decorators": []
|
|
38014
38025
|
},
|
|
@@ -38019,7 +38030,7 @@
|
|
|
38019
38030
|
"deprecationMessage": "",
|
|
38020
38031
|
"rawdescription": "\n\nSet to `true` for a loading number component.\n",
|
|
38021
38032
|
"description": "<p>Set to <code>true</code> for a loading number component.</p>\n",
|
|
38022
|
-
"line":
|
|
38033
|
+
"line": 170,
|
|
38023
38034
|
"type": "boolean",
|
|
38024
38035
|
"decorators": []
|
|
38025
38036
|
},
|
|
@@ -38030,7 +38041,7 @@
|
|
|
38030
38041
|
"deprecationMessage": "",
|
|
38031
38042
|
"rawdescription": "\n\nSets the amount the number controls increment and decrement by.\n",
|
|
38032
38043
|
"description": "<p>Sets the amount the number controls increment and decrement by.</p>\n",
|
|
38033
|
-
"line":
|
|
38044
|
+
"line": 228,
|
|
38034
38045
|
"type": "number",
|
|
38035
38046
|
"decorators": []
|
|
38036
38047
|
},
|
|
@@ -38041,15 +38052,15 @@
|
|
|
38041
38052
|
"deprecationMessage": "since v5 - Use `cdsLayer` directive instead\n`light` or `dark` number input theme.",
|
|
38042
38053
|
"jsdoctags": [
|
|
38043
38054
|
{
|
|
38044
|
-
"pos":
|
|
38045
|
-
"end":
|
|
38055
|
+
"pos": 4572,
|
|
38056
|
+
"end": 4672,
|
|
38046
38057
|
"flags": 16842752,
|
|
38047
38058
|
"modifierFlagsCache": 0,
|
|
38048
38059
|
"transformFlags": 0,
|
|
38049
38060
|
"kind": 338,
|
|
38050
38061
|
"tagName": {
|
|
38051
|
-
"pos":
|
|
38052
|
-
"end":
|
|
38062
|
+
"pos": 4573,
|
|
38063
|
+
"end": 4583,
|
|
38053
38064
|
"flags": 16842752,
|
|
38054
38065
|
"modifierFlagsCache": 0,
|
|
38055
38066
|
"transformFlags": 0,
|
|
@@ -38059,7 +38070,7 @@
|
|
|
38059
38070
|
"comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\n<code>light</code> or <code>dark</code> number input theme.</p>\n"
|
|
38060
38071
|
}
|
|
38061
38072
|
],
|
|
38062
|
-
"line":
|
|
38073
|
+
"line": 162,
|
|
38063
38074
|
"type": "\"light\" | \"dark\"",
|
|
38064
38075
|
"decorators": []
|
|
38065
38076
|
},
|
|
@@ -38069,7 +38080,7 @@
|
|
|
38069
38080
|
"deprecationMessage": "",
|
|
38070
38081
|
"rawdescription": "\n\nSets the value attribute on the `input` element.\n",
|
|
38071
38082
|
"description": "<p>Sets the value attribute on the <code>input</code> element.</p>\n",
|
|
38072
|
-
"line":
|
|
38083
|
+
"line": 194,
|
|
38073
38084
|
"type": "any",
|
|
38074
38085
|
"decorators": []
|
|
38075
38086
|
},
|
|
@@ -38080,7 +38091,7 @@
|
|
|
38080
38091
|
"deprecationMessage": "",
|
|
38081
38092
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
38082
38093
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
38083
|
-
"line":
|
|
38094
|
+
"line": 236,
|
|
38084
38095
|
"type": "boolean",
|
|
38085
38096
|
"decorators": []
|
|
38086
38097
|
},
|
|
@@ -38090,7 +38101,7 @@
|
|
|
38090
38101
|
"deprecationMessage": "",
|
|
38091
38102
|
"rawdescription": "\n\nSets the warning text\n",
|
|
38092
38103
|
"description": "<p>Sets the warning text</p>\n",
|
|
38093
|
-
"line":
|
|
38104
|
+
"line": 240,
|
|
38094
38105
|
"type": "string | TemplateRef<any>",
|
|
38095
38106
|
"decorators": []
|
|
38096
38107
|
}
|
|
@@ -38103,7 +38114,7 @@
|
|
|
38103
38114
|
"deprecationMessage": "",
|
|
38104
38115
|
"rawdescription": "\n\nEmits event notifying other classes when a change in state occurs in the input.\n",
|
|
38105
38116
|
"description": "<p>Emits event notifying other classes when a change in state occurs in the input.</p>\n",
|
|
38106
|
-
"line":
|
|
38117
|
+
"line": 248,
|
|
38107
38118
|
"type": "EventEmitter"
|
|
38108
38119
|
}
|
|
38109
38120
|
],
|
|
@@ -38116,7 +38127,7 @@
|
|
|
38116
38127
|
"type": "",
|
|
38117
38128
|
"optional": false,
|
|
38118
38129
|
"description": "",
|
|
38119
|
-
"line":
|
|
38130
|
+
"line": 152,
|
|
38120
38131
|
"decorators": [
|
|
38121
38132
|
{
|
|
38122
38133
|
"name": "HostBinding",
|
|
@@ -38135,7 +38146,7 @@
|
|
|
38135
38146
|
"type": "number",
|
|
38136
38147
|
"optional": false,
|
|
38137
38148
|
"description": "<p>Variable used for creating unique ids for number input components.</p>\n",
|
|
38138
|
-
"line":
|
|
38149
|
+
"line": 150,
|
|
38139
38150
|
"rawdescription": "\n\nVariable used for creating unique ids for number input components.\n",
|
|
38140
38151
|
"modifierKind": [
|
|
38141
38152
|
126
|
|
@@ -38149,7 +38160,7 @@
|
|
|
38149
38160
|
"type": "function",
|
|
38150
38161
|
"optional": false,
|
|
38151
38162
|
"description": "<p>Called when number input is blurred. Needed to properly implement <code>ControlValueAccessor</code>.</p>\n",
|
|
38152
|
-
"line":
|
|
38163
|
+
"line": 318,
|
|
38153
38164
|
"rawdescription": "\n\nCalled when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n"
|
|
38154
38165
|
},
|
|
38155
38166
|
{
|
|
@@ -38160,7 +38171,7 @@
|
|
|
38160
38171
|
"type": "",
|
|
38161
38172
|
"optional": false,
|
|
38162
38173
|
"description": "<p>Method set in <code>registerOnChange</code> to propagate changes back to the form.</p>\n",
|
|
38163
|
-
"line":
|
|
38174
|
+
"line": 323,
|
|
38164
38175
|
"rawdescription": "\n\nMethod set in `registerOnChange` to propagate changes back to the form.\n"
|
|
38165
38176
|
}
|
|
38166
38177
|
],
|
|
@@ -38171,7 +38182,7 @@
|
|
|
38171
38182
|
"optional": false,
|
|
38172
38183
|
"returnType": "void",
|
|
38173
38184
|
"typeParameters": [],
|
|
38174
|
-
"line":
|
|
38185
|
+
"line": 358,
|
|
38175
38186
|
"deprecated": false,
|
|
38176
38187
|
"deprecationMessage": "",
|
|
38177
38188
|
"rawdescription": "\n\nCreates a class of `NumberChange` to emit the change in the `Number`.\n",
|
|
@@ -38183,7 +38194,7 @@
|
|
|
38183
38194
|
"optional": false,
|
|
38184
38195
|
"returnType": "void",
|
|
38185
38196
|
"typeParameters": [],
|
|
38186
|
-
"line":
|
|
38197
|
+
"line": 304,
|
|
38187
38198
|
"deprecated": false,
|
|
38188
38199
|
"deprecationMessage": "",
|
|
38189
38200
|
"decorators": [
|
|
@@ -38202,7 +38213,7 @@
|
|
|
38202
38213
|
"optional": false,
|
|
38203
38214
|
"returnType": "Observable<string>",
|
|
38204
38215
|
"typeParameters": [],
|
|
38205
|
-
"line":
|
|
38216
|
+
"line": 347,
|
|
38206
38217
|
"deprecated": false,
|
|
38207
38218
|
"deprecationMessage": ""
|
|
38208
38219
|
},
|
|
@@ -38212,7 +38223,7 @@
|
|
|
38212
38223
|
"optional": false,
|
|
38213
38224
|
"returnType": "Observable<string>",
|
|
38214
38225
|
"typeParameters": [],
|
|
38215
|
-
"line":
|
|
38226
|
+
"line": 351,
|
|
38216
38227
|
"deprecated": false,
|
|
38217
38228
|
"deprecationMessage": ""
|
|
38218
38229
|
},
|
|
@@ -38229,7 +38240,7 @@
|
|
|
38229
38240
|
"optional": false,
|
|
38230
38241
|
"returnType": "boolean",
|
|
38231
38242
|
"typeParameters": [],
|
|
38232
|
-
"line":
|
|
38243
|
+
"line": 371,
|
|
38233
38244
|
"deprecated": false,
|
|
38234
38245
|
"deprecationMessage": "",
|
|
38235
38246
|
"modifierKind": [
|
|
@@ -38253,7 +38264,7 @@
|
|
|
38253
38264
|
"optional": false,
|
|
38254
38265
|
"returnType": "void",
|
|
38255
38266
|
"typeParameters": [],
|
|
38256
|
-
"line":
|
|
38267
|
+
"line": 339,
|
|
38257
38268
|
"deprecated": false,
|
|
38258
38269
|
"deprecationMessage": "",
|
|
38259
38270
|
"rawdescription": "\n\nSubtracts `step` to the current `value`.\n",
|
|
@@ -38265,7 +38276,7 @@
|
|
|
38265
38276
|
"optional": false,
|
|
38266
38277
|
"returnType": "void",
|
|
38267
38278
|
"typeParameters": [],
|
|
38268
|
-
"line":
|
|
38279
|
+
"line": 328,
|
|
38269
38280
|
"deprecated": false,
|
|
38270
38281
|
"deprecationMessage": "",
|
|
38271
38282
|
"rawdescription": "\n\nAdds `step` to the current `value`.\n",
|
|
@@ -38284,7 +38295,7 @@
|
|
|
38284
38295
|
"optional": false,
|
|
38285
38296
|
"returnType": "void",
|
|
38286
38297
|
"typeParameters": [],
|
|
38287
|
-
"line":
|
|
38298
|
+
"line": 366,
|
|
38288
38299
|
"deprecated": false,
|
|
38289
38300
|
"deprecationMessage": "",
|
|
38290
38301
|
"jsdoctags": [
|
|
@@ -38312,7 +38323,7 @@
|
|
|
38312
38323
|
"optional": false,
|
|
38313
38324
|
"returnType": "void",
|
|
38314
38325
|
"typeParameters": [],
|
|
38315
|
-
"line":
|
|
38326
|
+
"line": 291,
|
|
38316
38327
|
"deprecated": false,
|
|
38317
38328
|
"deprecationMessage": "",
|
|
38318
38329
|
"rawdescription": "\n\nSets a method in order to propagate changes back to the form.\n",
|
|
@@ -38345,7 +38356,7 @@
|
|
|
38345
38356
|
"optional": false,
|
|
38346
38357
|
"returnType": "void",
|
|
38347
38358
|
"typeParameters": [],
|
|
38348
|
-
"line":
|
|
38359
|
+
"line": 299,
|
|
38349
38360
|
"deprecated": false,
|
|
38350
38361
|
"deprecationMessage": "",
|
|
38351
38362
|
"rawdescription": "\n\nRegisters a callback to be triggered when the control has been touched.\n",
|
|
@@ -38356,8 +38367,8 @@
|
|
|
38356
38367
|
"jsdoctags": [
|
|
38357
38368
|
{
|
|
38358
38369
|
"name": {
|
|
38359
|
-
"pos":
|
|
38360
|
-
"end":
|
|
38370
|
+
"pos": 7758,
|
|
38371
|
+
"end": 7760,
|
|
38361
38372
|
"flags": 16842752,
|
|
38362
38373
|
"modifierFlagsCache": 0,
|
|
38363
38374
|
"transformFlags": 0,
|
|
@@ -38368,8 +38379,8 @@
|
|
|
38368
38379
|
"deprecated": false,
|
|
38369
38380
|
"deprecationMessage": "",
|
|
38370
38381
|
"tagName": {
|
|
38371
|
-
"pos":
|
|
38372
|
-
"end":
|
|
38382
|
+
"pos": 7752,
|
|
38383
|
+
"end": 7757,
|
|
38373
38384
|
"flags": 16842752,
|
|
38374
38385
|
"modifierFlagsCache": 0,
|
|
38375
38386
|
"transformFlags": 0,
|
|
@@ -38393,7 +38404,7 @@
|
|
|
38393
38404
|
"optional": false,
|
|
38394
38405
|
"returnType": "void",
|
|
38395
38406
|
"typeParameters": [],
|
|
38396
|
-
"line":
|
|
38407
|
+
"line": 311,
|
|
38397
38408
|
"deprecated": false,
|
|
38398
38409
|
"deprecationMessage": "",
|
|
38399
38410
|
"rawdescription": "\n\nSets the disabled state through the model\n",
|
|
@@ -38423,7 +38434,7 @@
|
|
|
38423
38434
|
"optional": false,
|
|
38424
38435
|
"returnType": "void",
|
|
38425
38436
|
"typeParameters": [],
|
|
38426
|
-
"line":
|
|
38437
|
+
"line": 284,
|
|
38427
38438
|
"deprecated": false,
|
|
38428
38439
|
"deprecationMessage": "",
|
|
38429
38440
|
"rawdescription": "\n\nThis is the initial value set to the component\n",
|
|
@@ -38434,8 +38445,8 @@
|
|
|
38434
38445
|
"jsdoctags": [
|
|
38435
38446
|
{
|
|
38436
38447
|
"name": {
|
|
38437
|
-
"pos":
|
|
38438
|
-
"end":
|
|
38448
|
+
"pos": 7434,
|
|
38449
|
+
"end": 7439,
|
|
38439
38450
|
"flags": 16842752,
|
|
38440
38451
|
"modifierFlagsCache": 0,
|
|
38441
38452
|
"transformFlags": 0,
|
|
@@ -38446,8 +38457,8 @@
|
|
|
38446
38457
|
"deprecated": false,
|
|
38447
38458
|
"deprecationMessage": "",
|
|
38448
38459
|
"tagName": {
|
|
38449
|
-
"pos":
|
|
38450
|
-
"end":
|
|
38460
|
+
"pos": 7428,
|
|
38461
|
+
"end": 7433,
|
|
38451
38462
|
"flags": 16842752,
|
|
38452
38463
|
"modifierFlagsCache": 0,
|
|
38453
38464
|
"transformFlags": 0,
|
|
@@ -38467,7 +38478,7 @@
|
|
|
38467
38478
|
"defaultValue": "true",
|
|
38468
38479
|
"deprecated": false,
|
|
38469
38480
|
"deprecationMessage": "",
|
|
38470
|
-
"line":
|
|
38481
|
+
"line": 152,
|
|
38471
38482
|
"type": "boolean",
|
|
38472
38483
|
"decorators": []
|
|
38473
38484
|
}
|
|
@@ -38479,7 +38490,7 @@
|
|
|
38479
38490
|
"argsDecorator": [],
|
|
38480
38491
|
"deprecated": false,
|
|
38481
38492
|
"deprecationMessage": "",
|
|
38482
|
-
"line":
|
|
38493
|
+
"line": 304
|
|
38483
38494
|
}
|
|
38484
38495
|
],
|
|
38485
38496
|
"standalone": false,
|
|
@@ -38487,7 +38498,7 @@
|
|
|
38487
38498
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { NumberModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-number--basic\">See demo</a></p>\n",
|
|
38488
38499
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { NumberModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-number--basic)\n",
|
|
38489
38500
|
"type": "component",
|
|
38490
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
38501
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
38491
38502
|
"assetsDirs": [],
|
|
38492
38503
|
"styleUrlsData": "",
|
|
38493
38504
|
"stylesData": "",
|
|
@@ -38504,7 +38515,7 @@
|
|
|
38504
38515
|
"deprecationMessage": ""
|
|
38505
38516
|
}
|
|
38506
38517
|
],
|
|
38507
|
-
"line":
|
|
38518
|
+
"line": 271,
|
|
38508
38519
|
"rawdescription": "\n\nCreates an instance of `Number`.\n",
|
|
38509
38520
|
"jsdoctags": [
|
|
38510
38521
|
{
|
|
@@ -38539,7 +38550,7 @@
|
|
|
38539
38550
|
}
|
|
38540
38551
|
],
|
|
38541
38552
|
"returnType": "void",
|
|
38542
|
-
"line":
|
|
38553
|
+
"line": 194,
|
|
38543
38554
|
"rawdescription": "\n\nSets the value attribute on the `input` element.\n",
|
|
38544
38555
|
"description": "<p>Sets the value attribute on the <code>input</code> element.</p>\n",
|
|
38545
38556
|
"jsdoctags": [
|
|
@@ -38558,7 +38569,7 @@
|
|
|
38558
38569
|
"name": "value",
|
|
38559
38570
|
"type": "",
|
|
38560
38571
|
"returnType": "",
|
|
38561
|
-
"line":
|
|
38572
|
+
"line": 202
|
|
38562
38573
|
}
|
|
38563
38574
|
},
|
|
38564
38575
|
"decrementLabel": {
|
|
@@ -38577,7 +38588,7 @@
|
|
|
38577
38588
|
}
|
|
38578
38589
|
],
|
|
38579
38590
|
"returnType": "void",
|
|
38580
|
-
"line":
|
|
38591
|
+
"line": 251,
|
|
38581
38592
|
"jsdoctags": [
|
|
38582
38593
|
{
|
|
38583
38594
|
"name": "value",
|
|
@@ -38594,7 +38605,7 @@
|
|
|
38594
38605
|
"name": "decrementLabel",
|
|
38595
38606
|
"type": "",
|
|
38596
38607
|
"returnType": "",
|
|
38597
|
-
"line":
|
|
38608
|
+
"line": 255
|
|
38598
38609
|
}
|
|
38599
38610
|
},
|
|
38600
38611
|
"incrementLabel": {
|
|
@@ -38613,7 +38624,7 @@
|
|
|
38613
38624
|
}
|
|
38614
38625
|
],
|
|
38615
38626
|
"returnType": "void",
|
|
38616
|
-
"line":
|
|
38627
|
+
"line": 260,
|
|
38617
38628
|
"jsdoctags": [
|
|
38618
38629
|
{
|
|
38619
38630
|
"name": "value",
|
|
@@ -38630,7 +38641,7 @@
|
|
|
38630
38641
|
"name": "incrementLabel",
|
|
38631
38642
|
"type": "",
|
|
38632
38643
|
"returnType": "",
|
|
38633
|
-
"line":
|
|
38644
|
+
"line": 264
|
|
38634
38645
|
}
|
|
38635
38646
|
}
|
|
38636
38647
|
}
|
|
@@ -55336,7 +55347,7 @@
|
|
|
55336
55347
|
},
|
|
55337
55348
|
{
|
|
55338
55349
|
"name": "TableCheckbox",
|
|
55339
|
-
"id": "component-TableCheckbox-
|
|
55350
|
+
"id": "component-TableCheckbox-72b2a2c440b7786653347d7ba6263c33234a7e9f8cacd65a41df61e63248a283460bfdb1c8b973498bd845b799f75296c0f8c3e674fefc9912b373dc8fd96906",
|
|
55340
55351
|
"file": "src/table/cell/table-checkbox.component.ts",
|
|
55341
55352
|
"encapsulation": [],
|
|
55342
55353
|
"entryComponents": [],
|
|
@@ -55346,7 +55357,7 @@
|
|
|
55346
55357
|
"selector": "[cdsTableCheckbox], [ibmTableCheckbox]",
|
|
55347
55358
|
"styleUrls": [],
|
|
55348
55359
|
"styles": [],
|
|
55349
|
-
"template": "<cds-checkbox\n\t*ngIf=\"!skeleton\"\n\tinline=\"true\"\n\t[name]=\"name\"\n\t[
|
|
55360
|
+
"template": "<cds-checkbox\n\t*ngIf=\"!skeleton\"\n\tinline=\"true\"\n\t[name]=\"name\"\n\t[checked]=\"selected\"\n\t[disabled]=\"disabled\"\n\t(checkedChange)=\"selectedChange.emit()\"\n\t[hideLabel]=\"true\">\n\t\t{{getLabel() | i18nReplace:getSelectionLabelValue(row) | async}}\n</cds-checkbox>\n\t",
|
|
55350
55361
|
"templateUrl": [],
|
|
55351
55362
|
"viewProviders": [],
|
|
55352
55363
|
"hostDirectives": [],
|
|
@@ -55355,7 +55366,7 @@
|
|
|
55355
55366
|
"name": "label",
|
|
55356
55367
|
"deprecated": false,
|
|
55357
55368
|
"deprecationMessage": "",
|
|
55358
|
-
"line":
|
|
55369
|
+
"line": 46,
|
|
55359
55370
|
"type": "string | Observable",
|
|
55360
55371
|
"decorators": []
|
|
55361
55372
|
},
|
|
@@ -55364,7 +55375,7 @@
|
|
|
55364
55375
|
"defaultValue": "\"\"",
|
|
55365
55376
|
"deprecated": false,
|
|
55366
55377
|
"deprecationMessage": "",
|
|
55367
|
-
"line":
|
|
55378
|
+
"line": 34,
|
|
55368
55379
|
"type": "string",
|
|
55369
55380
|
"decorators": []
|
|
55370
55381
|
},
|
|
@@ -55372,7 +55383,7 @@
|
|
|
55372
55383
|
"name": "row",
|
|
55373
55384
|
"deprecated": false,
|
|
55374
55385
|
"deprecationMessage": "",
|
|
55375
|
-
"line":
|
|
55386
|
+
"line": 30,
|
|
55376
55387
|
"type": "TableItem[]",
|
|
55377
55388
|
"decorators": []
|
|
55378
55389
|
},
|
|
@@ -55381,7 +55392,7 @@
|
|
|
55381
55392
|
"defaultValue": "false",
|
|
55382
55393
|
"deprecated": false,
|
|
55383
55394
|
"deprecationMessage": "",
|
|
55384
|
-
"line":
|
|
55395
|
+
"line": 32,
|
|
55385
55396
|
"type": "boolean",
|
|
55386
55397
|
"decorators": []
|
|
55387
55398
|
},
|
|
@@ -55391,7 +55402,7 @@
|
|
|
55391
55402
|
"deprecationMessage": "",
|
|
55392
55403
|
"rawdescription": "\n\nUsed to populate the row selection checkbox label with a useful value if set.\n\nExample:\n```\n<cds-table [selectionLabelColumn]=\"0\"></cds-table>\n<!-- results in aria-label=\"Select first column value\"\n(where \"first column value\" is the value of the first column in the row -->\n```\n",
|
|
55393
55404
|
"description": "<p>Used to populate the row selection checkbox label with a useful value if set.</p>\n<p>Example:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-none\"><cds-table [selectionLabelColumn]="0"></cds-table>\n<!-- results in aria-label="Select first column value"\n(where "first column value" is the value of the first column in the row --></code></pre></div>",
|
|
55394
|
-
"line":
|
|
55405
|
+
"line": 64,
|
|
55395
55406
|
"type": "number",
|
|
55396
55407
|
"decorators": []
|
|
55397
55408
|
},
|
|
@@ -55402,7 +55413,7 @@
|
|
|
55402
55413
|
"deprecationMessage": "",
|
|
55403
55414
|
"rawdescription": "\n\nSize of the table rows.\n",
|
|
55404
55415
|
"description": "<p>Size of the table rows.</p>\n",
|
|
55405
|
-
"line":
|
|
55416
|
+
"line": 43,
|
|
55406
55417
|
"type": "TableRowSize",
|
|
55407
55418
|
"decorators": []
|
|
55408
55419
|
},
|
|
@@ -55411,7 +55422,7 @@
|
|
|
55411
55422
|
"defaultValue": "false",
|
|
55412
55423
|
"deprecated": false,
|
|
55413
55424
|
"deprecationMessage": "",
|
|
55414
|
-
"line":
|
|
55425
|
+
"line": 66,
|
|
55415
55426
|
"type": "boolean",
|
|
55416
55427
|
"decorators": []
|
|
55417
55428
|
}
|
|
@@ -55424,7 +55435,7 @@
|
|
|
55424
55435
|
"deprecationMessage": "",
|
|
55425
55436
|
"rawdescription": "\n\nEmits if a single row is selected.\n",
|
|
55426
55437
|
"description": "<p>Emits if a single row is selected.</p>\n",
|
|
55427
|
-
"line":
|
|
55438
|
+
"line": 71,
|
|
55428
55439
|
"type": "EventEmitter"
|
|
55429
55440
|
}
|
|
55430
55441
|
],
|
|
@@ -55436,7 +55447,7 @@
|
|
|
55436
55447
|
"optional": false,
|
|
55437
55448
|
"returnType": "Observable<string>",
|
|
55438
55449
|
"typeParameters": [],
|
|
55439
|
-
"line":
|
|
55450
|
+
"line": 84,
|
|
55440
55451
|
"deprecated": false,
|
|
55441
55452
|
"deprecationMessage": ""
|
|
55442
55453
|
},
|
|
@@ -55453,7 +55464,7 @@
|
|
|
55453
55464
|
"optional": false,
|
|
55454
55465
|
"returnType": "{ value: any; }",
|
|
55455
55466
|
"typeParameters": [],
|
|
55456
|
-
"line":
|
|
55467
|
+
"line": 77,
|
|
55457
55468
|
"deprecated": false,
|
|
55458
55469
|
"deprecationMessage": "",
|
|
55459
55470
|
"jsdoctags": [
|
|
@@ -55478,7 +55489,7 @@
|
|
|
55478
55489
|
"description": "",
|
|
55479
55490
|
"rawdescription": "\n",
|
|
55480
55491
|
"type": "component",
|
|
55481
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { TableItem } from \"../table-item.class\";\nimport { TableRow } from \"../table-row.class\";\nimport { Observable } from \"rxjs\";\nimport { TableRowSize } from \"../table.types\";\n\n@Component({\n\t// tslint:disable-next-line: component-selector\n\tselector: \"[cdsTableCheckbox], [ibmTableCheckbox]\",\n\ttemplate: `\n\t\t<cds-checkbox\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\tinline=\"true\"\n\t\t\t[name]=\"name\"\n\t\t\t[
|
|
55492
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { TableItem } from \"../table-item.class\";\nimport { TableRow } from \"../table-row.class\";\nimport { Observable } from \"rxjs\";\nimport { TableRowSize } from \"../table.types\";\n\n@Component({\n\t// tslint:disable-next-line: component-selector\n\tselector: \"[cdsTableCheckbox], [ibmTableCheckbox]\",\n\ttemplate: `\n\t\t<cds-checkbox\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\tinline=\"true\"\n\t\t\t[name]=\"name\"\n\t\t\t[checked]=\"selected\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t(checkedChange)=\"selectedChange.emit()\"\n\t\t\t[hideLabel]=\"true\">\n\t\t\t\t{{getLabel() | i18nReplace:getSelectionLabelValue(row) | async}}\n\t\t</cds-checkbox>\n\t`\n})\nexport class TableCheckbox {\n\t@Input() row: TableItem[];\n\n\t@Input() selected = false;\n\n\t@Input() name = \"\";\n\n\tget disabled(): boolean {\n\t\treturn this.row ? !!(this.row as TableRow).disabled : false;\n\t}\n\n\t/**\n\t * Size of the table rows.\n\t */\n\t@Input() size: TableRowSize = \"md\";\n\n\t@Input()\n\tset label(value: string | Observable<string>) {\n\t\tthis._label.override(value);\n\t}\n\n\tget label() {\n\t\treturn this._label.value;\n\t}\n\n\t/**\n\t * Used to populate the row selection checkbox label with a useful value if set.\n\t *\n\t * Example:\n\t * ```\n\t * <cds-table [selectionLabelColumn]=\"0\"></cds-table>\n\t * <!-- results in aria-label=\"Select first column value\"\n\t * (where \"first column value\" is the value of the first column in the row -->\n\t * ```\n\t */\n\t@Input() selectionLabelColumn: number;\n\n\t@Input() skeleton = false;\n\n\t/**\n\t * Emits if a single row is selected.\n\t */\n\t@Output() selectedChange = new EventEmitter();\n\n\tprotected _label = this.i18n.getOverridable(\"TABLE.CHECKBOX_ROW\");\n\n\tconstructor(protected i18n: I18n) { }\n\n\tgetSelectionLabelValue(row: TableItem[]) {\n\t\tif (!this.selectionLabelColumn) {\n\t\t\treturn { value: this.i18n.get().TABLE.ROW };\n\t\t}\n\t\treturn { value: row[this.selectionLabelColumn].data };\n\t}\n\n\tgetLabel(): Observable<string> {\n\t\treturn this._label.subject;\n\t}\n}\n",
|
|
55482
55493
|
"assetsDirs": [],
|
|
55483
55494
|
"styleUrlsData": "",
|
|
55484
55495
|
"stylesData": "",
|
|
@@ -55495,7 +55506,7 @@
|
|
|
55495
55506
|
"deprecationMessage": ""
|
|
55496
55507
|
}
|
|
55497
55508
|
],
|
|
55498
|
-
"line":
|
|
55509
|
+
"line": 73,
|
|
55499
55510
|
"jsdoctags": [
|
|
55500
55511
|
{
|
|
55501
55512
|
"name": "i18n",
|
|
@@ -55516,7 +55527,7 @@
|
|
|
55516
55527
|
"name": "disabled",
|
|
55517
55528
|
"type": "boolean",
|
|
55518
55529
|
"returnType": "boolean",
|
|
55519
|
-
"line":
|
|
55530
|
+
"line": 36
|
|
55520
55531
|
}
|
|
55521
55532
|
},
|
|
55522
55533
|
"label": {
|
|
@@ -55535,7 +55546,7 @@
|
|
|
55535
55546
|
}
|
|
55536
55547
|
],
|
|
55537
55548
|
"returnType": "void",
|
|
55538
|
-
"line":
|
|
55549
|
+
"line": 46,
|
|
55539
55550
|
"jsdoctags": [
|
|
55540
55551
|
{
|
|
55541
55552
|
"name": "value",
|
|
@@ -55552,7 +55563,7 @@
|
|
|
55552
55563
|
"name": "label",
|
|
55553
55564
|
"type": "",
|
|
55554
55565
|
"returnType": "",
|
|
55555
|
-
"line":
|
|
55566
|
+
"line": 50
|
|
55556
55567
|
}
|
|
55557
55568
|
}
|
|
55558
55569
|
}
|
|
@@ -56911,7 +56922,7 @@
|
|
|
56911
56922
|
},
|
|
56912
56923
|
{
|
|
56913
56924
|
"name": "TableHeadCheckbox",
|
|
56914
|
-
"id": "component-TableHeadCheckbox-
|
|
56925
|
+
"id": "component-TableHeadCheckbox-283d5bf93a45d210a9f83df8ec84f2897344be0a5d2e4800260b8a347666383465b10a63122be2a327a65dbce8dcb7b10ebce7aedcc93f12efe6d966d5d4ec5f",
|
|
56915
56926
|
"file": "src/table/head/table-head-checkbox.component.ts",
|
|
56916
56927
|
"encapsulation": [],
|
|
56917
56928
|
"entryComponents": [],
|
|
@@ -56923,7 +56934,7 @@
|
|
|
56923
56934
|
"styles": [
|
|
56924
56935
|
"\n :host { width: 10px; }\n "
|
|
56925
56936
|
],
|
|
56926
|
-
"template": "<cds-checkbox\n\t*ngIf=\"!skeleton\"\n\tinline=\"true\"\n\t[name]=\"name\"\n\t[checked]=\"checked\"\n\t[indeterminate]=\"indeterminate\"\n\t(checkedChange)=\"change.emit()\"\n\t[
|
|
56937
|
+
"template": "<cds-checkbox\n\t*ngIf=\"!skeleton\"\n\tinline=\"true\"\n\t[name]=\"name\"\n\t[checked]=\"checked\"\n\t[indeterminate]=\"indeterminate\"\n\t(checkedChange)=\"change.emit()\"\n\t[hideLabel]=\"true\">\n\t\t{{getAriaLabel() | async}}\n</cds-checkbox>\n\t",
|
|
56927
56938
|
"templateUrl": [],
|
|
56928
56939
|
"viewProviders": [],
|
|
56929
56940
|
"hostDirectives": [],
|
|
@@ -56932,7 +56943,7 @@
|
|
|
56932
56943
|
"name": "ariaLabel",
|
|
56933
56944
|
"deprecated": false,
|
|
56934
56945
|
"deprecationMessage": "",
|
|
56935
|
-
"line":
|
|
56946
|
+
"line": 42,
|
|
56936
56947
|
"type": "string | Observable",
|
|
56937
56948
|
"decorators": []
|
|
56938
56949
|
},
|
|
@@ -56941,7 +56952,7 @@
|
|
|
56941
56952
|
"defaultValue": "false",
|
|
56942
56953
|
"deprecated": false,
|
|
56943
56954
|
"deprecationMessage": "",
|
|
56944
|
-
"line":
|
|
56955
|
+
"line": 33,
|
|
56945
56956
|
"type": "boolean",
|
|
56946
56957
|
"decorators": []
|
|
56947
56958
|
},
|
|
@@ -56950,7 +56961,7 @@
|
|
|
56950
56961
|
"defaultValue": "false",
|
|
56951
56962
|
"deprecated": false,
|
|
56952
56963
|
"deprecationMessage": "",
|
|
56953
|
-
"line":
|
|
56964
|
+
"line": 35,
|
|
56954
56965
|
"type": "boolean",
|
|
56955
56966
|
"decorators": []
|
|
56956
56967
|
},
|
|
@@ -56959,7 +56970,7 @@
|
|
|
56959
56970
|
"defaultValue": "`select-all-${TableHeadCheckbox.tableSelectAllCount++}`",
|
|
56960
56971
|
"deprecated": false,
|
|
56961
56972
|
"deprecationMessage": "",
|
|
56962
|
-
"line":
|
|
56973
|
+
"line": 39,
|
|
56963
56974
|
"type": "string",
|
|
56964
56975
|
"decorators": []
|
|
56965
56976
|
},
|
|
@@ -56968,7 +56979,7 @@
|
|
|
56968
56979
|
"defaultValue": "false",
|
|
56969
56980
|
"deprecated": false,
|
|
56970
56981
|
"deprecationMessage": "",
|
|
56971
|
-
"line":
|
|
56982
|
+
"line": 37,
|
|
56972
56983
|
"type": "boolean",
|
|
56973
56984
|
"decorators": []
|
|
56974
56985
|
}
|
|
@@ -56979,7 +56990,7 @@
|
|
|
56979
56990
|
"defaultValue": "new EventEmitter<void>()",
|
|
56980
56991
|
"deprecated": false,
|
|
56981
56992
|
"deprecationMessage": "",
|
|
56982
|
-
"line":
|
|
56993
|
+
"line": 50,
|
|
56983
56994
|
"type": "EventEmitter"
|
|
56984
56995
|
}
|
|
56985
56996
|
],
|
|
@@ -56992,7 +57003,7 @@
|
|
|
56992
57003
|
"type": "",
|
|
56993
57004
|
"optional": false,
|
|
56994
57005
|
"description": "",
|
|
56995
|
-
"line":
|
|
57006
|
+
"line": 52,
|
|
56996
57007
|
"decorators": [
|
|
56997
57008
|
{
|
|
56998
57009
|
"name": "HostBinding",
|
|
@@ -57011,7 +57022,7 @@
|
|
|
57011
57022
|
"optional": false,
|
|
57012
57023
|
"returnType": "Observable<string>",
|
|
57013
57024
|
"typeParameters": [],
|
|
57014
|
-
"line":
|
|
57025
|
+
"line": 58,
|
|
57015
57026
|
"deprecated": false,
|
|
57016
57027
|
"deprecationMessage": ""
|
|
57017
57028
|
}
|
|
@@ -57024,7 +57035,7 @@
|
|
|
57024
57035
|
"defaultValue": "true",
|
|
57025
57036
|
"deprecated": false,
|
|
57026
57037
|
"deprecationMessage": "",
|
|
57027
|
-
"line":
|
|
57038
|
+
"line": 52,
|
|
57028
57039
|
"type": "boolean",
|
|
57029
57040
|
"decorators": []
|
|
57030
57041
|
}
|
|
@@ -57035,7 +57046,7 @@
|
|
|
57035
57046
|
"description": "",
|
|
57036
57047
|
"rawdescription": "\n",
|
|
57037
57048
|
"type": "component",
|
|
57038
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tHostBinding,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n@Component({\n\t// tslint:disable-next-line: component-selector\n\tselector: \"[cdsTableHeadCheckbox], [ibmTableHeadCheckbox]\",\n\ttemplate: `\n\t\t<cds-checkbox\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\tinline=\"true\"\n\t\t\t[name]=\"name\"\n\t\t\t[checked]=\"checked\"\n\t\t\t[indeterminate]=\"indeterminate\"\n\t\t\t(checkedChange)=\"change.emit()\"\n\t\t\t[
|
|
57049
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tHostBinding,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n@Component({\n\t// tslint:disable-next-line: component-selector\n\tselector: \"[cdsTableHeadCheckbox], [ibmTableHeadCheckbox]\",\n\ttemplate: `\n\t\t<cds-checkbox\n\t\t\t*ngIf=\"!skeleton\"\n\t\t\tinline=\"true\"\n\t\t\t[name]=\"name\"\n\t\t\t[checked]=\"checked\"\n\t\t\t[indeterminate]=\"indeterminate\"\n\t\t\t(checkedChange)=\"change.emit()\"\n\t\t\t[hideLabel]=\"true\">\n\t\t\t\t{{getAriaLabel() | async}}\n\t\t</cds-checkbox>\n\t`,\n\tstyles: [`\n :host { width: 10px; }\n `]\n})\nexport class TableHeadCheckbox {\n\tprivate static tableSelectAllCount = 0;\n\n\t@Input() checked = false;\n\n\t@Input() indeterminate = false;\n\n\t@Input() skeleton = false;\n\n\t@Input() name = `select-all-${TableHeadCheckbox.tableSelectAllCount++}`;\n\n\t@Input()\n\tset ariaLabel(value: string | Observable<string>) {\n\t\tthis._ariaLabel.override(value);\n\t}\n\n\tget ariaLabel() {\n\t\treturn this._ariaLabel.value;\n\t}\n\n\t@Output() change = new EventEmitter<void>();\n\n\t@HostBinding(\"class.cds--table-column-checkbox\") hostClass = true;\n\n\tprotected _ariaLabel = this.i18n.getOverridable(\"TABLE.CHECKBOX_HEADER\");\n\n\tconstructor(protected i18n: I18n) { }\n\n\tgetAriaLabel(): Observable<string> {\n\t\treturn this._ariaLabel.subject;\n\t}\n}\n",
|
|
57039
57050
|
"assetsDirs": [],
|
|
57040
57051
|
"styleUrlsData": "",
|
|
57041
57052
|
"stylesData": "\n :host { width: 10px; }\n \n",
|
|
@@ -57052,7 +57063,7 @@
|
|
|
57052
57063
|
"deprecationMessage": ""
|
|
57053
57064
|
}
|
|
57054
57065
|
],
|
|
57055
|
-
"line":
|
|
57066
|
+
"line": 54,
|
|
57056
57067
|
"jsdoctags": [
|
|
57057
57068
|
{
|
|
57058
57069
|
"name": "i18n",
|
|
@@ -57083,7 +57094,7 @@
|
|
|
57083
57094
|
}
|
|
57084
57095
|
],
|
|
57085
57096
|
"returnType": "void",
|
|
57086
|
-
"line":
|
|
57097
|
+
"line": 42,
|
|
57087
57098
|
"jsdoctags": [
|
|
57088
57099
|
{
|
|
57089
57100
|
"name": "value",
|
|
@@ -57100,7 +57111,7 @@
|
|
|
57100
57111
|
"name": "ariaLabel",
|
|
57101
57112
|
"type": "",
|
|
57102
57113
|
"returnType": "",
|
|
57103
|
-
"line":
|
|
57114
|
+
"line": 46
|
|
57104
57115
|
}
|
|
57105
57116
|
}
|
|
57106
57117
|
}
|
|
@@ -63013,7 +63024,7 @@
|
|
|
63013
63024
|
},
|
|
63014
63025
|
{
|
|
63015
63026
|
"name": "Toggle",
|
|
63016
|
-
"id": "component-Toggle-
|
|
63027
|
+
"id": "component-Toggle-630556cb1912c46e615e8220bc9e3bda9fe05619dd4477bf6b06fcba589ef78f8bf4ba33458b21bbaddff3ca38e60dab6272159be15b648e4cb45cbf7bc47686",
|
|
63017
63028
|
"file": "src/toggle/toggle.component.ts",
|
|
63018
63029
|
"encapsulation": [],
|
|
63019
63030
|
"entryComponents": [],
|
|
@@ -63039,7 +63050,7 @@
|
|
|
63039
63050
|
"deprecationMessage": "",
|
|
63040
63051
|
"rawdescription": "\n\nSet to `true` to hide the toggle label & set toggle on/off text to label.\n",
|
|
63041
63052
|
"description": "<p>Set to <code>true</code> to hide the toggle label & set toggle on/off text to label.</p>\n",
|
|
63042
|
-
"line":
|
|
63053
|
+
"line": 144,
|
|
63043
63054
|
"type": "boolean",
|
|
63044
63055
|
"decorators": [],
|
|
63045
63056
|
"inheritance": {
|
|
@@ -63052,7 +63063,7 @@
|
|
|
63052
63063
|
"deprecationMessage": "",
|
|
63053
63064
|
"rawdescription": "\n\nText that is set as the label of the toggle.\n",
|
|
63054
63065
|
"description": "<p>Text that is set as the label of the toggle.</p>\n",
|
|
63055
|
-
"line":
|
|
63066
|
+
"line": 136,
|
|
63056
63067
|
"type": "string | TemplateRef<any>",
|
|
63057
63068
|
"decorators": []
|
|
63058
63069
|
},
|
|
@@ -63062,7 +63073,7 @@
|
|
|
63062
63073
|
"deprecationMessage": "",
|
|
63063
63074
|
"rawdescription": "\n\nText that is set on the left side of the toggle.\n",
|
|
63064
63075
|
"description": "<p>Text that is set on the left side of the toggle.</p>\n",
|
|
63065
|
-
"line":
|
|
63076
|
+
"line": 114,
|
|
63066
63077
|
"type": "string | Observable",
|
|
63067
63078
|
"decorators": []
|
|
63068
63079
|
},
|
|
@@ -63072,7 +63083,7 @@
|
|
|
63072
63083
|
"deprecationMessage": "",
|
|
63073
63084
|
"rawdescription": "\n\nText that is set on the right side of the toggle.\n",
|
|
63074
63085
|
"description": "<p>Text that is set on the right side of the toggle.</p>\n",
|
|
63075
|
-
"line":
|
|
63086
|
+
"line": 126,
|
|
63076
63087
|
"type": "string | Observable",
|
|
63077
63088
|
"decorators": []
|
|
63078
63089
|
},
|
|
@@ -63083,7 +63094,7 @@
|
|
|
63083
63094
|
"deprecationMessage": "",
|
|
63084
63095
|
"rawdescription": "\n\nSize of the toggle component.\n",
|
|
63085
63096
|
"description": "<p>Size of the toggle component.</p>\n",
|
|
63086
|
-
"line":
|
|
63097
|
+
"line": 140,
|
|
63087
63098
|
"type": "\"sm\" | \"md\"",
|
|
63088
63099
|
"decorators": []
|
|
63089
63100
|
},
|
|
@@ -63092,7 +63103,7 @@
|
|
|
63092
63103
|
"defaultValue": "false",
|
|
63093
63104
|
"deprecated": false,
|
|
63094
63105
|
"deprecationMessage": "",
|
|
63095
|
-
"line":
|
|
63106
|
+
"line": 146,
|
|
63096
63107
|
"type": "boolean",
|
|
63097
63108
|
"decorators": [],
|
|
63098
63109
|
"inheritance": {
|
|
@@ -63265,7 +63276,7 @@
|
|
|
63265
63276
|
"type": "",
|
|
63266
63277
|
"optional": false,
|
|
63267
63278
|
"description": "<p>The unique id allocated to the <code>Toggle</code>.</p>\n",
|
|
63268
|
-
"line":
|
|
63279
|
+
"line": 160,
|
|
63269
63280
|
"rawdescription": "\n\nThe unique id allocated to the `Toggle`.\n"
|
|
63270
63281
|
},
|
|
63271
63282
|
{
|
|
@@ -63276,7 +63287,7 @@
|
|
|
63276
63287
|
"type": "",
|
|
63277
63288
|
"optional": false,
|
|
63278
63289
|
"description": "",
|
|
63279
|
-
"line":
|
|
63290
|
+
"line": 148,
|
|
63280
63291
|
"decorators": [
|
|
63281
63292
|
{
|
|
63282
63293
|
"name": "HostBinding",
|
|
@@ -63295,7 +63306,7 @@
|
|
|
63295
63306
|
"type": "number",
|
|
63296
63307
|
"optional": false,
|
|
63297
63308
|
"description": "<p>Variable used for creating unique ids for toggle components.</p>\n",
|
|
63298
|
-
"line":
|
|
63309
|
+
"line": 108,
|
|
63299
63310
|
"rawdescription": "\n\nVariable used for creating unique ids for toggle components.\n",
|
|
63300
63311
|
"modifierKind": [
|
|
63301
63312
|
126
|
|
@@ -63418,7 +63429,7 @@
|
|
|
63418
63429
|
"optional": false,
|
|
63419
63430
|
"returnType": "void",
|
|
63420
63431
|
"typeParameters": [],
|
|
63421
|
-
"line":
|
|
63432
|
+
"line": 201,
|
|
63422
63433
|
"deprecated": false,
|
|
63423
63434
|
"deprecationMessage": "",
|
|
63424
63435
|
"rawdescription": "\n\nCreates instance of `ToggleChange` used to propagate the change event.\n",
|
|
@@ -63433,7 +63444,7 @@
|
|
|
63433
63444
|
"optional": false,
|
|
63434
63445
|
"returnType": "Observable<string>",
|
|
63435
63446
|
"typeParameters": [],
|
|
63436
|
-
"line":
|
|
63447
|
+
"line": 191,
|
|
63437
63448
|
"deprecated": false,
|
|
63438
63449
|
"deprecationMessage": ""
|
|
63439
63450
|
},
|
|
@@ -63443,7 +63454,7 @@
|
|
|
63443
63454
|
"optional": false,
|
|
63444
63455
|
"returnType": "Observable<string>",
|
|
63445
63456
|
"typeParameters": [],
|
|
63446
|
-
"line":
|
|
63457
|
+
"line": 183,
|
|
63447
63458
|
"deprecated": false,
|
|
63448
63459
|
"deprecationMessage": ""
|
|
63449
63460
|
},
|
|
@@ -63453,7 +63464,7 @@
|
|
|
63453
63464
|
"optional": false,
|
|
63454
63465
|
"returnType": "Observable<string>",
|
|
63455
63466
|
"typeParameters": [],
|
|
63456
|
-
"line":
|
|
63467
|
+
"line": 187,
|
|
63457
63468
|
"deprecated": false,
|
|
63458
63469
|
"deprecationMessage": ""
|
|
63459
63470
|
},
|
|
@@ -63470,7 +63481,7 @@
|
|
|
63470
63481
|
"optional": false,
|
|
63471
63482
|
"returnType": "boolean",
|
|
63472
63483
|
"typeParameters": [],
|
|
63473
|
-
"line":
|
|
63484
|
+
"line": 206,
|
|
63474
63485
|
"deprecated": false,
|
|
63475
63486
|
"deprecationMessage": "",
|
|
63476
63487
|
"modifierKind": [
|
|
@@ -63501,7 +63512,7 @@
|
|
|
63501
63512
|
"optional": false,
|
|
63502
63513
|
"returnType": "void",
|
|
63503
63514
|
"typeParameters": [],
|
|
63504
|
-
"line":
|
|
63515
|
+
"line": 179,
|
|
63505
63516
|
"deprecated": false,
|
|
63506
63517
|
"deprecationMessage": "",
|
|
63507
63518
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the toggle input.\n\nex: `this.formGroup.get(\"myToggle\").disable();`\n\n",
|
|
@@ -63509,8 +63520,8 @@
|
|
|
63509
63520
|
"jsdoctags": [
|
|
63510
63521
|
{
|
|
63511
63522
|
"name": {
|
|
63512
|
-
"pos":
|
|
63513
|
-
"end":
|
|
63523
|
+
"pos": 4208,
|
|
63524
|
+
"end": 4218,
|
|
63514
63525
|
"flags": 16842752,
|
|
63515
63526
|
"modifierFlagsCache": 0,
|
|
63516
63527
|
"transformFlags": 0,
|
|
@@ -63521,8 +63532,8 @@
|
|
|
63521
63532
|
"deprecated": false,
|
|
63522
63533
|
"deprecationMessage": "",
|
|
63523
63534
|
"tagName": {
|
|
63524
|
-
"pos":
|
|
63525
|
-
"end":
|
|
63535
|
+
"pos": 4202,
|
|
63536
|
+
"end": 4207,
|
|
63526
63537
|
"flags": 16842752,
|
|
63527
63538
|
"modifierFlagsCache": 0,
|
|
63528
63539
|
"transformFlags": 0,
|
|
@@ -63821,7 +63832,7 @@
|
|
|
63821
63832
|
"name": "class.cds--form-item",
|
|
63822
63833
|
"deprecated": false,
|
|
63823
63834
|
"deprecationMessage": "",
|
|
63824
|
-
"line":
|
|
63835
|
+
"line": 153,
|
|
63825
63836
|
"type": "boolean",
|
|
63826
63837
|
"decorators": []
|
|
63827
63838
|
},
|
|
@@ -63830,7 +63841,7 @@
|
|
|
63830
63841
|
"defaultValue": "true",
|
|
63831
63842
|
"deprecated": false,
|
|
63832
63843
|
"deprecationMessage": "",
|
|
63833
|
-
"line":
|
|
63844
|
+
"line": 148,
|
|
63834
63845
|
"type": "boolean",
|
|
63835
63846
|
"decorators": []
|
|
63836
63847
|
},
|
|
@@ -63838,7 +63849,7 @@
|
|
|
63838
63849
|
"name": "class.cds--toggle--disabled",
|
|
63839
63850
|
"deprecated": false,
|
|
63840
63851
|
"deprecationMessage": "",
|
|
63841
|
-
"line":
|
|
63852
|
+
"line": 149,
|
|
63842
63853
|
"type": "any",
|
|
63843
63854
|
"decorators": []
|
|
63844
63855
|
}
|
|
@@ -63861,7 +63872,7 @@
|
|
|
63861
63872
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ToggleModule } from 'carbon-components-angular';</code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-toggle [(ngModel)]="toggleState">Toggle</cds-toggle></code></pre></div><p><a href=\"../../?path=/story/components-toggle--basic\">See demo</a></p>\n",
|
|
63862
63873
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ToggleModule } from 'carbon-components-angular';\n```\n\n```html\n<cds-toggle [(ngModel)]=\"toggleState\">Toggle</cds-toggle>\n```\n\n[See demo](../../?path=/story/components-toggle--basic)\n",
|
|
63863
63874
|
"type": "component",
|
|
63864
|
-
"sourceCode": "import { Checkbox } from \"carbon-components-angular/checkbox\";\nimport {\n\tChangeDetectorRef,\n\tComponent,\n\tInput,\n\tHostBinding,\n\tTemplateRef\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Defines the set of states for a toggle component.\n */\nexport enum ToggleState {\n\tInit,\n\tChecked,\n\tUnchecked\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ToggleModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-toggle [(ngModel)]=\"toggleState\">Toggle</cds-toggle>\n * ```\n *\n * [See demo](../../?path=/story/components-toggle--basic)\n */\n@Component({\n\tselector: \"cds-toggle, ibm-toggle\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"!skeleton; else skeletonTemplate;\">\n\t\t\t<button\n\t\t\t\tclass=\"cds--toggle__button\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[id]=\"id\"\n\t\t\t\trole=\"switch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.aria-checked]=\"checked\"\n\t\t\t\t(click)=\"onClick($event)\">\n\t\t\t</button>\n\t\t\t<label\n\t\t\t\tclass=\"cds--toggle__label\"\n\t\t\t\t[for]=\"id\">\n\t\t\t\t<span\n\t\t\t\t\tclass=\"cds--toggle__label-text\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t\t</span>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--toggle__appearance\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--toggle__appearance--sm': size === 'sm'\n\t\t\t\t\t}\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"cds--toggle__switch\"\n\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t'cds--toggle__switch--checked': checked\n\t\t\t\t\t\t}\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t*ngIf=\"size === 'sm'\"\n\t\t\t\t\t\t\tclass='cds--toggle__check'\n\t\t\t\t\t\t\twidth=\"6px\"\n\t\t\t\t\t\t\theight=\"5px\"\n\t\t\t\t\t\t\tviewBox=\"0 0 6 5\">\n\t\t\t\t\t\t\t<path d=\"M2.2 2.7L5 0 6 1 2.2 5 0 2.7 1 1.5z\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<span class=\"cds--toggle__text\">\n\t\t\t\t\t\t{{(hideLabel ? label : (getCheckedText() | async))}}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</label>\n\t\t</ng-container>\n\t\t<ng-template #skeletonTemplate>\n\t\t\t<div class=\"cds--toggle__skeleton-circle\"></div>\n\t\t\t<div class=\"cds--toggle__skeleton-rectangle\"></div>\n\t\t</ng-template>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Toggle,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Toggle extends Checkbox {\n\t/**\n\t * Variable used for creating unique ids for toggle components.\n\t */\n\tstatic toggleCount = 0;\n\n\t/**\n\t * Text that is set on the left side of the toggle.\n\t */\n\t@Input()\n\tset offText(value: string | Observable<string>) {\n\t\tthis._offValues.override(value);\n\t}\n\n\tget offText() {\n\t\treturn this._offValues.value;\n\t}\n\n\t/**\n\t * Text that is set on the right side of the toggle.\n\t */\n\t@Input()\n\tset onText(value: string | Observable<string>) {\n\t\tthis._onValues.override(value);\n\t}\n\n\tget onText() {\n\t\treturn this._onValues.value;\n\t}\n\t/**\n\t * Text that is set as the label of the toggle.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Size of the toggle component.\n\t */\n\t@Input() size: \"sm\" | \"md\" = \"md\";\n\t/**\n\t * Set to `true` to hide the toggle label & set toggle on/off text to label.\n\t */\n\t@Input() hideLabel = false;\n\n\t@HostBinding(\"class.cds--toggle--skeleton\") @Input() skeleton = false;\n\n\t@HostBinding(\"class.cds--toggle\") toggleClass = true;\n\t@HostBinding(\"class.cds--toggle--disabled\") get disabledClass () {\n\t\treturn this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--form-item\") get formItem() {\n\t\treturn !this.skeleton;\n\t}\n\n\t/**\n\t * The unique id allocated to the `Toggle`.\n\t */\n\tid = \"toggle-\" + Toggle.toggleCount;\n\n\tprotected _offValues = this.i18n.getOverridable(\"TOGGLE.OFF\");\n\tprotected _onValues = this.i18n.getOverridable(\"TOGGLE.ON\");\n\t/**\n\t * Creates an instance of Toggle.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef, protected i18n: I18n) {\n\t\tsuper(changeDetectorRef);\n\t\tToggle.toggleCount++;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the toggle input.\n\t *\n\t * ex: `this.formGroup.get(\"myToggle\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tgetOffText(): Observable<string> {\n\t\treturn this._offValues.subject;\n\t}\n\n\tgetOnText(): Observable<string> {\n\t\treturn this._onValues.subject;\n\t}\n\n\tgetCheckedText(): Observable<string> {\n\t\tif (this.checked) {\n\t\t\treturn this._onValues.subject;\n\t\t}\n\t\treturn this._offValues.subject;\n\t}\n\n\t/**\n\t * Creates instance of `ToggleChange` used to propagate the change event.\n\t */\n\temitChangeEvent() {\n\t\tthis.checkedChange.emit(this.checked);\n\t\tthis.propagateChange(this.checked);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\n",
|
|
63875
|
+
"sourceCode": "import { Checkbox } from \"carbon-components-angular/checkbox\";\nimport {\n\tChangeDetectorRef,\n\tComponent,\n\tInput,\n\tHostBinding,\n\tTemplateRef\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Defines the set of states for a toggle component.\n */\nexport enum ToggleState {\n\tInit,\n\tChecked,\n\tUnchecked\n}\n\n/**\n * @todo - Toggle component will no longer extend `Checkbox` component as of v6\n * Toggle is no longer repies on using checkbox, so doesn't make sense for us to continue inheriting ALL checkbox\n * component attributes.\n */\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ToggleModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-toggle [(ngModel)]=\"toggleState\">Toggle</cds-toggle>\n * ```\n *\n * [See demo](../../?path=/story/components-toggle--basic)\n */\n@Component({\n\tselector: \"cds-toggle, ibm-toggle\",\n\ttemplate: `\n\t\t<ng-container *ngIf=\"!skeleton; else skeletonTemplate;\">\n\t\t\t<button\n\t\t\t\tclass=\"cds--toggle__button\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[id]=\"id\"\n\t\t\t\trole=\"switch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\t[attr.aria-checked]=\"checked\"\n\t\t\t\t(click)=\"onClick($event)\">\n\t\t\t</button>\n\t\t\t<label\n\t\t\t\tclass=\"cds--toggle__label\"\n\t\t\t\t[for]=\"id\">\n\t\t\t\t<span\n\t\t\t\t\tclass=\"cds--toggle__label-text\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t\t</span>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--toggle__appearance\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--toggle__appearance--sm': size === 'sm'\n\t\t\t\t\t}\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"cds--toggle__switch\"\n\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t'cds--toggle__switch--checked': checked\n\t\t\t\t\t\t}\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t*ngIf=\"size === 'sm'\"\n\t\t\t\t\t\t\tclass='cds--toggle__check'\n\t\t\t\t\t\t\twidth=\"6px\"\n\t\t\t\t\t\t\theight=\"5px\"\n\t\t\t\t\t\t\tviewBox=\"0 0 6 5\">\n\t\t\t\t\t\t\t<path d=\"M2.2 2.7L5 0 6 1 2.2 5 0 2.7 1 1.5z\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<span class=\"cds--toggle__text\">\n\t\t\t\t\t\t{{(hideLabel ? label : (getCheckedText() | async))}}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</label>\n\t\t</ng-container>\n\t\t<ng-template #skeletonTemplate>\n\t\t\t<div class=\"cds--toggle__skeleton-circle\"></div>\n\t\t\t<div class=\"cds--toggle__skeleton-rectangle\"></div>\n\t\t</ng-template>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Toggle,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Toggle extends Checkbox {\n\t/**\n\t * Variable used for creating unique ids for toggle components.\n\t */\n\tstatic toggleCount = 0;\n\n\t/**\n\t * Text that is set on the left side of the toggle.\n\t */\n\t@Input()\n\tset offText(value: string | Observable<string>) {\n\t\tthis._offValues.override(value);\n\t}\n\n\tget offText() {\n\t\treturn this._offValues.value;\n\t}\n\n\t/**\n\t * Text that is set on the right side of the toggle.\n\t */\n\t@Input()\n\tset onText(value: string | Observable<string>) {\n\t\tthis._onValues.override(value);\n\t}\n\n\tget onText() {\n\t\treturn this._onValues.value;\n\t}\n\t/**\n\t * Text that is set as the label of the toggle.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Size of the toggle component.\n\t */\n\t@Input() size: \"sm\" | \"md\" = \"md\";\n\t/**\n\t * Set to `true` to hide the toggle label & set toggle on/off text to label.\n\t */\n\t@Input() hideLabel = false;\n\n\t@HostBinding(\"class.cds--toggle--skeleton\") @Input() skeleton = false;\n\n\t@HostBinding(\"class.cds--toggle\") toggleClass = true;\n\t@HostBinding(\"class.cds--toggle--disabled\") get disabledClass () {\n\t\treturn this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--form-item\") get formItem() {\n\t\treturn !this.skeleton;\n\t}\n\n\t/**\n\t * The unique id allocated to the `Toggle`.\n\t */\n\tid = \"toggle-\" + Toggle.toggleCount;\n\n\tprotected _offValues = this.i18n.getOverridable(\"TOGGLE.OFF\");\n\tprotected _onValues = this.i18n.getOverridable(\"TOGGLE.ON\");\n\t/**\n\t * Creates an instance of Toggle.\n\t */\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef, protected i18n: I18n) {\n\t\tsuper(changeDetectorRef);\n\t\tToggle.toggleCount++;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the toggle input.\n\t *\n\t * ex: `this.formGroup.get(\"myToggle\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tgetOffText(): Observable<string> {\n\t\treturn this._offValues.subject;\n\t}\n\n\tgetOnText(): Observable<string> {\n\t\treturn this._onValues.subject;\n\t}\n\n\tgetCheckedText(): Observable<string> {\n\t\tif (this.checked) {\n\t\t\treturn this._onValues.subject;\n\t\t}\n\t\treturn this._offValues.subject;\n\t}\n\n\t/**\n\t * Creates instance of `ToggleChange` used to propagate the change event.\n\t */\n\temitChangeEvent() {\n\t\tthis.checkedChange.emit(this.checked);\n\t\tthis.propagateChange(this.checked);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n}\n",
|
|
63865
63876
|
"assetsDirs": [],
|
|
63866
63877
|
"styleUrlsData": "",
|
|
63867
63878
|
"stylesData": "",
|
|
@@ -63884,7 +63895,7 @@
|
|
|
63884
63895
|
"deprecationMessage": ""
|
|
63885
63896
|
}
|
|
63886
63897
|
],
|
|
63887
|
-
"line":
|
|
63898
|
+
"line": 163,
|
|
63888
63899
|
"rawdescription": "\n\nCreates an instance of Toggle.\n",
|
|
63889
63900
|
"jsdoctags": [
|
|
63890
63901
|
{
|
|
@@ -63927,7 +63938,7 @@
|
|
|
63927
63938
|
}
|
|
63928
63939
|
],
|
|
63929
63940
|
"returnType": "void",
|
|
63930
|
-
"line":
|
|
63941
|
+
"line": 114,
|
|
63931
63942
|
"rawdescription": "\n\nText that is set on the left side of the toggle.\n",
|
|
63932
63943
|
"description": "<p>Text that is set on the left side of the toggle.</p>\n",
|
|
63933
63944
|
"jsdoctags": [
|
|
@@ -63946,7 +63957,7 @@
|
|
|
63946
63957
|
"name": "offText",
|
|
63947
63958
|
"type": "",
|
|
63948
63959
|
"returnType": "",
|
|
63949
|
-
"line":
|
|
63960
|
+
"line": 118
|
|
63950
63961
|
}
|
|
63951
63962
|
},
|
|
63952
63963
|
"onText": {
|
|
@@ -63965,7 +63976,7 @@
|
|
|
63965
63976
|
}
|
|
63966
63977
|
],
|
|
63967
63978
|
"returnType": "void",
|
|
63968
|
-
"line":
|
|
63979
|
+
"line": 126,
|
|
63969
63980
|
"rawdescription": "\n\nText that is set on the right side of the toggle.\n",
|
|
63970
63981
|
"description": "<p>Text that is set on the right side of the toggle.</p>\n",
|
|
63971
63982
|
"jsdoctags": [
|
|
@@ -63984,7 +63995,7 @@
|
|
|
63984
63995
|
"name": "onText",
|
|
63985
63996
|
"type": "",
|
|
63986
63997
|
"returnType": "",
|
|
63987
|
-
"line":
|
|
63998
|
+
"line": 130
|
|
63988
63999
|
}
|
|
63989
64000
|
},
|
|
63990
64001
|
"disabledClass": {
|
|
@@ -63993,7 +64004,7 @@
|
|
|
63993
64004
|
"name": "disabledClass",
|
|
63994
64005
|
"type": "",
|
|
63995
64006
|
"returnType": "",
|
|
63996
|
-
"line":
|
|
64007
|
+
"line": 149
|
|
63997
64008
|
}
|
|
63998
64009
|
},
|
|
63999
64010
|
"formItem": {
|
|
@@ -64002,7 +64013,7 @@
|
|
|
64002
64013
|
"name": "formItem",
|
|
64003
64014
|
"type": "",
|
|
64004
64015
|
"returnType": "",
|
|
64005
|
-
"line":
|
|
64016
|
+
"line": 153
|
|
64006
64017
|
}
|
|
64007
64018
|
}
|
|
64008
64019
|
}
|
|
@@ -74007,7 +74018,7 @@
|
|
|
74007
74018
|
"deprecated": false,
|
|
74008
74019
|
"deprecationMessage": "",
|
|
74009
74020
|
"type": "",
|
|
74010
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[disabled]=\"disabled\">\n\t\t</cds-number>\n\t`\n})"
|
|
74021
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\">\n\t\t</cds-number>\n\t`\n})"
|
|
74011
74022
|
},
|
|
74012
74023
|
{
|
|
74013
74024
|
"name": "Template",
|
|
@@ -78987,7 +78998,7 @@
|
|
|
78987
78998
|
"deprecated": false,
|
|
78988
78999
|
"deprecationMessage": "",
|
|
78989
79000
|
"type": "",
|
|
78990
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[disabled]=\"disabled\">\n\t\t</cds-number>\n\t`\n})"
|
|
79001
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\">\n\t\t</cds-number>\n\t`\n})"
|
|
78991
79002
|
}
|
|
78992
79003
|
],
|
|
78993
79004
|
"src/pagination/pagination-nav.stories.ts": [
|
|
@@ -85940,8 +85951,8 @@
|
|
|
85940
85951
|
"type": "component",
|
|
85941
85952
|
"linktype": "component",
|
|
85942
85953
|
"name": "NumberComponent",
|
|
85943
|
-
"coveragePercent":
|
|
85944
|
-
"coverageCount": "
|
|
85954
|
+
"coveragePercent": 74,
|
|
85955
|
+
"coverageCount": "32/43",
|
|
85945
85956
|
"status": "good"
|
|
85946
85957
|
},
|
|
85947
85958
|
{
|