@privyid/persona 0.13.1 → 0.14.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.
@@ -60,7 +60,7 @@ export default defineComponent({
60
60
  <style lang="postcss">
61
61
  .breadcrumbs {
62
62
  &__item {
63
- @apply inline-flex text-sm items-center;
63
+ @apply inline-flex text-sm items-center capitalize;
64
64
 
65
65
  &:last-child {
66
66
  & > .breadcrumbs__item__icon {
@@ -48,15 +48,19 @@ export default defineComponent({
48
48
  .breadcrumbs__item {
49
49
  &&--dropdown {
50
50
  .dropdown__activator {
51
- @apply px-0 text-subtle bg-transparent border-transparent hover:shadow-none hover:border-transparent hover:bg-transparent focus:shadow-none focus:border-transparent focus:bg-transparent;
52
- @apply dark:text-dark-subtle dark:bg-transparent dark:border-transparent hover:dark:border-transparent hover:dark:bg-transparent focus:dark:border-transparent focus:dark:bg-transparent;
51
+ &.btn.btn--default.btn--variant-solid {
52
+ @apply px-0 text-subtle bg-transparent border-transparent hover:shadow-none hover:border-transparent hover:bg-transparent focus:shadow-none focus:border-transparent focus:bg-transparent;
53
+ @apply dark:text-dark-subtle dark:bg-transparent dark:border-transparent hover:dark:border-transparent hover:dark:bg-transparent focus:dark:border-transparent focus:dark:bg-transparent;
54
+ }
53
55
  }
54
56
  }
55
57
 
56
58
  &&--active {
57
59
  .dropdown__activator {
58
- @apply text-default;
59
- @apply dark:text-dark-default;
60
+ &.btn.btn--default.btn--variant-solid {
61
+ @apply text-default;
62
+ @apply dark:text-dark-default;
63
+ }
60
64
 
61
65
  & > .dropdown__caret {
62
66
  @apply text-subtle;
@@ -57,8 +57,8 @@ declare const _default: import("vue-demi").DefineComponent<{
57
57
  variant: StyleVariant;
58
58
  size: SizeVariant;
59
59
  color: ColorVariant;
60
- icon: boolean;
61
60
  href: string;
61
+ icon: boolean;
62
62
  pill: boolean;
63
63
  }, {}>;
64
64
  export default _default;
@@ -80,14 +80,4 @@ export default defineComponent({
80
80
  @apply hidden;
81
81
  }
82
82
  }
83
-
84
- .navbar {
85
- &--collapse {
86
- @apply basis-full flex-grow items-center;
87
-
88
- &.collapse--show {
89
- @apply pt-3;
90
- }
91
- }
92
- }
93
83
  </style>
@@ -366,8 +366,7 @@ export default defineComponent({
366
366
  }
367
367
 
368
368
  &__preview {
369
- background-image: url("./assets/ps-neutral.png");
370
-
369
+ @apply bg-[url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAGklEQVR4AWNYJYoK92ihwpGiAF0AXcMIUQAAbIfSgRmCFqkAAAAASUVORK5CYII=)];
371
370
  @apply flex w-full overflow-hidden h-auto relative aspect-compat-square select-none;
372
371
  }
373
372
 
@@ -36,7 +36,7 @@
36
36
  ref="menu"
37
37
  data-testid="dropdown-menu"
38
38
  class="dropdown__menu"
39
- :class="menuClass">
39
+ :class="[menuClass, containerSize]">
40
40
  <DropdownGroup
41
41
  ref="wizard"
42
42
  class="dropdown__menu__container">
@@ -132,6 +132,10 @@ export default defineComponent({
132
132
  Object
133
133
  ],
134
134
  default: void 0
135
+ },
136
+ menuSize: {
137
+ type: String,
138
+ default: "sm"
135
139
  }
136
140
  },
137
141
  models: {
@@ -156,6 +160,12 @@ export default defineComponent({
156
160
  result.push("dropdown--divider");
157
161
  return result;
158
162
  });
163
+ const containerSize = computed(() => {
164
+ const result = [""];
165
+ if (props.menuSize)
166
+ result.push(`dropdown__menu--${props.menuSize}`);
167
+ return result;
168
+ });
159
169
  function toggle() {
160
170
  if (!props.disabled) {
161
171
  if (isOpen.value)
@@ -247,6 +257,7 @@ export default defineComponent({
247
257
  return {
248
258
  isOpen,
249
259
  classNames,
260
+ containerSize,
250
261
  toggle,
251
262
  open,
252
263
  close
@@ -257,10 +268,14 @@ export default defineComponent({
257
268
 
258
269
  <style lang="postcss">
259
270
  .dropdown {
271
+ --p-dropdown-size-lg: 30rem; /* 480px */
272
+ --p-dropdown-size-md: 20rem; /* 320px */
273
+ --p-dropdown-size-sm: 15rem; /* 240px */
274
+
260
275
  @apply relative inline-flex;
261
276
 
262
277
  &__menu {
263
- @apply max-h-64 border rounded w-full min-w-[15rem] bg-default z-10 border-default shadow-xl overflow-x-hidden overflow-y-auto absolute;
278
+ @apply max-h-64 border rounded bg-default z-10 border-default shadow-xl overflow-x-hidden overflow-y-auto absolute;
264
279
  @apply dark:bg-dark-default dark:border-dark-default;
265
280
 
266
281
  &__container {
@@ -276,6 +291,18 @@ export default defineComponent({
276
291
  }
277
292
  }
278
293
  }
294
+
295
+ &--lg {
296
+ @apply w-[var(--p-dropdown-size-lg)];
297
+ }
298
+
299
+ &--md {
300
+ @apply w-[var(--p-dropdown-size-md)];
301
+ }
302
+
303
+ &--sm {
304
+ @apply w-[var(--p-dropdown-size-sm)];
305
+ }
279
306
  }
280
307
 
281
308
  &__activator > &__caret {
@@ -1,6 +1,7 @@
1
1
  import { PropType } from 'vue-demi';
2
2
  import { Placement } from '@floating-ui/dom';
3
3
  import type { StyleVariant, ColorVariant, SizeVariant } from '../button';
4
+ import type { MenuSizeVariant } from '.';
4
5
  declare const _default: import("vue-demi").DefineComponent<{
5
6
  modelValue: {
6
7
  type: BooleanConstructor;
@@ -50,9 +51,14 @@ declare const _default: import("vue-demi").DefineComponent<{
50
51
  type: (StringConstructor | ArrayConstructor | ObjectConstructor)[];
51
52
  default: undefined;
52
53
  };
54
+ menuSize: {
55
+ type: PropType<MenuSizeVariant>;
56
+ default: string;
57
+ };
53
58
  }, {
54
59
  isOpen: import("vue-demi").Ref<boolean>;
55
60
  classNames: import("vue-demi").ComputedRef<string[]>;
61
+ containerSize: import("vue-demi").ComputedRef<string[]>;
56
62
  toggle: () => void;
57
63
  open: () => void;
58
64
  close: () => void;
@@ -105,6 +111,10 @@ declare const _default: import("vue-demi").DefineComponent<{
105
111
  type: (StringConstructor | ArrayConstructor | ObjectConstructor)[];
106
112
  default: undefined;
107
113
  };
114
+ menuSize: {
115
+ type: PropType<MenuSizeVariant>;
116
+ default: string;
117
+ };
108
118
  }>> & {
109
119
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
110
120
  onShow?: ((...args: any[]) => any) | undefined;
@@ -113,8 +123,8 @@ declare const _default: import("vue-demi").DefineComponent<{
113
123
  variant: StyleVariant;
114
124
  size: SizeVariant;
115
125
  color: ColorVariant;
116
- icon: boolean;
117
126
  text: string;
127
+ icon: boolean;
118
128
  pill: boolean;
119
129
  modelValue: boolean;
120
130
  disabled: boolean;
@@ -122,5 +132,6 @@ declare const _default: import("vue-demi").DefineComponent<{
122
132
  noCaret: boolean;
123
133
  divider: boolean;
124
134
  menuClass: string | Record<string, any> | unknown[];
135
+ menuSize: MenuSizeVariant;
125
136
  }, {}>;
126
137
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import { Ref, InjectionKey } from 'vue-demi';
2
+ export type MenuSizeVariant = 'sm' | 'md' | 'lg';
2
3
  interface DropdownContext {
3
4
  close: () => void;
4
5
  open: () => void;
@@ -92,9 +92,9 @@ declare const _default: import("vue-demi").DefineComponent<{
92
92
  onClose?: ((...args: any[]) => any) | undefined;
93
93
  }, {
94
94
  size: SizeVariant;
95
+ text: string;
95
96
  dismissable: boolean;
96
97
  banner: boolean;
97
- text: string;
98
98
  modelValue: boolean;
99
99
  title: string;
100
100
  centered: boolean;
@@ -82,6 +82,14 @@ export default defineComponent({
82
82
  &__item {
83
83
  &--dropdown {
84
84
  @apply ml-auto;
85
+
86
+ .dropdown {
87
+ &__menu {
88
+ .dropdown__item {
89
+ @apply px-3;
90
+ }
91
+ }
92
+ }
85
93
  }
86
94
  }
87
95
 
@@ -74,8 +74,8 @@ declare const _default: import("vue-demi").DefineComponent<{
74
74
  }, {
75
75
  variant: StyleVariant;
76
76
  size: SizeVariant;
77
- icon: boolean;
78
77
  text: string;
78
+ icon: boolean;
79
79
  modelValue: boolean;
80
80
  placement: Placement;
81
81
  noCaret: boolean;
@@ -82,6 +82,7 @@ export default defineComponent({
82
82
  <style lang="postcss">
83
83
  .navbar {
84
84
  --p-navbar-z-index: theme(zIndex.fixed);
85
+ --p-navbar-collapse-max-height: 20rem; /** 320px */
85
86
 
86
87
  @apply bg-default relative p-3 flex items-center flex-wrap transition-shadow duration-150 ease-in-out;
87
88
  @apply dark:bg-dark-default;
@@ -151,5 +152,103 @@ export default defineComponent({
151
152
  }
152
153
  }
153
154
  }
155
+
156
+ &--collapse {
157
+ @apply basis-full flex-grow items-center max-h-[var(--p-navbar-collapse-max-height)] overflow-y-auto;
158
+
159
+ &.collapse--show {
160
+ @apply mt-3;
161
+
162
+ .nav__item--dropdown {
163
+ @apply ml-0;
164
+
165
+ .dropdown,
166
+ .btn {
167
+ @apply flex w-full;
168
+ }
169
+
170
+ .dropdown {
171
+ @apply flex-col;
172
+
173
+ &__menu {
174
+ @apply static shadow-none border-0 bg-base rounded-t-none;
175
+ @apply dark:bg-dark-base;
176
+
177
+ &__container {
178
+ .dropdown__item {
179
+ @apply first:rounded-t-none;
180
+ }
181
+ }
182
+ }
183
+
184
+ &.dropdown--open {
185
+ .dropdown__activator.btn.btn--md {
186
+ @apply rounded-b-none bg-base;
187
+ @apply dark:bg-dark-base;
188
+ }
189
+ }
190
+ }
191
+
192
+ &-icon {
193
+ .dropdown__menu__container {
194
+ .dropdown__item {
195
+ @apply px-11;
196
+ }
197
+ }
198
+ }
199
+
200
+ .btn {
201
+ @apply justify-start;
202
+
203
+ .dropdown__caret {
204
+ @apply ml-auto;
205
+ }
206
+ }
207
+ }
208
+
209
+ .nav__item,
210
+ .nav__text,
211
+ .nav__form {
212
+ @apply w-full;
213
+ }
214
+ }
215
+ }
216
+
217
+ &&--lines {
218
+ .navbar--collapse {
219
+
220
+ &.collapse--show {
221
+
222
+ .nav__item--dropdown {
223
+
224
+ .dropdown {
225
+ &__menu {
226
+ @apply rounded mt-2;
227
+
228
+ &__container {
229
+ .dropdown__item {
230
+ @apply first:rounded-t;
231
+ }
232
+ }
233
+ }
234
+
235
+ &.dropdown--open {
236
+ .dropdown__activator.btn.btn--md {
237
+ @apply rounded-b-none bg-transparent;
238
+ }
239
+ }
240
+ }
241
+
242
+ &-icon {
243
+ .dropdown__menu__container {
244
+ .dropdown__item {
245
+ @apply px-3;
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }
154
253
  }
155
254
  </style>
@@ -1,18 +1,23 @@
1
1
  <template>
2
2
  <aside
3
+ ref="sidebar"
3
4
  data-testid="sidebar"
4
5
  class="sidebar"
5
6
  :class="classNames">
6
- <slot name="brand" />
7
+ <slot
8
+ v-if="$slots.brand"
9
+ name="brand" />
7
10
  <div
8
11
  ref="sidebarMenus"
9
12
  data-testid="sidebar-menus"
13
+ :data-sidebar-menu="brandHeight"
10
14
  class="sidebar__menus"
11
- :style="`padding-bottom: ${height+40}px`">
15
+ :style="{ 'padding-bottom': bottomHeight }">
12
16
  <slot />
13
17
 
14
18
  <div
15
19
  v-if="$slots.bottom"
20
+ data-testid="sidebar-bottom"
16
21
  class="sidebar__bottom">
17
22
  <slot name="bottom" />
18
23
  </div>
@@ -62,17 +67,24 @@ export default defineComponent({
62
67
  event: "update:modelValue"
63
68
  },
64
69
  emits: ["update:modelValue"],
65
- setup(props) {
70
+ setup(props, { slots }) {
66
71
  provide(SIDEBAR_SETTINGS, {
67
72
  variant: props.variant,
68
73
  align: props.align,
69
74
  type: props.type
70
75
  });
76
+ const sidebar = templateRef("sidebar");
77
+ const sidebarBrand = useSelector(".sidebar__brand", sidebar);
71
78
  const sidebarMenus = templateRef("sidebarMenus");
72
79
  const sidebarBottom = useSelector(".sidebar__bottom", sidebarMenus);
73
- const {
74
- height
75
- } = useElementSize(sidebarBottom);
80
+ const { height } = useElementSize(sidebarBottom);
81
+ const brand = useElementSize(sidebarBrand);
82
+ const brandHeight = computed(() => {
83
+ return slots.brand ? `${brand.height.value + 16}px` : 0;
84
+ });
85
+ const bottomHeight = computed(() => {
86
+ return slots.bottom && !slots.default ? 0 : `${height.value + 24}px`;
87
+ });
76
88
  const model = useVModel(props);
77
89
  const classNames = computed(() => {
78
90
  const result = [""];
@@ -90,7 +102,11 @@ export default defineComponent({
90
102
  result.push("sidebar--show");
91
103
  return result;
92
104
  });
93
- return { classNames, height };
105
+ return {
106
+ classNames,
107
+ bottomHeight,
108
+ brandHeight
109
+ };
94
110
  }
95
111
  });
96
112
  </script>
@@ -130,7 +146,7 @@ export default defineComponent({
130
146
  @apply fixed z-[var(--p-sidebar-z-index)] top-0 h-full shadow-lg overflow-y-auto;
131
147
 
132
148
  .sidebar__menus {
133
- @apply relative min-h-full;
149
+ @apply relative min-h-[calc(100%-v-bind(brandHeight))];
134
150
  }
135
151
 
136
152
  &:not(.sidebar--right) {
@@ -138,7 +154,7 @@ export default defineComponent({
138
154
  }
139
155
 
140
156
  .sidebar__bottom {
141
- @apply absolute -bottom-4 pb-4 w-[calc(100%+1rem)] -left-2 bg-[color:var(--p-sidebar-bg)];
157
+ @apply absolute -bottom-4 w-[calc(100%+1rem)] -left-2 bg-[color:var(--p-sidebar-bg)];
142
158
  @apply dark:bg-[color:var(--p-sidebar-bg-dark)];
143
159
  }
144
160
 
@@ -29,7 +29,8 @@ declare const _default: import("vue-demi").DefineComponent<{
29
29
  };
30
30
  }, {
31
31
  classNames: import("vue-demi").ComputedRef<string[]>;
32
- height: import("vue-demi").Ref<number>;
32
+ bottomHeight: import("vue-demi").ComputedRef<string | 0>;
33
+ brandHeight: import("vue-demi").ComputedRef<string | 0>;
33
34
  }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
34
35
  variant: {
35
36
  type: PropType<StyleVariant>;
@@ -80,10 +80,6 @@ export default defineComponent({
80
80
  @apply pr-3;
81
81
  }
82
82
  }
83
-
84
- /* &&--bottom {
85
- @apply absolute bottom-0;
86
- } */
87
83
  }
88
84
 
89
85
  &&--narrow {
@@ -59,7 +59,9 @@
59
59
  </NavItem>
60
60
  </template>
61
61
  </SidebarNav>
62
- <template #bottom>
62
+ <template
63
+ v-if="$slots.bottom"
64
+ #bottom>
63
65
  <slot name="bottom" />
64
66
  </template>
65
67
  </Sidebar>
@@ -1,2 +1,2 @@
1
- export declare function capitalize(text: string): string;
2
- export declare function formatName(text: string): string;
1
+ export declare function capitalize(text: string): any;
2
+ export declare function formatName(text: string): any;
@@ -1,8 +1,8 @@
1
1
  export function capitalize(text) {
2
- return String(text).toLowerCase().replace(/^\w|([\s,.])(\w)/gm, (i) => i.toUpperCase());
2
+ return String(text).toLowerCase().replaceAll(/^\w|([\s,.])(\w)/gm, (i) => i.toUpperCase());
3
3
  }
4
4
  export function formatName(text) {
5
5
  if (!text)
6
6
  return "";
7
- return capitalize(String(text).trim().replace(/[^\s,.A-Za-z]+/g, ""));
7
+ return capitalize(String(text).trim().replaceAll(/[^\s,.A-Za-z]+/g, ""));
8
8
  }
@@ -94,8 +94,8 @@ declare const _default: import("vue-demi").DefineComponent<{
94
94
  onPrev?: ((...args: any[]) => any) | undefined;
95
95
  }, {
96
96
  image: string;
97
- dismissable: boolean;
98
97
  text: string;
98
+ dismissable: boolean;
99
99
  title: string;
100
100
  step: number;
101
101
  highlight: boolean;
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.13.1"
7
+ "version": "0.14.0"
8
8
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@privyid/persona",
3
3
  "description": "Persona core package",
4
- "version": "0.13.1",
4
+ "version": "0.14.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "url": "https://github.com/privy-open-source/design-system.git",
@@ -88,7 +88,7 @@
88
88
  "extends @privyid/browserslist-config"
89
89
  ],
90
90
  "peerDependencies": {
91
- "@privyid/tailwind-preset": "^0.13.1",
91
+ "@privyid/tailwind-preset": "^0.14.0",
92
92
  "postcss-custom-properties": "^12.1.11",
93
93
  "postcss-hexrgba": "^2.1.0",
94
94
  "postcss-lighten-darken": "^0.9.0",
@@ -99,8 +99,8 @@
99
99
  "@nuxt/module-builder": "^0.3.0",
100
100
  "@nuxt/schema": "3.3.3",
101
101
  "@nuxtjs/tailwindcss": "^6.2.0",
102
- "@privyid/browserslist-config": "^0.13.1",
103
- "@privyid/tailwind-preset": "^0.13.1",
102
+ "@privyid/browserslist-config": "^0.14.0",
103
+ "@privyid/tailwind-preset": "^0.14.0",
104
104
  "@types/sanitize-html": "^2",
105
105
  "browserslist-to-esbuild": "^1.2.0",
106
106
  "nuxt": "3.3.3",