noph-ui 0.10.13 → 0.11.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.
package/README.md CHANGED
@@ -69,15 +69,14 @@ Beta (No breaking changes expected)
69
69
 
70
70
  In progress (Breaking changes expected)
71
71
 
72
- - Chips
72
+ - Chips (Docs missing)
73
73
  - Dialogs (Fullscreen + Docs missing)
74
74
  - Menus (Positioning missing + Docs missing)
75
- - Navigation Rail (Badge is missing)
75
+ - Navigation Drawer (Docs missing)
76
+ - Navigation Rail (Badge is missing + Docs missing)
76
77
  - Tooltips (Positioning missing)
77
- - Select
78
+ - Select (iOS issues)
78
79
 
79
80
  Pending
80
81
 
81
- - Sliders
82
- - Switch
83
82
  - Tabs
@@ -125,8 +125,10 @@
125
125
  }
126
126
  .text-disabled {
127
127
  border-radius: var(--np-icon-button-container-shape, var(--np-shape-corner-full));
128
- height: var(--np-icon-button-container-height, 2.5rem);
129
- width: var(--np-icon-button-container-width, 2.5rem);
128
+ --_button-height: var(--np-icon-button-container-height, 2.5rem);
129
+ --_button-width: var(--np-icon-button-container-width, 2.5rem);
130
+ height: var(--_button-height);
131
+ width: var(--_button-width);
130
132
  --_icon-size: var(--np-icon-button-icon-size);
131
133
  }
132
134
  .filled-disabled {
@@ -176,8 +178,10 @@
176
178
  --np-ripple-pressed-color: var(--np-icon-button-icon-color, var(--np-color-on-surface-variant));
177
179
  color: var(--np-icon-button-icon-color, var(--np-color-on-surface-variant));
178
180
  border-radius: var(--np-icon-button-container-shape, var(--np-shape-corner-full));
179
- height: var(--np-icon-button-container-height, 2.5rem);
180
- width: var(--np-icon-button-container-width, 2.5rem);
181
+ --_button-height: var(--np-icon-button-container-height, 2.5rem);
182
+ --_button-width: var(--np-icon-button-container-width, 2.5rem);
183
+ height: var(--_button-height);
184
+ width: var(--_button-width);
181
185
  --_icon-size: var(--np-icon-button-icon-size);
182
186
  }
183
187
  .text.toggle {
@@ -255,7 +259,7 @@
255
259
  }
256
260
  .np-touch {
257
261
  position: absolute;
258
- height: max(48px, 100%);
259
- width: max(48px, 100%);
262
+ height: max(calc(var(--_button-height, 40px) + 8px), 100%);
263
+ width: max(calc(var(--_button-width, 40px) + 8px), 100%);
260
264
  }
261
265
  </style>
@@ -0,0 +1,186 @@
1
+ <script lang="ts">
2
+ import IconButton from '../button/IconButton.svelte'
3
+ import CheckIcon from '../icons/CheckIcon.svelte'
4
+ import CloseIcon from '../icons/CloseIcon.svelte'
5
+ import Ripple from '../ripple/Ripple.svelte'
6
+ import type { FilterChipProps } from './types.ts'
7
+
8
+ let {
9
+ selected = $bindable(false),
10
+ removable = false,
11
+ elevated = false,
12
+ disabled = false,
13
+ label = '',
14
+ icon,
15
+ ...attributes
16
+ }: FilterChipProps = $props()
17
+
18
+ let chipBtn: HTMLButtonElement | undefined = $state()
19
+ </script>
20
+
21
+ <div
22
+ {...attributes}
23
+ class={[
24
+ 'np-filter-chip',
25
+ elevated ? 'np-filter-chip-elevated' : 'np-filter-chip-default',
26
+ icon || selected ? 'np-filter-chip-icon' : '',
27
+ selected ? 'np-filter-chip-selected' : '',
28
+ removable ? 'np-filter-chip-removable' : '',
29
+ disabled ? 'np-filter-chip-disabled' : '',
30
+ attributes.class,
31
+ ]}
32
+ >
33
+ <button
34
+ bind:this={chipBtn}
35
+ class="np-filter-chip-btn"
36
+ {disabled}
37
+ onclick={() => {
38
+ console.log('click')
39
+ selected = !selected
40
+ }}
41
+ >
42
+ {#if icon && !selected}
43
+ {@render icon()}
44
+ {/if}
45
+ {#if selected}
46
+ <CheckIcon width={18} height={18} />
47
+ {/if}
48
+ <div class="np-chip-label">{label}</div>
49
+ </button>
50
+ {#if !disabled}
51
+ <Ripple forElement={chipBtn} />
52
+ {/if}
53
+ {#if removable}
54
+ <IconButton
55
+ {disabled}
56
+ --np-icon-button-container-height="1.75rem"
57
+ --np-icon-button-container-width="1.75rem"
58
+ --np-icon-button-icon-size="1.125rem"
59
+ onclick={(event: Event) => {
60
+ event.stopPropagation()
61
+ }}
62
+ >
63
+ <CloseIcon />
64
+ </IconButton>
65
+ {/if}
66
+ </div>
67
+
68
+ <style>
69
+ .np-filter-chip {
70
+ position: relative;
71
+ display: inline-flex;
72
+ align-items: center;
73
+ user-select: none;
74
+ border-radius: var(--np-filter-chip-container-shape, var(--np-shape-corner-small));
75
+ --np-icon-button-icon-color: var(--np-color-on-surface-variant);
76
+ --np-icon-size: 1.125rem;
77
+ }
78
+ .np-filter-chip-btn {
79
+ box-sizing: border-box;
80
+ font-family: inherit;
81
+ background-color: transparent;
82
+ border-width: 0;
83
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
84
+ cursor: pointer;
85
+ display: inline-flex;
86
+ align-items: center;
87
+ padding: 0;
88
+ height: 2rem;
89
+ color: var(--np-color-on-surface-variant);
90
+ fill: currentColor;
91
+ gap: 0.5rem;
92
+ z-index: 1;
93
+ padding-left: 1rem;
94
+ padding-right: 1rem;
95
+ }
96
+ .np-filter-chip-icon .np-filter-chip-btn {
97
+ padding-left: 0.5rem;
98
+ }
99
+ .np-filter-chip-removable {
100
+ padding-right: 2px;
101
+ }
102
+ .np-filter-chip-removable .np-filter-chip-btn {
103
+ padding-right: 2px;
104
+ }
105
+ .np-chip-label {
106
+ line-height: 1.25rem;
107
+ font-size: 0.875rem;
108
+ font-weight: 500;
109
+ }
110
+ .np-filter-chip::before {
111
+ content: '';
112
+ position: absolute;
113
+ inset: 0;
114
+ border-radius: inherit;
115
+ pointer-events: none;
116
+ background-color: var(--np-color-surface-container-low);
117
+ }
118
+ .np-filter-chip-default::before {
119
+ border-width: 1px;
120
+ border-style: solid;
121
+ border-color: var(--np-filter-chip-outline-color, var(--np-color-outline-variant));
122
+ }
123
+ .np-filter-chip-selected::before {
124
+ border-width: 0;
125
+ background-color: var(--np-color-secondary-container);
126
+ }
127
+ .np-filter-chip-elevated {
128
+ border-width: 0;
129
+ box-shadow: var(--np-elevation-1);
130
+ }
131
+ .np-filter-chip-selected {
132
+ --np-icon-button-icon-color: var(--np-color-on-secondary-container);
133
+ }
134
+ .np-filter-chip-selected .np-filter-chip-btn {
135
+ color: var(--np-color-on-secondary-container);
136
+ }
137
+ .np-filter-chip-btn:focus-visible {
138
+ outline-width: 0;
139
+ }
140
+ .np-filter-chip:has(.np-filter-chip-btn:focus-visible) {
141
+ outline-style: solid;
142
+ outline-color: var(--np-color-primary);
143
+ outline-width: 3px;
144
+ outline-offset: 2px;
145
+ animation: focusAnimation 0.3s ease forwards;
146
+ }
147
+ @keyframes focusAnimation {
148
+ 0% {
149
+ outline-width: 3px;
150
+ }
151
+ 50% {
152
+ outline-width: 6px;
153
+ }
154
+ 100% {
155
+ outline-width: 3px;
156
+ }
157
+ }
158
+
159
+ .np-filter-chip-disabled .np-filter-chip-btn {
160
+ cursor: default;
161
+ color: var(--np-color-on-surface);
162
+ opacity: 0.38;
163
+ }
164
+ .np-filter-chip-disabled.np-filter-chip-elevated {
165
+ box-shadow: none;
166
+ }
167
+ .np-filter-chip-disabled.np-filter-chip-selected::before {
168
+ opacity: 0.12;
169
+ }
170
+ :not(.np-filter-chip-selected).np-filter-chip-disabled.np-filter-chip-default::after {
171
+ content: '';
172
+ position: absolute;
173
+ inset: 0;
174
+ border-radius: inherit;
175
+ pointer-events: none;
176
+ border-width: 1px;
177
+ border-style: solid;
178
+ border-color: var(--np-color-on-surface);
179
+ opacity: 0.12;
180
+ }
181
+ .np-filter-chip-disabled::before {
182
+ background-color: var(--np-color-on-surface);
183
+ opacity: 0.12;
184
+ border-width: 0;
185
+ }
186
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { FilterChipProps } from './types.ts';
2
+ declare const FilterChip: import("svelte").Component<FilterChipProps, {}, "selected">;
3
+ type FilterChip = ReturnType<typeof FilterChip>;
4
+ export default FilterChip;
@@ -1 +1 @@
1
- export { default as Chip } from './Chip.svelte';
1
+ export { default as FilterChip } from './FilterChip.svelte';
@@ -1 +1 @@
1
- export { default as Chip } from './Chip.svelte';
1
+ export { default as FilterChip } from './FilterChip.svelte';
@@ -1 +1,10 @@
1
- export {};
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
4
+ selected?: boolean;
5
+ removable?: boolean;
6
+ disabled?: boolean;
7
+ elevated?: boolean;
8
+ label?: string;
9
+ icon?: Snippet;
10
+ }
@@ -1 +1 @@
1
- "use strict";
1
+ export {};
@@ -1,3 +1,13 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"
1
+ <script lang="ts">
2
+ let {
3
+ height = 24,
4
+ width = 24,
5
+ }: {
6
+ height?: number
7
+ width?: number
8
+ } = $props()
9
+ </script>
10
+
11
+ <svg xmlns="http://www.w3.org/2000/svg" {height} viewBox="0 -960 960 960" {width}
2
12
  ><path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" /></svg
3
13
  >
@@ -1,26 +1,7 @@
1
- export default CheckIcon;
2
- type CheckIcon = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
1
+ type $$ComponentProps = {
2
+ height?: number;
3
+ width?: number;
8
4
  };
9
- declare const CheckIcon: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
5
+ declare const CheckIcon: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type CheckIcon = ReturnType<typeof CheckIcon>;
7
+ export default CheckIcon;
@@ -1,4 +1,14 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"
1
+ <script lang="ts">
2
+ let {
3
+ height = 24,
4
+ width = 24,
5
+ }: {
6
+ height?: number
7
+ width?: number
8
+ } = $props()
9
+ </script>
10
+
11
+ <svg xmlns="http://www.w3.org/2000/svg" {height} viewBox="0 -960 960 960" {width}
2
12
  ><path
3
13
  d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
4
14
  /></svg
@@ -1,26 +1,7 @@
1
- export default CloseIcon;
2
- type CloseIcon = SvelteComponent<{
3
- [x: string]: never;
4
- }, {
5
- [evt: string]: CustomEvent<any>;
6
- }, {}> & {
7
- $$bindings?: string | undefined;
1
+ type $$ComponentProps = {
2
+ height?: number;
3
+ width?: number;
8
4
  };
9
- declare const CloseIcon: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
11
- }, {
12
- [evt: string]: CustomEvent<any>;
13
- }, {}, {}, string>;
14
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
15
- new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
16
- $$bindings?: Bindings;
17
- } & Exports;
18
- (internal: unknown, props: {
19
- $$events?: Events;
20
- $$slots?: Slots;
21
- }): Exports & {
22
- $set?: any;
23
- $on?: any;
24
- };
25
- z_$$bindings?: Bindings;
26
- }
5
+ declare const CloseIcon: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type CloseIcon = ReturnType<typeof CloseIcon>;
7
+ export default CloseIcon;
@@ -63,6 +63,7 @@
63
63
  rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
64
64
  --np-shape-corner-full: 9999px;
65
65
  --np-shape-corner-extra-small: 0.25rem;
66
+ --np-shape-corner-small: 0.5rem;
66
67
  --np-shape-corner-medium: 0.75rem;
67
68
  --np-shape-corner-large: 1rem;
68
69
  --np-shape-corner-extra-large: 1.75rem;
package/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './button/types.ts';
2
2
  export * from './card/types.ts';
3
3
  export * from './checkbox/types.ts';
4
4
  export * from './chip/types.ts';
5
+ export * from './dialog/types.js';
5
6
  export * from './divider/types.js';
6
7
  export * from './list/types.ts';
7
8
  export * from './menu/types.ts';
@@ -10,6 +11,7 @@ export * from './navigation-rail/types.ts';
10
11
  export * from './progress/types.js';
11
12
  export * from './radio/types.ts';
12
13
  export * from './ripple/types.ts';
14
+ export * from './select/types.js';
13
15
  export * from './snackbar/types.ts';
14
16
  export * from './text-field/types.ts';
15
17
  export * from './tooltip/types.ts';
package/dist/types.js CHANGED
@@ -2,6 +2,7 @@ export * from './button/types.ts';
2
2
  export * from './card/types.ts';
3
3
  export * from './checkbox/types.ts';
4
4
  export * from './chip/types.ts';
5
+ export * from './dialog/types.js';
5
6
  export * from './divider/types.js';
6
7
  export * from './list/types.ts';
7
8
  export * from './menu/types.ts';
@@ -10,6 +11,7 @@ export * from './navigation-rail/types.ts';
10
11
  export * from './progress/types.js';
11
12
  export * from './radio/types.ts';
12
13
  export * from './ripple/types.ts';
14
+ export * from './select/types.js';
13
15
  export * from './snackbar/types.ts';
14
16
  export * from './text-field/types.ts';
15
17
  export * from './tooltip/types.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.10.13",
3
+ "version": "0.11.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {
@@ -66,7 +66,7 @@
66
66
  "prettier": "^3.4.2",
67
67
  "prettier-plugin-svelte": "^3.3.3",
68
68
  "publint": "^0.3.2",
69
- "svelte": "^5.19.3",
69
+ "svelte": "^5.19.4",
70
70
  "svelte-check": "^4.1.4",
71
71
  "typescript": "^5.7.3",
72
72
  "typescript-eslint": "^8.22.0",
@@ -1,14 +0,0 @@
1
- <script lang="ts">
2
- let { ...attributes } = $props()
3
- </script>
4
-
5
- <template class="divider {attributes.class}"></template>
6
-
7
- <style>
8
- .divider {
9
- height: 1px;
10
- width: 100%;
11
- display: flex;
12
- background-color: var(--np-color-outline-variant);
13
- }
14
- </style>
@@ -1,3 +0,0 @@
1
- declare const Chip: import("svelte").Component<Record<string, any>, {}, "">;
2
- type Chip = ReturnType<typeof Chip>;
3
- export default Chip;