@redvars/peacock 3.0.1 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.css.js +3 -3
  2. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.css.js.map +1 -1
  3. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.d.ts +0 -6
  4. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.js +0 -6
  5. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.js.map +1 -1
  6. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/p-avatar.d.ts +10 -0
  7. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/p-avatar.js +17 -0
  8. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/p-avatar.js.map +1 -0
  9. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.css.d.ts +1 -0
  10. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.css.js +33 -0
  11. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.css.js.map +1 -0
  12. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.d.ts +9 -0
  13. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.js +37 -0
  14. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.js.map +1 -0
  15. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/index.d.ts +1 -0
  16. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/index.js +2 -0
  17. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/index.js.map +1 -0
  18. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/p-badge.d.ts +8 -0
  19. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/p-badge.js +15 -0
  20. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/p-badge.js.map +1 -0
  21. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.d.ts +0 -6
  22. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.js +0 -7
  23. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.js.map +1 -1
  24. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/p-icon.d.ts +8 -1
  25. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/p-icon.js +11 -4
  26. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/p-icon.js.map +1 -1
  27. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.d.ts +3 -2
  28. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.js +3 -2
  29. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.js.map +1 -1
  30. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/index.d.ts +1 -0
  31. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/index.js +2 -0
  32. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/index.js.map +1 -0
  33. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.css.d.ts +2 -0
  34. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.css.js +36 -0
  35. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.css.js.map +1 -0
  36. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.d.ts +12 -0
  37. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.js +18 -0
  38. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/link/link.js.map +1 -0
  39. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/peacock-loader.js +31 -2
  40. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/peacock-loader.js.map +1 -1
  41. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/styleMixins.css.d.ts +9 -0
  42. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/styleMixins.css.js +46 -0
  43. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/styleMixins.css.js.map +1 -0
  44. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/text/text.css.d.ts +2 -0
  45. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/text/text.css.js +70 -0
  46. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/text/text.css.js.map +1 -0
  47. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.d.ts +0 -1
  48. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.js +0 -7
  49. package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.js.map +1 -1
  50. package/.rollup.cache/E/git/redvars/peacock/components/dist/tsconfig.tsbuildinfo +1 -1
  51. package/{demo → assets}/tokens.css +60 -48
  52. package/copyDesignFiles.js +11 -0
  53. package/custom-elements-manifest.config.mjs +10 -22
  54. package/custom-elements.md +61 -137
  55. package/demo/index.html +21 -8
  56. package/demo/int.html +1 -1
  57. package/dist/assets/styles/tokens.css +522 -0
  58. package/dist/{icon-1wpxQtrZ.js → avatar-GQwWRGRw.js} +94 -17
  59. package/dist/avatar-GQwWRGRw.js.map +1 -0
  60. package/dist/avatar-jfcIDB8G.js +424 -0
  61. package/dist/avatar-jfcIDB8G.js.map +1 -0
  62. package/dist/component/avatar.js +12 -8
  63. package/dist/component/avatar.js.map +1 -1
  64. package/dist/component/{Icon.js → icon.js} +96 -9
  65. package/dist/component/icon.js.map +1 -0
  66. package/dist/directive-CKEA2P55.js +70 -0
  67. package/dist/directive-CKEA2P55.js.map +1 -0
  68. package/dist/index.js +40 -61
  69. package/dist/index.js.map +1 -1
  70. package/dist/peacock-loader.js +132 -3
  71. package/dist/peacock-loader.js.map +1 -1
  72. package/dist/src/avatar/avatar.d.ts +0 -6
  73. package/dist/src/avatar/p-avatar.d.ts +10 -0
  74. package/dist/src/badge/badge.css.d.ts +1 -0
  75. package/dist/src/badge/badge.d.ts +9 -0
  76. package/dist/src/badge/index.d.ts +1 -0
  77. package/dist/src/badge/p-badge.d.ts +8 -0
  78. package/dist/src/icon/icon.d.ts +0 -6
  79. package/dist/src/icon/p-icon.d.ts +8 -1
  80. package/dist/src/index.d.ts +3 -2
  81. package/dist/src/link/link.css.d.ts +2 -0
  82. package/dist/src/styleMixins.css.d.ts +9 -0
  83. package/dist/src/text/text.css.d.ts +2 -0
  84. package/dist/src/utils.d.ts +0 -1
  85. package/dist/tsconfig.tsbuildinfo +1 -1
  86. package/dist/web-types.json +78 -0
  87. package/package.json +19 -7
  88. package/readme-gen.mjs +15 -2
  89. package/readme.md +190 -0
  90. package/rollup.config.js +14 -1
  91. package/src/avatar/avatar.css.ts +2 -2
  92. package/src/avatar/avatar.ts +0 -6
  93. package/src/avatar/demo/index.html +2 -2
  94. package/src/avatar/p-avatar.ts +12 -0
  95. package/src/badge/badge.css.ts +33 -0
  96. package/src/badge/badge.ts +29 -0
  97. package/src/badge/demo/index.html +54 -0
  98. package/src/badge/index.ts +1 -0
  99. package/src/badge/p-badge.ts +10 -0
  100. package/src/icon/demo/index.html +4 -4
  101. package/src/icon/icon.ts +1 -7
  102. package/src/icon/p-icon.ts +8 -1
  103. package/src/index.ts +3 -2
  104. package/src/link/link.css.ts +36 -0
  105. package/src/peacock-loader.ts +40 -2
  106. package/src/styleMixins.css.ts +55 -0
  107. package/src/styles.d.ts +11 -0
  108. package/src/text/text.css.ts +76 -0
  109. package/src/utils.ts +0 -8
  110. package/tsconfig.json +1 -1
  111. package/README.md +0 -46
  112. package/dist/component/Icon.js.map +0 -1
  113. package/dist/icon-1wpxQtrZ.js.map +0 -1
  114. package/dist/src/peacock-loader.js +0 -16
  115. package/dist/src/peacock-loader.js.map +0 -1
package/readme.md ADDED
@@ -0,0 +1,190 @@
1
+ # Peacock
2
+ **The foundation for beautiful user interfaces.**
3
+
4
+ [![Build](https://github.com/redvars/peacock/workflows/Build/badge.svg)](https://github.com/goatui/components/actions?workflow=Build)
5
+ [![GitHub license](https://img.shields.io/github/license/redvars/peacock.svg)](/LICENSE)
6
+ ![Version](https://img.shields.io/npm/v/%40redvars%2Fpeacock)
7
+
8
+
9
+ <div align="center">
10
+ <img alt="Peacock LOGO" src="./logo.png" width="210">
11
+ </div>
12
+
13
+ Peacock gives you the tools and foundation to build beautiful, usable product interfaces. It’s the system you use to craft your own component library.
14
+
15
+ ## What is Peacock?
16
+ Peacock is more than just a collection of components; it is an aesthetic philosophy. Like its avian namesake, it provides the core elements (the primitives) that allow the full, vibrant display (the design) to be unveiled.
17
+
18
+ **Opinionated Beauty:** We deliver pre-styled, beautiful components that follow modern design trends, significantly reducing the boilerplate needed to achieve a professional look.
19
+
20
+ **Foundation First:** Similar to projects like `shadcn/ui`, Peacock focuses on providing the foundational primitives, ensuring maximum flexibility for customization without sacrificing initial polish.
21
+
22
+ **Seamless Integration:** Designed with modern web frameworks in mind (e.g., React, Vue), integrating Peacock into your existing project structure is fast, efficient, and empowering.
23
+
24
+ ## Key Features
25
+ Vibrant & Consistent Design System: Every component—from buttons and cards to complex data tables—shares a cohesive, high-quality visual language.
26
+
27
+ **Highly Extensible:** The component structure is designed for easy overwriting and theme customization, allowing you to quickly adapt the style to your specific brand identity.
28
+
29
+ **Built for Accessibility:** Focus on semantic HTML and proper ARIA attributes to ensure that your beautiful interfaces are accessible to all users.
30
+
31
+ **Responsive by Default:** Components are built with responsiveness baked in, guaranteeing a graceful display across all screen sizes and devices.
32
+
33
+ ## Documentation
34
+ Visit [https://peacock.redvars.com](https://goatui.com) to view the documentation.
35
+
36
+ ## Getting Started
37
+
38
+
39
+ ```html
40
+ <!doctype html>
41
+ <html lang='en'>
42
+ <head>
43
+ <meta charset='utf-8' />
44
+ <meta name='viewport' content='width=device-width' />
45
+ <title>Goat UI Component</title>
46
+
47
+ <link href="https://cdn.jsdelivr.net/npm/@redvars/components@3.1.0/dist/assets/styles/tokens.css" rel='stylesheet' />
48
+
49
+ <script type='module'
50
+ src='https://cdn.jsdelivr.net/npm/@redvars/components@3.1.0/dist/peacock-loader.js'></script>
51
+
52
+ <!-- Default font : Noto Sans and Noto Sans Mono -->
53
+ <link rel="preconnect" href="https://fonts.googleapis.com">
54
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
55
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
56
+
57
+
58
+ </head>
59
+ <body>
60
+ <p-avatar name="Shivaji Varma"></p-icon>
61
+
62
+ </body>
63
+ </html>
64
+ ```
65
+
66
+ # Components
67
+
68
+ - 🟢 ready (feature complete for now)
69
+ - 🟡 beta (changes possible, not feature complete)
70
+ - 🔴 not ready (unstyled / no functions)
71
+ - 🔵 planned (created, but empty files)
72
+
73
+ ## Input Controls
74
+
75
+ Input controls are UI design elements that allow users to input information into the system. They are essential for
76
+ collecting data and enabling user interactions. Some common examples of input controls include text fields, dropdown
77
+ menus, checkboxes, and radio buttons.
78
+
79
+ | Name | Component | State |
80
+ |------------------------------------------------------------|----------------------|-------|
81
+ | [Code editor](https://peacock.redvars.com/components/code-editor) | p-card-editor | 🟢 |
82
+ | Color picker | p-color-picker | 🔴 |
83
+ | [Checkbox](https://peacock.redvars.com/components/checkbox) | p-checkbox | 🟢 |
84
+ | [Date picker](https://peacock.redvars.com/components/date-picker) | p-date-picker | 🟡 |
85
+ | Date Time picker | p-datetime-picker | 🔴 |
86
+ | [Form control](https://peacock.redvars.com/components/form-control) | p-form-control | 🟡 |
87
+ | File picker | p-file-picker | 🔴 |
88
+ | [HTML editor](https://peacock.redvars.com/components/html-editor) | p-html-editor | 🟢 |
89
+ | [Input](https://peacock.redvars.com/components/input) | p-input | 🟢 |
90
+ | [Input URL](https://peacock.redvars.com/components/input-url) | p-input-url | 🟢 |
91
+ | Month picker | p-month-picker | 🔴 |
92
+ | [Number](https://peacock.redvars.com/components/number) | p-number | 🟢 |
93
+ | [Select](https://peacock.redvars.com/components/select) | p-select | 🟢 |
94
+ | [Textarea](https://peacock.redvars.com/components/textarea) | p-textarea | 🟢 |
95
+ | [Time picker](https://peacock.redvars.com/components/time-picker) | p-time-picker | 🟡 |
96
+ | [URL input](https://peacock.redvars.com/components/url-input) | p-url-input. | 🔴 |
97
+ | Week picker | p-week-picker | 🔴 |
98
+
99
+ ## Navigation
100
+
101
+ Navigational components are UI elements that help users move around the app or website. They provide users with a clear
102
+ and intuitive way to navigate through different sections and pages. Some common examples of navigational components
103
+ include menus, tabs, and breadcrumbs.
104
+
105
+ | Name | Component | State |
106
+ |--------------------------------------------------------|-----------------|-------|
107
+ | [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | p-breadcrumb | 🟢 |
108
+ | [Dropdown](https://peacock.redvars.com/components/dropdown) | p-dropdown | 🟡 |
109
+ | [Menu](https://peacock.redvars.com/components/menu) | p-menu | 🟡 |
110
+ | [Tabs](https://peacock.redvars.com/components/tabs) | p-tabs | 🟢 |
111
+
112
+ ## Informational
113
+
114
+ Informational components are UI elements that provide information to users. They communicate important messages,
115
+ updates, or instructions within the app or website. Some common examples of informational components include
116
+ notifications, tooltips, and progress bars.
117
+
118
+ | Name | Component | State |
119
+ |----------------------------------------------------------------------------------|---------------------------|-------|
120
+ | [Badge](https://peacock.redvars.com/components/badge) | p-badge | 🟢 |
121
+ | [Progress](https://peacock.redvars.com/components/progress) | p-progress | 🟢 |
122
+ | [Spinner](https://peacock.redvars.com/components/spinner) | p-spinner | 🟢 |
123
+ | [Tooltip](https://peacock.redvars.com/components/tooltip) | p-tooltip | 🟢 |
124
+ | [Notification](https://peacock.redvars.com/components/notification) | p-notification | 🟢 |
125
+ | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | p-notification-manager | 🟢 |
126
+
127
+
128
+ ## Containers
129
+
130
+ Containers are UI elements that group similar content together, making it easier for users to navigate and scan through
131
+ the interface. Examples of common containers include cards, carousels, and accordions, which provide structure and
132
+ organization to the content.
133
+
134
+ | Name | Component | State |
135
+ |------------------------------------------------------|----------------|-------|
136
+ | [Accordion](https://peacock.redvars.com/components/accordion) | p-accordion | 🟢 |
137
+ | Card | p-card | 🟡 |
138
+
139
+ ## General
140
+
141
+ These components are used for general purpose. They include
142
+
143
+ | Name | Component | State |
144
+ |----------------------------------------------------------------------------|---------------------------|-------|
145
+ | [Avatar](https://peacock.redvars.com/components/avatar) | p-avatar | 🟢 |
146
+ | [Button](https://peacock.redvars.com/components/button) | p-button | 🟢 |
147
+ | [Button Group](https://peacock.redvars.com/components/button-group) | p-button-group | 🟢 |
148
+ | [Calendar](https://peacock.redvars.com/components/calendar) | p-calendar | 🟢 |
149
+ | Card Select | p-cardselect | 🔴 |
150
+ | [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | p-card-highlighter | 🟢 |
151
+ | Column | p-col | 🔴 |
152
+ | [Empty State](https://peacock.redvars.com/components/empty-state) | p-empty-state | 🟡 |
153
+ | [Flow Designer ](https://peacock.redvars.com/components/flow-designer) | p-flow-designer | 🔵 |
154
+ | Grid | p-grid | 🔴 |
155
+ | Group | p-group | 🔴 |
156
+ | [Header](https://peacock.redvars.com/components/header) | p-header | 🟢 |
157
+ | [Icon](https://peacock.redvars.com/components/icon) | p-icon | 🟢 |
158
+ | [Link](https://peacock.redvars.com/components/link) | p-link | 🟢 |
159
+ | [Modal](https://peacock.redvars.com/components/modal) | p-modal | 🟢 |
160
+ | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | p-notification-manager | 🟡 |
161
+ | Observer | p-observer | 🔴 |
162
+ | Pagination | p-pagination | 🔴 |
163
+ | Radio Group | p-radiogroup | 🔴 |
164
+ | Row | p-row | 🔴 |
165
+ | [Slider](https://peacock.redvars.com/components/slider) | p-slider | 🟡 |
166
+ | Spoiler | p-spoiler | 🔴 |
167
+ | Stepper | p-stepper | 🔴 |
168
+ | [Table](https://peacock.redvars.com/components/table) | p-table | 🟡 |
169
+ | [Tag](https://peacock.redvars.com/components/tag) / Chip | p-tag | 🟢 |
170
+ | [Text](https://peacock.redvars.com/components/text) | p-text | 🟢 |
171
+ | [Tree View](https://peacock.redvars.com/components/tree-view) | p-tree-view | 🟡 |
172
+ | [Toggle](https://peacock.redvars.com/components/toggle) | p-toggle | 🟢 |
173
+
174
+ ## Charts
175
+
176
+ These components are used to display data in a graphical format. They include
177
+
178
+ | Name | Component | State |
179
+ |----------------------------------------------------------------|---------------------|-------|
180
+ | [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | p-chart-doughnut | 🟢 |
181
+ | [Pie Chart ](https://peacock.redvars.com/components/chart-pie) | p-chart-pie | 🟢 |
182
+
183
+
184
+ ## 📄 License
185
+
186
+ Peacock is open-source software licensed under the [Apache-2.0 License](LICENSE).
187
+
188
+ ---
189
+
190
+ Made with 💖 by [shivajivarma](https://shivajivarma.com).
package/rollup.config.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import typescript from '@rollup/plugin-typescript';
2
2
  import { nodeResolve } from '@rollup/plugin-node-resolve';
3
+ import css from 'rollup-plugin-import-css';
4
+ import copy from 'rollup-plugin-copy';
3
5
 
4
6
  export default [
5
7
  {
@@ -11,11 +13,12 @@ export default [
11
13
  },
12
14
  plugins: [
13
15
  typescript(), // The plugin loads options from tsconfig.json by default
16
+ css(),
14
17
  nodeResolve(),
15
18
  ],
16
19
  },
17
20
  {
18
- input: ['src/icon/Icon.ts', 'src/avatar/avatar.ts'], // Your main TypeScript entry file
21
+ input: ['src/icon/icon.ts', 'src/avatar/avatar.ts'], // Your main TypeScript entry file
19
22
  output: {
20
23
  dir: `dist`,
21
24
  format: 'esm', // Output as ES Modules (esm), also supports cjs, umd, etc.
@@ -24,7 +27,17 @@ export default [
24
27
  },
25
28
  plugins: [
26
29
  typescript(), // The plugin loads options from tsconfig.json by default
30
+ css(),
27
31
  nodeResolve(),
32
+
33
+ copy({
34
+ targets: [
35
+ {
36
+ src: '../readme.md',
37
+ dest: './',
38
+ },
39
+ ],
40
+ }),
28
41
  ],
29
42
  },
30
43
  ];
@@ -1,5 +1,5 @@
1
1
  import { css, unsafeCSS } from 'lit';
2
- import { getTypography } from '../utils.js';
2
+ import { getTypography } from '../styleMixins.css.js';
3
3
 
4
4
  export const styles = css`
5
5
  :host {
@@ -26,7 +26,7 @@ export const styles = css`
26
26
  color: var(--avatar-text-color);
27
27
  width: var(--avatar-size);
28
28
  height: var(--avatar-size);
29
- ${unsafeCSS(getTypography('body-large-emphasized'))}
29
+ ${getTypography('body-large-emphasized')}
30
30
  background-color: var(--avatar-background-color);
31
31
 
32
32
  font-size: calc(var(--avatar-size) * 0.4);
@@ -3,12 +3,6 @@ import { property } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import { styles } from './avatar.css.js';
5
5
 
6
- /**
7
- * @summary Icons are visual symbols used to represent ideas, objects, or actions.
8
- *
9
- * @cssprop --icon-color - Controls the color of the icon.
10
- * @cssprop --icon-size - Controls the size of the icon.
11
- */
12
6
  export class Avatar extends LitElement {
13
7
  static styles = [styles];
14
8
 
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset='utf-8'>
5
5
  <meta name='viewport' content='width=device-width, initial-scale=1.0, viewport-fit=cover' />
6
- <link rel='stylesheet' href='/demo/tokens.css' />
6
+ <link rel='stylesheet' href='/dist/assets/styles/tokens.css' />
7
7
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
8
8
 
9
9
  <style>
@@ -18,7 +18,7 @@
18
18
  <p-avatar name='Shivaji Varma'></p-avatar>
19
19
 
20
20
  <script type='module'>
21
- import { Avatar } from '/dist/src/index.js';
21
+ import { Avatar } from '/dist/index.js';
22
22
 
23
23
  window.customElements.define('p-avatar', Avatar);
24
24
  </script>
@@ -0,0 +1,12 @@
1
+ import { customElement } from 'lit/decorators.js';
2
+ import { Avatar } from './avatar.js';
3
+
4
+ /**
5
+ * @summary The Avatar component is used to represent user, and displays the profile picture, initials or fallback icon.
6
+ *
7
+ * @cssprop --avatar-background-color - Controls the color of the avatar.
8
+ * @cssprop --avatar-size - Controls the size of the avatar.
9
+ * @cssprop --avatar-text-color - Controls the color of the text inside the avatar.
10
+ */
11
+ @customElement('p-avatar')
12
+ export class PAvatar extends Avatar {}
@@ -0,0 +1,33 @@
1
+ import { css } from 'lit';
2
+ import { getTypography } from '../styleMixins.css.js';
3
+
4
+ export const styles = css`
5
+ :host {
6
+ display: inline-block;
7
+ --badge-color: var(--global-badge-color);
8
+ }
9
+
10
+ .badge {
11
+ pointer-events: none;
12
+ z-index: var(--z-index-badge);
13
+ color: var(--color-white);
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ background-color: var(--badge-color);
18
+ border-radius: var(--shape-corner-full);
19
+
20
+ &.has-content {
21
+ height: 1rem;
22
+ min-width: 1rem;
23
+ padding-inline: var(--spacing-050);
24
+ ${getTypography('label-small')};
25
+ color: var(--color-on-error);
26
+ }
27
+
28
+ &:not(.has-content) {
29
+ height: 6px;
30
+ width: 6px;
31
+ }
32
+ }
33
+ `;
@@ -0,0 +1,29 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { styles } from './badge.css.js';
5
+
6
+ export class Badge extends LitElement {
7
+ static styles = [styles];
8
+
9
+ @property({ type: String, reflect: true }) name: string = '';
10
+
11
+ @property({ type: String, reflect: true }) src?: string;
12
+
13
+ @state()
14
+ slotHasContent = false;
15
+
16
+ render() {
17
+ return html`<div
18
+ class=${classMap({ badge: true, 'has-content': this.slotHasContent })}
19
+ >
20
+ <slot @slotchange=${this.#handleSlotChange}></slot>
21
+ </div>`;
22
+ }
23
+
24
+ #handleSlotChange(event: { target: any }) {
25
+ const slot = event.target;
26
+ // Check assignedElements length
27
+ this.slotHasContent = slot.assignedElements().length > 0;
28
+ }
29
+ }
@@ -0,0 +1,54 @@
1
+ <!doctype html>
2
+ <html lang='en-GB'>
3
+ <head>
4
+ <meta charset='utf-8'>
5
+ <meta name='viewport' content='width=device-width, initial-scale=1.0, viewport-fit=cover' />
6
+ <link rel='stylesheet' href='/dist/assets/styles/tokens.css' />
7
+ <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
8
+
9
+ <style>
10
+ body {
11
+ background: #fafafa;
12
+ }
13
+ </style>
14
+ </head>
15
+ <body>
16
+
17
+ <style>
18
+ .badge-wrapper {
19
+ position: relative;
20
+ display: inline-flex;
21
+ width: 1.5rem;
22
+ height: 1.5rem;
23
+ align-items: center;
24
+ justify-content: center;
25
+ }
26
+
27
+ .badge-anchor-simple {
28
+ position: absolute;
29
+ top: 0;
30
+ right: 0;
31
+ }
32
+
33
+ .badge-anchor {
34
+ position: absolute;
35
+ top: -2px;
36
+ left: calc(100% - 12px);
37
+ }
38
+ </style>
39
+
40
+ <div class="badge-wrapper">
41
+ <p-icon name="notifications"></p-icon>
42
+ <p-badge class="badge-anchor-simple"></p-badge>
43
+ </div>
44
+
45
+
46
+ <p-avatar name='Shivaji Varma'></p-avatar>
47
+
48
+ <script type='module'>
49
+ import { Icon, Badge } from '/dist/index.js';
50
+ window.customElements.define('p-icon', Icon);
51
+ window.customElements.define('p-badge', Badge);
52
+ </script>
53
+ </body>
54
+ </html>
@@ -0,0 +1 @@
1
+ export { Badge } from './badge.js';
@@ -0,0 +1,10 @@
1
+ import { customElement } from 'lit/decorators.js';
2
+ import { Badge } from './badge.js';
3
+
4
+ /**
5
+ * @summary The badge component is used to display a small amount of information to the user.
6
+ *
7
+ * @cssprop --badge-color - Controls the color of the badge.
8
+ */
9
+ @customElement('p-badge')
10
+ export class PBadge extends Badge {}
@@ -13,13 +13,13 @@
13
13
  <body>
14
14
 
15
15
 
16
- <pc-icon></pc-icon>
17
- <pc-icon provider='carbon' name='logo--github'></pc-icon>
16
+ <p-icon></p-icon>
17
+ <p-icon provider='carbon' name='logo--github'></p-icon>
18
18
 
19
19
  <script type='module'>
20
- import { Icon } from '/dist/src/index.js';
20
+ import { Icon } from '/dist/index.js';
21
21
 
22
- window.customElements.define('pc-icon', Icon);
22
+ window.customElements.define('p-icon', Icon);
23
23
  </script>
24
24
  </body>
25
25
  </html>
package/src/icon/icon.ts CHANGED
@@ -5,16 +5,10 @@ import { fetchIcon, fetchSVG } from './datasource.js';
5
5
  import { sanitizeSvg } from '../utils.js';
6
6
  import { styles } from './icon.css.js';
7
7
 
8
- /**
9
- * @summary Icons are visual symbols used to represent ideas, objects, or actions.
10
- *
11
- * @cssprop --icon-color - Controls the color of the icon.
12
- * @cssprop [--icon-size=1rem] - Controls the size of the icon. Defaults to "1rem"
13
- */
14
8
  export class Icon extends LitElement {
15
9
  static styles = [styles];
16
10
 
17
- @property({ type: String, reflect: true }) name?: string = 'home';
11
+ @property({ type: String, reflect: true }) name?: string;
18
12
 
19
13
  @property({ type: String, reflect: true }) src?: string;
20
14
 
@@ -1,5 +1,12 @@
1
1
  import { customElement } from 'lit/decorators.js';
2
2
  import { Icon } from './icon.js';
3
3
 
4
+ /**
5
+ * @name Icon
6
+ * @summary Icons are visual symbols used to represent ideas, objects, or actions.
7
+ *
8
+ * @cssprop --icon-color - Controls the color of the icon.
9
+ * @cssprop [--icon-size=1rem] - Controls the size of the icon. Defaults to "1rem"
10
+ */
4
11
  @customElement('p-icon')
5
- export class IconComponent extends Icon {}
12
+ export class PIcon extends Icon {}
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { Icon } from './icon/icon.js';
2
- export { Avatar } from './avatar/avatar.js';
1
+ export { Icon } from './icon/index.js';
2
+ export { Avatar } from './avatar/index.js';
3
+ export { Badge } from './badge/index.js';
@@ -0,0 +1,36 @@
1
+ import { css, unsafeCSS, CSSResult } from 'lit';
2
+ import { focusRing } from '../styleMixins.css.js';
3
+
4
+ export const createLinkStyles = (prefix: string): CSSResult => css`
5
+ .${unsafeCSS(prefix)}-link {
6
+ border-radius: inherit;
7
+ corner-shape: inherit;
8
+
9
+ color: var(--color-primary);
10
+ --icon-color: var(--color-primary);
11
+ }
12
+
13
+ .${unsafeCSS(prefix)}-link:hover {
14
+ color: var(--color-on-primary-container);
15
+ --icon-color: var(--color-on-primary-container);
16
+ }
17
+
18
+ .${unsafeCSS(prefix)}-link:focus {
19
+ text-decoration: none;
20
+ ${focusRing()}
21
+ }
22
+
23
+ .${unsafeCSS(prefix)}-link.no-style {
24
+ color: var(--color-on-surface);
25
+ --icon-color: var(--color-on-surface);
26
+ text-decoration: none !important;
27
+ }
28
+
29
+ .${unsafeCSS(prefix)}-link.no-decoration {
30
+ text-decoration: none !important;
31
+ }
32
+
33
+ .${unsafeCSS(prefix)}-link.inline {
34
+ text-decoration: var(--link-decoration, underline);
35
+ }
36
+ `;
@@ -1,15 +1,53 @@
1
1
  // Eager loaded
2
2
  import { Icon } from './icon/icon.js';
3
+ import { Avatar } from './avatar/avatar.js';
4
+
3
5
  import { LoaderConfig, LoaderUtils } from './LoaderUtils.js';
6
+ import cssComponentsStyleSheet from '../assets/tokens.css';
7
+ import { createLinkStyles } from './link/link.css.js';
8
+ import { createTextStyles } from './text/text.css.js';
9
+
10
+ const libraryPrefix = 'p';
11
+
12
+ function buildSheet(styleSheet: any) {
13
+ const sheet = new CSSStyleSheet();
14
+ // Add rules
15
+ sheet.replaceSync(styleSheet.toString());
16
+ return sheet;
17
+ }
18
+
19
+ const styleSheets = [buildSheet(cssComponentsStyleSheet)];
20
+
21
+ const linkStylesheet = createLinkStyles(libraryPrefix).styleSheet;
22
+ if (linkStylesheet) styleSheets.push(linkStylesheet);
23
+
24
+ const textStylesheet = createTextStyles(libraryPrefix).styleSheet;
25
+ if (textStylesheet) styleSheets.push(textStylesheet);
26
+
27
+ function stringifyStyleSheet(stylesheet: any) {
28
+ // Use Array.from() to convert the CSSRuleList to an array
29
+ return (
30
+ Array.from(stylesheet.cssRules)
31
+ // Map each rule to its cssText property
32
+ .map((rule: any) => rule.cssText || '')
33
+ // Join all the rules with a newline character
34
+ .join('\\n')
35
+ );
36
+ }
37
+
38
+ console.log(stringifyStyleSheet(textStylesheet));
39
+
40
+ document.adoptedStyleSheets = styleSheets;
4
41
 
5
42
  const loaderConfig: LoaderConfig = {
6
- prefix: 'p',
43
+ prefix: libraryPrefix,
7
44
  components: {
8
45
  icon: {
9
46
  CustomElementClass: Icon,
47
+ // importPath: './component/icon.js', - for lazy load give path instead of CustomElementClass
10
48
  },
11
49
  avatar: {
12
- importPath: './component/avatar.js',
50
+ CustomElementClass: Avatar,
13
51
  },
14
52
  },
15
53
  };
@@ -0,0 +1,55 @@
1
+ import { css, unsafeCSS, CSSResult } from 'lit';
2
+
3
+ export const focusRing = (
4
+ color = 'var(--border-interactive)',
5
+ ): CSSResult => css`
6
+ outline: 2px solid ${unsafeCSS(color)};
7
+ `;
8
+
9
+ export const getTypography = (name: string): CSSResult => css`
10
+ font-family: var(--typography-${unsafeCSS(name)}-font-family) !important;
11
+ font-size: var(--typography-${unsafeCSS(name)}-font-size) !important;
12
+ font-weight: var(--typography-${unsafeCSS(name)}-font-weight) !important;
13
+ line-height: var(--typography-${unsafeCSS(name)}-line-height) !important;
14
+ letter-spacing: var(
15
+ --typography-${unsafeCSS(name)}-letter-spacing
16
+ ) !important;
17
+ `;
18
+
19
+ export const getTypographyNotImportant = (name: string): CSSResult => css`
20
+ font-family: var(--typography-${unsafeCSS(name)}-font-family);
21
+ font-size: var(--typography-${unsafeCSS(name)}-font-size);
22
+ font-weight: var(--typography-${unsafeCSS(name)}-font-weight);
23
+ line-height: var(--typography-${unsafeCSS(name)}-line-height);
24
+ letter-spacing: var(--typography-${unsafeCSS(name)}-letter-spacing);
25
+ `;
26
+
27
+ export const forPhoneOnly = (content: CSSResult): CSSResult => css`
28
+ @media (max-width: 671px) {
29
+ ${content}
30
+ }
31
+ `;
32
+
33
+ export const forTabletPortraitUp = (content: CSSResult): CSSResult => css`
34
+ @media (min-width: 672px) {
35
+ ${content}
36
+ }
37
+ `;
38
+
39
+ export const forTabletLandscapeUp = (content: CSSResult): CSSResult => css`
40
+ @media (min-width: 1056px) {
41
+ ${content}
42
+ }
43
+ `;
44
+
45
+ export const forDesktopUp = (content: CSSResult): CSSResult => css`
46
+ @media (min-width: 1312px) {
47
+ ${content}
48
+ }
49
+ `;
50
+
51
+ export const forBigDesktopUp = (content: CSSResult): CSSResult => css`
52
+ @media (min-width: 1584px) {
53
+ ${content}
54
+ }
55
+ `;
@@ -0,0 +1,11 @@
1
+ declare module '*.css' {
2
+ const content: Record<string, string>;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.scss' {
7
+ import { CSSResultGroup } from 'lit';
8
+
9
+ const styles: CSSResultGroup;
10
+ export default styles;
11
+ }