@hkdigital/lib-sveltekit 0.1.15 → 0.1.17

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.
@@ -7,7 +7,7 @@
7
7
  * bg?: string,
8
8
  * classes?: string,
9
9
  * type?: string,
10
- * role?: 'primary' | 'secondary',
10
+ * role?: 'primary' | 'secondary' | 'tertiary' | 'custom',
11
11
  * size?: 'sm' | 'md' | 'lg',
12
12
  * variant?: string,
13
13
  * active?: boolean,
@@ -7,7 +7,7 @@ type Button = {
7
7
  bg?: string;
8
8
  classes?: string;
9
9
  type?: string;
10
- role?: "primary" | "secondary";
10
+ role?: "custom" | "primary" | "secondary" | "tertiary";
11
11
  size?: "sm" | "md" | "lg";
12
12
  variant?: string;
13
13
  active?: boolean;
@@ -26,7 +26,7 @@ declare const Button: import("svelte").Component<{
26
26
  bg?: string;
27
27
  classes?: string;
28
28
  type?: string;
29
- role?: "primary" | "secondary";
29
+ role?: "primary" | "secondary" | "tertiary" | "custom";
30
30
  size?: "sm" | "md" | "lg";
31
31
  variant?: string;
32
32
  active?: boolean;
@@ -0,0 +1,89 @@
1
+ <script>
2
+ /**
3
+ * Grid Layers component
4
+ * This is a grid with only one cell. All direct children are
5
+ * place in the same cell and form a visually stacked component.
6
+ *
7
+ * This can be used to place e.g. texts over an image. Place the
8
+ * image in a layer and the text in another. The standard grid
9
+ * content placement options can be used.
10
+ *
11
+ * Following component guidelines from Skeleton
12
+ * @see https://next.skeleton.dev/docs/resources/contribute/components
13
+ */
14
+
15
+ /**
16
+ * @type {{
17
+ * base?: string,
18
+ * bg?: string,
19
+ * padding?: string,
20
+ * margin?: string,
21
+ * height?: string,
22
+ * classes?: string,
23
+ * style?: string,
24
+ * cellBase?: string,
25
+ * cellBg?: string,
26
+ * cellPadding?: string,
27
+ * cellMargin?: string,
28
+ * cellClasses?: string,
29
+ * cellStyle?: string,
30
+ * children: import('svelte').Snippet,
31
+ * cellAttrs?: { [attr: string]: * },
32
+ * [attr: string]: any
33
+ * }}
34
+ */
35
+ const {
36
+ // Style
37
+ base,
38
+ bg,
39
+ padding,
40
+ margin,
41
+ height,
42
+ classes,
43
+ style,
44
+ cellBase,
45
+ cellBg,
46
+ cellPadding,
47
+ cellMargin,
48
+ cellClasses,
49
+ cellStyle,
50
+
51
+ cellAttrs,
52
+
53
+ // Snippets
54
+ children,
55
+
56
+ // Attributes
57
+ ...attrs
58
+ } = $props();
59
+ </script>
60
+
61
+ <div
62
+ data-component="grid-layers"
63
+ class="relative {base} {bg} {height} {classes} {margin} {padding}"
64
+ {style}
65
+ {...attrs}
66
+ >
67
+ <div
68
+ data-section="layer"
69
+ class="absolute inset-0 grid {cellBase} {cellBg} {cellPadding} {cellMargin} {cellClasses}"
70
+ style={cellStyle}
71
+ >
72
+ {@render children()}
73
+ </div>
74
+ </div>
75
+
76
+ <style>
77
+ /* All children of the layer share the same grid area
78
+ but aren't absolutely positioned */
79
+ [data-section='layer'] {
80
+ grid-template-columns: 1fr;
81
+ grid-template-rows: 1fr;
82
+ }
83
+
84
+ [data-section='layer'] > :global(*) {
85
+ grid-column: 1;
86
+ grid-row: 1;
87
+ z-index: 0; /* Base z-index to allow explicit stacking order */
88
+ }
89
+ </style>
@@ -1,7 +1,8 @@
1
- export default HkGridLayers;
2
- type HkGridLayers = {
1
+ export default GridLayersLayout;
2
+ type GridLayersLayout = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
4
  $set?(props: Partial<{
5
+ [attr: string]: any;
5
6
  base?: string;
6
7
  bg?: string;
7
8
  padding?: string;
@@ -9,20 +10,20 @@ type HkGridLayers = {
9
10
  height?: string;
10
11
  classes?: string;
11
12
  style?: string;
12
- boxBase?: string;
13
- boxBg?: string;
14
- boxPadding?: string;
15
- boxMargin?: string;
16
- boxClasses?: string;
17
- boxAttrs?: {
13
+ cellBase?: string;
14
+ cellBg?: string;
15
+ cellPadding?: string;
16
+ cellMargin?: string;
17
+ cellClasses?: string;
18
+ cellStyle?: string;
19
+ children: Snippet<[]>;
20
+ cellAttrs?: {
18
21
  [attr: string]: any;
19
22
  };
20
- children: Snippet<[]>;
21
- } & {
22
- [attr: string]: any;
23
23
  }>): void;
24
24
  };
25
- declare const HkGridLayers: import("svelte").Component<{
25
+ declare const GridLayersLayout: import("svelte").Component<{
26
+ [attr: string]: any;
26
27
  base?: string;
27
28
  bg?: string;
28
29
  padding?: string;
@@ -30,15 +31,14 @@ declare const HkGridLayers: import("svelte").Component<{
30
31
  height?: string;
31
32
  classes?: string;
32
33
  style?: string;
33
- boxBase?: string;
34
- boxBg?: string;
35
- boxPadding?: string;
36
- boxMargin?: string;
37
- boxClasses?: string;
38
- boxAttrs?: {
34
+ cellBase?: string;
35
+ cellBg?: string;
36
+ cellPadding?: string;
37
+ cellMargin?: string;
38
+ cellClasses?: string;
39
+ cellStyle?: string;
40
+ children: import("svelte").Snippet;
41
+ cellAttrs?: {
39
42
  [attr: string]: any;
40
43
  };
41
- children: import("svelte").Snippet;
42
- } & {
43
- [attr: string]: any;
44
44
  }, {}, "">;
@@ -1,3 +1,3 @@
1
1
  export { default as HkAppLayout } from "./HkAppLayout.svelte";
2
- export { default as HkGridLayers } from "./HkGridLayers.svelte";
2
+ export { default as GridLayersLayout } from "./GridLayersLayout.svelte";
3
3
  export { createOrGetState as createOrGetAppLayoutState, createState as createAppLayoutState, getState as getAppLayoutState } from "./HkAppLayout.state.svelte.js";
@@ -6,4 +6,4 @@ export {
6
6
 
7
7
  export { default as HkAppLayout } from './HkAppLayout.svelte';
8
8
 
9
- export { default as HkGridLayers } from './HkGridLayers.svelte';
9
+ export { default as GridLayersLayout } from './GridLayersLayout.svelte';
@@ -1 +1 @@
1
- export { default as PlainPanel } from "./plain-panel/PlainPanel.svelte";
1
+ export { default as Panel } from "./panel/Panel.svelte";
@@ -1 +1 @@
1
- export { default as PlainPanel } from './plain-panel/PlainPanel.svelte';
1
+ export { default as Panel } from './panel/Panel.svelte';
@@ -9,8 +9,9 @@
9
9
  * @type {{
10
10
  * base?: string,
11
11
  * bg?: string,
12
- * width?: string,
13
- * classes?: string
12
+ * classes?: string,
13
+ * width?: 'sm' | 'md' | 'lg',
14
+ * variant?: string,
14
15
  * children?: import('svelte').Snippet,
15
16
  * } & { [attr: string]: any }}
16
17
  */
@@ -18,9 +19,12 @@
18
19
  // Style
19
20
  base,
20
21
  bg,
21
- width,
22
22
  classes,
23
23
 
24
+ width = 'md',
25
+ variant = 'light',
26
+
27
+ // Snippets
24
28
  children,
25
29
 
26
30
  // Attributes
@@ -28,6 +32,12 @@
28
32
  } = $props();
29
33
  </script>
30
34
 
31
- <div data-panel="plain-panel" class="{base} {bg} {width} {classes}" {...attrs}>
35
+ <div
36
+ data-component="panel"
37
+ data-width={width}
38
+ data-variant={variant}
39
+ class="{base} {bg} {classes}"
40
+ {...attrs}
41
+ >
32
42
  {@render children()}
33
43
  </div>
@@ -1,21 +1,23 @@
1
- export default PlainPanel;
2
- type PlainPanel = {
1
+ export default Panel;
2
+ type Panel = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
4
  $set?(props: Partial<{
5
5
  base?: string;
6
6
  bg?: string;
7
- width?: string;
8
7
  classes?: string;
8
+ width?: "sm" | "md" | "lg";
9
+ variant?: string;
9
10
  children?: Snippet<[]>;
10
11
  } & {
11
12
  [attr: string]: any;
12
13
  }>): void;
13
14
  };
14
- declare const PlainPanel: import("svelte").Component<{
15
+ declare const Panel: import("svelte").Component<{
15
16
  base?: string;
16
17
  bg?: string;
17
- width?: string;
18
18
  classes?: string;
19
+ width?: "sm" | "md" | "lg";
20
+ variant?: string;
19
21
  children?: import("svelte").Snippet;
20
22
  } & {
21
23
  [attr: string]: any;
@@ -40,19 +40,19 @@ export const TEXT_HEADING_SIZES = {
40
40
  };
41
41
 
42
42
  export const TEXT_UI_SIZES = {
43
- sm: { size: 14, lineHeight: 1.1 },
44
- md: { size: 16, lineHeight: 1.1 },
45
- lg: { size: 18, lineHeight: 1.1 }
43
+ sm: { size: 14, lineHeight: 1 },
44
+ md: { size: 16, lineHeight: 1 },
45
+ lg: { size: 18, lineHeight: 1 }
46
46
  };
47
47
 
48
48
  /* == Border radius == */
49
49
 
50
50
  export const RADIUS_SIZES = {
51
51
  none: '0px',
52
- xs: { size: 1 },
53
- sm: { size: 2 },
54
- md: { size: 4 },
55
- lg: { size: 8 },
52
+ xs: { size: 5 },
53
+ sm: { size: 10 },
54
+ md: { size: 25 },
55
+ lg: { size: 35 },
56
56
  full: '9999px'
57
57
  };
58
58
 
@@ -1,10 +1,10 @@
1
1
  @define-mixin component-button {
2
- [data-component="button"] {
2
+ [data-component='button'] {
3
3
  /* ---- Core Button Variables ---- */
4
4
 
5
5
  /* Size variables */
6
- --btn-min-width: calc( 150px * var(--scale-ui) );
7
- --btn-min-height: calc( 40px * var(--scale-ui) );
6
+ --btn-min-width: calc(150px * var(--scale-ui));
7
+ --btn-min-height: calc(40px * var(--scale-ui));
8
8
 
9
9
  /* ---- Primary Button Variables ---- */
10
10
  --btn-primary-bg: var(--color-primary-500);
@@ -48,7 +48,8 @@
48
48
  align-items: center;
49
49
  cursor: pointer;
50
50
  position: relative;
51
- transition-property: background-color, color, border-color, transform, box-shadow;
51
+ transition-property:
52
+ background-color, color, border-color, transform, box-shadow;
52
53
  transition-duration: var(--btn-transition-duration);
53
54
  }
54
55
 
@@ -66,7 +67,7 @@
66
67
  }*/
67
68
 
68
69
  /* Role-based styling for primary buttons */
69
- [data-component="button"][data-role="primary"] {
70
+ [data-component='button'][data-role='primary'] {
70
71
  @apply border-width-normal;
71
72
  border-color: rgb(var(--btn-primary-border));
72
73
  background-color: rgb(var(--btn-primary-bg));
@@ -90,7 +91,7 @@
90
91
  }
91
92
 
92
93
  /* Role-based styling for secondary buttons */
93
- [data-component="button"][data-role="secondary"] {
94
+ [data-component='button'][data-role='secondary'] {
94
95
  @apply border-width-normal;
95
96
  border-color: rgb(var(--btn-secondary-border));
96
97
  color: rgb(var(--btn-secondary-text));
@@ -113,23 +114,27 @@
113
114
  }
114
115
  }
115
116
 
116
- /* State-based styling */
117
- [data-component="button"].state-active {
118
- transform: var(--btn-active-transform);
119
- box-shadow: var(--btn-active-shadow);
120
- }
117
+ /* State-based styling for primary and secondary buttons */
121
118
 
122
- [data-component="button"].state-error {
123
- border-color: rgb(var(--btn-error-border));
124
- }
119
+ [data-component='button'][data-role='primary'],
120
+ [data-component='button'][data-role='secondary'] {
121
+ &.state-active {
122
+ transform: var(--btn-active-transform);
123
+ box-shadow: var(--btn-active-shadow);
124
+ }
125
125
 
126
- [data-component="button"].state-loading {
127
- opacity: var(--btn-loading-opacity);
128
- cursor: wait;
126
+ &.state-error {
127
+ border-color: rgb(var(--btn-error-border));
128
+ }
129
+
130
+ &.state-loading {
131
+ opacity: var(--btn-loading-opacity);
132
+ cursor: wait;
133
+ }
129
134
  }
130
135
 
131
136
  /* Disabled state */
132
- [data-component="button"]:disabled {
137
+ [data-component='button']:disabled {
133
138
  cursor: not-allowed;
134
139
  opacity: var(--btn-disabled-opacity);
135
140
  pointer-events: none;
@@ -0,0 +1,27 @@
1
+ @define-mixin component-panel {
2
+ [data-component='panel'] {
3
+ @apply py-30up px-40up;
4
+ @apply rounded-md;
5
+
6
+ &[data-variant='light'] {
7
+ @apply bg-surface-50;
8
+ }
9
+
10
+ &[data-variant='dark'] {
11
+ @apply bg-surface-950;
12
+ }
13
+
14
+ /* Size variants */
15
+ &[data-width='sm'] {
16
+ width: calc(400px * var(--scale-ui));
17
+ }
18
+
19
+ &[data-width='md'] {
20
+ width: calc(600px * var(--scale-ui));
21
+ }
22
+
23
+ &[data-width='lg'] {
24
+ width: calc(800px * var(--scale-ui));
25
+ }
26
+ }
27
+ }
@@ -1,8 +1,5 @@
1
1
  /* Import component styles */
2
2
 
3
- /* Panels */
4
- /*@import "./components/panels/plain-panel.css";*/
5
-
6
3
  /* Rows */
7
4
  /*@import "./components/rows/panel-grid-row.css";*/
8
5
  /*@import "./components/rows/panel-row-2.css";*/
@@ -17,24 +14,18 @@
17
14
  /* Icons */
18
15
  @import './components/icons/icon-steeze.css';
19
16
 
17
+ /* Panels */
18
+ @import './components/panels/panel.css';
19
+
20
20
  /* Inputs */
21
21
  @import './components/inputs/text-input.css';
22
22
 
23
23
  /* ... */
24
- /*@import "./components/select-level.css";*/
25
24
  @import './components/blocks/text-block.css';
26
25
 
27
- /* Not used */
28
- /*@import "./components/hk-tab-icon.css";*/
29
- /*@import "./components/avatar-layer.css";*/
30
-
31
26
  /* Wrap component styles in theme selector */
32
27
 
33
28
  [data-theme='hkdev'] {
34
- /* Panels */
35
- /* @mixin panels-plain-panel;*/
36
- /* @mixin panels-speech-bubble;*/
37
-
38
29
  /* Rows */
39
30
  /* @mixin rows-panel-grid-row;*/
40
31
  /* @mixin rows-panel-row-2;*/
@@ -47,13 +38,10 @@
47
38
 
48
39
  @mixin component-icon-steeze;
49
40
 
41
+ @mixin component-panel;
42
+
50
43
  @mixin text_block;
51
44
 
52
45
  /* Inputs */
53
46
  @mixin inputs-text-input;
54
-
55
- /* ... */
56
- /* @mixin hk_tab_icon;*/
57
- /* @mixin avatar_layer;*/
58
- /* @mixin select_level;*/
59
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"
@@ -1,82 +0,0 @@
1
- <script>
2
- /**
3
- * Grid Layers component
4
- * This is a grid with only one cell. All direct children are
5
- * place in the same cell and form a visually stacked component.
6
- *
7
- * This can be used to place e.g. texts over an image. Place the
8
- * image in a layer and the text in another. The standard grid
9
- * content placement options can be used.
10
- *
11
- * Following component guidelines from Skeleton
12
- * @see https://next.skeleton.dev/docs/resources/contribute/components
13
- */
14
-
15
- /**
16
- * @type {{
17
- * base?: string,
18
- * bg?: string,
19
- * padding?: string,
20
- * margin?: string,
21
- * height?: string,
22
- * classes?: string,
23
- * style?: string,
24
- * boxBase?: string,
25
- * boxBg?: string,
26
- * boxPadding?: string,
27
- * boxMargin?: string,
28
- * boxClasses?: string,
29
- * boxAttrs?: { [attr: string]: * },
30
- * children: import('svelte').Snippet
31
- * } & { [attr: string]: any }}
32
- */
33
- const {
34
- // Style
35
- base,
36
- bg,
37
- padding,
38
- margin,
39
- height = 'h-full',
40
- classes,
41
- style,
42
- boxBase,
43
- boxBg,
44
- boxPadding,
45
- boxMargin,
46
- boxClasses,
47
-
48
- // Snippets
49
- children,
50
-
51
- // Attributes
52
- ...attrs
53
- } = $props();
54
- </script>
55
-
56
- <div
57
- data-hk-grid-layers-box
58
- class="{boxBase} {boxBg} {boxPadding} {boxMargin} {boxClasses}"
59
- {...attrs}
60
- >
61
- <div
62
- data-hk-grid-layers
63
- class="grid grid-cols-1 grid-rows-1 {base} {bg} {height} {classes} {margin} {padding}"
64
- {style}
65
- >
66
- {@render children()}
67
- </div>
68
- </div>
69
-
70
- <style>
71
- [data-hk-grid-layers] > :global(.area-above) {
72
- grid-area: 1/1/2/2;
73
- }
74
-
75
- [data-hk-grid-layers] > :global(*) {
76
- grid-area: 2/1/3/2;
77
- }
78
-
79
- [data-hk-grid-layers] > :global(.area-below) {
80
- grid-area: 3/1/4/2;
81
- }
82
- </style>
@@ -1,44 +0,0 @@
1
- /*@import "../../global/on-colors.css";*/
2
-
3
- @define-mixin panels-plain-panel {
4
- [data-panel='plain-panel'] {
5
- @mixin on_surface_light;
6
- @apply bg-primary-50;
7
-
8
- @apply p-40p rounded-md;
9
-
10
- max-width: 50vw;
11
- /* max-width: 27vw;*/
12
- /* width: 26vw; */
13
-
14
- & picture {
15
- display: block;
16
- max-width: 100%;
17
- @apply pr-80p;
18
- /* border: solid 1px red; */
19
- }
20
-
21
- & > .h1 {
22
- @apply text-32p mb-20p;
23
- }
24
-
25
- & > .p {
26
- @apply text-24p mb-10p;
27
-
28
- & + picture {
29
- @apply mt-40p;
30
- }
31
- }
32
-
33
- & button {
34
- /* @apply min-w-180p; */
35
- }
36
-
37
- & .cc_cols-stretch {
38
- @apply grid auto-cols-fr grid-flow-col;
39
- @apply justify-stretch;
40
-
41
- border: solid 8px red;
42
- }
43
- }
44
- }
@@ -1,46 +0,0 @@
1
- @import '../../global/on-colors.css';
2
-
3
- @define-mixin panels-speech-bubble {
4
- [data-panel='speech-bubble'] {
5
- @mixin on_surface_light;
6
- @apply bg-primary-50;
7
-
8
- @apply pt-20p pb-20p pr-40p pl-40p rounded-tl-lg rounded-tr-lg rounded-bl-lg;
9
-
10
- /* max-width: 26vw;*/
11
- /* width: 26vw; */
12
-
13
- &.small {
14
- max-width: 16vw;
15
- }
16
-
17
- & picture {
18
- display: block;
19
- max-width: 100%;
20
- @apply pr-80p;
21
- /* border: solid 1px red; */
22
- }
23
-
24
- & [data-section='title'] {
25
- & .h1 {
26
- @apply text-32p pt-8p pb-8p;
27
- }
28
- }
29
-
30
- & [data-section='text'] {
31
- & .p {
32
- @apply text-20p pb-10p;
33
-
34
- /*& + picture {
35
- @apply mt-40p;
36
- }*/
37
- }
38
- }
39
-
40
- /* Footer */
41
-
42
- & [data-row][data-section='footer'] {
43
- @apply pt-10p;
44
- }
45
- }
46
- }