noph-ui 0.12.2 → 0.12.3

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
@@ -80,3 +80,4 @@ In progress (Breaking changes expected)
80
80
  Pending
81
81
 
82
82
  - Tabs
83
+ - Date Field
@@ -3,6 +3,7 @@
3
3
  import Tooltip from '../tooltip/Tooltip.svelte'
4
4
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
5
5
  import type { ButtonProps } from './types.ts'
6
+ import CircularProgress from '../progress/CircularProgress.svelte'
6
7
 
7
8
  let {
8
9
  variant = 'outlined',
@@ -12,6 +13,7 @@
12
13
  title,
13
14
  element = $bindable(),
14
15
  disabled = false,
16
+ loading = false,
15
17
  keepTooltipOnClick,
16
18
  ...attributes
17
19
  }: ButtonProps = $props()
@@ -27,9 +29,14 @@
27
29
  </script>
28
30
 
29
31
  {#snippet content()}
30
- {#if !disabled}
32
+ {#if !disabled && !loading}
31
33
  <Ripple />
32
34
  {/if}
35
+ {#if loading}
36
+ <div class="circular-progress">
37
+ <CircularProgress indeterminate />
38
+ </div>
39
+ {/if}
33
40
  <div class="button-icon">
34
41
  {#if start}
35
42
  {@render start()}
@@ -47,16 +54,17 @@
47
54
  </div>
48
55
  {/snippet}
49
56
 
50
- {#if isButton(attributes) || disabled}
57
+ {#if isButton(attributes) || disabled || loading}
51
58
  <button
52
59
  {...attributes as HTMLButtonAttributes}
53
60
  aria-describedby={title ? tooltipId : attributes['aria-describedby']}
54
61
  aria-label={title || attributes['aria-label']}
55
- {disabled}
62
+ disabled={disabled || loading}
56
63
  bind:this={element}
57
64
  class={[
58
65
  'np-button',
59
- disabled ? `${variant}-disabled disabled` : `${variant} enabled`,
66
+ loading ? 'np-loading' : '',
67
+ disabled || loading ? `${variant}-disabled disabled` : `${variant} enabled`,
60
68
  attributes.class,
61
69
  ]}
62
70
  >
@@ -85,6 +93,18 @@
85
93
  text-overflow: ellipsis;
86
94
  text-wrap: nowrap;
87
95
  }
96
+ .circular-progress {
97
+ --np-circular-progress-size: calc(var(--button-height) * 0.75);
98
+ --np-circular-progress-color: color-mix(in srgb, var(--np-color-on-surface) 38%, transparent);
99
+ position: absolute;
100
+ top: 50%;
101
+ left: 50%;
102
+ transform: translate(-50%, -50%);
103
+ }
104
+ .np-loading .button-icon,
105
+ .np-loading .children-wrapper {
106
+ opacity: 0;
107
+ }
88
108
  .np-button {
89
109
  box-sizing: border-box;
90
110
  font-family: inherit;
@@ -6,6 +6,7 @@ interface ButtonButtonProps extends HTMLButtonAttributes {
6
6
  end?: Snippet | undefined;
7
7
  element?: HTMLElement;
8
8
  disabled?: boolean;
9
+ loading?: boolean;
9
10
  keepTooltipOnClick?: boolean;
10
11
  }
11
12
  interface ButtonAnchorProps extends HTMLAnchorAttributes {
@@ -15,6 +16,7 @@ interface ButtonAnchorProps extends HTMLAnchorAttributes {
15
16
  element?: HTMLElement;
16
17
  keepTooltipOnClick?: boolean;
17
18
  disabled?: boolean;
19
+ loading?: boolean;
18
20
  }
19
21
  interface IconButtonButtonProps extends HTMLButtonAttributes {
20
22
  variant?: 'text' | 'filled' | 'outlined' | 'tonal';
@@ -1,4 +1,4 @@
1
1
  import type { CheckboxProps } from './types.ts';
2
- declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "element" | "group" | "checked" | "indeterminate">;
2
+ declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "element" | "group" | "indeterminate" | "checked">;
3
3
  type Checkbox = ReturnType<typeof Checkbox>;
4
4
  export default Checkbox;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {
@@ -65,8 +65,8 @@
65
65
  "globals": "^15.14.0",
66
66
  "prettier": "^3.4.2",
67
67
  "prettier-plugin-svelte": "^3.3.3",
68
- "publint": "^0.3.3",
69
- "svelte": "^5.19.7",
68
+ "publint": "^0.3.4",
69
+ "svelte": "^5.19.9",
70
70
  "svelte-check": "^4.1.4",
71
71
  "typescript": "^5.7.3",
72
72
  "typescript-eslint": "^8.23.0",