@ni/ok-components 0.3.13 → 0.4.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.
@@ -49,6 +49,142 @@
49
49
  }
50
50
  ]
51
51
  },
52
+ {
53
+ "kind": "javascript-module",
54
+ "path": "src/fv-accordion-item/index.ts",
55
+ "declarations": [
56
+ {
57
+ "kind": "class",
58
+ "description": "An accordion item component that can be expanded or collapsed to\nshow or hide its content.",
59
+ "name": "FvAccordionItem",
60
+ "members": [
61
+ {
62
+ "kind": "field",
63
+ "name": "header",
64
+ "type": {
65
+ "text": "string"
66
+ },
67
+ "privacy": "public",
68
+ "default": "''"
69
+ },
70
+ {
71
+ "kind": "field",
72
+ "name": "expanded",
73
+ "type": {
74
+ "text": "boolean"
75
+ },
76
+ "privacy": "public",
77
+ "default": "false"
78
+ },
79
+ {
80
+ "kind": "field",
81
+ "name": "appearance",
82
+ "type": {
83
+ "text": "FvAccordionItemAppearance"
84
+ },
85
+ "privacy": "public"
86
+ },
87
+ {
88
+ "kind": "method",
89
+ "name": "handleToggle",
90
+ "privacy": "public",
91
+ "return": {
92
+ "type": {
93
+ "text": "boolean"
94
+ }
95
+ },
96
+ "parameters": [
97
+ {
98
+ "name": "event",
99
+ "type": {
100
+ "text": "Event"
101
+ }
102
+ }
103
+ ]
104
+ }
105
+ ],
106
+ "attributes": [
107
+ {
108
+ "name": "header",
109
+ "type": {
110
+ "text": "string"
111
+ },
112
+ "default": "''",
113
+ "fieldName": "header"
114
+ },
115
+ {
116
+ "name": "expanded",
117
+ "type": {
118
+ "text": "boolean"
119
+ },
120
+ "default": "false",
121
+ "fieldName": "expanded"
122
+ },
123
+ {
124
+ "name": "appearance",
125
+ "type": {
126
+ "text": "FvAccordionItemAppearance"
127
+ },
128
+ "fieldName": "appearance"
129
+ }
130
+ ],
131
+ "superclass": {
132
+ "name": "FoundationElement",
133
+ "package": "@ni/fast-foundation"
134
+ }
135
+ },
136
+ {
137
+ "kind": "variable",
138
+ "name": "fvAccordionItemTag",
139
+ "type": {
140
+ "text": "string"
141
+ },
142
+ "default": "'ok-fv-accordion-item'"
143
+ }
144
+ ],
145
+ "exports": [
146
+ {
147
+ "kind": "js",
148
+ "name": "FvAccordionItem",
149
+ "declaration": {
150
+ "name": "FvAccordionItem",
151
+ "module": "src/fv-accordion-item/index.ts"
152
+ }
153
+ },
154
+ {
155
+ "kind": "js",
156
+ "name": "fvAccordionItemTag",
157
+ "declaration": {
158
+ "name": "fvAccordionItemTag",
159
+ "module": "src/fv-accordion-item/index.ts"
160
+ }
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ "kind": "javascript-module",
166
+ "path": "src/fv-accordion-item/types.ts",
167
+ "declarations": [
168
+ {
169
+ "kind": "variable",
170
+ "name": "FvAccordionItemAppearance",
171
+ "type": {
172
+ "text": "{\n outline: 'outline',\n ghost: 'ghost',\n block: 'block'\n}"
173
+ },
174
+ "default": "{ outline: 'outline', ghost: 'ghost', block: 'block' }"
175
+ }
176
+ ],
177
+ "exports": [
178
+ {
179
+ "kind": "js",
180
+ "name": "FvAccordionItemAppearance",
181
+ "declaration": {
182
+ "name": "FvAccordionItemAppearance",
183
+ "module": "src/fv-accordion-item/types.ts"
184
+ }
185
+ }
186
+ ]
187
+ },
52
188
  {
53
189
  "kind": "javascript-module",
54
190
  "path": "src/icon-dynamic/index.ts",
@@ -8,6 +8,38 @@
8
8
 
9
9
  <hr/>
10
10
 
11
+ ## class: `FvAccordionItem`
12
+
13
+ ### Superclass
14
+
15
+ | Name | Module | Package |
16
+ | ------------------- | ------ | ------------------- |
17
+ | `FoundationElement` | | @ni/fast-foundation |
18
+
19
+ ### Fields
20
+
21
+ | Name | Privacy | Type | Default | Description | Inherited From |
22
+ | ------------ | ------- | --------------------------- | ------- | ----------- | -------------- |
23
+ | `header` | public | `string` | `''` | | |
24
+ | `expanded` | public | `boolean` | `false` | | |
25
+ | `appearance` | public | `FvAccordionItemAppearance` | | | |
26
+
27
+ ### Methods
28
+
29
+ | Name | Privacy | Description | Parameters | Return | Inherited From |
30
+ | -------------- | ------- | ----------- | -------------- | --------- | -------------- |
31
+ | `handleToggle` | public | | `event: Event` | `boolean` | |
32
+
33
+ ### Attributes
34
+
35
+ | Name | Field | Inherited From |
36
+ | ------------ | ---------- | -------------- |
37
+ | `header` | header | |
38
+ | `expanded` | expanded | |
39
+ | `appearance` | appearance | |
40
+
41
+ <hr/>
42
+
11
43
  ## class: `IconDynamic`
12
44
 
13
45
  ### Superclass
@@ -4,5 +4,6 @@
4
4
  * that are required instead of leveraging this file.
5
5
  */
6
6
  import '@ni/spright-components/dist/esm/all-components';
7
+ import './fv-accordion-item';
7
8
  import './button';
8
9
  import './icon-dynamic';
@@ -4,6 +4,7 @@
4
4
  * that are required instead of leveraging this file.
5
5
  */
6
6
  import '@ni/spright-components/dist/esm/all-components';
7
+ import './fv-accordion-item';
7
8
  import './button';
8
9
  import './icon-dynamic';
9
10
  //# sourceMappingURL=all-components.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gDAAgD,CAAC;AAExD,OAAO,UAAU,CAAC;AAClB,OAAO,gBAAgB,CAAC","sourcesContent":["/**\n * Import of all the web components available in Nimble, Spright, and Ok.\n * Production applications are encouraged to import only components\n * that are required instead of leveraging this file.\n */\n\nimport '@ni/spright-components/dist/esm/all-components';\n\nimport './button';\nimport './icon-dynamic';\n"]}
1
+ {"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,gDAAgD,CAAC;AAExD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,CAAC;AAClB,OAAO,gBAAgB,CAAC","sourcesContent":["/**\n * Import of all the web components available in Nimble, Spright, and Ok.\n * Production applications are encouraged to import only components\n * that are required instead of leveraging this file.\n */\n\nimport '@ni/spright-components/dist/esm/all-components';\n\nimport './fv-accordion-item';\nimport './button';\nimport './icon-dynamic';\n"]}
@@ -0,0 +1,19 @@
1
+ import { FoundationElement } from '@ni/fast-foundation';
2
+ import '@ni/nimble-components/dist/esm/icons/arrow-expander-right';
3
+ import { FvAccordionItemAppearance } from './types';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'ok-fv-accordion-item': FvAccordionItem;
7
+ }
8
+ }
9
+ /**
10
+ * An accordion item component that can be expanded or collapsed to
11
+ * show or hide its content.
12
+ */
13
+ export declare class FvAccordionItem extends FoundationElement {
14
+ header: string;
15
+ expanded: boolean;
16
+ appearance: FvAccordionItemAppearance;
17
+ handleToggle(event: Event): boolean;
18
+ }
19
+ export declare const fvAccordionItemTag = "ok-fv-accordion-item";
@@ -0,0 +1,42 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@ni/fast-element';
3
+ import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
4
+ import '@ni/nimble-components/dist/esm/icons/arrow-expander-right';
5
+ import { styles } from './styles';
6
+ import { template } from './template';
7
+ import { FvAccordionItemAppearance } from './types';
8
+ /**
9
+ * An accordion item component that can be expanded or collapsed to
10
+ * show or hide its content.
11
+ */
12
+ export class FvAccordionItem extends FoundationElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.header = '';
16
+ this.expanded = false;
17
+ this.appearance = FvAccordionItemAppearance.ghost;
18
+ }
19
+ handleToggle(event) {
20
+ this.expanded = event.target.open;
21
+ return true;
22
+ }
23
+ }
24
+ __decorate([
25
+ attr
26
+ ], FvAccordionItem.prototype, "header", void 0);
27
+ __decorate([
28
+ attr({ mode: 'boolean' })
29
+ ], FvAccordionItem.prototype, "expanded", void 0);
30
+ __decorate([
31
+ attr()
32
+ ], FvAccordionItem.prototype, "appearance", void 0);
33
+ const okFvAccordionItem = FvAccordionItem.compose({
34
+ baseName: 'fv-accordion-item',
35
+ template,
36
+ styles
37
+ });
38
+ DesignSystem.getOrCreate()
39
+ .withPrefix('ok')
40
+ .register(okFvAccordionItem());
41
+ export const fvAccordionItemTag = 'ok-fv-accordion-item';
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fv-accordion-item/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,2DAA2D,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAQpD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IAAtD;;QAEW,WAAM,GAAG,EAAE,CAAC;QAGZ,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,GAA8B,yBAAyB,CAAC,KAAK,CAAC;IAMnF,CAAC;IAJU,YAAY,CAAC,KAAY;QAC5B,IAAI,CAAC,QAAQ,GAAI,KAAK,CAAC,MAA6B,CAAC,IAAI,CAAC;QAC1D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAZU;IADN,IAAI;+CACc;AAGZ;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;iDACF;AAGjB;IADN,IAAI,EAAE;mDACwE;AAQnF,MAAM,iBAAiB,GAAG,eAAe,CAAC,OAAO,CAAC;IAC9C,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,IAAI,CAAC;KAChB,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC","sourcesContent":["import { attr } from '@ni/fast-element';\nimport { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport '@ni/nimble-components/dist/esm/icons/arrow-expander-right';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { FvAccordionItemAppearance } from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ok-fv-accordion-item': FvAccordionItem;\n }\n}\n\n/**\n * An accordion item component that can be expanded or collapsed to\n * show or hide its content.\n */\nexport class FvAccordionItem extends FoundationElement {\n @attr\n public header = '';\n\n @attr({ mode: 'boolean' })\n public expanded = false;\n\n @attr()\n public appearance: FvAccordionItemAppearance = FvAccordionItemAppearance.ghost;\n\n public handleToggle(event: Event): boolean {\n this.expanded = (event.target as HTMLDetailsElement).open;\n return true;\n }\n}\n\nconst okFvAccordionItem = FvAccordionItem.compose({\n baseName: 'fv-accordion-item',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('ok')\n .register(okFvAccordionItem());\nexport const fvAccordionItemTag = 'ok-fv-accordion-item';\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@ni/fast-element").ElementStyles;
@@ -0,0 +1,112 @@
1
+ import { css } from '@ni/fast-element';
2
+ import { bodyPlus1EmphasizedFont, bodyPlus1EmphasizedFontColor, borderHoverColor, borderRgbPartialColor, controlHeight, dividerWidth, iconSize, largePadding, mediumPadding, mediumDelay, smallDelay, standardPadding, smallPadding, borderWidth } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
+ import { appearanceBehavior } from '@ni/nimble-components/dist/esm/utilities/style/appearance';
4
+ import { display } from '../utilities/style/display';
5
+ import { userSelectNone } from '../utilities/style/user-select';
6
+ import { FvAccordionItemAppearance } from './types';
7
+ export const styles = css `
8
+ @layer base, hover, focusVisible, active, disabled, top;
9
+
10
+ @layer base {
11
+ ${display('block')}
12
+
13
+ :host {
14
+ border-bottom: ${dividerWidth} solid transparent;
15
+ }
16
+
17
+ .accordion-item-details > .accordion-item-summary {
18
+ display: flex;
19
+ box-sizing: border-box;
20
+ height: calc(${controlHeight} + (2 * ${dividerWidth}));
21
+ align-items: center;
22
+ margin-left: 0;
23
+ border: ${dividerWidth} solid transparent;
24
+ outline: ${dividerWidth} solid transparent;
25
+ outline-offset: -1px;
26
+ list-style: none;
27
+ cursor: pointer;
28
+ ${userSelectNone}
29
+ transition:
30
+ border-color ${smallDelay} ease-in,
31
+ outline-color ${smallDelay} ease-in;
32
+ }
33
+
34
+ .accordion-item-details > .accordion-item-summary::-webkit-details-marker {
35
+ display: none;
36
+ }
37
+
38
+ .accordion-item-details > .accordion-item-summary::marker {
39
+ content: "";
40
+ }
41
+
42
+ .accordion-item-icon {
43
+ transition: transform ${mediumDelay} ease-in;
44
+ margin: calc(${smallPadding} - ${borderWidth});
45
+ min-width: ${iconSize};
46
+ }
47
+
48
+ .accordion-item-details[open] > .accordion-item-summary > .accordion-item-icon {
49
+ transform: rotate(90deg);
50
+ }
51
+
52
+ .accordion-item-title {
53
+ flex: 1;
54
+ width: 100%;
55
+ position: relative;
56
+ font: ${bodyPlus1EmphasizedFont};
57
+ color: ${bodyPlus1EmphasizedFontColor};
58
+ text-align: left;
59
+ display: block;
60
+ /* Preserve descenders within the ellipsis clip region without shifting the text. */
61
+ padding-bottom: 2px;
62
+ margin-bottom: -2px;
63
+ text-overflow: ellipsis;
64
+ overflow: hidden;
65
+ white-space: nowrap;
66
+ overflow-wrap: normal;
67
+ }
68
+
69
+ .accordion-item-content {
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: ${standardPadding};
73
+ margin-left: ${largePadding};
74
+ margin-top: ${mediumPadding};
75
+ padding-bottom: ${standardPadding};
76
+ }
77
+ }
78
+
79
+ @layer hover {
80
+ .accordion-item-details > .accordion-item-summary:hover {
81
+ border-color: ${borderHoverColor};
82
+ }
83
+ }
84
+
85
+ @layer focusVisible {
86
+ .accordion-item-details > .accordion-item-summary:focus-visible {
87
+ outline: 2px solid ${borderHoverColor};
88
+ outline-offset: -2px;
89
+ }
90
+ }
91
+ `.withBehaviors(appearanceBehavior(FvAccordionItemAppearance.outline, css `
92
+ @layer base {
93
+ :host {
94
+ border-bottom: ${dividerWidth} solid rgba(${borderRgbPartialColor}, 0.2);
95
+ border-bottom-color: rgba(${borderRgbPartialColor}, 0.2);
96
+ }
97
+ }
98
+ `), appearanceBehavior(FvAccordionItemAppearance.block, css `
99
+ @layer base {
100
+ .accordion-item-details > .accordion-item-summary {
101
+ background-color: rgba(${borderRgbPartialColor}, 0.1);
102
+ }
103
+ }
104
+
105
+ @layer hover {
106
+ .accordion-item-details > .accordion-item-summary:hover {
107
+ border-color: transparent;
108
+ outline-color: ${borderHoverColor};
109
+ }
110
+ }
111
+ `));
112
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/fv-accordion-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACd,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;UAIf,OAAO,CAAC,OAAO,CAAC;;;6BAGG,YAAY;;;;;;2BAMd,aAAa,WAAW,YAAY;;;sBAGzC,YAAY;uBACX,YAAY;;;;cAIrB,cAAc;;+BAEG,UAAU;gCACT,UAAU;;;;;;;;;;;;oCAYN,WAAW;2BACpB,YAAY,MAAM,WAAW;yBAC/B,QAAQ;;;;;;;;;;;oBAWb,uBAAuB;qBACtB,4BAA4B;;;;;;;;;;;;;;;mBAe9B,eAAe;2BACP,YAAY;0BACb,aAAa;8BACT,eAAe;;;;;;4BAMjB,gBAAgB;;;;;;iCAMX,gBAAgB;;;;CAIhD,CAAC,aAAa,CACX,kBAAkB,CACd,yBAAyB,CAAC,OAAO,EACjC,GAAG,CAAA;;;qCAG0B,YAAY,eAAe,qBAAqB;gDACrC,qBAAqB;;;SAG5D,CACJ,EACD,kBAAkB,CACd,yBAAyB,CAAC,KAAK,EAC/B,GAAG,CAAA;;;6CAGkC,qBAAqB;;;;;;;qCAO7B,gBAAgB;;;SAG5C,CACJ,CACJ,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n bodyPlus1EmphasizedFont,\n bodyPlus1EmphasizedFontColor,\n borderHoverColor,\n borderRgbPartialColor,\n controlHeight,\n dividerWidth,\n iconSize,\n largePadding,\n mediumPadding,\n mediumDelay,\n smallDelay,\n standardPadding,\n smallPadding,\n borderWidth\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { appearanceBehavior } from '@ni/nimble-components/dist/esm/utilities/style/appearance';\nimport { display } from '../utilities/style/display';\nimport { userSelectNone } from '../utilities/style/user-select';\nimport { FvAccordionItemAppearance } from './types';\n\nexport const styles = css`\n @layer base, hover, focusVisible, active, disabled, top;\n\n @layer base {\n ${display('block')}\n\n :host {\n border-bottom: ${dividerWidth} solid transparent;\n }\n\n .accordion-item-details > .accordion-item-summary {\n display: flex;\n box-sizing: border-box;\n height: calc(${controlHeight} + (2 * ${dividerWidth}));\n align-items: center;\n margin-left: 0;\n border: ${dividerWidth} solid transparent;\n outline: ${dividerWidth} solid transparent;\n outline-offset: -1px;\n list-style: none;\n cursor: pointer;\n ${userSelectNone}\n transition:\n border-color ${smallDelay} ease-in,\n outline-color ${smallDelay} ease-in;\n }\n\n .accordion-item-details > .accordion-item-summary::-webkit-details-marker {\n display: none;\n }\n\n .accordion-item-details > .accordion-item-summary::marker {\n content: \"\";\n }\n\n .accordion-item-icon {\n transition: transform ${mediumDelay} ease-in;\n margin: calc(${smallPadding} - ${borderWidth});\n min-width: ${iconSize};\n }\n\n .accordion-item-details[open] > .accordion-item-summary > .accordion-item-icon {\n transform: rotate(90deg);\n }\n\n .accordion-item-title {\n flex: 1;\n width: 100%;\n position: relative;\n font: ${bodyPlus1EmphasizedFont};\n color: ${bodyPlus1EmphasizedFontColor};\n text-align: left;\n display: block;\n /* Preserve descenders within the ellipsis clip region without shifting the text. */\n padding-bottom: 2px;\n margin-bottom: -2px;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n overflow-wrap: normal;\n }\n\n .accordion-item-content {\n display: flex;\n flex-direction: column;\n gap: ${standardPadding};\n margin-left: ${largePadding};\n margin-top: ${mediumPadding};\n padding-bottom: ${standardPadding};\n }\n }\n\n @layer hover {\n .accordion-item-details > .accordion-item-summary:hover {\n border-color: ${borderHoverColor};\n }\n }\n\n @layer focusVisible {\n .accordion-item-details > .accordion-item-summary:focus-visible {\n outline: 2px solid ${borderHoverColor};\n outline-offset: -2px;\n }\n }\n`.withBehaviors(\n appearanceBehavior(\n FvAccordionItemAppearance.outline,\n css`\n @layer base {\n :host {\n border-bottom: ${dividerWidth} solid rgba(${borderRgbPartialColor}, 0.2);\n border-bottom-color: rgba(${borderRgbPartialColor}, 0.2);\n }\n }\n `\n ),\n appearanceBehavior(\n FvAccordionItemAppearance.block,\n css`\n @layer base {\n .accordion-item-details > .accordion-item-summary {\n background-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n }\n\n @layer hover {\n .accordion-item-details > .accordion-item-summary:hover {\n border-color: transparent;\n outline-color: ${borderHoverColor};\n }\n }\n `\n )\n);\n"]}
@@ -0,0 +1,2 @@
1
+ import type { FvAccordionItem } from '.';
2
+ export declare const template: import("@ni/fast-element").ViewTemplate<FvAccordionItem, any>;
@@ -0,0 +1,26 @@
1
+ import { html } from '@ni/fast-element';
2
+ import { iconArrowExpanderRightTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-right';
3
+ const arrowExpanderRightTag = iconArrowExpanderRightTag;
4
+ export const template = html `
5
+ <details
6
+ class="accordion-item-details"
7
+ ?open="${x => x.expanded}"
8
+ @toggle="${(x, c) => x.handleToggle(c.event)}"
9
+ >
10
+ <summary
11
+ class="accordion-item-summary"
12
+ aria-expanded="${x => x.expanded}"
13
+ >
14
+ <${arrowExpanderRightTag}
15
+ class="accordion-item-icon"
16
+ ></${arrowExpanderRightTag}>
17
+ <span class="accordion-item-title" title="${x => x.header}">
18
+ ${x => x.header}
19
+ </span>
20
+ </summary>
21
+ <div class="accordion-item-content">
22
+ <slot></slot>
23
+ </div>
24
+ </details>
25
+ `;
26
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/fv-accordion-item/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAGtG,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAiB;;;iBAG5B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;mBACb,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;;;;6BAIvB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;eAE7B,qBAAqB;;iBAEnB,qBAAqB;wDACkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;kBACnD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;;;;;;;CAO9B,CAAC","sourcesContent":["import { html } from '@ni/fast-element';\nimport { iconArrowExpanderRightTag } from '@ni/nimble-components/dist/esm/icons/arrow-expander-right';\nimport type { FvAccordionItem } from '.';\n\nconst arrowExpanderRightTag = iconArrowExpanderRightTag;\n\nexport const template = html<FvAccordionItem>`\n <details\n class=\"accordion-item-details\"\n ?open=\"${x => x.expanded}\"\n @toggle=\"${(x, c) => x.handleToggle(c.event)}\"\n >\n <summary\n class=\"accordion-item-summary\"\n aria-expanded=\"${x => x.expanded}\"\n >\n <${arrowExpanderRightTag}\n class=\"accordion-item-icon\"\n ></${arrowExpanderRightTag}>\n <span class=\"accordion-item-title\" title=\"${x => x.header}\">\n ${x => x.header}\n </span>\n </summary>\n <div class=\"accordion-item-content\">\n <slot></slot>\n </div>\n </details>\n`;\n"]}
@@ -0,0 +1,17 @@
1
+ import type { FvAccordionItem } from '..';
2
+ /**
3
+ * Page object for the `ok-fv-accordion-item` component to provide consistent
4
+ * ways of querying and interacting with the component during tests.
5
+ */
6
+ export declare class FvAccordionItemPageObject {
7
+ protected readonly accordionItemElement: FvAccordionItem;
8
+ constructor(accordionItemElement: FvAccordionItem);
9
+ clickSummary(): Promise<void>;
10
+ getHeaderText(): string;
11
+ isExpanded(): boolean;
12
+ hasContentSlot(): boolean;
13
+ hasExpanderIcon(): boolean;
14
+ private getDetails;
15
+ private getSummary;
16
+ private getTitle;
17
+ }
@@ -0,0 +1,48 @@
1
+ import { waitForUpdatesAsync } from '@ni/nimble-components/dist/esm/testing/async-helpers';
2
+ /**
3
+ * Page object for the `ok-fv-accordion-item` component to provide consistent
4
+ * ways of querying and interacting with the component during tests.
5
+ */
6
+ export class FvAccordionItemPageObject {
7
+ constructor(accordionItemElement) {
8
+ this.accordionItemElement = accordionItemElement;
9
+ }
10
+ async clickSummary() {
11
+ this.getSummary().click();
12
+ await waitForUpdatesAsync();
13
+ }
14
+ getHeaderText() {
15
+ return this.getTitle().textContent?.trim() ?? '';
16
+ }
17
+ isExpanded() {
18
+ return this.getDetails().open;
19
+ }
20
+ hasContentSlot() {
21
+ return !!this.accordionItemElement.shadowRoot?.querySelector('slot');
22
+ }
23
+ hasExpanderIcon() {
24
+ return !!this.accordionItemElement.shadowRoot?.querySelector('nimble-icon-arrow-expander-right');
25
+ }
26
+ getDetails() {
27
+ const details = this.accordionItemElement.shadowRoot?.querySelector('details');
28
+ if (!details) {
29
+ throw new Error('Accordion item details element not found');
30
+ }
31
+ return details;
32
+ }
33
+ getSummary() {
34
+ const summary = this.accordionItemElement.shadowRoot?.querySelector('.accordion-item-summary');
35
+ if (!summary) {
36
+ throw new Error('Accordion item summary element not found');
37
+ }
38
+ return summary;
39
+ }
40
+ getTitle() {
41
+ const title = this.accordionItemElement.shadowRoot?.querySelector('.accordion-item-title');
42
+ if (!title) {
43
+ throw new Error('Accordion item title element not found');
44
+ }
45
+ return title;
46
+ }
47
+ }
48
+ //# sourceMappingURL=fv-accordion-item.pageobject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fv-accordion-item.pageobject.js","sourceRoot":"","sources":["../../../../src/fv-accordion-item/testing/fv-accordion-item.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAG3F;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAClC,YAAsC,oBAAqC;QAArC,yBAAoB,GAApB,oBAAoB,CAAiB;IAAG,CAAC;IAExE,KAAK,CAAC,YAAY;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,mBAAmB,EAAE,CAAC;IAChC,CAAC;IAEM,aAAa;QAChB,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACrD,CAAC;IAEM,UAAU;QACb,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC;IAClC,CAAC;IAEM,cAAc;QACjB,OAAO,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;IAEM,eAAe;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,aAAa,CACxD,kCAAkC,CACrC,CAAC;IACN,CAAC;IAEO,UAAU;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;QAC/E,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,UAAU;QACd,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,aAAa,CAC/D,yBAAyB,CAC5B,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,QAAQ;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,EAAE,aAAa,CAC7D,uBAAuB,CAC1B,CAAC;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { waitForUpdatesAsync } from '@ni/nimble-components/dist/esm/testing/async-helpers';\nimport type { FvAccordionItem } from '..';\n\n/**\n * Page object for the `ok-fv-accordion-item` component to provide consistent\n * ways of querying and interacting with the component during tests.\n */\nexport class FvAccordionItemPageObject {\n public constructor(protected readonly accordionItemElement: FvAccordionItem) {}\n\n public async clickSummary(): Promise<void> {\n this.getSummary().click();\n await waitForUpdatesAsync();\n }\n\n public getHeaderText(): string {\n return this.getTitle().textContent?.trim() ?? '';\n }\n\n public isExpanded(): boolean {\n return this.getDetails().open;\n }\n\n public hasContentSlot(): boolean {\n return !!this.accordionItemElement.shadowRoot?.querySelector('slot');\n }\n\n public hasExpanderIcon(): boolean {\n return !!this.accordionItemElement.shadowRoot?.querySelector(\n 'nimble-icon-arrow-expander-right'\n );\n }\n\n private getDetails(): HTMLDetailsElement {\n const details = this.accordionItemElement.shadowRoot?.querySelector('details');\n if (!details) {\n throw new Error('Accordion item details element not found');\n }\n return details;\n }\n\n private getSummary(): HTMLElement {\n const summary = this.accordionItemElement.shadowRoot?.querySelector<HTMLElement>(\n '.accordion-item-summary'\n );\n if (!summary) {\n throw new Error('Accordion item summary element not found');\n }\n return summary;\n }\n\n private getTitle(): HTMLElement {\n const title = this.accordionItemElement.shadowRoot?.querySelector<HTMLElement>(\n '.accordion-item-title'\n );\n if (!title) {\n throw new Error('Accordion item title element not found');\n }\n return title;\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export declare const FvAccordionItemAppearance: {
2
+ readonly outline: "outline";
3
+ readonly ghost: "ghost";
4
+ readonly block: "block";
5
+ };
6
+ export type FvAccordionItemAppearance = (typeof FvAccordionItemAppearance)[keyof typeof FvAccordionItemAppearance];
@@ -0,0 +1,6 @@
1
+ export const FvAccordionItemAppearance = {
2
+ outline: 'outline',
3
+ ghost: 'ghost',
4
+ block: 'block'
5
+ };
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/fv-accordion-item/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACrC,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACR,CAAC","sourcesContent":["export const FvAccordionItemAppearance = {\n outline: 'outline',\n ghost: 'ghost',\n block: 'block'\n} as const;\nexport type FvAccordionItemAppearance = (typeof FvAccordionItemAppearance)[keyof typeof FvAccordionItemAppearance];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/ok-components",
3
- "version": "0.3.13",
3
+ "version": "0.4.1",
4
4
  "description": "NI Ok Components",
5
5
  "scripts": {
6
6
  "build": "npm run build:components && npm run build:cem",
@@ -42,8 +42,8 @@
42
42
  "@ni/fast-element": "^10.1.1",
43
43
  "@ni/fast-foundation": "^10.2.3",
44
44
  "@ni/fast-web-utilities": "^10.0.0",
45
- "@ni/nimble-components": "^35.6.0",
46
- "@ni/spright-components": "^6.15.8",
45
+ "@ni/nimble-components": "^35.6.1",
46
+ "@ni/spright-components": "^6.15.9",
47
47
  "tslib": "^2.2.0"
48
48
  },
49
49
  "devDependencies": {