@aquera/nile-elements 0.0.20 → 0.0.22

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.
Files changed (157) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +3 -0
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +3 -0
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js +2 -5
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.d.ts +1 -0
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js +8 -16
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +4 -2
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
  11. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.d.ts +8 -3
  12. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js +58 -31
  13. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
  14. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +5 -9
  15. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  16. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +2 -0
  17. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +29 -15
  18. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  19. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.d.ts +1 -0
  20. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.js +2 -0
  21. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/index.js.map +1 -0
  22. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.d.ts +12 -0
  23. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.js +80 -0
  24. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.css.js.map +1 -0
  25. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.d.ts +55 -0
  26. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.js +129 -0
  27. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab/nile-tab.js.map +1 -0
  28. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.d.ts +1 -0
  29. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.js +2 -0
  30. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/index.js.map +1 -0
  31. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.d.ts +12 -0
  32. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.js +245 -0
  33. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -0
  34. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.d.ts +82 -0
  35. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.js +392 -0
  36. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-group/nile-tab-group.js.map +1 -0
  37. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.d.ts +1 -0
  38. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.js +2 -0
  39. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/index.js.map +1 -0
  40. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.d.ts +12 -0
  41. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.js +32 -0
  42. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.css.js.map +1 -0
  43. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.d.ts +38 -0
  44. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.js +71 -0
  45. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-tab-panel/nile-tab-panel.js.map +1 -0
  46. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +1 -1
  49. package/dist/index.iife.js +497 -118
  50. package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
  51. package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
  52. package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
  53. package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
  54. package/dist/nile-calendar/nile-calendar.css.esm.js +2 -5
  55. package/dist/nile-calendar/nile-calendar.esm.js +8 -16
  56. package/dist/nile-content-editor/nile-content-editor.cjs.js +1 -1
  57. package/dist/nile-content-editor/nile-content-editor.cjs.js.map +1 -1
  58. package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
  59. package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
  60. package/dist/nile-content-editor/nile-content-editor.css.esm.js +4 -2
  61. package/dist/nile-content-editor/nile-content-editor.esm.js +5 -5
  62. package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
  63. package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
  64. package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
  65. package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
  66. package/dist/nile-switcher/nile-switcher.css.esm.js +7 -11
  67. package/dist/nile-switcher/nile-switcher.esm.js +33 -26
  68. package/dist/nile-tab/index.cjs.js +2 -0
  69. package/dist/nile-tab/index.cjs.js.map +1 -0
  70. package/dist/nile-tab/index.esm.js +1 -0
  71. package/dist/nile-tab/nile-tab.cjs.js +2 -0
  72. package/dist/nile-tab/nile-tab.cjs.js.map +1 -0
  73. package/dist/nile-tab/nile-tab.css.cjs.js +2 -0
  74. package/dist/nile-tab/nile-tab.css.cjs.js.map +1 -0
  75. package/dist/nile-tab/nile-tab.css.esm.js +68 -0
  76. package/dist/nile-tab/nile-tab.esm.js +21 -0
  77. package/dist/nile-tab-group/index.cjs.js +2 -0
  78. package/dist/nile-tab-group/index.cjs.js.map +1 -0
  79. package/dist/nile-tab-group/index.esm.js +1 -0
  80. package/dist/nile-tab-group/nile-tab-group.cjs.js +2 -0
  81. package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -0
  82. package/dist/nile-tab-group/nile-tab-group.css.cjs.js +2 -0
  83. package/dist/nile-tab-group/nile-tab-group.css.cjs.js.map +1 -0
  84. package/dist/nile-tab-group/nile-tab-group.css.esm.js +233 -0
  85. package/dist/nile-tab-group/nile-tab-group.esm.js +43 -0
  86. package/dist/nile-tab-panel/index.cjs.js +2 -0
  87. package/dist/nile-tab-panel/index.cjs.js.map +1 -0
  88. package/dist/nile-tab-panel/index.esm.js +1 -0
  89. package/dist/nile-tab-panel/nile-tab-panel.cjs.js +2 -0
  90. package/dist/nile-tab-panel/nile-tab-panel.cjs.js.map +1 -0
  91. package/dist/nile-tab-panel/nile-tab-panel.css.cjs.js +2 -0
  92. package/dist/nile-tab-panel/nile-tab-panel.css.cjs.js.map +1 -0
  93. package/dist/nile-tab-panel/nile-tab-panel.css.esm.js +20 -0
  94. package/dist/nile-tab-panel/nile-tab-panel.esm.js +6 -0
  95. package/dist/src/index.d.ts +3 -0
  96. package/dist/src/index.js +3 -0
  97. package/dist/src/index.js.map +1 -1
  98. package/dist/src/nile-calendar/nile-calendar.css.js +2 -5
  99. package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
  100. package/dist/src/nile-calendar/nile-calendar.d.ts +1 -0
  101. package/dist/src/nile-calendar/nile-calendar.js +8 -16
  102. package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
  103. package/dist/src/nile-content-editor/nile-content-editor.css.js +4 -2
  104. package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
  105. package/dist/src/nile-content-editor/nile-content-editor.d.ts +8 -3
  106. package/dist/src/nile-content-editor/nile-content-editor.js +58 -31
  107. package/dist/src/nile-content-editor/nile-content-editor.js.map +1 -1
  108. package/dist/src/nile-switcher/nile-switcher.css.js +5 -9
  109. package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  110. package/dist/src/nile-switcher/nile-switcher.d.ts +2 -0
  111. package/dist/src/nile-switcher/nile-switcher.js +29 -15
  112. package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  113. package/dist/src/nile-tab/index.d.ts +1 -0
  114. package/dist/src/nile-tab/index.js +2 -0
  115. package/dist/src/nile-tab/index.js.map +1 -0
  116. package/dist/src/nile-tab/nile-tab.css.d.ts +12 -0
  117. package/dist/src/nile-tab/nile-tab.css.js +80 -0
  118. package/dist/src/nile-tab/nile-tab.css.js.map +1 -0
  119. package/dist/src/nile-tab/nile-tab.d.ts +55 -0
  120. package/dist/src/nile-tab/nile-tab.js +129 -0
  121. package/dist/src/nile-tab/nile-tab.js.map +1 -0
  122. package/dist/src/nile-tab-group/index.d.ts +1 -0
  123. package/dist/src/nile-tab-group/index.js +2 -0
  124. package/dist/src/nile-tab-group/index.js.map +1 -0
  125. package/dist/src/nile-tab-group/nile-tab-group.css.d.ts +12 -0
  126. package/dist/src/nile-tab-group/nile-tab-group.css.js +245 -0
  127. package/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -0
  128. package/dist/src/nile-tab-group/nile-tab-group.d.ts +82 -0
  129. package/dist/src/nile-tab-group/nile-tab-group.js +392 -0
  130. package/dist/src/nile-tab-group/nile-tab-group.js.map +1 -0
  131. package/dist/src/nile-tab-panel/index.d.ts +1 -0
  132. package/dist/src/nile-tab-panel/index.js +2 -0
  133. package/dist/src/nile-tab-panel/index.js.map +1 -0
  134. package/dist/src/nile-tab-panel/nile-tab-panel.css.d.ts +12 -0
  135. package/dist/src/nile-tab-panel/nile-tab-panel.css.js +32 -0
  136. package/dist/src/nile-tab-panel/nile-tab-panel.css.js.map +1 -0
  137. package/dist/src/nile-tab-panel/nile-tab-panel.d.ts +38 -0
  138. package/dist/src/nile-tab-panel/nile-tab-panel.js +71 -0
  139. package/dist/src/nile-tab-panel/nile-tab-panel.js.map +1 -0
  140. package/dist/tsconfig.tsbuildinfo +1 -1
  141. package/package.json +1 -1
  142. package/src/index.ts +3 -0
  143. package/src/nile-calendar/nile-calendar.css.ts +2 -5
  144. package/src/nile-calendar/nile-calendar.ts +9 -16
  145. package/src/nile-content-editor/nile-content-editor.css.ts +4 -2
  146. package/src/nile-content-editor/nile-content-editor.ts +74 -39
  147. package/src/nile-switcher/nile-switcher.css.ts +5 -9
  148. package/src/nile-switcher/nile-switcher.ts +46 -22
  149. package/src/nile-tab/index.ts +1 -0
  150. package/src/nile-tab/nile-tab.css.ts +82 -0
  151. package/src/nile-tab/nile-tab.ts +129 -0
  152. package/src/nile-tab-group/index.ts +1 -0
  153. package/src/nile-tab-group/nile-tab-group.css.ts +247 -0
  154. package/src/nile-tab-group/nile-tab-group.ts +441 -0
  155. package/src/nile-tab-panel/index.ts +1 -0
  156. package/src/nile-tab-panel/nile-tab-panel.css.ts +34 -0
  157. package/src/nile-tab-panel/nile-tab-panel.ts +74 -0
@@ -64,6 +64,7 @@ export declare class NileSwitcher extends NileElement {
64
64
  */
65
65
  static styles: CSSResultGroup;
66
66
  nileSwitchConfig: switchconfig;
67
+ value: string;
67
68
  connectedCallback(): void;
68
69
  disconnectedCallback(): void;
69
70
  renderNileText(Input: switchInputType, inputType: string): TemplateResult<1>;
@@ -71,6 +72,7 @@ export declare class NileSwitcher extends NileElement {
71
72
  renderNileTextArea(Input: switchInputType, inputType: string): TemplateResult<1>;
72
73
  renderNileCheckBox(Input: switchInputType, inputType: string): TemplateResult<1>;
73
74
  renderNileRadio(Input: switchInputType, inputType: string): TemplateResult<1>;
75
+ renderErrorMessage(errorMessage: string): TemplateResult<1>;
74
76
  renderContentEditor(Input: switchInputType, inputType: string): TemplateResult<1>;
75
77
  handleChange(event: CustomEvent, inputType: string, inputTypeName: string): void;
76
78
  renderIcon(defaultInput: switchInputType, switchInput: switchInputType): TemplateResult<1>;
@@ -50,11 +50,14 @@ let NileSwitcher = class NileSwitcher extends NileElement {
50
50
  ></nile-input>`;
51
51
  }
52
52
  renderDropdown(Input, inputType) {
53
- const { options, multiple, placeholder, disabled, inputType: inputTypeName, } = Input;
53
+ const { options, multiple, placeholder, disabled, value, error, errorMessage, inputType: inputTypeName, } = Input;
54
54
  return html `<nile-select
55
55
  .placeholder=${placeholder}
56
56
  .disabled="${disabled}"
57
57
  .multiple="${multiple}"
58
+ .value="${value}"
59
+ .error="${error}"
60
+ .errorMessage="${errorMessage}"
58
61
  @nile-change=${(e) => {
59
62
  this.handleChange(e, inputType, inputTypeName);
60
63
  }}
@@ -80,33 +83,41 @@ let NileSwitcher = class NileSwitcher extends NileElement {
80
83
  renderNileCheckBox(Input, inputType) {
81
84
  const { value, label, disabled, inputType: inputTypeName } = Input;
82
85
  return html `<nile-checkbox
83
- .checked=${value}
84
- .label=${label}
85
- .disabled=${disabled}
86
- @valueChange=${(e) => {
86
+ .checked=${value}
87
+ .label=${label}
88
+ .disabled=${disabled}
89
+ @valueChange=${(e) => {
87
90
  this.handleChange(e, inputType, inputTypeName);
88
91
  }}
89
- ></nile-checkbox>`;
92
+ ></nile-checkbox
93
+ >; `;
90
94
  }
91
95
  renderNileRadio(Input, inputType) {
92
- const { options, value, disabled, inputType: inputTypeName } = Input;
96
+ const { options, value, disabled, inputType: inputTypeName, errorMessage, } = Input;
97
+ const haserrorMessage = !!errorMessage;
93
98
  return html `<nile-radio-group
94
- .value=${value}
95
- .disabled=${disabled}
96
- @change=${(e) => {
99
+ .value=${value}
100
+ .disabled=${disabled}
101
+ @change=${(e) => {
97
102
  this.handleChange(e, inputType, inputTypeName);
98
103
  }}
99
- >
100
- ${options &&
104
+ >
105
+ ${options &&
101
106
  options.map((option) => {
102
107
  return html `<nile-radio .value="${option}">${option} </nile-radio>`;
103
108
  })}
104
- </nile-radio-group>`;
109
+ </nile-radio-group>
110
+ ${haserrorMessage ? this.renderErrorMessage(errorMessage) : ''}`;
111
+ }
112
+ renderErrorMessage(errorMessage) {
113
+ return html `
114
+ <nile-form-error-message>${errorMessage}</nile-form-error-message>
115
+ `;
105
116
  }
106
117
  renderContentEditor(Input, inputType) {
107
- const { value, options, inputType: inputTypeName, errorMessage, type, readonly, noborder, } = Input;
118
+ let { options, inputType: inputTypeName, errorMessage, type, readonly, noborder, } = Input;
108
119
  return html `<nile-content-editor
109
- .value=${value}
120
+ .value=${this.value}
110
121
  .options=${options}
111
122
  .type=${type}
112
123
  .readonly=${readonly}
@@ -233,6 +244,9 @@ NileSwitcher.styles = styles;
233
244
  __decorate([
234
245
  property({ type: Object })
235
246
  ], NileSwitcher.prototype, "nileSwitchConfig", void 0);
247
+ __decorate([
248
+ property()
249
+ ], NileSwitcher.prototype, "value", void 0);
236
250
  NileSwitcher = __decorate([
237
251
  customElement('nile-switcher')
238
252
  ], NileSwitcher);
@@ -1 +1 @@
1
- {"version":3,"file":"nile-switcher.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAiDvD,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,sCAAwB,CAAA;IACxB,oCAAsB,CAAA;AACxB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,CAAN,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,yCAAqB,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AC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAC9D;QACH,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE;KAC7D,CAAC;IACJ,CAAC;IACM,MAAM;QACX,MAAM,EACJ,YAAY,EAAE,WAAW,EACzB,YAAY,EACZ,WAAW,EACX,OAAO,GACR,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAE1B,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,mBAAmB,CACxB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,CAAC,CAAC,OAAO,CACV;WACI,CAAC;IACV,CAAC;;AA3RD;;;GAGG;AACI,mBAAM,GAAmB,MAAM,CAAC;AACX;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgC;AANhD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA6RxB;SA7RY,YAAY;AA+RzB,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, TemplateResult } from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-switcher.css';\nimport NileElement from '../internal/nile-element';\nimport { CSSResultGroup } from 'lit';\nimport { choose } from 'lit/directives/choose.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/**\n * @summary Allows you to switch between nile elements\n\n * @dependency nile-icon\n * @dependency nile-input\n * @dependency nile-checkbox\n * @dependency nile-dropdown\n * @dependency nile-textarea\n *\n \n * @event nile-change - Emitted when the control's value changes.\n * @event nile-switch - Emitted when the nile component is being switched.\n \n */\n\nexport interface switchconfig {\n [key: string]: any;\n toggleSwitch: boolean;\n disable?: boolean;\n confirmation?: boolean;\n defaultInput: switchInputType;\n switchInput: switchInputType;\n}\n\nexport interface switchInputType {\n inputType:\n | INPUT_TYPE_NAMES.DROPDOWN\n | INPUT_TYPE_NAMES.TEXT\n | INPUT_TYPE_NAMES.CHECKBOX\n | INPUT_TYPE_NAMES.TEXTAREA\n | INPUT_TYPE_NAMES.RADIO\n | INPUT_TYPE_NAMES.CONTENTEDITOR;\n value?: String | boolean;\n label?: String;\n readonly?: boolean;\n type?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n error?: boolean;\n errorMessage?: string;\n options?: Array<any>;\n helperText?: string;\n multiple?: boolean;\n noborder?: boolean;\n}\n\nexport enum INPUT_TYPE {\n DEFAULT = 'defaultInput',\n SWITCH = 'switchInput',\n}\n\nexport enum INPUT_TYPE_NAMES {\n DROPDOWN = 'dropdown',\n TEXT = 'text',\n CHECKBOX = 'checkbox',\n TEXTAREA = 'text-area',\n RADIO = 'radio',\n CONTENTEDITOR = 'content-editor',\n}\n\n@customElement('nile-switcher')\nexport class NileSwitcher extends NileElement {\n /**\n * The styles for nile switcher\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n static styles: CSSResultGroup = styles;\n @property({ type: Object }) nileSwitchConfig: switchconfig;\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n renderNileText(Input: switchInputType, inputType: string) {\n const {\n value,\n label,\n placeholder,\n disabled,\n required,\n error,\n errorMessage,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-input\n .value=${value}\n .label=${label}\n .disabled=${disabled}\n .required=${required}\n .errorMessage=${errorMessage}\n .placeholder=${placeholder}\n .error=${error}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-input>`;\n }\n\n renderDropdown(Input: switchInputType, inputType: string) {\n const {\n options,\n multiple,\n placeholder,\n disabled,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-select\n .placeholder=${placeholder}\n .disabled=\"${disabled}\"\n .multiple=\"${multiple}\"\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options?.map((option: any) => {\n return html`<nile-option .value=\"${option}\">${option} </nile-option>`;\n })}\n </nile-select>`;\n }\n\n renderNileTextArea(Input: switchInputType, inputType: string) {\n const {\n value,\n disabled,\n readonly,\n errorMessage,\n error,\n inputType: inputTypeName,\n } = Input;\n\n return html`<nile-textarea\n .value=${value}\n .disabled=${disabled}\n ?readonly=${readonly}\n .error=${error}\n .errorMessage=${errorMessage}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-textarea>`;\n }\n\n renderNileCheckBox(Input: switchInputType, inputType: string) {\n const { value, label, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-checkbox\n .checked=${value}\n .label=${label}\n .disabled=${disabled}\n @valueChange=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-checkbox>`;\n }\n\n renderNileRadio(Input: switchInputType, inputType: string) {\n const { options, value, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-radio-group\n .value=${value}\n .disabled=${disabled}\n @change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options &&\n options.map((option: any) => {\n return html`<nile-radio .value=\"${option}\">${option} </nile-radio>`;\n })}\n </nile-radio-group>`;\n }\n\n renderContentEditor(Input: switchInputType, inputType: string) {\n const {\n value,\n options,\n inputType: inputTypeName,\n errorMessage,\n type,\n readonly,\n noborder,\n } = Input;\n return html`<nile-content-editor\n .value=${value}\n .options=${options}\n .type=${type}\n .readonly=${readonly}\n .noborder=${noborder}\n .errorMessage=${errorMessage}\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n </nile-content-editor>`;\n }\n\n handleChange(event: CustomEvent, inputType: string, inputTypeName: string) {\n if (inputTypeName === INPUT_TYPE_NAMES.CHECKBOX) {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.checked;\n } else {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.value;\n }\n event.stopPropagation();\n this.emit('nile-change', { config: this.nileSwitchConfig });\n }\n\n renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {\n const defaultHelperText = defaultInput.helperText;\n const switchHelperText = switchInput.helperText;\n\n const icon = !this.nileSwitchConfig.toggleSwitch\n ? 'header-functions'\n : 'stringinput';\n\n const helperText = !this.nileSwitchConfig.toggleSwitch\n ? !!switchHelperText\n ? switchHelperText\n : `switch to ${switchInput.inputType}`\n : !!defaultHelperText\n ? defaultHelperText\n : `switch to ${defaultInput.inputType}`;\n\n return html` <nile-tooltip\n class=${classMap({\n 'tooltip-container': true,\n })}\n content=${helperText}\n placement=\"bottom\"\n >\n <nile-icon\n size=\"14\"\n class=${classMap({\n 'pointer-cursor': true,\n })}\n .name=${icon}\n color=\"#005EA6\"\n @click=${this.toggleField}\n ></nile-icon>\n </nile-tooltip>`;\n }\n\n toggleField() {\n if (!this.nileSwitchConfig.confirmation) {\n this.nileSwitchConfig = {\n ...this.nileSwitchConfig,\n toggleSwitch: !this.nileSwitchConfig.toggleSwitch,\n };\n }\n this.emit('nile-switch', { config: this.nileSwitchConfig });\n }\n\n singleFieldSwitcher(\n defaultInput: switchInputType,\n switchInput: switchInputType,\n toggleField: boolean,\n disable: boolean\n ) {\n const defaultInputType = defaultInput.inputType;\n const switchInputType = switchInput.inputType;\n return html`\n ${!toggleField\n ? choose(\n defaultInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.CHECKBOX,\n () => this.renderNileCheckBox(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.RADIO,\n () => this.renderNileRadio(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.DROPDOWN,\n () =>\n this.renderDropdown(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () =>\n this.renderContentEditor(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n ],\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT)\n )\n : choose(\n switchInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),\n ],\n ],\n\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)\n )}\n ${!disable ? this.renderIcon(defaultInput, switchInput) : ''}\n `;\n }\n public render(): TemplateResult {\n const {\n toggleSwitch: toggleField,\n defaultInput,\n switchInput,\n disable,\n } = this.nileSwitchConfig;\n\n return html`<div class=\"input-container\">\n ${this.singleFieldSwitcher(\n defaultInput,\n switchInput,\n toggleField,\n !!disable\n )}\n </div>`;\n }\n}\n\nexport default NileSwitcher;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-switcher': NileSwitcher;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-switcher.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAkB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,W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;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAqTxB;SArTY,YAAY;AAuTzB,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, property, TemplateResult } from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-switcher.css';\nimport NileElement from '../internal/nile-element';\nimport { CSSResultGroup } from 'lit';\nimport { choose } from 'lit/directives/choose.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\n/**\n * @summary Allows you to switch between nile elements\n\n * @dependency nile-icon\n * @dependency nile-input\n * @dependency nile-checkbox\n * @dependency nile-dropdown\n * @dependency nile-textarea\n *\n \n * @event nile-change - Emitted when the control's value changes.\n * @event nile-switch - Emitted when the nile component is being switched.\n \n */\n\nexport interface switchconfig {\n [key: string]: any;\n toggleSwitch: boolean;\n disable?: boolean;\n confirmation?: boolean;\n defaultInput: switchInputType;\n switchInput: switchInputType;\n}\n\nexport interface switchInputType {\n inputType:\n | INPUT_TYPE_NAMES.DROPDOWN\n | INPUT_TYPE_NAMES.TEXT\n | INPUT_TYPE_NAMES.CHECKBOX\n | INPUT_TYPE_NAMES.TEXTAREA\n | INPUT_TYPE_NAMES.RADIO\n | INPUT_TYPE_NAMES.CONTENTEDITOR;\n value?: String | boolean;\n label?: String;\n readonly?: boolean;\n type?: string;\n placeholder?: string;\n disabled?: boolean;\n required?: boolean;\n error?: boolean;\n errorMessage?: string;\n options?: Array<any>;\n helperText?: string;\n multiple?: boolean;\n noborder?: boolean;\n}\n\nexport enum INPUT_TYPE {\n DEFAULT = 'defaultInput',\n SWITCH = 'switchInput',\n}\n\nexport enum INPUT_TYPE_NAMES {\n DROPDOWN = 'dropdown',\n TEXT = 'text',\n CHECKBOX = 'checkbox',\n TEXTAREA = 'text-area',\n RADIO = 'radio',\n CONTENTEDITOR = 'content-editor',\n}\n\n@customElement('nile-switcher')\nexport class NileSwitcher extends NileElement {\n /**\n * The styles for nile switcher\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n static styles: CSSResultGroup = styles;\n @property({ type: Object }) nileSwitchConfig: switchconfig;\n\n @property() value: string;\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n renderNileText(Input: switchInputType, inputType: string) {\n const {\n value,\n label,\n placeholder,\n disabled,\n required,\n error,\n errorMessage,\n inputType: inputTypeName,\n } = Input;\n return html`<nile-input\n .value=${value}\n .label=${label}\n .disabled=${disabled}\n .required=${required}\n .errorMessage=${errorMessage}\n .placeholder=${placeholder}\n .error=${error}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-input>`;\n }\n\n renderDropdown(Input: switchInputType, inputType: string) {\n const {\n options,\n multiple,\n placeholder,\n disabled,\n value,\n error,\n errorMessage,\n inputType: inputTypeName,\n } = Input;\n\n return html`<nile-select\n .placeholder=${placeholder}\n .disabled=\"${disabled}\"\n .multiple=\"${multiple}\"\n .value=\"${value}\"\n .error=\"${error}\"\n .errorMessage=\"${errorMessage}\"\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options?.map((option: any) => {\n return html`<nile-option .value=\"${option}\">${option} </nile-option>`;\n })}\n </nile-select>`;\n }\n\n renderNileTextArea(Input: switchInputType, inputType: string) {\n const {\n value,\n disabled,\n readonly,\n errorMessage,\n error,\n inputType: inputTypeName,\n } = Input;\n\n return html`<nile-textarea\n .value=${value}\n .disabled=${disabled}\n ?readonly=${readonly}\n .error=${error}\n .errorMessage=${errorMessage}\n @nile-input=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-textarea>`;\n }\n\n renderNileCheckBox(Input: switchInputType, inputType: string) {\n const { value, label, disabled, inputType: inputTypeName } = Input;\n\n return html`<nile-checkbox\n .checked=${value}\n .label=${label}\n .disabled=${disabled}\n @valueChange=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n ></nile-checkbox\n >; `;\n }\n\n renderNileRadio(Input: switchInputType, inputType: string) {\n const {\n options,\n value,\n disabled,\n inputType: inputTypeName,\n errorMessage,\n } = Input;\n\n const haserrorMessage = !!errorMessage;\n\n return html`<nile-radio-group\n .value=${value}\n .disabled=${disabled}\n @change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n ${options &&\n options.map((option: any) => {\n return html`<nile-radio .value=\"${option}\">${option} </nile-radio>`;\n })}\n </nile-radio-group>\n ${haserrorMessage ? this.renderErrorMessage(errorMessage) : ''}`;\n }\n\n renderErrorMessage(errorMessage: string) {\n return html`\n <nile-form-error-message>${errorMessage}</nile-form-error-message>\n `;\n }\n\n renderContentEditor(Input: switchInputType, inputType: string) {\n let {\n options,\n inputType: inputTypeName,\n errorMessage,\n type,\n readonly,\n noborder,\n } = Input;\n return html`<nile-content-editor\n .value=${this.value}\n .options=${options}\n .type=${type}\n .readonly=${readonly}\n .noborder=${noborder}\n .errorMessage=${errorMessage}\n @nile-change=${(e: CustomEvent) => {\n this.handleChange(e, inputType, inputTypeName);\n }}\n >\n </nile-content-editor>`;\n }\n\n handleChange(event: CustomEvent, inputType: string, inputTypeName: string) {\n if (inputTypeName === INPUT_TYPE_NAMES.CHECKBOX) {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.checked;\n } else {\n this.nileSwitchConfig[inputType as keyof switchconfig].value =\n event.detail.value;\n }\n event.stopPropagation();\n this.emit('nile-change', { config: this.nileSwitchConfig });\n }\n\n renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {\n const defaultHelperText = defaultInput.helperText;\n const switchHelperText = switchInput.helperText;\n\n const icon = !this.nileSwitchConfig.toggleSwitch\n ? 'header-functions'\n : 'stringinput';\n\n const helperText = !this.nileSwitchConfig.toggleSwitch\n ? !!switchHelperText\n ? switchHelperText\n : `switch to ${switchInput.inputType}`\n : !!defaultHelperText\n ? defaultHelperText\n : `switch to ${defaultInput.inputType}`;\n\n return html` <nile-tooltip\n class=${classMap({\n 'tooltip-container': true,\n })}\n content=${helperText}\n placement=\"bottom\"\n >\n <nile-icon\n size=\"14\"\n class=${classMap({\n 'pointer-cursor': true,\n })}\n .name=${icon}\n color=\"#005EA6\"\n @click=${this.toggleField}\n ></nile-icon>\n </nile-tooltip>`;\n }\n\n toggleField() {\n if (!this.nileSwitchConfig.confirmation) {\n this.nileSwitchConfig = {\n ...this.nileSwitchConfig,\n toggleSwitch: !this.nileSwitchConfig.toggleSwitch,\n };\n }\n this.emit('nile-switch', { config: this.nileSwitchConfig });\n }\n\n singleFieldSwitcher(\n defaultInput: switchInputType,\n switchInput: switchInputType,\n toggleField: boolean,\n disable: boolean\n ) {\n const defaultInputType = defaultInput.inputType;\n const switchInputType = switchInput.inputType;\n return html`\n ${!toggleField\n ? choose(\n defaultInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.CHECKBOX,\n () => this.renderNileCheckBox(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.RADIO,\n () => this.renderNileRadio(defaultInput, INPUT_TYPE.DEFAULT),\n ],\n [\n INPUT_TYPE_NAMES.DROPDOWN,\n () =>\n this.renderDropdown(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () =>\n this.renderContentEditor(\n this.nileSwitchConfig.defaultInput,\n INPUT_TYPE.DEFAULT\n ),\n ],\n ],\n () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT)\n )\n : choose(\n switchInputType,\n [\n [\n INPUT_TYPE_NAMES.TEXTAREA,\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.TEXT,\n () => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),\n ],\n [\n INPUT_TYPE_NAMES.CONTENTEDITOR,\n () => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),\n ],\n ],\n\n () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)\n )}\n ${!disable ? this.renderIcon(defaultInput, switchInput) : ''}\n `;\n }\n public render(): TemplateResult {\n const {\n toggleSwitch: toggleField,\n defaultInput,\n switchInput,\n disable,\n } = this.nileSwitchConfig;\n\n return html`<div class=\"input-container\">\n ${this.singleFieldSwitcher(\n defaultInput,\n switchInput,\n toggleField,\n !!disable\n )}\n </div>`;\n }\n}\n\nexport default NileSwitcher;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-switcher': NileSwitcher;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { NileTab } from './nile-tab';
@@ -0,0 +1,2 @@
1
+ export { NileTab } from './nile-tab';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-tab/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { NileTab } from './nile-tab';\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Tab CSS
9
+ */
10
+ export declare const styles: import("lit-element").CSSResult;
11
+ declare const _default: import("lit-element").CSSResult[];
12
+ export default _default;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { css } from 'lit-element';
8
+ /**
9
+ * Tab CSS
10
+ */
11
+ export const styles = css `
12
+ [hidden] {
13
+ display: none !important;
14
+ }
15
+
16
+ :host {
17
+ display: inline-block;
18
+ }
19
+
20
+ .tab {
21
+ display: inline-flex;
22
+ align-items: center;
23
+ border-radius: 8px;
24
+ color: var(--nile-colors-dark-500);
25
+ padding: 4px 4px 12px 4px;
26
+ white-space: nowrap;
27
+ user-select: none;
28
+ cursor: pointer;
29
+ transition: 0.2s box-shadow, 0.2s color;
30
+ font-family: Colfax-regular;
31
+ font-size: 16px;
32
+ font-style: normal;
33
+ font-weight: 500;
34
+ line-height: 16px;
35
+ letter-spacing: 0.2px;
36
+ }
37
+
38
+ .tab:hover:not(.tab--disabled) {
39
+ color: var(--nile-colors-dark-900);
40
+ }
41
+
42
+ .tab:focus {
43
+ outline: none;
44
+ }
45
+
46
+ .tab:focus-visible:not(.tab--disabled) {
47
+ color: var(--nile-colors-primary-600);
48
+ }
49
+
50
+ .tab.tab--active:not(.tab--disabled) {
51
+ color: var(--nile-colors-primary-600);
52
+ }
53
+
54
+ .tab.tab--closable {
55
+ padding-inline-end: 4px;
56
+ }
57
+
58
+ .tab.tab--disabled {
59
+ opacity: 0.5;
60
+ cursor: not-allowed;
61
+ }
62
+
63
+ .tab__close-button {
64
+ font-size: 14px;
65
+ margin-inline-start: 4px;
66
+ }
67
+
68
+ .tab__close-button::part(base) {
69
+ padding: 3px;
70
+ }
71
+
72
+ @media (forced-colors: active) {
73
+ .tab.tab--active:not(.tab--disabled) {
74
+ outline: solid 1px transparent;
75
+ outline-offset: -3px;
76
+ }
77
+ }
78
+ `;
79
+ export default [styles];
80
+ //# sourceMappingURL=nile-tab.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-tab.css.js","sourceRoot":"","sources":["../../../src/nile-tab/nile-tab.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,aAAa,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmExB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit-element';\n\n/**\n * Tab CSS\n */\nexport const styles = css`\n [hidden] {\n display: none !important;\n }\n\n :host {\n display: inline-block;\n }\n\n .tab {\n display: inline-flex;\n align-items: center;\n border-radius: 8px;\n color: var(--nile-colors-dark-500);\n padding: 4px 4px 12px 4px;\n white-space: nowrap;\n user-select: none;\n cursor: pointer;\n transition: 0.2s box-shadow, 0.2s color;\n font-family: Colfax-regular;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n letter-spacing: 0.2px;\n }\n\n .tab:hover:not(.tab--disabled) {\n color: var(--nile-colors-dark-900);\n }\n\n .tab:focus {\n outline: none;\n }\n\n .tab:focus-visible:not(.tab--disabled) {\n color: var(--nile-colors-primary-600);\n }\n\n .tab.tab--active:not(.tab--disabled) {\n color: var(--nile-colors-primary-600);\n }\n\n .tab.tab--closable {\n padding-inline-end: 4px;\n }\n\n .tab.tab--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .tab__close-button {\n font-size: 14px;\n margin-inline-start: 4px;\n }\n\n .tab__close-button::part(base) {\n padding: 3px;\n }\n\n @media (forced-colors: active) {\n .tab.tab--active:not(.tab--disabled) {\n outline: solid 1px transparent;\n outline-offset: -3px;\n }\n }\n`;\n\nexport default [styles];\n"]}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { TemplateResult } from 'lit-element';
8
+ import '../nile-icon-button/nile-icon-button';
9
+ import NileElement from '../internal/nile-element';
10
+ import type { CSSResultGroup } from 'lit';
11
+ /**
12
+ * Nile icon component.
13
+ *
14
+ * @tag nile-tab
15
+ *
16
+ *
17
+ * @dependency nile-icon-button
18
+ *
19
+ * @slot - The tab's label.
20
+ *
21
+ * @event nile-close - Emitted when the tab is closable and the close button is activated.
22
+ *
23
+ * @csspart base - The component's base wrapper.
24
+ * @csspart close-button - The close button, an `<nile-icon-button>`.
25
+ * @csspart close-button__base - The close button's exported `base` part.
26
+ */
27
+ export declare class NileTab extends NileElement {
28
+ static styles: CSSResultGroup;
29
+ private readonly attrId;
30
+ private readonly componentId;
31
+ tab: HTMLElement;
32
+ /** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */
33
+ panel: string;
34
+ /** Draws the tab in an active state. */
35
+ active: boolean;
36
+ /** Makes the tab closable and shows a close button. */
37
+ closable: boolean;
38
+ /** Disables the tab and prevents selection. */
39
+ disabled: boolean;
40
+ connectedCallback(): void;
41
+ private handleCloseClick;
42
+ handleActiveChange(): void;
43
+ handleDisabledChange(): void;
44
+ /** Sets focus to the tab. */
45
+ focus(options?: FocusOptions): void;
46
+ /** Removes focus from the tab. */
47
+ blur(): void;
48
+ render(): TemplateResult<1>;
49
+ }
50
+ export default NileTab;
51
+ declare global {
52
+ interface HTMLElementTagNameMap {
53
+ 'nile-tab': NileTab;
54
+ }
55
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { __decorate } from "tslib";
8
+ import { html, property } from 'lit-element';
9
+ import { customElement } from 'lit/decorators.js';
10
+ import { styles } from './nile-tab.css';
11
+ import '../nile-icon-button/nile-icon-button';
12
+ import { classMap } from 'lit/directives/class-map.js';
13
+ import { query } from 'lit/decorators.js';
14
+ import { watch } from '../internal/watch';
15
+ import NileElement from '../internal/nile-element';
16
+ let id = 0;
17
+ /**
18
+ * Nile icon component.
19
+ *
20
+ * @tag nile-tab
21
+ *
22
+ *
23
+ * @dependency nile-icon-button
24
+ *
25
+ * @slot - The tab's label.
26
+ *
27
+ * @event nile-close - Emitted when the tab is closable and the close button is activated.
28
+ *
29
+ * @csspart base - The component's base wrapper.
30
+ * @csspart close-button - The close button, an `<nile-icon-button>`.
31
+ * @csspart close-button__base - The close button's exported `base` part.
32
+ */
33
+ let NileTab = class NileTab extends NileElement {
34
+ constructor() {
35
+ super(...arguments);
36
+ this.attrId = ++id;
37
+ this.componentId = `nile-tab-${this.attrId}`;
38
+ /** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */
39
+ this.panel = '';
40
+ /** Draws the tab in an active state. */
41
+ this.active = false;
42
+ /** Makes the tab closable and shows a close button. */
43
+ this.closable = false;
44
+ /** Disables the tab and prevents selection. */
45
+ this.disabled = false;
46
+ }
47
+ connectedCallback() {
48
+ super.connectedCallback();
49
+ this.setAttribute('role', 'tab');
50
+ }
51
+ handleCloseClick(event) {
52
+ event.stopPropagation();
53
+ this.emit('nile-close');
54
+ }
55
+ handleActiveChange() {
56
+ this.setAttribute('aria-selected', this.active ? 'true' : 'false');
57
+ }
58
+ handleDisabledChange() {
59
+ this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
60
+ }
61
+ /** Sets focus to the tab. */
62
+ focus(options) {
63
+ this.tab.focus(options);
64
+ }
65
+ /** Removes focus from the tab. */
66
+ blur() {
67
+ this.tab.blur();
68
+ }
69
+ render() {
70
+ // If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels
71
+ this.id = this.id.length > 0 ? this.id : this.componentId;
72
+ return html `
73
+ <div
74
+ part="base"
75
+ class=${classMap({
76
+ tab: true,
77
+ 'tab--active': this.active,
78
+ 'tab--closable': this.closable,
79
+ 'tab--disabled': this.disabled
80
+ })}
81
+ tabindex=${this.disabled ? '-1' : '0'}
82
+ >
83
+ <slot></slot>
84
+ ${this.closable
85
+ ? html `
86
+ <nile-icon-button
87
+ part="close-button"
88
+ exportparts="base:close-button__base"
89
+ name="x-lg"
90
+ library="system"
91
+ label="close"
92
+ class="tab__close-button"
93
+ @click=${this.handleCloseClick}
94
+ tabindex="-1"
95
+ ></nile-icon-button>
96
+ `
97
+ : ''}
98
+ </div>
99
+ `;
100
+ }
101
+ };
102
+ NileTab.styles = styles;
103
+ __decorate([
104
+ query('.tab')
105
+ ], NileTab.prototype, "tab", void 0);
106
+ __decorate([
107
+ property({ reflect: true })
108
+ ], NileTab.prototype, "panel", void 0);
109
+ __decorate([
110
+ property({ type: Boolean, reflect: true })
111
+ ], NileTab.prototype, "active", void 0);
112
+ __decorate([
113
+ property({ type: Boolean })
114
+ ], NileTab.prototype, "closable", void 0);
115
+ __decorate([
116
+ property({ type: Boolean, reflect: true })
117
+ ], NileTab.prototype, "disabled", void 0);
118
+ __decorate([
119
+ watch('active')
120
+ ], NileTab.prototype, "handleActiveChange", null);
121
+ __decorate([
122
+ watch('disabled')
123
+ ], NileTab.prototype, "handleDisabledChange", null);
124
+ NileTab = __decorate([
125
+ customElement('nile-tab')
126
+ ], NileTab);
127
+ export { NileTab };
128
+ export default NileTab;
129
+ //# sourceMappingURL=nile-tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-tab.js","sourceRoot":"","sources":["../../../src/nile-tab/nile-tab.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,m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ent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport {styles} from './nile-tab.css';\n\nimport '../nile-icon-button/nile-icon-button';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n\nlet id = 0;\n\n/**\n * Nile icon component.\n *\n * @tag nile-tab\n *\n *\n * @dependency nile-icon-button\n *\n * @slot - The tab's label.\n *\n * @event nile-close - Emitted when the tab is closable and the close button is activated.\n *\n * @csspart base - The component's base wrapper.\n * @csspart close-button - The close button, an `<nile-icon-button>`.\n * @csspart close-button__base - The close button's exported `base` part.\n */\n@customElement('nile-tab')\nexport class NileTab extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly attrId = ++id;\n private readonly componentId = `nile-tab-${this.attrId}`;\n\n @query('.tab') tab: HTMLElement;\n\n /** The name of the tab panel this tab is associated with. The panel must be located in the same tab group. */\n @property({ reflect: true }) panel = '';\n\n /** Draws the tab in an active state. */\n @property({ type: Boolean, reflect: true }) active = false;\n\n /** Makes the tab closable and shows a close button. */\n @property({ type: Boolean }) closable = false;\n\n /** Disables the tab and prevents selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'tab');\n }\n\n private handleCloseClick(event: Event) {\n event.stopPropagation();\n this.emit('nile-close');\n }\n\n @watch('active')\n handleActiveChange() {\n this.setAttribute('aria-selected', this.active ? 'true' : 'false');\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n /** Sets focus to the tab. */\n focus(options?: FocusOptions) {\n this.tab.focus(options);\n }\n\n /** Removes focus from the tab. */\n blur() {\n this.tab.blur();\n }\n\n render() {\n // If the user didn't provide an ID, we'll set one so we can link tabs and tab panels with aria labels\n this.id = this.id.length > 0 ? this.id : this.componentId;\n\n return html`\n <div\n part=\"base\"\n class=${classMap({\n tab: true,\n 'tab--active': this.active,\n 'tab--closable': this.closable,\n 'tab--disabled': this.disabled\n })}\n tabindex=${this.disabled ? '-1' : '0'}\n >\n <slot></slot>\n ${this.closable\n ? html`\n <nile-icon-button\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n name=\"x-lg\"\n library=\"system\"\n label=\"close\"\n class=\"tab__close-button\"\n @click=${this.handleCloseClick}\n tabindex=\"-1\"\n ></nile-icon-button>\n `\n : ''}\n </div>\n `;\n }\n}\n\nexport default NileTab;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-tab': NileTab;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { NileTabGroup } from './nile-tab-group';
@@ -0,0 +1,2 @@
1
+ export { NileTabGroup } from './nile-tab-group';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-tab-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { NileTabGroup } from './nile-tab-group';\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * TabGroup CSS
9
+ */
10
+ export declare const styles: import("lit-element").CSSResult;
11
+ declare const _default: import("lit-element").CSSResult[];
12
+ export default _default;