noph-ui 0.7.6 → 0.7.8

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
@@ -56,12 +56,12 @@ Beta (No breaking changes expected)
56
56
 
57
57
  - Buttons
58
58
  - Cards
59
- - Checkbox (Docs missing)
59
+ - Checkbox
60
60
  - Divider
61
61
  - Icon buttons
62
62
  - Lists (Docs missing)
63
63
  - Progress indicators
64
- - Radio (Docs missing)
64
+ - Radio
65
65
  - Ripple
66
66
  - Segmented buttons
67
67
  - Snackbar
@@ -5,11 +5,13 @@
5
5
  let {
6
6
  indeterminate = $bindable(),
7
7
  checked = $bindable(),
8
+ element = $bindable(),
9
+ style,
8
10
  ...attributes
9
11
  }: CheckboxProps = $props()
10
12
  </script>
11
13
 
12
- <div class="np-host">
14
+ <div {style} class={['np-host', attributes.class]} bind:this={element}>
13
15
  <div class="np-container">
14
16
  <label class="np-input-wrapper">
15
17
  <input
@@ -130,7 +132,7 @@
130
132
  visibility: hidden;
131
133
  }
132
134
  .np-background {
133
- background-color: var(--np-color-primary);
135
+ background-color: var(--np-checkbox-selected-container-color, var(--np-color-primary));
134
136
  }
135
137
  .np-background,
136
138
  .np-icon {
@@ -1,4 +1,4 @@
1
1
  import type { CheckboxProps } from './types.ts';
2
- declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "checked" | "indeterminate">;
2
+ declare const Checkbox: import("svelte").Component<CheckboxProps, {}, "element" | "checked" | "indeterminate">;
3
3
  type Checkbox = ReturnType<typeof Checkbox>;
4
4
  export default Checkbox;
@@ -1,2 +1,4 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
- export type CheckboxProps = Omit<HTMLInputAttributes, 'class' | 'type'>;
2
+ export interface CheckboxProps extends Omit<HTMLInputAttributes, 'type'> {
3
+ element?: HTMLElement;
4
+ }
@@ -2,12 +2,12 @@
2
2
  import Ripple from '../ripple/Ripple.svelte'
3
3
  import type { RadioProps } from './types.ts'
4
4
 
5
- let { ...attributes }: RadioProps = $props()
5
+ let { element = $bindable(), style, ...attributes }: RadioProps = $props()
6
6
 
7
7
  let touchEl: HTMLSpanElement | undefined = $state()
8
8
  </script>
9
9
 
10
- <label class="np-host">
10
+ <label {style} class={['np-host', attributes.class]} bind:this={element}>
11
11
  <input {...attributes} type="radio" class="np-input" />
12
12
  <div class="np-container" aria-hidden="true">
13
13
  {#if !attributes.disabled}
@@ -43,8 +43,8 @@
43
43
  position: relative;
44
44
  display: inline-flex;
45
45
  vertical-align: top;
46
- width: 20px;
47
- height: 20px;
46
+ width: var(--np-radio-icon-size, 20px);
47
+ height: var(--np-radio-icon-size, 20px);
48
48
  cursor: pointer;
49
49
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
50
50
  outline: none;
@@ -1,4 +1,4 @@
1
1
  import type { RadioProps } from './types.ts';
2
- declare const Radio: import("svelte").Component<RadioProps, {}, "">;
2
+ declare const Radio: import("svelte").Component<RadioProps, {}, "element">;
3
3
  type Radio = ReturnType<typeof Radio>;
4
4
  export default Radio;
@@ -1,2 +1,4 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
- export type RadioProps = Omit<HTMLInputAttributes, 'class' | 'type'>;
2
+ export interface RadioProps extends Omit<HTMLInputAttributes, 'type'> {
3
+ element?: HTMLElement;
4
+ }
@@ -70,21 +70,26 @@
70
70
  >
71
71
  {/if}
72
72
  {#if icon}
73
- <IconButton
74
- --np-icon-button-icon-color="var(--np-snackbar-text-color, var(--np-color-inverse-on-surface))"
75
- --np-icon-button-container-shape="0"
76
- --np-icon-button-container-height={buttonHeight}
77
- --np-icon-button-container-width="2.5rem"
78
- aria-label="Close"
79
- onclick={onIconClick}
80
- >
81
- {@render icon()}</IconButton
82
- >
73
+ <div class="np-snackbar-icon-container">
74
+ <IconButton
75
+ --np-icon-button-icon-color="var(--np-snackbar-text-color, var(--np-color-inverse-on-surface))"
76
+ --np-icon-button-container-shape="0"
77
+ --np-icon-button-container-height={buttonHeight}
78
+ --np-icon-button-container-width="2.5rem"
79
+ aria-label="Close"
80
+ onclick={onIconClick}
81
+ >
82
+ {@render icon()}</IconButton
83
+ >
84
+ </div>
83
85
  {/if}
84
86
  </div>
85
87
  </div>
86
88
 
87
89
  <style>
90
+ .np-snackbar-icon-container {
91
+ width: 2.75rem;
92
+ }
88
93
  .np-snackbar-supporting-text {
89
94
  font-weight: 400;
90
95
  }
@@ -65,7 +65,7 @@
65
65
  : !label?.length
66
66
  ? '--top-space:1rem;--bottom-space:1rem;'
67
67
  : '') + style}
68
- class="text-field"
68
+ class={['text-field', attributes.class]}
69
69
  bind:this={element}
70
70
  >
71
71
  <div
@@ -112,11 +112,11 @@
112
112
  <div class="content">
113
113
  {#if attributes.type === 'textarea'}
114
114
  <textarea
115
+ aria-label={label}
115
116
  {...attributes}
116
117
  bind:value
117
118
  bind:this={textElement}
118
119
  class="input"
119
- aria-label={label}
120
120
  {placeholder}
121
121
  rows={attributes.rows || 2}
122
122
  ></textarea>
@@ -128,12 +128,12 @@
128
128
  </span>
129
129
  {/if}
130
130
  <input
131
+ aria-label={label}
131
132
  {...attributes}
132
133
  bind:value
133
134
  bind:this={textElement}
134
135
  class="input"
135
136
  {placeholder}
136
- aria-label={label}
137
137
  aria-invalid={error}
138
138
  />
139
139
  {#if suffixText}
@@ -13,10 +13,10 @@ interface FieldProps {
13
13
  noAsterisk?: boolean;
14
14
  element?: HTMLSpanElement;
15
15
  }
16
- export interface InputFieldProps extends Omit<HTMLInputAttributes, 'class'>, FieldProps {
16
+ export interface InputFieldProps extends HTMLInputAttributes, FieldProps {
17
17
  type?: 'text' | 'password' | 'email' | 'number' | 'search' | 'tel' | 'url';
18
18
  }
19
- export interface TextAreaFieldProps extends Omit<HTMLTextareaAttributes, 'class'>, FieldProps {
19
+ export interface TextAreaFieldProps extends HTMLTextareaAttributes, FieldProps {
20
20
  type: 'textarea';
21
21
  }
22
22
  export type TextFieldProps = InputFieldProps | TextAreaFieldProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {