noph-ui 0.14.3 → 0.15.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.
@@ -19,7 +19,7 @@
19
19
  ...attributes
20
20
  }: ButtonProps = $props()
21
21
 
22
- let uid = $props.id()
22
+ const uid = $props.id()
23
23
 
24
24
  const isButton = (obj: unknown): obj is HTMLButtonAttributes => {
25
25
  return (obj as HTMLAnchorAttributes).href === undefined
@@ -121,11 +121,11 @@
121
121
  overflow: hidden;
122
122
  font-weight: 500;
123
123
  text-decoration: none;
124
- font-size: calc(var(--button-height) * 0.35);
124
+ font-size: var(--np-button-label-text-font-size, calc(var(--button-height) * 0.35));
125
125
  height: var(--button-height);
126
- padding-left: calc((var(--button-height) - 0.5rem) / 2);
127
- padding-right: calc((var(--button-height) - 0.5rem) / 2);
128
- gap: calc((var(--button-height) - 1.5rem) / 2);
126
+ padding-left: var(--np-button-padding-left, calc((var(--button-height) - 0.5rem) / 2));
127
+ padding-right: var(--np-button-padding-right, calc((var(--button-height) - 0.5rem) / 2));
128
+ gap: var(--np-button-gap, calc((var(--button-height) - 1.5rem) / 2));
129
129
  }
130
130
  .disabled {
131
131
  pointer-events: none;
@@ -263,6 +263,7 @@
263
263
  box-shadow: var(--np-elevation-1);
264
264
  }
265
265
  .outlined {
266
+ background-color: var(--np-outlined-button-container-color, transparent);
266
267
  border: 1px solid;
267
268
  --button-height: var(--np-outlined-button-container-height, 2.5rem);
268
269
  --np-ripple-hover-color: var(--np-outlined-button-label-text-color, var(--np-color-primary));
@@ -278,8 +279,8 @@
278
279
  }
279
280
 
280
281
  :global(.np-button .button-icon) {
281
- --_icon-size: calc((var(--button-height) - 0.375rem) / 2);
282
- --_icon-color: inherit;
282
+ --_icon-size: var(--np-button-icon-size, calc((var(--button-height) - 0.375rem) / 2));
283
+ --_icon-color: var(--np-button-icon-color, inherit);
283
284
  }
284
285
 
285
286
  :global(.np-button .button-icon svg) {
@@ -22,7 +22,7 @@
22
22
  ...attributes
23
23
  }: IconButtonProps = $props()
24
24
 
25
- let uid = $props.id()
25
+ const uid = $props.id()
26
26
  let selectedState = $state(!toggle || selected)
27
27
  let touchEl: HTMLSpanElement | undefined = $state()
28
28
 
@@ -73,7 +73,7 @@
73
73
  width: 18px;
74
74
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
75
75
  cursor: pointer;
76
- margin: max(0px, (48px - 18px)/2);
76
+ margin: var(--np-checkbox-margin, max(0px, (48px - 18px)/2));
77
77
  }
78
78
  .np-host:has(input:disabled) {
79
79
  cursor: default;
@@ -0,0 +1,39 @@
1
+ <script lang="ts">
2
+ import type { AssistChipProps } from './types.ts'
3
+ import Button from '../button/Button.svelte'
4
+
5
+ let {
6
+ elevated = false,
7
+ disabled = false,
8
+ label = '',
9
+ icon,
10
+ element = $bindable(),
11
+ ...attributes
12
+ }: AssistChipProps = $props()
13
+ </script>
14
+
15
+ <Button
16
+ --np-elevated-button-container-shape="var(--np-assist-chip-container-shape, var(--np-shape-corner-small))"
17
+ --np-outlined-button-container-shape="var(--np-assist-chip-container-shape, var(--np-shape-corner-small))"
18
+ --np-elevated-button-label-text-color="var(--np-assist-chip-label-text-color, var(--np-color-on-surface-variant))"
19
+ --np-outlined-button-label-text-color="var(--np-assist-chip-label-text-color, var(--np-color-on-surface-variant))"
20
+ --np-outlined-button-outline-color="var(--np-assist-chip-outline-color, var(--np-color-outline-variant))"
21
+ --np-elevated-button-container-height="2rem"
22
+ --np-outlined-button-container-height="2rem"
23
+ --np-button-label-text-font-size="0.875rem"
24
+ --np-button-icon-size="1.125rem"
25
+ --np-button-padding-left="0.5rem"
26
+ --np-button-padding-right="0.5rem"
27
+ --np-button-gap="0.5rem"
28
+ --np-button-icon-color="var(--np-color-primary)"
29
+ --np-outlined-button-container-color="var(--np-color-surface-container-low)"
30
+ bind:element
31
+ variant={elevated ? 'elevated' : 'outlined'}
32
+ {disabled}
33
+ {...attributes}
34
+ >
35
+ {#snippet start()}
36
+ {@render icon?.()}
37
+ {/snippet}
38
+ {label}
39
+ </Button>
@@ -0,0 +1,4 @@
1
+ import type { AssistChipProps } from './types.ts';
2
+ declare const AssistChip: import("svelte").Component<AssistChipProps, {}, "element">;
3
+ type AssistChip = ReturnType<typeof AssistChip>;
4
+ export default AssistChip;
@@ -1,3 +1,4 @@
1
1
  export { default as FilterChip } from './FilterChip.svelte';
2
+ export { default as AssistChip } from './AssistChip.svelte';
2
3
  export { default as InputChip } from './InputChip.svelte';
3
4
  export { default as ChipSet } from './ChipSet.svelte';
@@ -1,3 +1,4 @@
1
1
  export { default as FilterChip } from './FilterChip.svelte';
2
+ export { default as AssistChip } from './AssistChip.svelte';
2
3
  export { default as InputChip } from './InputChip.svelte';
3
4
  export { default as ChipSet } from './ChipSet.svelte';
@@ -1,6 +1,21 @@
1
1
  import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
3
3
  export type ChipSetProps = HTMLAttributes<HTMLDivElement>;
4
+ interface AssistChipButtonProps extends HTMLButtonAttributes {
5
+ elevated?: boolean;
6
+ disabled?: boolean;
7
+ label?: string;
8
+ icon?: Snippet;
9
+ element?: HTMLDivElement;
10
+ }
11
+ interface AssistChipAnchorProps extends HTMLAnchorAttributes {
12
+ elevated?: boolean;
13
+ disabled?: boolean;
14
+ label?: string;
15
+ icon?: Snippet;
16
+ element?: HTMLDivElement;
17
+ }
18
+ export type AssistChipProps = AssistChipButtonProps | AssistChipAnchorProps;
4
19
  export interface FilterChipProps extends HTMLAttributes<HTMLDivElement> {
5
20
  selected?: boolean;
6
21
  removable?: boolean;
@@ -33,3 +48,4 @@ export interface InputChipProps extends HTMLAttributes<HTMLDivElement> {
33
48
  currentTarget: EventTarget & HTMLButtonElement;
34
49
  }) => void;
35
50
  }
51
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.14.3",
3
+ "version": "0.15.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {
@@ -52,27 +52,27 @@
52
52
  "svelte": "^5.20.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@eslint/js": "^9.21.0",
55
+ "@eslint/js": "^9.22.0",
56
56
  "@material/material-color-utilities": "^0.3.0",
57
- "@playwright/test": "^1.50.1",
57
+ "@playwright/test": "^1.51.0",
58
58
  "@sveltejs/adapter-vercel": "^5.6.3",
59
- "@sveltejs/kit": "^2.18.0",
59
+ "@sveltejs/kit": "^2.19.0",
60
60
  "@sveltejs/package": "^2.3.10",
61
61
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
62
62
  "@types/eslint": "^9.6.1",
63
- "eslint": "^9.21.0",
64
- "eslint-config-prettier": "^10.0.2",
65
- "eslint-plugin-svelte": "^3.0.2",
63
+ "eslint": "^9.22.0",
64
+ "eslint-config-prettier": "^10.1.1",
65
+ "eslint-plugin-svelte": "^3.1.0",
66
66
  "globals": "^16.0.0",
67
67
  "prettier": "^3.5.3",
68
68
  "prettier-plugin-svelte": "^3.3.3",
69
- "publint": "^0.3.8",
70
- "svelte": "^5.22.1",
71
- "svelte-check": "^4.1.4",
69
+ "publint": "^0.3.9",
70
+ "svelte": "^5.22.6",
71
+ "svelte-check": "^4.1.5",
72
72
  "typescript": "^5.8.2",
73
- "typescript-eslint": "^8.26.0",
74
- "vite": "^6.2.0",
75
- "vitest": "^3.0.7"
73
+ "typescript-eslint": "^8.26.1",
74
+ "vite": "^6.2.1",
75
+ "vitest": "^3.0.8"
76
76
  },
77
77
  "svelte": "./dist/index.js",
78
78
  "types": "./dist/index.d.ts",