@ni/ok-components 1.0.1 → 1.1.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.
@@ -16,13 +16,13 @@
16
16
  },
17
17
  {
18
18
  "kind": "javascript-module",
19
- "path": "src/fv/all-fv.ts",
19
+ "path": "src/ts/all-ts.ts",
20
20
  "declarations": [],
21
21
  "exports": []
22
22
  },
23
23
  {
24
24
  "kind": "javascript-module",
25
- "path": "src/ts/all-ts.ts",
25
+ "path": "src/fv/all-fv.ts",
26
26
  "declarations": [],
27
27
  "exports": []
28
28
  },
@@ -67,6 +67,74 @@
67
67
  }
68
68
  ]
69
69
  },
70
+ {
71
+ "kind": "javascript-module",
72
+ "path": "src/ts/icon-dynamic/index.ts",
73
+ "declarations": [
74
+ {
75
+ "kind": "class",
76
+ "description": "Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:\n```\ncustomElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');\n```\nAfter calling successfully, the icon can be used like any other icon:\n```\n<ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>\n<nimble-mapping-icon icon=\"ok-ts-icon-dynamic-awesome\"></nimble-mapping-icon>\n```",
77
+ "name": "TsIconDynamic",
78
+ "members": [
79
+ {
80
+ "kind": "method",
81
+ "name": "registerIconDynamic",
82
+ "privacy": "public",
83
+ "static": true,
84
+ "return": {
85
+ "type": {
86
+ "text": "void"
87
+ }
88
+ },
89
+ "parameters": [
90
+ {
91
+ "name": "tagName",
92
+ "type": {
93
+ "text": "string"
94
+ }
95
+ },
96
+ {
97
+ "name": "url",
98
+ "type": {
99
+ "text": "string"
100
+ }
101
+ }
102
+ ]
103
+ }
104
+ ],
105
+ "superclass": {
106
+ "name": "Icon",
107
+ "package": "@ni/nimble-components/dist/esm/icon-base"
108
+ }
109
+ },
110
+ {
111
+ "kind": "variable",
112
+ "name": "tsIconDynamicTag",
113
+ "type": {
114
+ "text": "string"
115
+ },
116
+ "default": "'ok-ts-icon-dynamic'"
117
+ }
118
+ ],
119
+ "exports": [
120
+ {
121
+ "kind": "js",
122
+ "name": "TsIconDynamic",
123
+ "declaration": {
124
+ "name": "TsIconDynamic",
125
+ "module": "src/ts/icon-dynamic/index.ts"
126
+ }
127
+ },
128
+ {
129
+ "kind": "js",
130
+ "name": "tsIconDynamicTag",
131
+ "declaration": {
132
+ "name": "tsIconDynamicTag",
133
+ "module": "src/ts/icon-dynamic/index.ts"
134
+ }
135
+ }
136
+ ]
137
+ },
70
138
  {
71
139
  "kind": "javascript-module",
72
140
  "path": "src/fv/accordion-item/index.ts",
@@ -205,68 +273,113 @@
205
273
  },
206
274
  {
207
275
  "kind": "javascript-module",
208
- "path": "src/ts/icon-dynamic/index.ts",
276
+ "path": "src/fv/search-input/index.ts",
209
277
  "declarations": [
210
278
  {
211
279
  "kind": "class",
212
- "description": "Base class for dynamic icons. Not intended to be used directly, instead use to register dynamic icons:\n```\ncustomElements.get('ok-ts-icon-dynamic').registerIconDynamic('ok-ts-icon-dynamic-awesome', '<img data uri or arbitrary url>');\n```\nAfter calling successfully, the icon can be used like any other icon:\n```\n<ok-ts-icon-dynamic-awesome></ok-ts-icon-dynamic-awesome>\n<nimble-mapping-icon icon=\"ok-ts-icon-dynamic-awesome\"></nimble-mapping-icon>\n```",
213
- "name": "TsIconDynamic",
280
+ "description": "A compact search input with a built-in clear affordance.",
281
+ "name": "FvSearchInput",
214
282
  "members": [
283
+ {
284
+ "kind": "field",
285
+ "name": "appearance",
286
+ "type": {
287
+ "text": "FvSearchInputAppearanceType"
288
+ },
289
+ "privacy": "public"
290
+ },
215
291
  {
216
292
  "kind": "method",
217
- "name": "registerIconDynamic",
293
+ "name": "handleChange",
218
294
  "privacy": "public",
219
- "static": true,
220
295
  "return": {
221
296
  "type": {
222
297
  "text": "void"
223
298
  }
224
- },
225
- "parameters": [
226
- {
227
- "name": "tagName",
228
- "type": {
229
- "text": "string"
230
- }
231
- },
232
- {
233
- "name": "url",
234
- "type": {
235
- "text": "string"
236
- }
299
+ }
300
+ },
301
+ {
302
+ "kind": "method",
303
+ "name": "clear",
304
+ "privacy": "public",
305
+ "return": {
306
+ "type": {
307
+ "text": "boolean"
237
308
  }
238
- ]
309
+ },
310
+ "description": "Clears the current value, restores focus to the text input, and\ndispatches a synthetic `input` event on the host so consumers\nobserve the same immediate value-update contract as typing.\nThe inner <input> value is updated on the next FAST render cycle\nvia the `:value` template binding."
311
+ }
312
+ ],
313
+ "events": [
314
+ {
315
+ "name": "input",
316
+ "type": {
317
+ "text": "Event"
318
+ }
319
+ }
320
+ ],
321
+ "attributes": [
322
+ {
323
+ "name": "appearance",
324
+ "type": {
325
+ "text": "FvSearchInputAppearanceType"
326
+ },
327
+ "fieldName": "appearance"
239
328
  }
240
329
  ],
241
330
  "superclass": {
242
- "name": "Icon",
243
- "package": "@ni/nimble-components/dist/esm/icon-base"
331
+ "name": "FoundationTextField",
332
+ "package": "@ni/fast-foundation"
244
333
  }
245
334
  },
246
335
  {
247
336
  "kind": "variable",
248
- "name": "tsIconDynamicTag",
337
+ "name": "fvSearchInputTag",
249
338
  "type": {
250
339
  "text": "string"
251
340
  },
252
- "default": "'ok-ts-icon-dynamic'"
341
+ "default": "'ok-fv-search-input'"
253
342
  }
254
343
  ],
255
344
  "exports": [
256
345
  {
257
346
  "kind": "js",
258
- "name": "TsIconDynamic",
347
+ "name": "FvSearchInput",
259
348
  "declaration": {
260
- "name": "TsIconDynamic",
261
- "module": "src/ts/icon-dynamic/index.ts"
349
+ "name": "FvSearchInput",
350
+ "module": "src/fv/search-input/index.ts"
262
351
  }
263
352
  },
264
353
  {
265
354
  "kind": "js",
266
- "name": "tsIconDynamicTag",
355
+ "name": "fvSearchInputTag",
267
356
  "declaration": {
268
- "name": "tsIconDynamicTag",
269
- "module": "src/ts/icon-dynamic/index.ts"
357
+ "name": "fvSearchInputTag",
358
+ "module": "src/fv/search-input/index.ts"
359
+ }
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "kind": "javascript-module",
365
+ "path": "src/fv/search-input/types.ts",
366
+ "declarations": [
367
+ {
368
+ "kind": "variable",
369
+ "name": "FvSearchInputAppearance",
370
+ "type": {
371
+ "text": "{\n block: 'block',\n outline: 'outline',\n underline: 'underline',\n frameless: 'frameless'\n}"
372
+ },
373
+ "default": "{ block: 'block', outline: 'outline', underline: 'underline', frameless: 'frameless' }"
374
+ }
375
+ ],
376
+ "exports": [
377
+ {
378
+ "kind": "js",
379
+ "name": "FvSearchInputAppearance",
380
+ "declaration": {
381
+ "name": "FvSearchInputAppearance",
382
+ "module": "src/fv/search-input/types.ts"
270
383
  }
271
384
  }
272
385
  ]
@@ -8,6 +8,22 @@
8
8
 
9
9
  <hr/>
10
10
 
11
+ ## class: `TsIconDynamic`
12
+
13
+ ### Superclass
14
+
15
+ | Name | Module | Package |
16
+ | ------ | ------ | ---------------------------------------- |
17
+ | `Icon` | | @ni/nimble-components/dist/esm/icon-base |
18
+
19
+ ### Static Methods
20
+
21
+ | Name | Privacy | Description | Parameters | Return | Inherited From |
22
+ | --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
23
+ | `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
24
+
25
+ <hr/>
26
+
11
27
  ## class: `FvAccordionItem`
12
28
 
13
29
  ### Superclass
@@ -40,18 +56,37 @@
40
56
 
41
57
  <hr/>
42
58
 
43
- ## class: `TsIconDynamic`
59
+ ## class: `FvSearchInput`
44
60
 
45
61
  ### Superclass
46
62
 
47
- | Name | Module | Package |
48
- | ------ | ------ | ---------------------------------------- |
49
- | `Icon` | | @ni/nimble-components/dist/esm/icon-base |
63
+ | Name | Module | Package |
64
+ | --------------------- | ------ | ------------------- |
65
+ | `FoundationTextField` | | @ni/fast-foundation |
50
66
 
51
- ### Static Methods
67
+ ### Fields
52
68
 
53
- | Name | Privacy | Description | Parameters | Return | Inherited From |
54
- | --------------------- | ------- | ----------- | ------------------------------ | ------ | -------------- |
55
- | `registerIconDynamic` | public | | `tagName: string, url: string` | `void` | |
69
+ | Name | Privacy | Type | Default | Description | Inherited From |
70
+ | ------------ | ------- | ----------------------------- | ------- | ----------- | -------------- |
71
+ | `appearance` | public | `FvSearchInputAppearanceType` | | | |
72
+
73
+ ### Methods
74
+
75
+ | Name | Privacy | Description | Parameters | Return | Inherited From |
76
+ | -------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | --------- | -------------- |
77
+ | `handleChange` | public | | | `void` | |
78
+ | `clear` | public | Clears the current value, restores focus to the text input, and&#xA;dispatches a synthetic \`input\` event on the host so consumers&#xA;observe the same immediate value-update contract as typing.&#xA;The inner \<input> value is updated on the next FAST render cycle&#xA;via the \`:value\` template binding. | | `boolean` | |
79
+
80
+ ### Events
81
+
82
+ | Name | Type | Description | Inherited From |
83
+ | ------- | ------- | ----------- | -------------- |
84
+ | `input` | `Event` | | |
85
+
86
+ ### Attributes
87
+
88
+ | Name | Field | Inherited From |
89
+ | ------------ | ---------- | -------------- |
90
+ | `appearance` | appearance | |
56
91
 
57
92
  <hr/>
@@ -1 +1,2 @@
1
1
  import './accordion-item';
2
+ import './search-input';
@@ -1,2 +1,3 @@
1
1
  import './accordion-item';
2
+ import './search-input';
2
3
  //# sourceMappingURL=all-fv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC","sourcesContent":["import './accordion-item';\n"]}
1
+ {"version":3,"file":"all-fv.js","sourceRoot":"","sources":["../../../src/fv/all-fv.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC","sourcesContent":["import './accordion-item';\nimport './search-input';\n"]}
@@ -0,0 +1,23 @@
1
+ import { TextField as FoundationTextField } from '@ni/fast-foundation';
2
+ import { type FvSearchInputAppearance as FvSearchInputAppearanceType } from './types';
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ 'ok-fv-search-input': FvSearchInput;
6
+ }
7
+ }
8
+ /**
9
+ * A compact search input with a built-in clear affordance.
10
+ */
11
+ export declare class FvSearchInput extends FoundationTextField {
12
+ appearance: FvSearchInputAppearanceType;
13
+ handleChange(): void;
14
+ /**
15
+ * Clears the current value, restores focus to the text input, and
16
+ * dispatches a synthetic `input` event on the host so consumers
17
+ * observe the same immediate value-update contract as typing.
18
+ * The inner <input> value is updated on the next FAST render cycle
19
+ * via the `:value` template binding.
20
+ */
21
+ clear(): boolean;
22
+ }
23
+ export declare const fvSearchInputTag = "ok-fv-search-input";
@@ -0,0 +1,50 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@ni/fast-element';
3
+ import { DesignSystem, TextField as FoundationTextField } from '@ni/fast-foundation';
4
+ import { styles } from './styles';
5
+ import { template } from './template';
6
+ import { FvSearchInputAppearance } from './types';
7
+ /**
8
+ * A compact search input with a built-in clear affordance.
9
+ */
10
+ export class FvSearchInput extends FoundationTextField {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.appearance = FvSearchInputAppearance.outline;
14
+ }
15
+ handleChange() {
16
+ this.value = this.control.value;
17
+ super.handleChange();
18
+ }
19
+ /**
20
+ * Clears the current value, restores focus to the text input, and
21
+ * dispatches a synthetic `input` event on the host so consumers
22
+ * observe the same immediate value-update contract as typing.
23
+ * The inner <input> value is updated on the next FAST render cycle
24
+ * via the `:value` template binding.
25
+ */
26
+ clear() {
27
+ if (this.value === '') {
28
+ return true;
29
+ }
30
+ this.value = '';
31
+ this.control.focus();
32
+ this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
33
+ return true;
34
+ }
35
+ }
36
+ __decorate([
37
+ attr
38
+ ], FvSearchInput.prototype, "appearance", void 0);
39
+ const okFvSearchInput = FvSearchInput.compose({
40
+ baseName: 'fv-search-input',
41
+ baseClass: FoundationTextField,
42
+ template,
43
+ styles,
44
+ shadowOptions: {
45
+ delegatesFocus: true
46
+ }
47
+ });
48
+ DesignSystem.getOrCreate().withPrefix('ok').register(okFvSearchInput());
49
+ export const fvSearchInputTag = 'ok-fv-search-input';
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/fv/search-input/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EACH,YAAY,EACZ,SAAS,IAAI,mBAAmB,EAEnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACH,uBAAuB,EAE1B,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,mBAAmB;IAAtD;;QAEW,eAAU,GAAgC,uBAAuB,CAAC,OAAO,CAAC;IAwBrF,CAAC;IAtBmB,YAAY;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAChC,KAAK,CAAC,YAAY,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,KAAK;QACR,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxBU;IADN,IAAI;iDAC4E;AA0BrF,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAmB;IAC5D,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,mBAAmB;IAC9B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC","sourcesContent":["import { attr } from '@ni/fast-element';\nimport {\n DesignSystem,\n TextField as FoundationTextField,\n type TextFieldOptions\n} from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\nimport {\n FvSearchInputAppearance,\n type FvSearchInputAppearance as FvSearchInputAppearanceType\n} from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-search-input': FvSearchInput;\n }\n}\n\n/**\n * A compact search input with a built-in clear affordance.\n */\nexport class FvSearchInput extends FoundationTextField {\n @attr\n public appearance: FvSearchInputAppearanceType = FvSearchInputAppearance.outline;\n\n public override handleChange(): void {\n this.value = this.control.value;\n super.handleChange();\n }\n\n /**\n * Clears the current value, restores focus to the text input, and\n * dispatches a synthetic `input` event on the host so consumers\n * observe the same immediate value-update contract as typing.\n * The inner <input> value is updated on the next FAST render cycle\n * via the `:value` template binding.\n */\n public clear(): boolean {\n if (this.value === '') {\n return true;\n }\n\n this.value = '';\n this.control.focus();\n this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));\n return true;\n }\n}\n\nconst okFvSearchInput = FvSearchInput.compose<TextFieldOptions>({\n baseName: 'fv-search-input',\n baseClass: FoundationTextField,\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('ok').register(okFvSearchInput());\nexport const fvSearchInputTag = 'ok-fv-search-input';"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@ni/fast-element").ElementStyles;
@@ -0,0 +1,178 @@
1
+ import { css } from '@ni/fast-element';
2
+ import { bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, controlHeight, fillHoverColor, iconColor, iconSize, mediumPadding, placeholderFontColor, smallPadding, smallDelay, standardPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
+ import { display } from '../../utilities/style/display';
4
+ export const styles = css `
5
+ @layer base, hover, focusVisible, active, disabled, top;
6
+
7
+ @layer base {
8
+ ${display('inline-block')}
9
+
10
+ :host {
11
+ --ni-private-fv-search-input-inline-padding: ${standardPadding};
12
+ --ni-private-fv-search-input-leading-inset: ${mediumPadding};
13
+ --ni-private-fv-search-input-leading-space: calc(var(--ni-private-fv-search-input-leading-inset) + ${iconSize} + ${smallPadding});
14
+ --ni-private-fv-search-input-trailing-space: calc(var(--ni-private-fv-search-input-inline-padding) + ${iconSize});
15
+ --ni-private-fv-search-input-border-color: rgba(${borderRgbPartialColor}, 0.3);
16
+ --ni-private-fv-search-input-border-radius: 0px;
17
+ min-width: 120px;
18
+ height: ${controlHeight};
19
+ font: ${bodyFont};
20
+ color: ${bodyFontColor};
21
+ }
22
+
23
+ .search-input-container {
24
+ position: relative;
25
+ display: flex;
26
+ align-items: center;
27
+ width: 100%;
28
+ height: 100%;
29
+ border: ${borderWidth} solid transparent;
30
+ border-radius: var(--ni-private-fv-search-input-border-radius);
31
+ color: inherit;
32
+ background-color: transparent;
33
+ transition:
34
+ border-color ${smallDelay} ease-in-out,
35
+ box-shadow ${smallDelay} ease-in-out,
36
+ background-color ${smallDelay} ease-in-out;
37
+ }
38
+
39
+ .search-input-container::after {
40
+ content: '';
41
+ position: absolute;
42
+ inset-inline: 0;
43
+ inset-block-end: calc(-1 * ${borderWidth});
44
+ border-bottom: calc(${borderWidth} + 1px) solid ${borderHoverColor};
45
+ transform: scaleX(0);
46
+ transform-origin: center;
47
+ transition:
48
+ transform ${smallDelay} ease-in-out,
49
+ border-bottom-color ${smallDelay} ease-in-out;
50
+ pointer-events: none;
51
+ }
52
+
53
+ .search-input-icon {
54
+ position: absolute;
55
+ display: inline-flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ top: 50%;
59
+ inset-inline-start: var(--ni-private-fv-search-input-leading-inset);
60
+ transform: translateY(-50%);
61
+ color: ${placeholderFontColor};
62
+ pointer-events: none;
63
+ ${iconColor.cssCustomProperty}: ${placeholderFontColor};
64
+ }
65
+
66
+ .search-input {
67
+ -webkit-appearance: none;
68
+ appearance: none;
69
+ display: block;
70
+ flex: 1 1 auto;
71
+ min-width: 0;
72
+ width: 100%;
73
+ height: 100%;
74
+ padding: 0 var(--ni-private-fv-search-input-trailing-space) 0 var(--ni-private-fv-search-input-leading-space);
75
+ font: inherit;
76
+ line-height: normal;
77
+ color: inherit;
78
+ border: none;
79
+ outline: none;
80
+ border-radius: 0;
81
+ background: transparent;
82
+ }
83
+
84
+ .search-input::placeholder {
85
+ color: ${placeholderFontColor};
86
+ }
87
+
88
+ .search-input-clear {
89
+ -webkit-appearance: none;
90
+ appearance: none;
91
+ position: absolute;
92
+ display: inline-flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ top: 50%;
96
+ inset-inline-end: 2px;
97
+ height: calc(100% - 6px);
98
+ aspect-ratio: 1;
99
+ padding: 0;
100
+ transform: translateY(-50%);
101
+ color: ${placeholderFontColor};
102
+ border: none;
103
+ border-radius: 2px;
104
+ background: transparent;
105
+ cursor: pointer;
106
+ ${iconColor.cssCustomProperty}: ${placeholderFontColor};
107
+ }
108
+
109
+ :host([appearance='outline']) .search-input-container {
110
+ border-color: var(--ni-private-fv-search-input-border-color);
111
+ }
112
+
113
+ :host([appearance='block']) .search-input-container {
114
+ background-color: rgba(${borderRgbPartialColor}, 0.1);
115
+ }
116
+
117
+ :host([appearance='underline']) .search-input-container::after {
118
+ transform: scaleX(1);
119
+ border-bottom-color: var(--ni-private-fv-search-input-border-color);
120
+ }
121
+ }
122
+
123
+ @layer hover {
124
+ .search-input-clear:hover {
125
+ background: ${fillHoverColor};
126
+ }
127
+
128
+ :host([appearance='outline']) .search-input-container:hover {
129
+ border-color: ${borderHoverColor};
130
+ box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
131
+ }
132
+
133
+ :host([appearance='block']) .search-input-container:hover::after {
134
+ transform: scaleX(1);
135
+ border-bottom-color: ${borderHoverColor};
136
+ }
137
+
138
+ :host([appearance='underline']) .search-input-container:hover::after {
139
+ border-bottom-color: ${borderHoverColor};
140
+ }
141
+
142
+ :host([appearance='frameless']) .search-input-container:hover::after {
143
+ transform: scaleX(1);
144
+ border-bottom-color: ${borderHoverColor};
145
+ }
146
+ }
147
+
148
+ @layer focusVisible {
149
+ .search-input:focus-visible {
150
+ outline: none;
151
+ }
152
+
153
+ .search-input-clear:focus-visible {
154
+ outline: ${borderWidth} solid ${borderHoverColor};
155
+ outline-offset: -1px;
156
+ }
157
+
158
+ :host([appearance='outline']) .search-input-container:focus-within {
159
+ border-color: ${borderHoverColor};
160
+ box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;
161
+ }
162
+
163
+ :host([appearance='block']) .search-input-container:focus-within::after {
164
+ transform: scaleX(1);
165
+ border-bottom-color: ${borderHoverColor};
166
+ }
167
+
168
+ :host([appearance='underline']) .search-input-container:focus-within::after {
169
+ border-bottom-color: ${borderHoverColor};
170
+ }
171
+
172
+ :host([appearance='frameless']) .search-input-container:focus-within::after {
173
+ transform: scaleX(1);
174
+ border-bottom-color: ${borderHoverColor};
175
+ }
176
+ }
177
+ `;
178
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/fv/search-input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,cAAc,EACd,SAAS,EACT,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,eAAe,EAClB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;UAIf,OAAO,CAAC,cAAc,CAAC;;;2DAG0B,eAAe;0DAChB,aAAa;iHAC0C,QAAQ,MAAM,YAAY;mHACxB,QAAQ;8DAC7D,qBAAqB;;;sBAG7D,aAAa;oBACf,QAAQ;qBACP,aAAa;;;;;;;;;sBASZ,WAAW;;;;;+BAKF,UAAU;6BACZ,UAAU;mCACJ,UAAU;;;;;;;yCAOJ,WAAW;kCAClB,WAAW,iBAAiB,gBAAgB;;;;4BAIlD,UAAU;sCACA,UAAU;;;;;;;;;;;;qBAY3B,oBAAoB;;cAE3B,SAAS,CAAC,iBAAiB,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;;;;;qBAsB7C,oBAAoB;;;;;;;;;;;;;;;;qBAgBpB,oBAAoB;;;;;cAK3B,SAAS,CAAC,iBAAiB,KAAK,oBAAoB;;;;;;;;qCAQ7B,qBAAqB;;;;;;;;;;;0BAWhC,cAAc;;;;4BAIZ,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;mCAK5B,gBAAgB;;;;mCAIhB,gBAAgB;;;;;mCAKhB,gBAAgB;;;;;;;;;;uBAU5B,WAAW,UAAU,gBAAgB;;;;;4BAKhC,gBAAgB;gCACZ,WAAW,IAAI,gBAAgB;;;;;mCAK5B,gBAAgB;;;;mCAIhB,gBAAgB;;;;;mCAKhB,gBAAgB;;;CAGlD,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n controlHeight,\n fillHoverColor,\n iconColor,\n iconSize,\n mediumPadding,\n placeholderFontColor,\n smallPadding,\n smallDelay,\n standardPadding\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n @layer base, hover, focusVisible, active, disabled, top;\n\n @layer base {\n ${display('inline-block')}\n\n :host {\n --ni-private-fv-search-input-inline-padding: ${standardPadding};\n --ni-private-fv-search-input-leading-inset: ${mediumPadding};\n --ni-private-fv-search-input-leading-space: calc(var(--ni-private-fv-search-input-leading-inset) + ${iconSize} + ${smallPadding});\n --ni-private-fv-search-input-trailing-space: calc(var(--ni-private-fv-search-input-inline-padding) + ${iconSize});\n --ni-private-fv-search-input-border-color: rgba(${borderRgbPartialColor}, 0.3);\n --ni-private-fv-search-input-border-radius: 0px;\n min-width: 120px;\n height: ${controlHeight};\n font: ${bodyFont};\n color: ${bodyFontColor};\n }\n\n .search-input-container {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n border: ${borderWidth} solid transparent;\n border-radius: var(--ni-private-fv-search-input-border-radius);\n color: inherit;\n background-color: transparent;\n transition:\n border-color ${smallDelay} ease-in-out,\n box-shadow ${smallDelay} ease-in-out,\n background-color ${smallDelay} ease-in-out;\n }\n\n .search-input-container::after {\n content: '';\n position: absolute;\n inset-inline: 0;\n inset-block-end: calc(-1 * ${borderWidth});\n border-bottom: calc(${borderWidth} + 1px) solid ${borderHoverColor};\n transform: scaleX(0);\n transform-origin: center;\n transition:\n transform ${smallDelay} ease-in-out,\n border-bottom-color ${smallDelay} ease-in-out;\n pointer-events: none;\n }\n\n .search-input-icon {\n position: absolute;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n top: 50%;\n inset-inline-start: var(--ni-private-fv-search-input-leading-inset);\n transform: translateY(-50%);\n color: ${placeholderFontColor};\n pointer-events: none;\n ${iconColor.cssCustomProperty}: ${placeholderFontColor};\n }\n\n .search-input {\n -webkit-appearance: none;\n appearance: none;\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n width: 100%;\n height: 100%;\n padding: 0 var(--ni-private-fv-search-input-trailing-space) 0 var(--ni-private-fv-search-input-leading-space);\n font: inherit;\n line-height: normal;\n color: inherit;\n border: none;\n outline: none;\n border-radius: 0;\n background: transparent;\n }\n\n .search-input::placeholder {\n color: ${placeholderFontColor};\n }\n\n .search-input-clear {\n -webkit-appearance: none;\n appearance: none;\n position: absolute;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n top: 50%;\n inset-inline-end: 2px;\n height: calc(100% - 6px);\n aspect-ratio: 1;\n padding: 0;\n transform: translateY(-50%);\n color: ${placeholderFontColor};\n border: none;\n border-radius: 2px;\n background: transparent;\n cursor: pointer;\n ${iconColor.cssCustomProperty}: ${placeholderFontColor};\n }\n\n :host([appearance='outline']) .search-input-container {\n border-color: var(--ni-private-fv-search-input-border-color);\n }\n\n :host([appearance='block']) .search-input-container {\n background-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n\n :host([appearance='underline']) .search-input-container::after {\n transform: scaleX(1);\n border-bottom-color: var(--ni-private-fv-search-input-border-color);\n }\n }\n\n @layer hover {\n .search-input-clear:hover {\n background: ${fillHoverColor};\n }\n\n :host([appearance='outline']) .search-input-container:hover {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n\n :host([appearance='block']) .search-input-container:hover::after {\n transform: scaleX(1);\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([appearance='underline']) .search-input-container:hover::after {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([appearance='frameless']) .search-input-container:hover::after {\n transform: scaleX(1);\n border-bottom-color: ${borderHoverColor};\n }\n }\n\n @layer focusVisible {\n .search-input:focus-visible {\n outline: none;\n }\n\n .search-input-clear:focus-visible {\n outline: ${borderWidth} solid ${borderHoverColor};\n outline-offset: -1px;\n }\n\n :host([appearance='outline']) .search-input-container:focus-within {\n border-color: ${borderHoverColor};\n box-shadow: 0 0 0 ${borderWidth} ${borderHoverColor} inset;\n }\n\n :host([appearance='block']) .search-input-container:focus-within::after {\n transform: scaleX(1);\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([appearance='underline']) .search-input-container:focus-within::after {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([appearance='frameless']) .search-input-container:focus-within::after {\n transform: scaleX(1);\n border-bottom-color: ${borderHoverColor};\n }\n }\n`;"]}
@@ -0,0 +1,2 @@
1
+ import type { FvSearchInput } from '.';
2
+ export declare const template: import("@ni/fast-element").ViewTemplate<FvSearchInput, any>;
@@ -0,0 +1,34 @@
1
+ import { html, ref, when } from '@ni/fast-element';
2
+ import { iconMagnifyingGlassTag } from '@ni/nimble-components/dist/esm/icons/magnifying-glass';
3
+ import { iconTimesTag } from '@ni/nimble-components/dist/esm/icons/times';
4
+ export const template = html `
5
+ <div class="search-input-container">
6
+ <span class="search-input-icon" aria-hidden="true">
7
+ <${iconMagnifyingGlassTag}></${iconMagnifyingGlassTag}>
8
+ </span>
9
+ <input
10
+ class="search-input"
11
+ part="control"
12
+ id="control"
13
+ type="text"
14
+ aria-label="${x => x.ariaLabel}"
15
+ aria-labelledby="${x => x.ariaLabelledby}"
16
+ placeholder="${x => x.placeholder}"
17
+ :value="${x => x.value}"
18
+ @input="${x => x.handleTextInput()}"
19
+ @change="${x => x.handleChange()}"
20
+ ${ref('control')}
21
+ />
22
+ ${when(x => x.value.length > 0, html `
23
+ <button
24
+ class="search-input-clear"
25
+ type="button"
26
+ aria-label="Clear search"
27
+ @click="${x => x.clear()}"
28
+ >
29
+ <${iconTimesTag}></${iconTimesTag}>
30
+ </button>
31
+ `)}
32
+ </div>
33
+ `;
34
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/fv/search-input/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAG1E,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAe;;;eAG5B,sBAAsB,MAAM,sBAAsB;;;;;;;0BAOvC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;+BACX,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;2BACzB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW;sBACvB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;sBACZ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE;uBACvB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE;cAC9B,GAAG,CAAC,SAAS,CAAC;;UAElB,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EACvB,IAAI,CAAe;;;;;8BAKD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE;;uBAErB,YAAY,MAAM,YAAY;;aAExC,CACJ;;CAER,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { iconMagnifyingGlassTag } from '@ni/nimble-components/dist/esm/icons/magnifying-glass';\nimport { iconTimesTag } from '@ni/nimble-components/dist/esm/icons/times';\nimport type { FvSearchInput } from '.';\n\nexport const template = html<FvSearchInput>`\n <div class=\"search-input-container\">\n <span class=\"search-input-icon\" aria-hidden=\"true\">\n <${iconMagnifyingGlassTag}></${iconMagnifyingGlassTag}>\n </span>\n <input\n class=\"search-input\"\n part=\"control\"\n id=\"control\"\n type=\"text\"\n aria-label=\"${x => x.ariaLabel}\"\n aria-labelledby=\"${x => x.ariaLabelledby}\"\n placeholder=\"${x => x.placeholder}\"\n :value=\"${x => x.value}\"\n @input=\"${x => x.handleTextInput()}\"\n @change=\"${x => x.handleChange()}\"\n ${ref('control')}\n />\n ${when(\n x => x.value.length > 0,\n html<FvSearchInput>`\n <button\n class=\"search-input-clear\"\n type=\"button\"\n aria-label=\"Clear search\"\n @click=\"${x => x.clear()}\"\n >\n <${iconTimesTag}></${iconTimesTag}>\n </button>\n `\n )}\n </div>\n`;"]}