@ni/ok-components 1.17.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-components-bundle.js +135 -8
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1606 -1564
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +956 -840
- package/dist/custom-elements.md +132 -116
- package/dist/esm/fv/all-fv.d.ts +1 -0
- package/dist/esm/fv/all-fv.js +1 -0
- package/dist/esm/fv/all-fv.js.map +1 -1
- package/dist/esm/fv/multi-select/styles.js +35 -9
- package/dist/esm/fv/multi-select/styles.js.map +1 -1
- package/dist/esm/fv/text-field/index.d.ts +39 -0
- package/dist/esm/fv/text-field/index.js +111 -0
- package/dist/esm/fv/text-field/index.js.map +1 -0
- package/package.json +1 -1
package/dist/custom-elements.md
CHANGED
|
@@ -34,6 +34,34 @@
|
|
|
34
34
|
|
|
35
35
|
<hr/>
|
|
36
36
|
|
|
37
|
+
## class: `BulkEditState`
|
|
38
|
+
|
|
39
|
+
### Fields
|
|
40
|
+
|
|
41
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
42
|
+
| ----------------- | ------- | ---------------------------------- | ------- | ----------- | -------------- |
|
|
43
|
+
| `selectedIds` | public | `readonly RecordId[]` | | | |
|
|
44
|
+
| `changes` | public | `Readonly<PendingChanges<TField>>` | | | |
|
|
45
|
+
| `selectedRecords` | public | `readonly TRecord[]` | | | |
|
|
46
|
+
|
|
47
|
+
### Methods
|
|
48
|
+
|
|
49
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
50
|
+
| ------------------ | ------- | ----------- | ------------------------------------------------------------------------------------ | --------------------------------- | -------------- |
|
|
51
|
+
| `field` | public | | `field: TField` | `BulkEditFieldValue` | |
|
|
52
|
+
| `edit` | public | | `field: TField, value: string` | `void` | |
|
|
53
|
+
| `clear` | public | | `field: TField` | `void` | |
|
|
54
|
+
| `resetField` | public | | `field: TField` | `void` | |
|
|
55
|
+
| `revert` | public | | | `void` | |
|
|
56
|
+
| `isSelection` | public | | `ids: readonly RecordId[]` | `boolean` | |
|
|
57
|
+
| `visibleSelection` | public | | `visibleIds: readonly RecordId[]` | `readonly RecordId[]` | |
|
|
58
|
+
| `mergeVisible` | public | | `visibleIds: readonly RecordId[], selectedVisibleIds: readonly RecordId[], additive` | `readonly RecordId[]` | |
|
|
59
|
+
| `select` | public | | `ids: readonly RecordId[]` | `void` | |
|
|
60
|
+
| `createCommit` | public | | | `BulkEditCommit<TRecord, TField>` | |
|
|
61
|
+
| `commitSucceeded` | public | | `updatedRecords: readonly TRecord[]` | `void` | |
|
|
62
|
+
|
|
63
|
+
<hr/>
|
|
64
|
+
|
|
37
65
|
## class: `FvBulkEditField`
|
|
38
66
|
|
|
39
67
|
### Superclass
|
|
@@ -63,34 +91,6 @@
|
|
|
63
91
|
|
|
64
92
|
<hr/>
|
|
65
93
|
|
|
66
|
-
## class: `BulkEditState`
|
|
67
|
-
|
|
68
|
-
### Fields
|
|
69
|
-
|
|
70
|
-
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
71
|
-
| ----------------- | ------- | ---------------------------------- | ------- | ----------- | -------------- |
|
|
72
|
-
| `selectedIds` | public | `readonly RecordId[]` | | | |
|
|
73
|
-
| `changes` | public | `Readonly<PendingChanges<TField>>` | | | |
|
|
74
|
-
| `selectedRecords` | public | `readonly TRecord[]` | | | |
|
|
75
|
-
|
|
76
|
-
### Methods
|
|
77
|
-
|
|
78
|
-
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
79
|
-
| ------------------ | ------- | ----------- | ------------------------------------------------------------------------------------ | --------------------------------- | -------------- |
|
|
80
|
-
| `field` | public | | `field: TField` | `BulkEditFieldValue` | |
|
|
81
|
-
| `edit` | public | | `field: TField, value: string` | `void` | |
|
|
82
|
-
| `clear` | public | | `field: TField` | `void` | |
|
|
83
|
-
| `resetField` | public | | `field: TField` | `void` | |
|
|
84
|
-
| `revert` | public | | | `void` | |
|
|
85
|
-
| `isSelection` | public | | `ids: readonly RecordId[]` | `boolean` | |
|
|
86
|
-
| `visibleSelection` | public | | `visibleIds: readonly RecordId[]` | `readonly RecordId[]` | |
|
|
87
|
-
| `mergeVisible` | public | | `visibleIds: readonly RecordId[], selectedVisibleIds: readonly RecordId[], additive` | `readonly RecordId[]` | |
|
|
88
|
-
| `select` | public | | `ids: readonly RecordId[]` | `void` | |
|
|
89
|
-
| `createCommit` | public | | | `BulkEditCommit<TRecord, TField>` | |
|
|
90
|
-
| `commitSucceeded` | public | | `updatedRecords: readonly TRecord[]` | `void` | |
|
|
91
|
-
|
|
92
|
-
<hr/>
|
|
93
|
-
|
|
94
94
|
## class: `FvCard`
|
|
95
95
|
|
|
96
96
|
### Superclass
|
|
@@ -382,34 +382,6 @@
|
|
|
382
382
|
|
|
383
383
|
<hr/>
|
|
384
384
|
|
|
385
|
-
## class: `FvMasterDetailList`
|
|
386
|
-
|
|
387
|
-
### Superclass
|
|
388
|
-
|
|
389
|
-
| Name | Module | Package |
|
|
390
|
-
| ------------------- | ------ | ------------------- |
|
|
391
|
-
| `FoundationElement` | | @ni/fast-foundation |
|
|
392
|
-
|
|
393
|
-
### Fields
|
|
394
|
-
|
|
395
|
-
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
396
|
-
| ------------- | ------- | -------- | ------------------- | ----------- | -------------- |
|
|
397
|
-
| `placeholder` | public | `string` | `'Filter items...'` | | |
|
|
398
|
-
|
|
399
|
-
### Events
|
|
400
|
-
|
|
401
|
-
| Name | Type | Description | Inherited From |
|
|
402
|
-
| -------- | ------------- | ----------- | -------------- |
|
|
403
|
-
| `change` | `CustomEvent` | | |
|
|
404
|
-
|
|
405
|
-
### Attributes
|
|
406
|
-
|
|
407
|
-
| Name | Field | Inherited From |
|
|
408
|
-
| ------------- | ----------- | -------------- |
|
|
409
|
-
| `placeholder` | placeholder | |
|
|
410
|
-
|
|
411
|
-
<hr/>
|
|
412
|
-
|
|
413
385
|
## class: `FvMasterDetailListItem`
|
|
414
386
|
|
|
415
387
|
### Superclass
|
|
@@ -444,6 +416,34 @@
|
|
|
444
416
|
|
|
445
417
|
<hr/>
|
|
446
418
|
|
|
419
|
+
## class: `FvMasterDetailList`
|
|
420
|
+
|
|
421
|
+
### Superclass
|
|
422
|
+
|
|
423
|
+
| Name | Module | Package |
|
|
424
|
+
| ------------------- | ------ | ------------------- |
|
|
425
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
426
|
+
|
|
427
|
+
### Fields
|
|
428
|
+
|
|
429
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
430
|
+
| ------------- | ------- | -------- | ------------------- | ----------- | -------------- |
|
|
431
|
+
| `placeholder` | public | `string` | `'Filter items...'` | | |
|
|
432
|
+
|
|
433
|
+
### Events
|
|
434
|
+
|
|
435
|
+
| Name | Type | Description | Inherited From |
|
|
436
|
+
| -------- | ------------- | ----------- | -------------- |
|
|
437
|
+
| `change` | `CustomEvent` | | |
|
|
438
|
+
|
|
439
|
+
### Attributes
|
|
440
|
+
|
|
441
|
+
| Name | Field | Inherited From |
|
|
442
|
+
| ------------- | ----------- | -------------- |
|
|
443
|
+
| `placeholder` | placeholder | |
|
|
444
|
+
|
|
445
|
+
<hr/>
|
|
446
|
+
|
|
447
447
|
## class: `FvMultiSelect`
|
|
448
448
|
|
|
449
449
|
### Superclass
|
|
@@ -506,6 +506,43 @@
|
|
|
506
506
|
|
|
507
507
|
<hr/>
|
|
508
508
|
|
|
509
|
+
## class: `FvSplitButton`
|
|
510
|
+
|
|
511
|
+
### Superclass
|
|
512
|
+
|
|
513
|
+
| Name | Module | Package |
|
|
514
|
+
| ------------------- | ------ | ------------------- |
|
|
515
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
516
|
+
|
|
517
|
+
### Fields
|
|
518
|
+
|
|
519
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
520
|
+
| ------------------- | ------- | ------------------------------------ | -------------------- | ----------- | -------------- |
|
|
521
|
+
| `label` | public | `string` | `'Primary function'` | | |
|
|
522
|
+
| `disabled` | public | `boolean` | `false` | | |
|
|
523
|
+
| `open` | public | `boolean` | `false` | | |
|
|
524
|
+
| `appearance` | public | `FvSplitButtonAppearanceType` | | | |
|
|
525
|
+
| `appearanceVariant` | public | `FvSplitButtonAppearanceVariantType` | | | |
|
|
526
|
+
|
|
527
|
+
### Events
|
|
528
|
+
|
|
529
|
+
| Name | Type | Description | Inherited From |
|
|
530
|
+
| --------- | ------------- | ----------- | -------------- |
|
|
531
|
+
| `trigger` | `CustomEvent` | | |
|
|
532
|
+
| `toggle` | `CustomEvent` | | |
|
|
533
|
+
|
|
534
|
+
### Attributes
|
|
535
|
+
|
|
536
|
+
| Name | Field | Inherited From |
|
|
537
|
+
| -------------------- | ----------------- | -------------- |
|
|
538
|
+
| `label` | label | |
|
|
539
|
+
| `disabled` | disabled | |
|
|
540
|
+
| `open` | open | |
|
|
541
|
+
| `appearance` | appearance | |
|
|
542
|
+
| `appearance-variant` | appearanceVariant | |
|
|
543
|
+
|
|
544
|
+
<hr/>
|
|
545
|
+
|
|
509
546
|
## class: `FvSplitButtonAnchor`
|
|
510
547
|
|
|
511
548
|
### Superclass
|
|
@@ -638,43 +675,6 @@
|
|
|
638
675
|
|
|
639
676
|
<hr/>
|
|
640
677
|
|
|
641
|
-
## class: `FvSplitButton`
|
|
642
|
-
|
|
643
|
-
### Superclass
|
|
644
|
-
|
|
645
|
-
| Name | Module | Package |
|
|
646
|
-
| ------------------- | ------ | ------------------- |
|
|
647
|
-
| `FoundationElement` | | @ni/fast-foundation |
|
|
648
|
-
|
|
649
|
-
### Fields
|
|
650
|
-
|
|
651
|
-
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
652
|
-
| ------------------- | ------- | ------------------------------------ | -------------------- | ----------- | -------------- |
|
|
653
|
-
| `label` | public | `string` | `'Primary function'` | | |
|
|
654
|
-
| `disabled` | public | `boolean` | `false` | | |
|
|
655
|
-
| `open` | public | `boolean` | `false` | | |
|
|
656
|
-
| `appearance` | public | `FvSplitButtonAppearanceType` | | | |
|
|
657
|
-
| `appearanceVariant` | public | `FvSplitButtonAppearanceVariantType` | | | |
|
|
658
|
-
|
|
659
|
-
### Events
|
|
660
|
-
|
|
661
|
-
| Name | Type | Description | Inherited From |
|
|
662
|
-
| --------- | ------------- | ----------- | -------------- |
|
|
663
|
-
| `trigger` | `CustomEvent` | | |
|
|
664
|
-
| `toggle` | `CustomEvent` | | |
|
|
665
|
-
|
|
666
|
-
### Attributes
|
|
667
|
-
|
|
668
|
-
| Name | Field | Inherited From |
|
|
669
|
-
| -------------------- | ----------------- | -------------- |
|
|
670
|
-
| `label` | label | |
|
|
671
|
-
| `disabled` | disabled | |
|
|
672
|
-
| `open` | open | |
|
|
673
|
-
| `appearance` | appearance | |
|
|
674
|
-
| `appearance-variant` | appearanceVariant | |
|
|
675
|
-
|
|
676
|
-
<hr/>
|
|
677
|
-
|
|
678
678
|
## class: `FvStickyHeader`
|
|
679
679
|
|
|
680
680
|
### Superclass
|
|
@@ -719,35 +719,19 @@
|
|
|
719
719
|
|
|
720
720
|
<hr/>
|
|
721
721
|
|
|
722
|
-
## class: `
|
|
722
|
+
## class: `FvTextField`
|
|
723
723
|
|
|
724
724
|
### Superclass
|
|
725
725
|
|
|
726
|
-
| Name
|
|
727
|
-
|
|
|
728
|
-
| `
|
|
726
|
+
| Name | Module | Package |
|
|
727
|
+
| ----------------- | ------ | ----------------------------------------- |
|
|
728
|
+
| `NimbleTextField` | | @ni/nimble-components/dist/esm/text-field |
|
|
729
729
|
|
|
730
730
|
### Fields
|
|
731
731
|
|
|
732
|
-
| Name
|
|
733
|
-
|
|
|
734
|
-
| `
|
|
735
|
-
| `label` | public | `string` | `''` | | |
|
|
736
|
-
| `legacyStyle` | public | `boolean` | `false` | | |
|
|
737
|
-
| `size` | public | `FvSummaryPanelSizeType` | | | |
|
|
738
|
-
| `selected` | public | `boolean` | `false` | | |
|
|
739
|
-
| `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
|
|
740
|
-
|
|
741
|
-
### Attributes
|
|
742
|
-
|
|
743
|
-
| Name | Field | Inherited From |
|
|
744
|
-
| --------------- | ------------ | -------------- |
|
|
745
|
-
| `count` | count | |
|
|
746
|
-
| `label` | label | |
|
|
747
|
-
| `legacy-style` | legacyStyle | |
|
|
748
|
-
| `size` | size | |
|
|
749
|
-
| `selected` | selected | |
|
|
750
|
-
| `text-position` | textPosition | |
|
|
732
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
733
|
+
| ------------- | ------- | ----------------------------- | ------- | ------------------------------------------------------------- | -------------- |
|
|
734
|
+
| `maskOptions` | public | `MaskitoOptions \| undefined` | | Maskito configuration applied to user and programmatic input. | |
|
|
751
735
|
|
|
752
736
|
<hr/>
|
|
753
737
|
|
|
@@ -774,6 +758,38 @@
|
|
|
774
758
|
|
|
775
759
|
<hr/>
|
|
776
760
|
|
|
761
|
+
## class: `FvSummaryPanelTile`
|
|
762
|
+
|
|
763
|
+
### Superclass
|
|
764
|
+
|
|
765
|
+
| Name | Module | Package |
|
|
766
|
+
| ------------------- | ------ | ------------------- |
|
|
767
|
+
| `FoundationElement` | | @ni/fast-foundation |
|
|
768
|
+
|
|
769
|
+
### Fields
|
|
770
|
+
|
|
771
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
772
|
+
| -------------- | ------- | ------------------------------------ | ------- | ----------- | -------------- |
|
|
773
|
+
| `count` | public | `string` | `''` | | |
|
|
774
|
+
| `label` | public | `string` | `''` | | |
|
|
775
|
+
| `legacyStyle` | public | `boolean` | `false` | | |
|
|
776
|
+
| `size` | public | `FvSummaryPanelSizeType` | | | |
|
|
777
|
+
| `selected` | public | `boolean` | `false` | | |
|
|
778
|
+
| `textPosition` | public | `FvSummaryPanelTileTextPositionType` | | | |
|
|
779
|
+
|
|
780
|
+
### Attributes
|
|
781
|
+
|
|
782
|
+
| Name | Field | Inherited From |
|
|
783
|
+
| --------------- | ------------ | -------------- |
|
|
784
|
+
| `count` | count | |
|
|
785
|
+
| `label` | label | |
|
|
786
|
+
| `legacy-style` | legacyStyle | |
|
|
787
|
+
| `size` | size | |
|
|
788
|
+
| `selected` | selected | |
|
|
789
|
+
| `text-position` | textPosition | |
|
|
790
|
+
|
|
791
|
+
<hr/>
|
|
792
|
+
|
|
777
793
|
## class: `TsIconDynamic`
|
|
778
794
|
|
|
779
795
|
### Superclass
|
package/dist/esm/fv/all-fv.d.ts
CHANGED
package/dist/esm/fv/all-fv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './date-time-picker';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './multi-select';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
|
|
1
|
+
{"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,QAAQ,CAAC;AAChB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,gBAAgB,CAAC;AACxB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,iBAAiB,CAAC;AACzB,OAAO,iBAAiB,CAAC;AACzB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,YAAY,CAAC;AACpB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,CAAC","sourcesContent":["import './accordion-item';\nimport './card';\nimport './bulk-edit-field';\nimport './chip-selector';\nimport './context-help';\nimport './date-time-picker';\nimport './edit-commit-bar';\nimport './filter-bar';\nimport './master-detail-list-item';\nimport './master-detail-list';\nimport './multi-select';\nimport './split-button';\nimport './split-button-anchor';\nimport './sticky-header';\nimport './summary-panel';\nimport './summary-panel-tile';\nimport './search-input';\nimport './text-field';\nimport './splitter';\nimport './split-layout';\nimport './toolbar';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@ni/fast-element';
|
|
2
|
-
import { applicationBackgroundColor, bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, controlHeight, controlSlimHeight, controlLabelFont, controlLabelFontColor, elevation2BoxShadow, fillHoverColor,
|
|
2
|
+
import { applicationBackgroundColor, bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, controlHeight, controlSlimHeight, controlLabelFont, controlLabelFontColor, elevation2BoxShadow, fillHoverColor, iconColor, mediumPadding, placeholderFontColor, popupBorderColor, smallDelay, smallPadding, standardPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
3
3
|
import { Theme } from '@ni/nimble-components/dist/esm/theme-provider/types';
|
|
4
4
|
import { focusVisible } from '@ni/nimble-components/dist/esm/utilities/style/focus';
|
|
5
5
|
import { themeBehavior } from '@ni/nimble-components/dist/esm/utilities/style/theme';
|
|
@@ -148,6 +148,10 @@ export const styles = css `
|
|
|
148
148
|
box-shadow: ${elevation2BoxShadow};
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
.anchored-region.top .popup {
|
|
152
|
+
flex-direction: column-reverse;
|
|
153
|
+
}
|
|
154
|
+
|
|
151
155
|
.filter-field {
|
|
152
156
|
flex-shrink: 0;
|
|
153
157
|
display: flex;
|
|
@@ -157,6 +161,10 @@ export const styles = css `
|
|
|
157
161
|
box-shadow: 0 2px rgba(${borderRgbPartialColor}, 0.1);
|
|
158
162
|
}
|
|
159
163
|
|
|
164
|
+
.anchored-region.top .filter-field {
|
|
165
|
+
box-shadow: 0 -2px rgba(${borderRgbPartialColor}, 0.1);
|
|
166
|
+
}
|
|
167
|
+
|
|
160
168
|
.filter-icon {
|
|
161
169
|
flex-shrink: 0;
|
|
162
170
|
margin-left: ${smallPadding};
|
|
@@ -182,16 +190,31 @@ export const styles = css `
|
|
|
182
190
|
.listbox {
|
|
183
191
|
min-height: 0;
|
|
184
192
|
max-height: 240px;
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
padding: ${smallPadding};
|
|
195
|
+
padding-top: calc(${smallPadding} + 2px);
|
|
196
|
+
scroll-padding: calc(${smallPadding} + 2px) ${smallPadding} ${smallPadding};
|
|
185
197
|
overflow-y: auto;
|
|
186
198
|
outline: none;
|
|
187
199
|
}
|
|
188
200
|
|
|
201
|
+
.anchored-region.top .filter-field + .listbox:has(.option) {
|
|
202
|
+
padding-top: ${smallPadding};
|
|
203
|
+
padding-bottom: calc(${smallPadding} + 2px);
|
|
204
|
+
scroll-padding-top: ${smallPadding};
|
|
205
|
+
scroll-padding-bottom: calc(${smallPadding} + 2px);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.popup:has(.empty) .listbox {
|
|
209
|
+
padding: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
189
212
|
.option {
|
|
190
213
|
display: flex;
|
|
191
214
|
align-items: center;
|
|
192
215
|
gap: ${smallPadding};
|
|
193
216
|
min-height: ${controlHeight};
|
|
194
|
-
padding: 0 ${
|
|
217
|
+
padding: 0 ${mediumPadding};
|
|
195
218
|
cursor: pointer;
|
|
196
219
|
}
|
|
197
220
|
|
|
@@ -211,11 +234,8 @@ export const styles = css `
|
|
|
211
234
|
}
|
|
212
235
|
|
|
213
236
|
.keyboard-navigation .option.active {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
.keyboard-navigation .option.active:hover {
|
|
218
|
-
background: ${fillHoverSelectedColor};
|
|
237
|
+
outline: 2px solid ${borderHoverColor};
|
|
238
|
+
outline-offset: -2px;
|
|
219
239
|
}
|
|
220
240
|
|
|
221
241
|
:host(:is([disabled], :disabled)) .control-field,
|
|
@@ -231,10 +251,16 @@ export const styles = css `
|
|
|
231
251
|
|
|
232
252
|
.empty {
|
|
233
253
|
flex-shrink: 0;
|
|
234
|
-
|
|
254
|
+
display: flex;
|
|
255
|
+
align-items: center;
|
|
256
|
+
box-sizing: border-box;
|
|
257
|
+
height: ${controlHeight};
|
|
258
|
+
padding: ${smallPadding} ${mediumPadding};
|
|
235
259
|
}
|
|
236
260
|
`.withBehaviors(themeBehavior(Theme.color, css `
|
|
237
|
-
.filter-field
|
|
261
|
+
.filter-field,
|
|
262
|
+
.listbox,
|
|
263
|
+
.empty {
|
|
238
264
|
background: rgba(255, 255, 255, 0.15);
|
|
239
265
|
}
|
|
240
266
|
`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/multi-select/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/multi-select/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,EAClB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,qDAAqD,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,sDAAsD,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;;;gBAKb,QAAQ;iBACP,aAAa;;;;;yBAKL,YAAY;gBACrB,gBAAgB;iBACf,qBAAqB;;;;;;;eAOvB,YAAY;;kBAET,aAAa;;qBAEV,eAAe;kBAClB,WAAW;oCACO,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2BvC,iBAAiB;;;;6BAIN,qBAAqB;;;;2BAIvB,qBAAqB;;;;;;;;;+BASjB,gBAAgB;;;;;;;;;;;;4BAYnB,UAAU;;;;uBAIf,WAAW;mCACC,gBAAgB;;;;4BAIvB,WAAW;8BACT,WAAW,iBAAiB,gBAAgB;;;oEAGN,YAAY;;;;;oEAKZ,YAAY;;;;;;;;;;;;;;;;;;;;;iBAqB/D,oBAAoB;;;;uBAId,YAAY;;;;0BAIT,YAAY;;;;;;;wFAOkD,YAAY;;kBAElF,WAAW,UAAU,gBAAgB;sBACjC,0BAA0B;sBAC1B,mBAAmB;;;;;;;;;;;kBAWvB,aAAa;;iCAEE,qBAAqB;;;;kCAIpB,qBAAqB;;;;;uBAKhC,YAAY;UACzB,SAAS,CAAC,iBAAiB,KAAK,oBAAoB;;;;;;kBAM5C,aAAa;qBACV,YAAY,MAAM,aAAa;;;;;;;;;iBASnC,oBAAoB;;;;;;;mBAOlB,YAAY;4BACH,YAAY;+BACT,YAAY,WAAW,YAAY,IAAI,YAAY;;;;;;uBAM3D,YAAY;+BACJ,YAAY;8BACb,YAAY;sCACJ,YAAY;;;;;;;;;;eAUnC,YAAY;sBACL,aAAa;qBACd,aAAa;;;;;;;;;;;;;;;;sBAgBZ,cAAc;;;;6BAIP,gBAAgB;;;;;;;iBAO5B,qBAAqB;;;;;UAK5B,SAAS,CAAC,iBAAiB,KAAK,qBAAqB;;;;;;;;kBAQ7C,aAAa;mBACZ,YAAY,IAAI,aAAa;;CAE/C,CAAC,aAAa,CACX,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;;;;;SAMF,CACJ,CACJ,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n bodyDisabledFontColor,\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n controlHeight,\n controlSlimHeight,\n controlLabelFont,\n controlLabelFontColor,\n elevation2BoxShadow,\n fillHoverColor,\n iconColor,\n mediumPadding,\n placeholderFontColor,\n popupBorderColor,\n smallDelay,\n smallPadding,\n standardPadding\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { Theme } from '@ni/nimble-components/dist/esm/theme-provider/types';\nimport { focusVisible } from '@ni/nimble-components/dist/esm/utilities/style/focus';\nimport { themeBehavior } from '@ni/nimble-components/dist/esm/utilities/style/theme';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('inline-block')}\n\n :host {\n width: 300px;\n max-width: 100%;\n font: ${bodyFont};\n color: ${bodyFontColor};\n }\n\n .label {\n display: block;\n margin-bottom: ${smallPadding};\n font: ${controlLabelFont};\n color: ${controlLabelFontColor};\n }\n\n .control-field {\n position: relative;\n display: flex;\n align-items: center;\n gap: ${smallPadding};\n width: 100%;\n height: ${controlHeight};\n box-sizing: border-box;\n padding: 0 ${standardPadding};\n border: ${borderWidth} solid transparent;\n border-bottom-color: rgba(${borderRgbPartialColor}, 0.3);\n border-radius: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n text-align: start;\n cursor: pointer;\n }\n\n .control {\n display: flex;\n align-items: center;\n flex: 1;\n min-width: 0;\n height: 100%;\n padding: 0;\n border: none;\n font: inherit;\n color: inherit;\n background: transparent;\n text-align: start;\n cursor: inherit;\n outline: none;\n }\n\n .clear-button {\n flex: none;\n height: ${controlSlimHeight};\n }\n\n :host([appearance='outline']) .control-field {\n border-color: rgba(${borderRgbPartialColor}, 0.3);\n }\n\n :host([appearance='block']) .control-field {\n background: rgba(${borderRgbPartialColor}, 0.1);\n border-color: transparent;\n }\n\n :host([appearance='frameless']) .control-field {\n border-color: transparent;\n }\n\n :host([open]:not(:hover)) .control-field {\n border-bottom-color: ${borderHoverColor};\n }\n\n .control-field::before,\n .control-field::after {\n content: '';\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n width: 0;\n height: 0;\n pointer-events: none;\n transition: width ${smallDelay} ease-in;\n }\n\n .control-field::before {\n bottom: calc(${borderWidth} + 1px);\n border-bottom: 1px solid ${borderHoverColor};\n }\n\n .control-field::after {\n bottom: calc(-1 * ${borderWidth});\n border-bottom: calc(${borderWidth} + 1px) solid ${borderHoverColor};\n }\n\n :host(:not([disabled], :disabled)) .control-field:has(.control${focusVisible})::before {\n width: calc(100% - 8px);\n }\n\n :host(:not([disabled], :disabled)) .control-field:hover::after,\n :host(:not([disabled], :disabled)) .control-field:has(.control${focusVisible})::after {\n width: 100%;\n }\n\n @media (prefers-reduced-motion) {\n .control-field::before,\n .control-field::after {\n transition-duration: 0s;\n }\n }\n\n .selected-value {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .placeholder,\n .empty {\n color: ${placeholderFontColor};\n }\n\n .anchored-region.bottom {\n padding-top: ${smallPadding};\n }\n\n .anchored-region.top {\n padding-bottom: ${smallPadding};\n }\n\n .popup {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-height: max(0px, calc(var(--ok-fv-multi-select-available-height, 100vh) - ${smallPadding}));\n box-sizing: border-box;\n border: ${borderWidth} solid ${popupBorderColor};\n background: ${applicationBackgroundColor};\n box-shadow: ${elevation2BoxShadow};\n }\n\n .anchored-region.top .popup {\n flex-direction: column-reverse;\n }\n\n .filter-field {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n height: ${controlHeight};\n background: transparent;\n box-shadow: 0 2px rgba(${borderRgbPartialColor}, 0.1);\n }\n\n .anchored-region.top .filter-field {\n box-shadow: 0 -2px rgba(${borderRgbPartialColor}, 0.1);\n }\n\n .filter-icon {\n flex-shrink: 0;\n margin-left: ${smallPadding};\n ${iconColor.cssCustomProperty}: ${placeholderFontColor};\n }\n\n .filter-input {\n width: 100%;\n min-width: 0;\n height: ${controlHeight};\n padding: 0 ${smallPadding} 0 ${mediumPadding};\n border: none;\n outline: none;\n font: inherit;\n color: inherit;\n background: transparent;\n }\n\n .filter-input::placeholder {\n color: ${placeholderFontColor};\n }\n\n .listbox {\n min-height: 0;\n max-height: 240px;\n box-sizing: border-box;\n padding: ${smallPadding};\n padding-top: calc(${smallPadding} + 2px);\n scroll-padding: calc(${smallPadding} + 2px) ${smallPadding} ${smallPadding};\n overflow-y: auto;\n outline: none;\n }\n\n .anchored-region.top .filter-field + .listbox:has(.option) {\n padding-top: ${smallPadding};\n padding-bottom: calc(${smallPadding} + 2px);\n scroll-padding-top: ${smallPadding};\n scroll-padding-bottom: calc(${smallPadding} + 2px);\n }\n\n .popup:has(.empty) .listbox {\n padding: 0;\n }\n\n .option {\n display: flex;\n align-items: center;\n gap: ${smallPadding};\n min-height: ${controlHeight};\n padding: 0 ${mediumPadding};\n cursor: pointer;\n }\n\n .option-label {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .option nimble-checkbox {\n flex: none;\n pointer-events: none;\n }\n\n .option:not([aria-disabled='true']):hover {\n background: ${fillHoverColor};\n }\n\n .keyboard-navigation .option.active {\n outline: 2px solid ${borderHoverColor};\n outline-offset: -2px;\n }\n\n :host(:is([disabled], :disabled)) .control-field,\n :host(:is([disabled], :disabled)) .label,\n .option[aria-disabled='true'] {\n color: ${bodyDisabledFontColor};\n cursor: default;\n }\n\n :host(:is([disabled], :disabled)) .control-field {\n ${iconColor.cssCustomProperty}: ${bodyDisabledFontColor};\n }\n\n .empty {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: ${controlHeight};\n padding: ${smallPadding} ${mediumPadding};\n }\n`.withBehaviors(\n themeBehavior(\n Theme.color,\n css`\n .filter-field,\n .listbox,\n .empty {\n background: rgba(255, 255, 255, 0.15);\n }\n `\n )\n);\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type MaskitoOptions } from '@maskito/core';
|
|
2
|
+
import { TextField as NimbleTextField } from '@ni/nimble-components/dist/esm/text-field';
|
|
3
|
+
export type { MaskitoOptions } from '@maskito/core';
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'ok-fv-text-field': FvTextField;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A Nimble text field with optional Maskito input masking.
|
|
11
|
+
*/
|
|
12
|
+
export declare class FvTextField extends NimbleTextField {
|
|
13
|
+
/**
|
|
14
|
+
* Maskito configuration applied to user and programmatic input.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
* @remarks
|
|
18
|
+
* This property is not reflected to an HTML attribute because Maskito
|
|
19
|
+
* options can contain regular expressions and functions.
|
|
20
|
+
*/
|
|
21
|
+
maskOptions?: MaskitoOptions;
|
|
22
|
+
private maskito?;
|
|
23
|
+
private updatingValueFromControl;
|
|
24
|
+
private normalizingValue;
|
|
25
|
+
/** @internal */
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
/** @internal */
|
|
28
|
+
disconnectedCallback(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
maskOptionsChanged(): void;
|
|
31
|
+
/** @internal */
|
|
32
|
+
handleTextInput(): void;
|
|
33
|
+
/** @internal */
|
|
34
|
+
valueChanged(previous: string, next: string): void;
|
|
35
|
+
private initializeMask;
|
|
36
|
+
private createMask;
|
|
37
|
+
private destroyMask;
|
|
38
|
+
}
|
|
39
|
+
export declare const fvTextFieldTag = "ok-fv-text-field";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, observable } from '@ni/fast-element';
|
|
3
|
+
import { Maskito, maskitoTransform } from '@maskito/core';
|
|
4
|
+
import { TextField as NimbleTextField } from '@ni/nimble-components/dist/esm/text-field';
|
|
5
|
+
import { styles } from '@ni/nimble-components/dist/esm/text-field/styles';
|
|
6
|
+
import { template } from '@ni/nimble-components/dist/esm/text-field/template';
|
|
7
|
+
import { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';
|
|
8
|
+
import { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';
|
|
9
|
+
import { DesignSystem } from '@ni/fast-foundation';
|
|
10
|
+
/**
|
|
11
|
+
* A Nimble text field with optional Maskito input masking.
|
|
12
|
+
*/
|
|
13
|
+
export class FvTextField extends NimbleTextField {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.updatingValueFromControl = false;
|
|
17
|
+
this.normalizingValue = false;
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
this.initializeMask();
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
this.destroyMask();
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
maskOptionsChanged() {
|
|
31
|
+
if (this.$fastController.isConnected) {
|
|
32
|
+
this.initializeMask();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
handleTextInput() {
|
|
37
|
+
this.updatingValueFromControl = true;
|
|
38
|
+
super.handleTextInput();
|
|
39
|
+
this.updatingValueFromControl = false;
|
|
40
|
+
}
|
|
41
|
+
/** @internal */
|
|
42
|
+
valueChanged(previous, next) {
|
|
43
|
+
if (!this.maskOptions
|
|
44
|
+
|| this.updatingValueFromControl
|
|
45
|
+
|| this.normalizingValue) {
|
|
46
|
+
super.valueChanged(previous, next);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const maskedValue = maskitoTransform(next, this.maskOptions);
|
|
50
|
+
if (maskedValue !== next) {
|
|
51
|
+
this.normalizingValue = true;
|
|
52
|
+
this.value = maskedValue;
|
|
53
|
+
this.normalizingValue = false;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
super.valueChanged(previous, next);
|
|
57
|
+
}
|
|
58
|
+
if (this.$fastController.isConnected) {
|
|
59
|
+
this.control.value = maskedValue;
|
|
60
|
+
this.createMask();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
initializeMask() {
|
|
64
|
+
this.destroyMask();
|
|
65
|
+
if (!this.maskOptions) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const maskedValue = maskitoTransform(this.value, this.maskOptions);
|
|
69
|
+
if (maskedValue !== this.value) {
|
|
70
|
+
this.value = maskedValue;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.control.value = maskedValue;
|
|
74
|
+
this.createMask();
|
|
75
|
+
}
|
|
76
|
+
createMask() {
|
|
77
|
+
this.destroyMask();
|
|
78
|
+
if (this.maskOptions) {
|
|
79
|
+
this.maskito = new Maskito(this.control, this.maskOptions);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
destroyMask() {
|
|
83
|
+
this.maskito?.destroy();
|
|
84
|
+
this.maskito = undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
__decorate([
|
|
88
|
+
observable
|
|
89
|
+
], FvTextField.prototype, "maskOptions", void 0);
|
|
90
|
+
const okFvTextField = FvTextField.compose({
|
|
91
|
+
baseName: 'fv-text-field',
|
|
92
|
+
baseClass: NimbleTextField,
|
|
93
|
+
template,
|
|
94
|
+
styles,
|
|
95
|
+
shadowOptions: {
|
|
96
|
+
delegatesFocus: true
|
|
97
|
+
},
|
|
98
|
+
end: html `
|
|
99
|
+
<${iconExclamationMarkTag}
|
|
100
|
+
severity="error"
|
|
101
|
+
class="error-icon"
|
|
102
|
+
></${iconExclamationMarkTag}>
|
|
103
|
+
<span part="actions">
|
|
104
|
+
<slot name="actions"></slot>
|
|
105
|
+
</span>
|
|
106
|
+
${errorTextTemplate}
|
|
107
|
+
`
|
|
108
|
+
});
|
|
109
|
+
DesignSystem.getOrCreate().withPrefix('ok').register(okFvTextField());
|
|
110
|
+
export const fvTextFieldTag = 'ok-fv-text-field';
|
|
111
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/text-field/index.ts"],"names":[],"mappings":"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","sourcesContent":["import { html, observable } from '@ni/fast-element';\nimport type { TextFieldOptions } from '@ni/fast-foundation';\nimport {\n Maskito,\n type MaskitoOptions,\n maskitoTransform\n} from '@maskito/core';\nimport {\n TextField as NimbleTextField\n} from '@ni/nimble-components/dist/esm/text-field';\nimport { styles } from '@ni/nimble-components/dist/esm/text-field/styles';\nimport { template } from '@ni/nimble-components/dist/esm/text-field/template';\nimport { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';\nimport { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';\nimport { DesignSystem } from '@ni/fast-foundation';\n\nexport type { MaskitoOptions } from '@maskito/core';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-text-field': FvTextField;\n }\n}\n\n/**\n * A Nimble text field with optional Maskito input masking.\n */\nexport class FvTextField extends NimbleTextField {\n /**\n * Maskito configuration applied to user and programmatic input.\n *\n * @public\n * @remarks\n * This property is not reflected to an HTML attribute because Maskito\n * options can contain regular expressions and functions.\n */\n @observable\n public maskOptions?: MaskitoOptions;\n\n private maskito?: Maskito;\n private updatingValueFromControl = false;\n private normalizingValue = false;\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.initializeMask();\n }\n\n /** @internal */\n public override disconnectedCallback(): void {\n this.destroyMask();\n super.disconnectedCallback();\n }\n\n /** @internal */\n public maskOptionsChanged(): void {\n if (this.$fastController.isConnected) {\n this.initializeMask();\n }\n }\n\n /** @internal */\n public override handleTextInput(): void {\n this.updatingValueFromControl = true;\n super.handleTextInput();\n this.updatingValueFromControl = false;\n }\n\n /** @internal */\n public override valueChanged(previous: string, next: string): void {\n if (\n !this.maskOptions\n || this.updatingValueFromControl\n || this.normalizingValue\n ) {\n super.valueChanged(previous, next);\n return;\n }\n\n const maskedValue = maskitoTransform(next, this.maskOptions);\n if (maskedValue !== next) {\n this.normalizingValue = true;\n this.value = maskedValue;\n this.normalizingValue = false;\n } else {\n super.valueChanged(previous, next);\n }\n\n if (this.$fastController.isConnected) {\n this.control.value = maskedValue;\n this.createMask();\n }\n }\n\n private initializeMask(): void {\n this.destroyMask();\n if (!this.maskOptions) {\n return;\n }\n\n const maskedValue = maskitoTransform(this.value, this.maskOptions);\n if (maskedValue !== this.value) {\n this.value = maskedValue;\n return;\n }\n\n this.control.value = maskedValue;\n this.createMask();\n }\n\n private createMask(): void {\n this.destroyMask();\n if (this.maskOptions) {\n this.maskito = new Maskito(this.control, this.maskOptions);\n }\n }\n\n private destroyMask(): void {\n this.maskito?.destroy();\n this.maskito = undefined;\n }\n}\n\nconst okFvTextField = FvTextField.compose<TextFieldOptions>({\n baseName: 'fv-text-field',\n baseClass: NimbleTextField,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n },\n end: html<FvTextField>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n <span part=\"actions\">\n <slot name=\"actions\"></slot>\n </span>\n ${errorTextTemplate}\n `\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvTextField());\nexport const fvTextFieldTag = 'ok-fv-text-field';"]}
|