@exakt/ui 0.0.1 → 0.0.4

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.
package/README.md CHANGED
@@ -3,7 +3,7 @@ Get your module up and running quickly.
3
3
 
4
4
  Find and replace all on all files (CMD+SHIFT+F):
5
5
  - Name: exakt
6
- - Package name: exakt-ui
6
+ - Package name: @exakt/ui
7
7
  - Description: My new Nuxt module
8
8
  -->
9
9
 
@@ -28,25 +28,25 @@ a simple nuxt ui library focused on doing as much as possible with css
28
28
 
29
29
  ## Quick Setup
30
30
 
31
- 1. Add `exakt-ui` dependency to your project
31
+ 1. Add `@exakt/ui` dependency to your project
32
32
 
33
33
  ```bash
34
34
  # Using pnpm
35
- pnpm add -D exakt-ui
35
+ pnpm add -D @exakt/ui
36
36
 
37
37
  # Using yarn
38
- yarn add --dev exakt-ui
38
+ yarn add --dev @exakt/ui
39
39
 
40
40
  # Using npm
41
- npm install --save-dev exakt-ui
41
+ npm install --save-dev @exakt/ui
42
42
  ```
43
43
 
44
- 2. Add `exakt-ui` to the `modules` section of `nuxt.config.ts`
44
+ 2. Add `@exakt/ui` to the `modules` section of `nuxt.config.ts`
45
45
 
46
46
  ```js
47
47
  export default defineNuxtConfig({
48
48
  modules: [
49
- 'exakt-ui'
49
+ '@exakt/ui'
50
50
  ]
51
51
  })
52
52
  ```
@@ -80,14 +80,14 @@ npm run release
80
80
  ```
81
81
 
82
82
  <!-- Badges -->
83
- [npm-version-src]: https://img.shields.io/npm/v/exakt-ui/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
84
- [npm-version-href]: https://npmjs.com/package/exakt-ui
83
+ [npm-version-src]: https://img.shields.io/npm/v/@exakt/ui/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
84
+ [npm-version-href]: https://npmjs.com/package/@exakt/ui
85
85
 
86
- [npm-downloads-src]: https://img.shields.io/npm/dm/exakt-ui.svg?style=flat&colorA=18181B&colorB=28CF8D
87
- [npm-downloads-href]: https://npmjs.com/package/exakt-ui
86
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@exakt/ui.svg?style=flat&colorA=18181B&colorB=28CF8D
87
+ [npm-downloads-href]: https://npmjs.com/package/@exakt/ui
88
88
 
89
- [license-src]: https://img.shields.io/npm/l/exakt-ui.svg?style=flat&colorA=18181B&colorB=28CF8D
90
- [license-href]: https://npmjs.com/package/exakt-ui
89
+ [license-src]: https://img.shields.io/npm/l/@exakt/ui.svg?style=flat&colorA=18181B&colorB=28CF8D
90
+ [license-href]: https://npmjs.com/package/@exakt/ui
91
91
 
92
92
  [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
93
93
  [nuxt-href]: https://nuxt.com
package/dist/module.d.ts CHANGED
@@ -14,6 +14,7 @@ interface ModuleOptions {
14
14
  xl?: string;
15
15
  };
16
16
  borderRadius: string;
17
+ corePaddingX: string;
17
18
  font: string;
18
19
  }
19
20
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "exakt-ui",
3
3
  "configKey": "exakt",
4
- "version": "0.0.1"
4
+ "version": "0.0.4"
5
5
  }
package/dist/module.mjs CHANGED
@@ -15,6 +15,7 @@ const defaults = {
15
15
  xl: "60em"
16
16
  },
17
17
  borderRadius: "8px",
18
+ corePaddingX: "1rem",
18
19
  font: "Roboto, sans-serif"
19
20
  };
20
21
  const module = defineNuxtModule({
@@ -27,21 +28,30 @@ const module = defineNuxtModule({
27
28
  async setup(options, nuxt) {
28
29
  const resolver = createResolver(import.meta.url);
29
30
  addPlugin(resolver.resolve("./runtime/plugin"));
30
- await fs.promises.mkdir("node_modules/.cache/exakt-ui", {
31
- recursive: true
32
- });
33
- let variables = "";
31
+ await fs.promises.mkdir(
32
+ resolver.resolve("../node_modules/.cache/exakt-ui"),
33
+ {
34
+ recursive: true
35
+ }
36
+ );
37
+ let SCSSvariables = "";
38
+ let CSSvariables = ":root{";
34
39
  for (const [key, value] of Object.entries(options.colors)) {
35
- variables += `$root-${key}: ${value}; `;
40
+ SCSSvariables += `$root-${key}: ${value}; `;
36
41
  }
37
42
  for (const [key, value] of Object.entries(options.breakpoints)) {
38
- variables += `$${key}-screen-breakpoint: ${value}; `;
43
+ SCSSvariables += `$e-${key}-screen-breakpoint: ${value}; `;
39
44
  }
40
- variables += `$font-family: ${options.font}; `;
41
- variables += `$rounded-border-radius: ${options.borderRadius}; `;
45
+ CSSvariables += `--e-font-family: ${options.font}; `;
46
+ CSSvariables += `--e-rounded-border-radius: ${options.borderRadius}; `;
47
+ CSSvariables += `--e-core-padding-x: ${options.corePaddingX}; `;
42
48
  await fs.promises.writeFile(
43
- "node_modules/.cache/exakt-ui/variables.scss",
44
- new Uint8Array(Buffer.from(variables))
49
+ resolver.resolve("../node_modules/.cache/exakt-ui/variables.scss"),
50
+ new Uint8Array(Buffer.from(SCSSvariables))
51
+ );
52
+ await fs.promises.writeFile(
53
+ resolver.resolve("../node_modules/.cache/exakt-ui/variables.css"),
54
+ new Uint8Array(Buffer.from(CSSvariables + "}"))
45
55
  );
46
56
  extendViteConfig((config) => {
47
57
  Object.assign(config, {
@@ -56,8 +66,12 @@ const module = defineNuxtModule({
56
66
  }
57
67
  });
58
68
  });
59
- nuxt.options.css.push(resolver.resolve("./css/main.scss"));
60
- addComponentsDir({ path: resolver.resolve("./components") });
69
+ nuxt.options.css.push(resolver.resolve("./runtime/css/main.scss"));
70
+ nuxt.options.css.push(resolver.resolve("./runtime/css/util.scss"));
71
+ nuxt.options.css.push(
72
+ resolver.resolve("../node_modules/.cache/exakt-ui/variables.css")
73
+ );
74
+ addComponentsDir({ path: resolver.resolve("./runtime/components") });
61
75
  }
62
76
  });
63
77
 
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <div class="flex-center color-red">
3
+ <e-icon
4
+ :icon="mdiAlert"
5
+ size="19"
6
+ class="mr-2"
7
+ /><small><slot /></small>
8
+ </div>
9
+ </template>
10
+ <script setup lang="ts">
11
+ import { mdiAlert } from "@mdi/js";
12
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="title-bar">
3
+ <e-progress-linear :model-value="props.loading" />
4
+ <div class="pf-wrap">
5
+ <slot name="left" />
6
+ </div>
7
+ <slot name="center" />
8
+
9
+ <div class="pf-wrap">
10
+ <slot name="right" />
11
+ </div>
12
+ </div>
13
+
14
+ <div class="bar-container">
15
+ <e-container
16
+ class="bar-e-container"
17
+ :force-full-width="true"
18
+ >
19
+ <div class="rounded bar">
20
+ <e-progress-linear
21
+ :model-value="props.loading"
22
+ class="md-and-up-only"
23
+ />
24
+
25
+ <div class="md-and-up-only flex-stretch">
26
+ <slot name="center" />
27
+ </div>
28
+ <slot name="nav-items" />
29
+ <div class="md-and-up-only flex-stretch">
30
+ <slot
31
+ name="right"
32
+ class="fullwidth"
33
+ />
34
+ </div>
35
+ </div>
36
+ </e-container>
37
+ </div>
38
+ </template>
39
+ <script setup lang="ts">
40
+ const props = withDefaults(
41
+ defineProps<{
42
+ loading?: boolean;
43
+ }>(),
44
+ { loading: false }
45
+ );
46
+
47
+ </script>
48
+
49
+ <style lang="scss" scoped>
50
+ .title-bar {
51
+ display: none;
52
+ position: relative;
53
+ }
54
+
55
+ .bar {
56
+ display: flex;
57
+ justify-content: flex-start;
58
+ justify-items: flex-start;
59
+ background-color: var(--e-color-elev-2);
60
+ width: 100%;
61
+ overflow: clip;
62
+ position: relative;
63
+ }
64
+
65
+ .bar-container {
66
+ width: 100%;
67
+ top: 1rem;
68
+
69
+ height: 4rem;
70
+ padding-bottom: 1rem;
71
+
72
+ display: flex;
73
+ justify-content: center;
74
+ position: sticky;
75
+ align-self: flex-start;
76
+ z-index: 4;
77
+ }
78
+
79
+ @media screen and (max-width: ($e-md-screen-breakpoint)) {
80
+ .title-bar {
81
+ display: unset;
82
+ top: 0px;
83
+ left: 0px;
84
+ height: 4rem;
85
+ width: 100%;
86
+ z-index: 4;
87
+ background-color: var(--e-color-elev-2);
88
+ position: fixed;
89
+ display: flex;
90
+ justify-content: space-between;
91
+ align-content: stretch;
92
+ justify-items: space-between;
93
+ align-items: stretch;
94
+
95
+ .pf-wrap {
96
+ display: flex;
97
+ align-items: stretch;
98
+ width: 5rem;
99
+ }
100
+ }
101
+
102
+ .md-and-up-only {
103
+ display: none;
104
+ }
105
+
106
+ .bar-container {
107
+ bottom: 0px;
108
+ left: 0px;
109
+ top: unset;
110
+ position: fixed;
111
+ padding: 0px;
112
+ z-index: 3;
113
+ }
114
+
115
+ .bar-e-container {
116
+ padding: 0px;
117
+ margin: 0px;
118
+ }
119
+
120
+ .bar {
121
+ border-radius: 0px;
122
+ width: 100%;
123
+ height: 100%;
124
+
125
+ padding-bottom: calc(env(safe-area-insee-bottom));
126
+ }
127
+ }
128
+ </style>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <div class="flex-center a-container">
3
+ <slot />
4
+ <e-image-lazy-view
5
+ v-if="src"
6
+ class="avatar"
7
+ :width="size"
8
+ :height="size"
9
+ :contain="true"
10
+ :immediate-render="true"
11
+ :src="src"
12
+ border-radius="100%"
13
+ />
14
+ <div v-else>
15
+ <e-icon
16
+ :size="size"
17
+ :icon="mdiAccountCircle"
18
+ />
19
+ </div>
20
+ </div>
21
+ </template>
22
+ <script setup lang="ts">
23
+ import { mdiAccountCircle } from "@mdi/js";
24
+ const size = 120;
25
+
26
+ defineProps<{
27
+ src?: string;
28
+ }>();
29
+ </script>
30
+ <style lang="scss" scoped>
31
+ .avatar {
32
+ border-radius: 100%;
33
+ width: fie-content;
34
+ height: fie-content;
35
+ background-color: var(--e-color-elev);
36
+ }
37
+
38
+ .a-container {
39
+ position: relative;
40
+ }
41
+ </style>
@@ -0,0 +1,266 @@
1
+ <template>
2
+ <button
3
+ class="e-btn "
4
+ :style="{ width, justifyContent: justifyWrapper }"
5
+ :type="type"
6
+ :disabled="disabled || loading"
7
+ :class="{
8
+ active,
9
+ inactive,
10
+ solid,
11
+ block,
12
+ rounded: solid,
13
+ 'e-disabled': disabled,
14
+ 'my-2':solid,
15
+ loading,
16
+ fab,
17
+ loadingGradient,
18
+ colored: background !== 'transparent' || color || solid,
19
+ }"
20
+ >
21
+ <e-progress-gradient
22
+ v-if="loading && loadingGradient"
23
+ class="prog-grad"
24
+ color="primary"
25
+ />
26
+
27
+ <div
28
+ ref="content"
29
+ class="e-btn-content"
30
+ :style="contentStyles"
31
+ >
32
+ <div
33
+ v-if="loading && !loadingGradient"
34
+ class="load-overlay"
35
+ >
36
+ <e-loading-spinner />
37
+ </div>
38
+ <span class="actual-content flex-center">
39
+
40
+ <slot />
41
+ </span>
42
+ </div>
43
+ </button>
44
+ </template>
45
+ <script lang="ts" setup>
46
+ import { computed, reactive, ref, onMounted } from "vue";
47
+ //import { IonSpinner } from "@ionic/vue";
48
+ const { $exakt } = useNuxtApp();
49
+ const props = withDefaults(
50
+ defineProps<{
51
+ width?: number | string;
52
+ justify?: string;
53
+ active?: boolean;
54
+ inactive?: boolean;
55
+ solid?: boolean;
56
+ color?: string;
57
+ background?: string;
58
+ block?: boolean;
59
+ loading?: boolean;
60
+ loadingGradient?: boolean;
61
+ fab?: boolean;
62
+ disabled?: boolean;
63
+ type?: "button" | "submit" | "reset";
64
+ }>(),
65
+ { type: "button", background: "primary", solid: true }
66
+ );
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ const justifyWrapper = computed(() => {
75
+ if (props.justify === "space-between") {
76
+ return "stretch";
77
+ }
78
+ return props.justify;
79
+ });
80
+
81
+ const contentStyles = computed(() => {
82
+ if (props.justify === "space-between") {
83
+ return "justify-content:space-between; flex-grow: 1";
84
+ }
85
+
86
+ return "";
87
+ });
88
+
89
+ function parseColor(input: string) {
90
+ const div = document.createElement("div");
91
+ document.body.appendChild(div);
92
+ div.style.color = input;
93
+ const c = getComputedStyle(div).color as any;
94
+ const res = c.match(/[.\d]+/g).map(Number);
95
+
96
+ div.remove();
97
+ return { r: res[0], g: res[1], b: res[2] };
98
+ }
99
+
100
+ const backgroundColorRgb = computed(() => {
101
+ if (!props.background || process.server) {
102
+ return { r: 0, g: 0, b: 0 };
103
+ }
104
+ return parseColor(parsedBackgroundProp.value);
105
+ });
106
+
107
+ const parsedBackgroundProp = computed(() => $exakt.parseColor(props.background));
108
+
109
+ const textColor = computed(() => {
110
+ if (props.color) {
111
+ return props.color;
112
+ }
113
+
114
+ const rgb = backgroundColorRgb.value;
115
+
116
+ const brightness = Math.round(
117
+ (299 * rgb.r + 224490 + 587 * rgb.g + 114 * rgb.b) / 2000
118
+ );
119
+ if (brightness > 150) {
120
+ // Dark Text
121
+ return "#000000";
122
+ }
123
+ return "#FFFFFF";
124
+ });
125
+
126
+ const hoverColor = computed(() => {
127
+ if (parsedBackgroundProp.value === 'transparent') {
128
+ return 'rgba(98, 98, 98, 0.15)';
129
+ }
130
+
131
+ const rgb = backgroundColorRgb.value;
132
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.9)`;
133
+ });
134
+ </script>
135
+ <style lang="scss" scoped>
136
+ .prog-grad {
137
+ position: absolute;
138
+ top: 0;
139
+ left: 0;
140
+ }
141
+
142
+ .e-btn-content {
143
+ transition: transform 0.1s ease-in-out;
144
+ flex-direction: row;
145
+ display: flex;
146
+ position: relative;
147
+ align-content: center;
148
+ align-items: center;
149
+ justify-content: center;
150
+ }
151
+
152
+ .e-btn {
153
+ user-select: none;
154
+ background: rgba(0, 0, 0, 0);
155
+ display: flex;
156
+ font-size: 1rem;
157
+
158
+ justify-content: center;
159
+ align-content: center;
160
+ align-items: center;
161
+ padding: 0.3rem var(--e-core-padding-x);
162
+ overflow: hidden;
163
+ color: var(--e-color-dark);
164
+ outline: none;
165
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
166
+ border: none;
167
+ text-decoration: none;
168
+ cursor: pointer;
169
+ position: relative;
170
+ flex-shrink: 1;
171
+
172
+ transition: background 0.4s, color 0.3s, opacity 0.4s;
173
+
174
+ font-family: var(--e-font-family);
175
+
176
+ &.loading {
177
+ pointer-events: none;
178
+
179
+ &.loadingGradient {
180
+ background: rgba(0, 0, 0, 0) !important;
181
+ color: var(--e-color-dark) !important;
182
+ transition: background 0.8s, color 0.5s, opacity 0.4s;
183
+
184
+ .actual-content {
185
+
186
+ opacity: 0.8;
187
+ transition: opacity 0.5s;;
188
+ }
189
+ }
190
+
191
+ .actual-content {
192
+ opacity: 0;
193
+ }
194
+
195
+ }
196
+
197
+ &:hover {
198
+ background: rgba(98, 98, 98, 0.15);
199
+ }
200
+
201
+ &:active {
202
+ .e-btn-content {
203
+ transform: scale(0.85);
204
+ }
205
+ }
206
+
207
+ &.fab {
208
+ position: fixed;
209
+ right: 5rem;
210
+ bottom: 5rem;
211
+ aspect-ratio: 1;
212
+ border-radius: 100%;
213
+ height: 4.2rem;
214
+ z-index: 3;
215
+ }
216
+
217
+ &.block {
218
+ width: 100%;
219
+ }
220
+
221
+ &.colored {
222
+ background-color: v-bind(parsedBackgroundProp);
223
+ color: v-bind(textColor);
224
+
225
+ &:hover {
226
+ background-color: v-bind(hoverColor);
227
+ }
228
+ }
229
+
230
+ &.solid {
231
+ padding: 0.7rem 0.9rem;
232
+ }
233
+
234
+ &.active {
235
+ color: var(--e-color-primary);
236
+ }
237
+
238
+ &.inactive {
239
+ color: var(--e-color-dark);
240
+ opacity: 80%;
241
+ }
242
+ }
243
+
244
+ @media screen and (max-width: $e-md-screen-breakpoint) {
245
+ .e-btn.fab {
246
+ right: 1rem;
247
+ }
248
+ }
249
+
250
+ .loading-spinner {
251
+ max-height: 1rem;
252
+ }
253
+
254
+ .load-overlay {
255
+ position: absolute;
256
+ top: 0;
257
+ left: 0;
258
+ right: 0;
259
+ bottom: 0;
260
+ width: 100%;
261
+ display: flex;
262
+ justify-content: center;
263
+ align-items: center;
264
+ z-index: 1;
265
+ }
266
+ </style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div
3
+ class="container"
4
+ :class="{ 'no-btn-padding': noBtnPadding }"
5
+ >
6
+ <div
7
+ class="content"
8
+ :class="{ forceFullWidth }"
9
+ >
10
+ <slot />
11
+ </div>
12
+ </div>
13
+ </template>
14
+ <script setup lang="ts">
15
+ defineProps(["noBtnPadding", "forceFullWidth"]);
16
+ </script>
17
+ <style lang="scss" scoped>
18
+ .content {
19
+ word-wrap: break-word;
20
+
21
+ width: 95%;
22
+
23
+ @media (max-width: $e-md-screen-breakpoint) {
24
+ &.forceFullWidth {
25
+ width: 100%;
26
+ }
27
+ }
28
+
29
+ $padding: 0rem;
30
+
31
+ @media (min-width: $e-md-screen-breakpoint) {
32
+ width: calc(85% - $padding);
33
+ }
34
+
35
+ @media (min-width: var(--e-l-screen-breakpoint)) {
36
+ width: calc(65% - $padding);
37
+ }
38
+ }
39
+
40
+ .container.no-btn-padding {
41
+ padding: 0px 0px;
42
+ .content {
43
+ margin: 0px 0px;
44
+ }
45
+ }
46
+
47
+ .container {
48
+ width: 100%;
49
+ display: flex;
50
+ height: 100%;
51
+ justify-content: center;
52
+ word-wrap: break-word;
53
+ box-sizing: border-box; /* Opera/IE 8+ */
54
+
55
+ padding: 0px var(--e-core-padding-x);
56
+ }
57
+ </style>