@krumio/trailhand-ui 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +102 -11
  2. package/dist/components/button/button.d.ts +20 -0
  3. package/dist/components/button/button.d.ts.map +1 -0
  4. package/dist/components/button/button.js +189 -0
  5. package/dist/components/button/button.js.map +1 -0
  6. package/dist/components/button/index.d.ts +2 -0
  7. package/dist/components/button/index.d.ts.map +1 -0
  8. package/dist/components/button/index.js +2 -0
  9. package/dist/components/button/index.js.map +1 -0
  10. package/dist/components/icon/icon.d.ts +18 -0
  11. package/dist/components/icon/icon.d.ts.map +1 -0
  12. package/dist/components/icon/icon.js +44 -0
  13. package/dist/components/icon/icon.js.map +1 -0
  14. package/dist/components/icon/index.d.ts +2 -0
  15. package/dist/components/icon/index.d.ts.map +1 -0
  16. package/dist/components/icon/index.js +2 -0
  17. package/dist/components/icon/index.js.map +1 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/styles/colors.css +132 -0
  23. package/package.json +17 -8
  24. package/dist/Button.d.ts +0 -15
  25. package/dist/Button.d.ts.map +0 -1
  26. package/dist/Button.js +0 -18
  27. package/dist/Button.js.map +0 -1
  28. package/dist/Header.d.ts +0 -15
  29. package/dist/Header.d.ts.map +0 -1
  30. package/dist/Header.js +0 -44
  31. package/dist/Header.js.map +0 -1
  32. package/dist/Page.d.ts +0 -9
  33. package/dist/Page.d.ts.map +0 -1
  34. package/dist/Page.js +0 -61
  35. package/dist/Page.js.map +0 -1
  36. package/dist/action-menu.d.ts +0 -79
  37. package/dist/action-menu.d.ts.map +0 -1
  38. package/dist/action-menu.js +0 -321
  39. package/dist/action-menu.js.map +0 -1
  40. package/dist/assets/index-B7q5L5KS.js +0 -91
  41. package/dist/components/action-menu/action-menu.stories.d.ts +0 -261
  42. package/dist/components/action-menu/action-menu.stories.d.ts.map +0 -1
  43. package/dist/components/action-menu/action-menu.stories.js +0 -363
  44. package/dist/components/action-menu/action-menu.stories.js.map +0 -1
  45. package/dist/components/data-table/data-table.stories.d.ts +0 -507
  46. package/dist/components/data-table/data-table.stories.d.ts.map +0 -1
  47. package/dist/components/data-table/data-table.stories.js +0 -601
  48. package/dist/components/data-table/data-table.stories.js.map +0 -1
  49. package/dist/components/th-card/index.d.ts +0 -3
  50. package/dist/components/th-card/index.d.ts.map +0 -1
  51. package/dist/components/th-card/index.js +0 -2
  52. package/dist/components/th-card/index.js.map +0 -1
  53. package/dist/components/th-card/th-card.d.ts +0 -78
  54. package/dist/components/th-card/th-card.d.ts.map +0 -1
  55. package/dist/components/th-card/th-card.js +0 -449
  56. package/dist/components/th-card/th-card.js.map +0 -1
  57. package/dist/components/th-card/th-card.stories.d.ts +0 -232
  58. package/dist/components/th-card/th-card.stories.d.ts.map +0 -1
  59. package/dist/components/th-card/th-card.stories.js +0 -385
  60. package/dist/components/th-card/th-card.stories.js.map +0 -1
  61. package/dist/components/th-tag/index.d.ts +0 -3
  62. package/dist/components/th-tag/index.d.ts.map +0 -1
  63. package/dist/components/th-tag/index.js +0 -2
  64. package/dist/components/th-tag/index.js.map +0 -1
  65. package/dist/components/th-tag/th-tag.d.ts +0 -65
  66. package/dist/components/th-tag/th-tag.d.ts.map +0 -1
  67. package/dist/components/th-tag/th-tag.js +0 -307
  68. package/dist/components/th-tag/th-tag.js.map +0 -1
  69. package/dist/components/th-tag/th-tag.stories.d.ts +0 -277
  70. package/dist/components/th-tag/th-tag.stories.d.ts.map +0 -1
  71. package/dist/components/th-tag/th-tag.stories.js +0 -415
  72. package/dist/components/th-tag/th-tag.stories.js.map +0 -1
  73. package/dist/components/toggle-switch/toggle-switch.stories.d.ts +0 -239
  74. package/dist/components/toggle-switch/toggle-switch.stories.d.ts.map +0 -1
  75. package/dist/components/toggle-switch/toggle-switch.stories.js +0 -408
  76. package/dist/components/toggle-switch/toggle-switch.stories.js.map +0 -1
  77. package/dist/data-table.d.ts +0 -191
  78. package/dist/data-table.d.ts.map +0 -1
  79. package/dist/data-table.js +0 -796
  80. package/dist/data-table.js.map +0 -1
  81. package/dist/design-system/color-palette.stories.d.ts +0 -24
  82. package/dist/design-system/color-palette.stories.d.ts.map +0 -1
  83. package/dist/design-system/color-palette.stories.js +0 -361
  84. package/dist/design-system/color-palette.stories.js.map +0 -1
  85. package/dist/index.html +0 -102
  86. package/dist/toggle-switch.d.ts +0 -38
  87. package/dist/toggle-switch.d.ts.map +0 -1
  88. package/dist/toggle-switch.js +0 -175
  89. package/dist/toggle-switch.js.map +0 -1
package/README.md CHANGED
@@ -94,16 +94,20 @@ npm run build-storybook
94
94
  ```
95
95
  trailhand-ui/
96
96
  ├── src/
97
- │ ├── components/ # Web components (TypeScript)
98
- │ │ ├── toggle-switch/
99
- │ │ ├── data-table/
100
- │ │ └── action-menu/
101
- │ ├── design-system/ # Design system stories
97
+ │ ├── components/ # Components
98
+ │ │ ├── button/ # Component folder
99
+ │ │ ├── button.ts # Web component
100
+ │ │ │ ├── index.ts # Export file
101
+ │ │ ├── button.stories.ts # Storybook for documentation and testing
102
+ │ │ │ └── button.test.ts # Unit tests
103
+ │ │ └── more components/
104
+ │ ├── design-system/ # Design system stories
102
105
  │ └── styles/
103
- │ └── colors.css # Global color variables
104
- ├── stories/ # Additional Storybook stories
105
- ├── .storybook/ # Storybook configuration
106
- ├── dist/ # Compiled output
106
+ │ └── colors.css # Global color variables
107
+ ├── dev/ # Playground application for development
108
+ ├── stories/ # Additional Storybook stories
109
+ ├── .storybook/ # Storybook configuration
110
+ ├── dist/ # Compiled output
107
111
  └── package.json
108
112
  ```
109
113
 
@@ -128,8 +132,8 @@ A sortable, paginated data table with search and custom actions.
128
132
 
129
133
  ```html
130
134
  <data-table
131
- .columns=${columns}
132
- .data=${data}
135
+ .columns="${columns}"
136
+ .data="${data}"
133
137
  searchable
134
138
  paginated
135
139
  ></data-table>
@@ -148,6 +152,92 @@ A dropdown menu for row-level actions in tables.
148
152
  ></action-menu>
149
153
  ```
150
154
 
155
+ ### Button
156
+
157
+ A simple button with different variations to handle click events.
158
+
159
+ ```html
160
+ <trailhand-button @click="${handleClick}" variant="primary" size="large">
161
+ <trailhand-icon name="globe" slot="icon-left"></trailhand-icon>
162
+ Primary
163
+ <trailhand-icon name="globe" slot="icon-right"></trailhand-icon>
164
+ </trailhand-button>
165
+ ```
166
+
167
+ ## Testing
168
+
169
+ This component library will serve as the foundation for future projects, thus it is important to ensure that these components are well tested. Thankfully, Storybook provides many useful tools to test the components using various methods.
170
+
171
+ ### Render Tests
172
+
173
+ Render tests (smoke tests), as one might expect, simply tes that the component renders as desired. These tests serve to find any errors that would cause the component to fail on render. Storybook turns each story into a render test. By adding stories to represent the various states of a component, you can confirm that the component will render in that state.
174
+
175
+ ### Interaction Tests
176
+
177
+ After confirming that a component renders properly, you would likely next want to test that it behaves properly. These interaction tests can be written by adding a new story for the interaction you are testing, and then using the "play" method provided by Storybook to simulate user interactions and make assumptions against expected results.
178
+
179
+ ### Accessibility Tests
180
+
181
+ Storybook also provides addons to check components against accessibility rules. This ensures components meet certain standards. The configuration for which rules are applied as well as the result of not meeting said rules can be set in .storybook/preview.js. These properties can also be set at the Component and Story levels in case secific rulesets need to be applied or removed.
182
+
183
+ ### Visual Tests
184
+
185
+ Visual tests compare snapshots taken of components to catch unexpected visual changes. The Storybook developers provide a platform to run and manage these tests called Chromatic.
186
+
187
+ ### Unit Tests
188
+
189
+ The testing methods listed above are great for ensuring user-visible behavior. However, there may be things that need to be tested that are not captured in the methods above, and for that we can use Vitest unit tests. Storybook can confirm visible outcomes, however, to truly test the buisness logic in the component or in associated helpers unit tests are required.
190
+
191
+ ### Running the tests
192
+
193
+ Tests can be executed via the Storybook UI or in the command line.
194
+
195
+ #### Via Storybook
196
+
197
+ To run tests via the Storybook UI, first run
198
+
199
+ ```bash
200
+ npm run storybook
201
+ ```
202
+
203
+ In the bottom left hand corner of the UI, you can open a menu to run tests and view test results.
204
+
205
+ ![Storybook Testing Menu](/docs/images/image.png)
206
+
207
+ You can also view test results for specific stories in the playground for that story.
208
+
209
+ ![Interaction Test](/docs/images/image-1.png)
210
+
211
+ ![Visual Tests](/docs/images/image-2.png)
212
+
213
+ ![Accessibility Test](/docs/images/image-3.png)
214
+
215
+ #### Via the command line
216
+
217
+ To run render, interaction and accessibility tests via the command line run the following command
218
+
219
+ ```bash
220
+ npm run test:storybook
221
+ ```
222
+
223
+ To run unit tests via the command line run the following command
224
+
225
+ ```bash
226
+ npm run test:unit
227
+ ```
228
+
229
+ To run both storybook and unit tests via the command line run the following command
230
+
231
+ ```bash
232
+ npm run test
233
+ ```
234
+
235
+ To run visual tests via the command line ensure CHROMATIC_PROJECT_TOKEN is added to your env and then run the following command
236
+
237
+ ```bash
238
+ npm run chromatic
239
+ ```
240
+
151
241
  ## Tech Stack
152
242
 
153
243
  - **Lit Element** 3.x - Web component library
@@ -162,6 +252,7 @@ A dropdown menu for row-level actions in tables.
162
252
  This library uses **Lit Element** for building fast, lightweight web components. Web components are framework-agnostic and work with any JavaScript framework or vanilla JS.
163
253
 
164
254
  ### Benefits
255
+
165
256
  - Framework agnostic
166
257
  - Encapsulated styles and functionality
167
258
  - Reusable across projects
@@ -0,0 +1,20 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ export interface ButtonProps {
3
+ variant: 'primary' | 'secondary' | 'alternate' | 'destructive' | 'confirmation';
4
+ size: 'small' | 'medium' | 'large';
5
+ disabled: boolean;
6
+ type: 'button' | 'submit' | 'reset';
7
+ name: string;
8
+ }
9
+ export declare class Button extends LitElement {
10
+ variant: 'primary' | 'secondary' | 'alternate' | 'destructive' | 'confirmation';
11
+ size: 'small' | 'medium' | 'large';
12
+ name: string;
13
+ disabled: boolean;
14
+ type: 'button' | 'submit' | 'reset';
15
+ static styles: import("lit").CSSResult;
16
+ updated(): void;
17
+ private handleClick;
18
+ render(): TemplateResult;
19
+ }
20
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D,MAAM,WAAW,WAAW;IAC1B,OAAO,EACH,SAAS,GACT,WAAW,GACX,WAAW,GACX,aAAa,GACb,cAAc,CAAC;IACnB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,MAAO,SAAQ,UAAU;IAEpC,OAAO,EACH,SAAS,GACT,WAAW,GACX,WAAW,GACX,aAAa,GACb,cAAc,CAAa;IAG/B,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAY;IAG9C,IAAI,SAAM;IAGV,QAAQ,UAAS;IAGjB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAE/C,OAAgB,MAAM,0BAwGpB;IAEF,OAAO;IAQP,OAAO,CAAC,WAAW;IAmBV,MAAM,IAAI,cAAc;CA0BlC"}
@@ -0,0 +1,189 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, css } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import { styleMap } from 'lit/directives/style-map.js';
10
+ export class Button extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.variant = 'primary';
14
+ this.size = 'medium';
15
+ this.name = '';
16
+ this.disabled = false;
17
+ this.type = 'button';
18
+ }
19
+ updated() {
20
+ if (this.disabled) {
21
+ this.setAttribute('aria-disabled', 'true');
22
+ }
23
+ else {
24
+ this.removeAttribute('aria-disabled');
25
+ }
26
+ }
27
+ handleClick(e) {
28
+ if (this.disabled) {
29
+ e.preventDefault();
30
+ e.stopPropagation();
31
+ return;
32
+ }
33
+ this.dispatchEvent(new CustomEvent('button-click', {
34
+ bubbles: true,
35
+ composed: true,
36
+ detail: {
37
+ name: this.name,
38
+ originalEvent: e,
39
+ },
40
+ }));
41
+ }
42
+ render() {
43
+ const styles = {};
44
+ return html `
45
+ <button
46
+ type=${this.type}
47
+ class="trailhand-button trailhand-button--${this
48
+ .variant} trailhand-button--${this.size}"
49
+ style=${styleMap(styles)}
50
+ ?disabled=${this.disabled}
51
+ @click=${this.handleClick}
52
+ >
53
+ <span class="icon left">
54
+ <slot name="icon-left"></slot>
55
+ </span>
56
+
57
+ <span class="label">
58
+ <slot></slot>
59
+ </span>
60
+
61
+ <span class="icon right">
62
+ <slot name="icon-right"></slot>
63
+ </span>
64
+ </button>
65
+ `;
66
+ }
67
+ }
68
+ Button.styles = css `
69
+ :host {
70
+ display: inline-block;
71
+ }
72
+
73
+ .trailhand-button {
74
+ font-family: 'Montserrat', system-ui, sans-serif;
75
+ font-weight: 600;
76
+ border: 0;
77
+ border-radius: 8px;
78
+ cursor: pointer;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ gap: 8px;
83
+ line-height: 1;
84
+ width: 100%;
85
+ }
86
+
87
+ .trailhand-button:disabled {
88
+ cursor: not-allowed;
89
+ background-color: var(--button-disabled-bg, #e0e0e0);
90
+ color: var(--button-disabled-color, #a8a8a8);
91
+ border: none;
92
+ }
93
+
94
+ .trailhand-button--primary {
95
+ color: var(--button-primary-color, #fff);
96
+ background-color: var(--button-primary-bg, #005cb9);
97
+ }
98
+
99
+ .trailhand-button--primary:not(:disabled):hover {
100
+ background-color: var(--button-primary-bg-hover, #00478e);
101
+ }
102
+
103
+ .trailhand-button--secondary {
104
+ color: var(--button-secondary-color, #005cb9);
105
+ background-color: var(--button-secondary-bg, #ffffff);
106
+ border: 1px solid var(--button-secondary-border, #005cb9);
107
+ }
108
+
109
+ .trailhand-button--secondary:not(:disabled):hover {
110
+ background-color: var(--button-secondary-bg-hover, #f5faff);
111
+ }
112
+
113
+ .trailhand-button--alternate {
114
+ color: var(--button-alternate-color, #ffffff);
115
+ background-color: var(--button-alternate-bg, #3492f1);
116
+ }
117
+
118
+ .trailhand-button--alternate:not(:disabled):hover {
119
+ background-color: var(--button-alternate-bg-hover, #156ec8);
120
+ }
121
+
122
+ .trailhand-button--destructive {
123
+ color: var(--button-destructive-color, #fff);
124
+ background-color: var(--button-destructive-bg, #9f3a3a);
125
+ }
126
+
127
+ .trailhand-button--destructive:not(:disabled):hover {
128
+ background-color: var(--button-destructive-bg-hover, #731616);
129
+ }
130
+
131
+ .trailhand-button--confirmation {
132
+ color: var(--button-confirmation-color, #fff);
133
+ background-color: var(--button-confirmation-bg, #30ac66);
134
+ }
135
+
136
+ .trailhand-button--confirmation:not(:disabled):hover {
137
+ background-color: var(--button-confirmation-bg-hover, #0f8240);
138
+ }
139
+
140
+ .trailhand-button--small {
141
+ font-size: 11px;
142
+ padding: 12px 8px;
143
+ }
144
+
145
+ .trailhand-button--medium {
146
+ font-size: 12px;
147
+ padding: 12px 16px;
148
+ }
149
+
150
+ .trailhand-button--large {
151
+ font-size: 14px;
152
+ padding: 16px 32px;
153
+ }
154
+
155
+ .icon {
156
+ display: inline-flex;
157
+ align-items: center;
158
+ }
159
+
160
+ .icon.left {
161
+ margin-right: 0.25rem;
162
+ }
163
+
164
+ .icon.right {
165
+ margin-left: 0.25rem;
166
+ }
167
+
168
+ .label {
169
+ display: inline-flex;
170
+ align-items: center;
171
+ }
172
+ `;
173
+ __decorate([
174
+ property({ type: String })
175
+ ], Button.prototype, "variant", void 0);
176
+ __decorate([
177
+ property({ type: String })
178
+ ], Button.prototype, "size", void 0);
179
+ __decorate([
180
+ property({ type: String })
181
+ ], Button.prototype, "name", void 0);
182
+ __decorate([
183
+ property({ type: Boolean, reflect: true })
184
+ ], Button.prototype, "disabled", void 0);
185
+ __decorate([
186
+ property({ type: String })
187
+ ], Button.prototype, "type", void 0);
188
+ customElements.define('trailhand-button', Button);
189
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAevD,MAAM,OAAO,MAAO,SAAQ,UAAU;IAAtC;;QAEE,YAAO,GAKc,SAAS,CAAC;QAG/B,SAAI,GAAiC,QAAQ,CAAC;QAG9C,SAAI,GAAG,EAAE,CAAC;QAGV,aAAQ,GAAG,KAAK,CAAC;QAGjB,SAAI,GAAkC,QAAQ,CAAC;IAiKjD,CAAC;IArDC,OAAO;QACL,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,CAAQ;QAC1B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,cAAc,EAAE;YAC9B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,aAAa,EAAE,CAAC;aACjB;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,OAAO,IAAI,CAAA;;eAEA,IAAI,CAAC,IAAI;oDAC4B,IAAI;aAC7C,OAAO,sBAAsB,IAAI,CAAC,IAAI;gBACjC,QAAQ,CAAC,MAAM,CAAC;oBACZ,IAAI,CAAC,QAAQ;iBAChB,IAAI,CAAC,WAAW;;;;;;;;;;;;;;KAc5B,CAAC;IACJ,CAAC;;AA9Je,aAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwG3B,AAxGqB,CAwGpB;AA3HF;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAMI;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACjB;AAGV;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAC1B;AAGjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCACoB;AAmKjD,cAAc,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Button } from './button';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Button } from './button';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { LitElement } from 'lit';
2
+ declare const iconMap: {
3
+ globe: import("@fortawesome/fontawesome-common-types").IconDefinition;
4
+ home: import("@fortawesome/fontawesome-common-types").IconDefinition;
5
+ user: import("@fortawesome/fontawesome-common-types").IconDefinition;
6
+ };
7
+ export declare const availableIcons: (keyof typeof iconMap)[];
8
+ type AvailableIcons = keyof typeof iconMap;
9
+ export interface IconProps {
10
+ name: AvailableIcons;
11
+ }
12
+ export declare class Icon extends LitElement {
13
+ name: AvailableIcons;
14
+ static styles: import("lit").CSSResult;
15
+ render(): import("lit-html").TemplateResult<1> | null;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,QAAA,MAAM,OAAO;;;;CAIZ,CAAC;AAEF,eAAO,MAAM,cAAc,EAA2B,CAAC,MAAM,OAAO,OAAO,CAAC,EAAE,CAAC;AAI/E,KAAK,cAAc,GAAG,MAAM,OAAO,OAAO,CAAC;AAE3C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,qBAAa,IAAK,SAAQ,UAAU;IACN,IAAI,EAAE,cAAc,CAAU;IAE1D,MAAM,CAAC,MAAM,0BAWX;IAEF,MAAM;CAIP"}
@@ -0,0 +1,44 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, css } from 'lit';
8
+ import { property } from 'lit/decorators.js';
9
+ import { library, icon } from '@fortawesome/fontawesome-svg-core';
10
+ import { faGlobe, faHome, faUser } from '@fortawesome/free-solid-svg-icons';
11
+ const iconMap = {
12
+ globe: faGlobe,
13
+ home: faHome,
14
+ user: faUser,
15
+ };
16
+ export const availableIcons = Object.keys(iconMap);
17
+ library.add(...Object.values(iconMap));
18
+ export class Icon extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.name = 'user';
22
+ }
23
+ render() {
24
+ const faIcon = icon({ prefix: 'fas', iconName: this.name });
25
+ return faIcon ? html `${faIcon.node[0]}` : null;
26
+ }
27
+ }
28
+ Icon.styles = css `
29
+ :host {
30
+ display: inline-flex;
31
+ width: 1em;
32
+ height: 1em;
33
+ }
34
+ svg {
35
+ width: 100%;
36
+ height: 100%;
37
+ fill: currentColor;
38
+ }
39
+ `;
40
+ __decorate([
41
+ property({ type: String })
42
+ ], Icon.prototype, "name", void 0);
43
+ customElements.define('trailhand-icon', Icon);
44
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/icon/icon.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAA6B,CAAC;AAE/E,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAQvC,MAAM,OAAO,IAAK,SAAQ,UAAU;IAApC;;QAC8B,SAAI,GAAmB,MAAM,CAAC;IAmB5D,CAAC;IAJC,MAAM;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;;AAhBM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;GAWlB,AAXY,CAWX;AAb0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kCAA+B;AAqB5D,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Icon } from './icon';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Icon } from './icon';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './components/toggle-switch';
2
2
  export * from './components/action-menu';
3
3
  export * from './components/data-table';
4
+ export * from './components/button';
5
+ export * from './components/icon';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -2,4 +2,6 @@
2
2
  export * from './components/toggle-switch';
3
3
  export * from './components/action-menu';
4
4
  export * from './components/data-table';
5
+ export * from './components/button';
6
+ export * from './components/icon';
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * TrailHand UI Global Color Variables
3
+ * Based on Figma Design System Color Palette
4
+ *
5
+ * Usage: Import this file in your application root, then use CSS variables
6
+ * Example: color: var(--color-primary);
7
+ */
8
+
9
+ :root {
10
+ /* Color Palette */
11
+ /* Primary Blues */
12
+ --color-primary: #3d98d3; /* Primary brand color */
13
+ --color-light-primary: #e6f3ff; /* Light variant for backgrounds */
14
+ --color-dark-primary: #005cb9; /* Dark variant for buttons/links */
15
+
16
+ /* Black + White */
17
+ --color-black: #000000;
18
+ --color-white: #ffffff;
19
+
20
+ /* Greyscale */
21
+ --color-grey-100: #fafafa;
22
+ --color-grey-200: #ebebeb;
23
+ --color-grey-300: #d7d7d7;
24
+ --color-grey-400: #bababa;
25
+ --color-grey-500: #8d8d8d;
26
+ --color-grey-600: #636363;
27
+ --color-grey-700: #303131;
28
+ --color-grey-800: #212121;
29
+
30
+ /* Status Colors */
31
+ --color-light-red: #fee2e2;
32
+ --color-red: #9f3a3a;
33
+ --color-dark-red: #731616;
34
+
35
+ --color-light-green: #d2fdd2;
36
+ --color-green: #30ac66;
37
+ --color-dark-green: #0f8240;
38
+
39
+ --color-light-yellow: #fffeb4;
40
+ --color-yellow: #d3c255;
41
+ --color-dark-yellow: #a89939;
42
+
43
+ --color-light-blue: #e6f3ff;
44
+ --color-blue: #0085ff;
45
+ --color-dark-blue: #005cb9;
46
+
47
+ /* Semantic Aliases - for common use cases */
48
+ /* Text */
49
+ --color-text-primary: var(--color-grey-800);
50
+ --color-text-secondary: var(--color-grey-600);
51
+ --color-text-muted: var(--color-grey-500);
52
+ --color-text-inverse: var(--color-white);
53
+
54
+ /* Backgrounds */
55
+ --color-background: var(--color-white);
56
+ --color-background-muted: var(--color-grey-100);
57
+ --color-background-hover: var(--color-grey-200);
58
+
59
+ /* Borders */
60
+ --color-border: var(--color-grey-300);
61
+ --color-border-light: var(--color-grey-200);
62
+
63
+ --color-error-outline: var(--color-red);
64
+ --color-success-outline: var(--color-green);
65
+ --color-warning-outline: var(--color-yellow);
66
+ --color-info-outline: var(--color-blue);
67
+
68
+ --color-error-fill: var(--color-light-red);
69
+ --color-success-fill: var(--color-light-green);
70
+ --color-warning-fill: var(--color-light-yellow);
71
+ --color-info-fill: var(--color-light-blue);
72
+
73
+ /* Component-specific variables (mapped to palette) */
74
+ /* Links */
75
+ --color-link: var(--color-primary);
76
+ --color-link-hover: var(--color-primary);
77
+ /* Buttons */
78
+ --button-disabled-bg: var(--color-grey-200);
79
+ --button-disabled-color: var(--color-grey-500);
80
+
81
+ --button-primary-bg: var(--color-primary);
82
+ --button-primary-bg-hover: var(--color-dark-primary);
83
+ --button-primary-color: var(--color-white);
84
+
85
+ --button-secondary-bg: var(--color-white);
86
+ --button-secondary-bg-hover: var(--color-light-primary);
87
+ --button-secondary-color: var(--color-primary);
88
+ --button-secondary-border: var(--color-primary);
89
+
90
+ --button-alternate-bg: var(--color-blue);
91
+ --button-alternate-bg-hover: var(--color-dark-blue);
92
+ --button-alternate-color: var(--color-white);
93
+
94
+ --button-destructive-bg: var(--color-red);
95
+ --button-destructive-bg-hover: var(--color-dark-red);
96
+ --button-destructive-color: var(--color-white);
97
+
98
+ --button-confirmation-bg: var(--color-green);
99
+ --button-confirmation-bg-hover: var(--color-dark-green);
100
+ --button-confirmation-color: var(--color-white);
101
+
102
+ /* Shadow colors using opacity */
103
+ --color-shadow: rgba(0, 0, 0, 0.1);
104
+ --color-shadow-medium: rgba(0, 0, 0, 0.15);
105
+ }
106
+
107
+ /* Dark Theme Overrides */
108
+ [data-theme='dark'] {
109
+ /* Text */
110
+ --color-text-primary: var(--color-grey-100);
111
+ --color-text-secondary: var(--color-grey-300);
112
+ --color-text-muted: var(--color-grey-500);
113
+
114
+ /* Backgrounds */
115
+ --color-background: var(--color-grey-800);
116
+ --color-background-muted: var(--color-grey-700);
117
+ --color-background-hover: var(--color-grey-600);
118
+
119
+ /* Borders */
120
+ --color-border: var(--color-grey-700);
121
+
122
+ /* Buttons */
123
+ --button-primary-bg: var(--color-dark-primary);
124
+ --button-primary-bg-hover: var(--color-primary);
125
+
126
+ --button-secondary-bg: var(--color-grey-800);
127
+ --button-secondary-bg-hover: var(--color-grey-700);
128
+ --button-secondary-color: var(--color-primary);
129
+
130
+ --button-disabled-bg: var(--color-grey-700);
131
+ --button-disabled-color: var(--color-grey-500);
132
+ }