@iroco/ui 1.4.2 → 1.6.0

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/dist/Alert.svelte CHANGED
@@ -54,4 +54,8 @@
54
54
  border: none;
55
55
  cursor: pointer;
56
56
  color: var(--color-icon-primary);
57
+ }
58
+ .alert__close:focus {
59
+ outline-color: var(--color-secondary);
60
+ outline-style: auto;
57
61
  }</style>
@@ -30,7 +30,7 @@
30
30
  </script>
31
31
 
32
32
  {#snippet template({ ...args })}
33
- <!--👇 'on:click' allows to forward event to addon-actions -->
33
+ <!--👇 'onclick' allows to forward event to addon-actions -->
34
34
  <Button {...args} onclick={handleClick}>
35
35
  You clicked: {count}
36
36
  </Button>
@@ -1,17 +1,14 @@
1
1
  <script lang="ts">
2
- import type { MouseEventHandler } from 'svelte/elements';
2
+ import type {
3
+ HTMLButtonAttributes,
4
+ HTMLInputAttributes,
5
+ MouseEventHandler
6
+ } from 'svelte/elements';
3
7
 
4
- interface Props {
5
- type?: 'button' | 'reset' | 'submit' | null | undefined;
6
- disabled?: boolean;
8
+ interface Props extends HTMLButtonAttributes {
7
9
  kind?: 'danger' | 'success' | 'dark' | 'basic';
8
10
  size?: 'small' | 'regular';
9
11
  fullWidth?: boolean;
10
- id?: string | null;
11
- formaction?: string | null;
12
- form?: string | null;
13
- children?: import('svelte').Snippet;
14
- onclick?: MouseEventHandler<HTMLButtonElement>;
15
12
  }
16
13
 
17
14
  let {
@@ -20,23 +17,15 @@
20
17
  kind = 'basic',
21
18
  size = 'regular',
22
19
  fullWidth = false,
23
- id = null,
24
- formaction = null,
25
- form = null,
26
20
  children,
27
- onclick
21
+ ...rest
28
22
  }: Props = $props();
29
23
  </script>
30
24
 
31
25
  <button
32
- {id}
33
26
  class={`iroco-ui-button iroco-ui-button--${size} iroco-ui-button--${kind} ${fullWidth ? 'iroco-ui-button--full-width' : ''}`}
34
27
  class:disabled
35
- {type}
36
- {formaction}
37
- {disabled}
38
- {onclick}
39
- {form}
28
+ {...rest}
40
29
  >
41
30
  {@render children?.()}
42
31
  </button>
@@ -243,6 +232,10 @@
243
232
  .iroco-ui-button:active {
244
233
  box-shadow: none;
245
234
  }
235
+ .iroco-ui-button:focus {
236
+ outline-color: var(--color-primary);
237
+ outline-style: auto;
238
+ }
246
239
  .iroco-ui-button.disabled, .iroco-ui-button:disabled {
247
240
  background-color: var(--btn-disabled-bg);
248
241
  color: var(--btn-disabled-label);
@@ -1,15 +1,8 @@
1
- import type { MouseEventHandler } from 'svelte/elements';
2
- interface Props {
3
- type?: 'button' | 'reset' | 'submit' | null | undefined;
4
- disabled?: boolean;
1
+ import type { HTMLButtonAttributes } from 'svelte/elements';
2
+ interface Props extends HTMLButtonAttributes {
5
3
  kind?: 'danger' | 'success' | 'dark' | 'basic';
6
4
  size?: 'small' | 'regular';
7
5
  fullWidth?: boolean;
8
- id?: string | null;
9
- formaction?: string | null;
10
- form?: string | null;
11
- children?: import('svelte').Snippet;
12
- onclick?: MouseEventHandler<HTMLButtonElement>;
13
6
  }
14
7
  declare const Button: import("svelte").Component<Props, {}, "">;
15
8
  type Button = ReturnType<typeof Button>;
@@ -252,6 +252,10 @@
252
252
  .iroco-ui-button:active {
253
253
  box-shadow: none;
254
254
  }
255
+ .iroco-ui-button:focus {
256
+ outline-color: var(--color-primary);
257
+ outline-style: auto;
258
+ }
255
259
  .iroco-ui-button.disabled, .iroco-ui-button:disabled {
256
260
  background-color: var(--btn-disabled-bg);
257
261
  color: var(--btn-disabled-label);
@@ -24,6 +24,14 @@
24
24
  ]
25
25
  }
26
26
  });
27
+
28
+ function handleClose() {
29
+ console.log('onclick');
30
+ }
31
+
32
+ function handleClickLink(e) {
33
+ console.log('onclick_link : ', e);
34
+ }
27
35
  </script>
28
36
 
29
37
  <script lang="ts">
@@ -31,7 +39,7 @@
31
39
  </script>
32
40
 
33
41
  {#snippet template({ ...args })}
34
- <NavBar {...args} />
42
+ <NavBar {...args} onclick={handleClose} onclick_link={handleClickLink} />
35
43
  {/snippet}
36
44
 
37
45
  <Story name="Default" />
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import { IconClose } from './index';
3
- import { createEventDispatcher } from 'svelte';
4
3
  import { NavigationItem, NavigationItemType } from './definition.js';
5
4
  import type { MouseEventHandler } from 'svelte/elements';
6
5
 
@@ -10,19 +9,17 @@
10
9
  version?: string | null;
11
10
  currentRoute?: string | null;
12
11
  onclick?: MouseEventHandler<HTMLButtonElement>;
12
+ onclick_link?: MouseEventHandler<HTMLButtonElement>;
13
13
  }
14
14
 
15
- let { navigationItems, type, version = null, currentRoute, onclick }: Props = $props();
16
-
17
- const dispatch = createEventDispatcher();
18
-
19
- const handleClickLink = (menuItem: NavigationItem) => {
20
- if (typeof menuItem.hrefOrCallback === 'function') {
21
- menuItem.hrefOrCallback();
22
- return false; // to avoid calling href
23
- }
24
- dispatch('click_link');
25
- };
15
+ let {
16
+ navigationItems,
17
+ type,
18
+ version = null,
19
+ currentRoute,
20
+ onclick,
21
+ onclick_link
22
+ }: Props = $props();
26
23
 
27
24
  function isActive(item: NavigationItem): boolean {
28
25
  if (typeof item.hrefOrCallback === 'string') {
@@ -47,7 +44,13 @@
47
44
  </form>
48
45
  {:else}
49
46
  <a
50
- onclick={() => handleClickLink(item)}
47
+ onclick={() => {
48
+ if (typeof item.hrefOrCallback === 'function') {
49
+ item.hrefOrCallback();
50
+ return false; // to avoid calling href
51
+ }
52
+ onclick_link();
53
+ }}
51
54
  href={typeof item.hrefOrCallback === 'string' ? item.hrefOrCallback : '#'}
52
55
  class:iroco-ui-button={item.type === NavigationItemType.BUTTON}
53
56
  class:iroco-ui-button--small={item.type === NavigationItemType.BUTTON}
@@ -264,6 +267,10 @@
264
267
  .iroco-ui-button:active {
265
268
  box-shadow: none;
266
269
  }
270
+ .iroco-ui-button:focus {
271
+ outline-color: var(--color-primary);
272
+ outline-style: auto;
273
+ }
267
274
  .iroco-ui-button.disabled, .iroco-ui-button:disabled {
268
275
  background-color: var(--btn-disabled-bg);
269
276
  color: var(--btn-disabled-label);
@@ -6,24 +6,8 @@ interface Props {
6
6
  version?: string | null;
7
7
  currentRoute?: string | null;
8
8
  onclick?: MouseEventHandler<HTMLButtonElement>;
9
+ onclick_link?: MouseEventHandler<HTMLButtonElement>;
9
10
  }
10
- 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> {
11
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
12
- $$bindings?: Bindings;
13
- } & Exports;
14
- (internal: unknown, props: Props & {
15
- $$events?: Events;
16
- $$slots?: Slots;
17
- }): Exports & {
18
- $set?: any;
19
- $on?: any;
20
- };
21
- z_$$bindings?: Bindings;
22
- }
23
- declare const NavBar: $$__sveltets_2_IsomorphicComponent<Props, {
24
- click_link: CustomEvent<any>;
25
- } & {
26
- [evt: string]: CustomEvent<any>;
27
- }, {}, {}, "">;
28
- type NavBar = InstanceType<typeof NavBar>;
11
+ declare const NavBar: import("svelte").Component<Props, {}, "">;
12
+ type NavBar = ReturnType<typeof NavBar>;
29
13
  export default NavBar;
@@ -47,8 +47,8 @@
47
47
  {currentRoute}
48
48
  {type}
49
49
  {version}
50
- on:click_link={() => (showMenu = false)}
51
- on:click={() => (showMenu = false)}
50
+ onclick_link={() => (showMenu = false)}
51
+ onclick={() => (showMenu = false)}
52
52
  />
53
53
  {/if}
54
54
  </div>
@@ -1,35 +1,19 @@
1
1
  <script lang="ts">
2
- import type { ChangeEventHandler, HTMLInputAttributes } from 'svelte/elements';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
3
 
4
4
  interface Props extends HTMLInputAttributes {
5
- id: string;
6
- label: string | '' | undefined;
7
- placeholder?: string | '' | undefined;
5
+ label?: string | '' | undefined;
8
6
  error?: string | undefined;
9
- value?: number | undefined;
10
- min: number | undefined;
11
- max: number | undefined;
12
- onchange: ChangeEventHandler<HTMLInputElement> | null | undefined;
13
7
  }
14
8
 
15
- let {
16
- id,
17
- label,
18
- placeholder = '',
19
- error = undefined,
20
- value = $bindable(undefined),
21
- min,
22
- max,
23
- onchange,
24
- ...rest
25
- }: Props = $props();
9
+ let { id, label, error = undefined, ...rest }: Props = $props();
26
10
  </script>
27
11
 
28
12
  <div class="iroco-ui-input">
29
13
  {#if label}
30
14
  <label class="iroco-ui-label" for={id}>{label}</label>
31
15
  {/if}
32
- <input {onchange} bind:value {id} type="number" {placeholder} {min} {max} {...rest} />
16
+ <input {id} type="number" {...rest} />
33
17
  {#if error}
34
18
  <p data-testid="error" class="error">{error}</p>
35
19
  {/if}
@@ -37,10 +21,16 @@
37
21
 
38
22
  <style>.iroco-ui-form input,
39
23
  .iroco-ui-form textarea {
40
- outline: none;
24
+ outline-color: var(--color-secondary);
25
+ outline-style: ridge;
41
26
  text-decoration: none;
42
27
  font-size: 14px;
43
28
  }
29
+ .iroco-ui-form input:focus,
30
+ .iroco-ui-form textarea:focus {
31
+ outline-color: var(--color-primary);
32
+ outline-style: auto;
33
+ }
44
34
  .iroco-ui-form .iroco-ui-input {
45
35
  display: flex;
46
36
  flex-direction: column;
@@ -61,25 +51,59 @@
61
51
  .iroco-ui-form .iroco-ui-input > input.error {
62
52
  border-color: var(--color-danger);
63
53
  }
54
+ .iroco-ui-form .iroco-ui-input > input.error:focus {
55
+ outline-color: var(--color-danger);
56
+ }
64
57
  .iroco-ui-form .iroco-ui-input > input.readonlyInput {
65
58
  cursor: not-allowed;
66
59
  }
60
+ .iroco-ui-form .iroco-ui-input > input.border {
61
+ border: 1px solid var(--form-element-border);
62
+ }
67
63
  .iroco-ui-form .iroco-ui-label {
68
64
  color: var(--color-text-op-60);
69
65
  font-weight: bold;
70
66
  padding-bottom: 10px;
71
67
  display: inline-block;
72
68
  }
73
- .iroco-ui-form .field {
74
- margin-top: 20px;
75
- }
76
- .iroco-ui-form .field:first-child {
77
- margin: 0;
78
- }
79
- .iroco-ui-form > .submit {
80
- margin-top: 40px;
81
- }
82
69
  .iroco-ui-form p.error {
83
70
  margin: 0;
84
71
  color: var(--color-danger);
72
+ }
73
+
74
+ /* radio button */
75
+ .iroco-ui-radio {
76
+ color: var(--color-text);
77
+ position: relative;
78
+ margin-top: 0.5em;
79
+ padding-left: 1.5em;
80
+ cursor: pointer;
81
+ -webkit-user-select: none;
82
+ -moz-user-select: none;
83
+ -ms-user-select: none;
84
+ user-select: none;
85
+ }
86
+
87
+ .iroco-ui-radio input {
88
+ position: absolute;
89
+ opacity: 0;
90
+ cursor: pointer;
91
+ }
92
+ .iroco-ui-radio input:focus + .radio-button-color {
93
+ outline-color: var(--color-primary);
94
+ outline-style: auto;
95
+ }
96
+
97
+ .radio-button-color {
98
+ position: absolute;
99
+ top: 0;
100
+ left: 0;
101
+ height: 1em;
102
+ width: 1em;
103
+ background-color: var(--form-element-bg);
104
+ border-radius: 50%;
105
+ }
106
+
107
+ .iroco-ui-radio input:checked ~ .radio-button-color {
108
+ background-color: var(--color-primary);
85
109
  }</style>
@@ -1,14 +1,8 @@
1
- import type { ChangeEventHandler, HTMLInputAttributes } from 'svelte/elements';
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  interface Props extends HTMLInputAttributes {
3
- id: string;
4
- label: string | '' | undefined;
5
- placeholder?: string | '' | undefined;
3
+ label?: string | '' | undefined;
6
4
  error?: string | undefined;
7
- value?: number | undefined;
8
- min: number | undefined;
9
- max: number | undefined;
10
- onchange: ChangeEventHandler<HTMLInputElement> | null | undefined;
11
5
  }
12
- declare const NumberInput: import("svelte").Component<Props, {}, "value">;
6
+ declare const NumberInput: import("svelte").Component<Props, {}, "">;
13
7
  type NumberInput = ReturnType<typeof NumberInput>;
14
8
  export default NumberInput;
@@ -2,27 +2,73 @@
2
2
  import type { HTMLInputAttributes } from 'svelte/elements';
3
3
 
4
4
  interface Props extends HTMLInputAttributes {
5
- value?: string | number | null;
6
5
  group?: string | number | null;
7
- name?: string | null;
8
- checked?: boolean;
9
6
  children?: import('svelte').Snippet;
10
7
  }
11
8
 
12
- let { value = null, group = $bindable(null), name = null, checked, children }: Props = $props();
13
-
14
- function onchange(event: Event) {
15
- group = event.currentTarget.value;
16
- }
9
+ let { group = $bindable(null), children, ...others }: Props = $props();
17
10
  </script>
18
11
 
19
12
  <label class="iroco-ui-radio">
20
- <input type="radio" bind:group {value} {name} {checked} {onchange} />
13
+ <input type="radio" bind:group {...others} />
21
14
  <span class="radio-button-color"></span>
22
15
  {@render children?.()}
23
16
  </label>
24
17
 
25
- <style>.iroco-ui-radio {
18
+ <style>.iroco-ui-form input,
19
+ .iroco-ui-form textarea {
20
+ outline-color: var(--color-secondary);
21
+ outline-style: ridge;
22
+ text-decoration: none;
23
+ font-size: 14px;
24
+ }
25
+ .iroco-ui-form input:focus,
26
+ .iroco-ui-form textarea:focus {
27
+ outline-color: var(--color-primary);
28
+ outline-style: auto;
29
+ }
30
+ .iroco-ui-form .iroco-ui-input {
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+ .iroco-ui-form .iroco-ui-input > input {
35
+ color: var(--color-text);
36
+ background: var(--color-body);
37
+ border: 1px solid var(--color-border);
38
+ padding: 1em 1.5em;
39
+ text-overflow: ellipsis;
40
+ white-space: nowrap;
41
+ overflow: hidden;
42
+ border-radius: 0.5em;
43
+ }
44
+ .iroco-ui-form .iroco-ui-input > input::placeholder {
45
+ color: var(--color-text-op-50);
46
+ }
47
+ .iroco-ui-form .iroco-ui-input > input.error {
48
+ border-color: var(--color-danger);
49
+ }
50
+ .iroco-ui-form .iroco-ui-input > input.error:focus {
51
+ outline-color: var(--color-danger);
52
+ }
53
+ .iroco-ui-form .iroco-ui-input > input.readonlyInput {
54
+ cursor: not-allowed;
55
+ }
56
+ .iroco-ui-form .iroco-ui-input > input.border {
57
+ border: 1px solid var(--form-element-border);
58
+ }
59
+ .iroco-ui-form .iroco-ui-label {
60
+ color: var(--color-text-op-60);
61
+ font-weight: bold;
62
+ padding-bottom: 10px;
63
+ display: inline-block;
64
+ }
65
+ .iroco-ui-form p.error {
66
+ margin: 0;
67
+ color: var(--color-danger);
68
+ }
69
+
70
+ /* radio button */
71
+ .iroco-ui-radio {
26
72
  color: var(--color-text);
27
73
  position: relative;
28
74
  margin-top: 0.5em;
@@ -39,6 +85,10 @@
39
85
  opacity: 0;
40
86
  cursor: pointer;
41
87
  }
88
+ .iroco-ui-radio input:focus + .radio-button-color {
89
+ outline-color: var(--color-primary);
90
+ outline-style: auto;
91
+ }
42
92
 
43
93
  .radio-button-color {
44
94
  position: absolute;
@@ -1,9 +1,6 @@
1
1
  import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  interface Props extends HTMLInputAttributes {
3
- value?: string | number | null;
4
3
  group?: string | number | null;
5
- name?: string | null;
6
- checked?: boolean;
7
4
  children?: import('svelte').Snippet;
8
5
  }
9
6
  declare const RadioButton: import("svelte").Component<Props, {}, "group">;
@@ -1,46 +1,30 @@
1
1
  <script lang="ts">
2
- import type { FormEventHandler, FullAutoFill, HTMLInputAttributes } from 'svelte/elements';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
3
 
4
4
  export type ValidationErrorMessage = { key: string; isHtml?: boolean };
5
5
 
6
6
  interface Props extends HTMLInputAttributes {
7
- id?: string | null;
8
- type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
9
- name?: string | null;
10
7
  label?: string | null;
11
- placeholder?: string | null;
12
8
  error?: string | null;
13
9
  errors?: Array<ValidationErrorMessage> | null;
14
10
  htmlError?: boolean;
15
- value?: string | null;
16
- onFocus?: ((e: FocusEvent) => void) | null;
17
- onBlur?: ((e: Event) => void) | null;
18
- readonly?: boolean;
19
11
  border?: boolean;
20
- autocomplete?: FullAutoFill | null | undefined;
21
- oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
22
12
  }
23
13
 
24
14
  let {
25
- id = null,
26
15
  type = 'text',
27
- name = null,
28
16
  label = null,
29
- placeholder = null,
30
17
  error = null,
31
- errors = null,
18
+ errors = [],
32
19
  htmlError = false,
33
- value = $bindable(null),
34
- onFocus = null,
35
- onBlur = null,
36
- readonly = false,
37
20
  border = false,
38
21
  autocomplete = 'on',
39
- oninput
22
+ readonly,
23
+ ...rest
40
24
  }: Props = $props();
41
25
 
42
26
  function hasErrors() {
43
- return error !== null || errors?.length > 0;
27
+ return error !== null || (errors?.length ?? 0) > 0;
44
28
  }
45
29
  </script>
46
30
 
@@ -49,19 +33,12 @@
49
33
  <label class="iroco-ui-label" for={id}>{label}</label>
50
34
  {/if}
51
35
  <input
52
- {oninput}
53
- bind:value
54
- onfocus={onFocus}
55
- onblur={onBlur}
56
- {id}
57
36
  {type}
58
- {name}
59
- {placeholder}
60
37
  class:border
61
38
  class:error={hasErrors()}
62
39
  class:readonlyInput={readonly === true}
63
- {readonly}
64
40
  {autocomplete}
41
+ {...rest}
65
42
  />
66
43
  {#if error != null}
67
44
  <p data-testid="error" class="error">
@@ -74,59 +51,91 @@
74
51
  {/if}
75
52
  </div>
76
53
 
77
- <style>input,
78
- textarea {
79
- outline: none;
54
+ <style>.iroco-ui-form input,
55
+ .iroco-ui-form textarea {
56
+ outline-color: var(--color-secondary);
57
+ outline-style: ridge;
80
58
  text-decoration: none;
81
59
  font-size: 14px;
82
60
  }
83
- input:focus,
84
- textarea:focus {
85
- outline: none;
86
- text-decoration: none;
87
- font-size: 14px;
61
+ .iroco-ui-form input:focus,
62
+ .iroco-ui-form textarea:focus {
63
+ outline-color: var(--color-primary);
64
+ outline-style: auto;
88
65
  }
89
-
90
- .iroco-ui-input {
66
+ .iroco-ui-form .iroco-ui-input {
91
67
  display: flex;
92
68
  flex-direction: column;
93
69
  }
94
- .iroco-ui-input > input {
70
+ .iroco-ui-form .iroco-ui-input > input {
95
71
  color: var(--color-text);
96
- background: var(--color-dark-blue);
97
- border: 1px solid var(--color-dark-blue);
72
+ background: var(--color-body);
73
+ border: 1px solid var(--color-border);
98
74
  padding: 1em 1.5em;
99
75
  text-overflow: ellipsis;
100
76
  white-space: nowrap;
101
77
  overflow: hidden;
102
- border-radius: 0.3em;
103
- }
104
- .iroco-ui-input > input.border {
105
- border: 1px solid var(--form-element-border);
78
+ border-radius: 0.5em;
106
79
  }
107
- .iroco-ui-input > input::placeholder {
80
+ .iroco-ui-form .iroco-ui-input > input::placeholder {
108
81
  color: var(--color-text-op-50);
109
82
  }
110
- .iroco-ui-input > input.error {
83
+ .iroco-ui-form .iroco-ui-input > input.error {
111
84
  border-color: var(--color-danger);
112
85
  }
113
- .iroco-ui-input > input.readonlyInput {
86
+ .iroco-ui-form .iroco-ui-input > input.error:focus {
87
+ outline-color: var(--color-danger);
88
+ }
89
+ .iroco-ui-form .iroco-ui-input > input.readonlyInput {
114
90
  cursor: not-allowed;
115
91
  }
116
- .iroco-ui-input .error {
117
- color: var(--color-danger);
92
+ .iroco-ui-form .iroco-ui-input > input.border {
93
+ border: 1px solid var(--form-element-border);
118
94
  }
119
-
120
- .iroco-ui-label {
95
+ .iroco-ui-form .iroco-ui-label {
121
96
  color: var(--color-text-op-60);
122
97
  font-weight: bold;
123
98
  padding-bottom: 10px;
124
99
  display: inline-block;
125
100
  }
101
+ .iroco-ui-form p.error {
102
+ margin: 0;
103
+ color: var(--color-danger);
104
+ }
126
105
 
127
- .field {
128
- margin-top: 20px;
106
+ /* radio button */
107
+ .iroco-ui-radio {
108
+ color: var(--color-text);
109
+ position: relative;
110
+ margin-top: 0.5em;
111
+ padding-left: 1.5em;
112
+ cursor: pointer;
113
+ -webkit-user-select: none;
114
+ -moz-user-select: none;
115
+ -ms-user-select: none;
116
+ user-select: none;
129
117
  }
130
- .field:first-child {
131
- margin: 0;
118
+
119
+ .iroco-ui-radio input {
120
+ position: absolute;
121
+ opacity: 0;
122
+ cursor: pointer;
123
+ }
124
+ .iroco-ui-radio input:focus + .radio-button-color {
125
+ outline-color: var(--color-primary);
126
+ outline-style: auto;
127
+ }
128
+
129
+ .radio-button-color {
130
+ position: absolute;
131
+ top: 0;
132
+ left: 0;
133
+ height: 1em;
134
+ width: 1em;
135
+ background-color: var(--form-element-bg);
136
+ border-radius: 50%;
137
+ }
138
+
139
+ .iroco-ui-radio input:checked ~ .radio-button-color {
140
+ background-color: var(--color-primary);
132
141
  }</style>
@@ -1,25 +1,15 @@
1
- import type { FormEventHandler, FullAutoFill, HTMLInputAttributes } from 'svelte/elements';
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
2
  export type ValidationErrorMessage = {
3
3
  key: string;
4
4
  isHtml?: boolean;
5
5
  };
6
6
  interface Props extends HTMLInputAttributes {
7
- id?: string | null;
8
- type?: 'email' | 'password' | 'search' | 'tel' | 'text' | 'url' | null | undefined;
9
- name?: string | null;
10
7
  label?: string | null;
11
- placeholder?: string | null;
12
8
  error?: string | null;
13
9
  errors?: Array<ValidationErrorMessage> | null;
14
10
  htmlError?: boolean;
15
- value?: string | null;
16
- onFocus?: ((e: FocusEvent) => void) | null;
17
- onBlur?: ((e: Event) => void) | null;
18
- readonly?: boolean;
19
11
  border?: boolean;
20
- autocomplete?: FullAutoFill | null | undefined;
21
- oninput?: FormEventHandler<HTMLInputElement> | null | undefined;
22
12
  }
23
- declare const TextInput: import("svelte").Component<Props, {}, "value">;
13
+ declare const TextInput: import("svelte").Component<Props, {}, "">;
24
14
  type TextInput = ReturnType<typeof TextInput>;
25
15
  export default TextInput;
@@ -1,4 +1,3 @@
1
- //@use './colors';
2
1
  @use './fonts';
3
2
  @use './containers';
4
3
  @use './constants';
@@ -59,6 +58,11 @@
59
58
  box-shadow: none;
60
59
  }
61
60
 
61
+ &:focus {
62
+ outline-color: var(--color-primary);
63
+ outline-style: auto;
64
+ }
65
+
62
66
  &.disabled,
63
67
  &:disabled {
64
68
  background-color: var(--btn-disabled-bg);
@@ -1,18 +1,26 @@
1
1
  .iroco-ui-form {
2
2
  input,
3
3
  textarea {
4
- outline: none;
4
+ outline-color: var(--color-secondary);
5
+ outline-style: ridge;
5
6
  text-decoration: none;
6
7
  font-size: 14px;
8
+
9
+ &:focus {
10
+ outline-color: var(--color-primary);
11
+ outline-style: auto;
12
+ }
7
13
  }
8
14
 
9
15
  .iroco-ui-input {
10
16
  display: flex;
11
17
  flex-direction: column;
18
+
12
19
  > input {
13
20
  color: var(--color-text);
14
21
  background: var(--color-body);
15
22
  border: 1px solid var(--color-border);
23
+ //border: 1px solid var(--color-dark-blue);
16
24
  padding: 1em 1.5em;
17
25
  text-overflow: ellipsis;
18
26
  white-space: nowrap;
@@ -22,12 +30,22 @@
22
30
  &::placeholder {
23
31
  color: var(--color-text-op-50);
24
32
  }
33
+
25
34
  &.error {
26
35
  border-color: var(--color-danger);
36
+
37
+ &:focus {
38
+ outline-color: var(--color-danger);
39
+ }
27
40
  }
41
+
28
42
  &.readonlyInput {
29
43
  cursor: not-allowed;
30
44
  }
45
+
46
+ &.border {
47
+ border: 1px solid var(--form-element-border);
48
+ }
31
49
  }
32
50
  }
33
51
 
@@ -38,20 +56,47 @@
38
56
  display: inline-block;
39
57
  }
40
58
 
41
- .field {
42
- margin-top: 20px;
43
-
44
- &:first-child {
45
- margin: 0;
46
- }
47
- }
48
-
49
- > .submit {
50
- margin-top: 40px;
51
- }
52
-
53
59
  p.error {
54
60
  margin: 0;
55
61
  color: var(--color-danger);
56
62
  }
57
63
  }
64
+
65
+ /* radio button */
66
+
67
+ .iroco-ui-radio {
68
+ color: var(--color-text);
69
+ position: relative;
70
+ margin-top: 0.5em;
71
+ padding-left: 1.5em;
72
+ cursor: pointer;
73
+ -webkit-user-select: none;
74
+ -moz-user-select: none;
75
+ -ms-user-select: none;
76
+ user-select: none;
77
+ }
78
+
79
+ .iroco-ui-radio input {
80
+ position: absolute;
81
+ opacity: 0;
82
+ cursor: pointer;
83
+
84
+ &:focus + .radio-button-color {
85
+ outline-color: var(--color-primary);
86
+ outline-style: auto;
87
+ }
88
+ }
89
+
90
+ .radio-button-color {
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ height: 1em;
95
+ width: 1em;
96
+ background-color: var(--form-element-bg);
97
+ border-radius: 50%;
98
+ }
99
+
100
+ .iroco-ui-radio input:checked ~ .radio-button-color {
101
+ background-color: var(--color-primary);
102
+ }
@@ -1,5 +1,11 @@
1
- //@use 'colors';
2
1
  @use 'containers';
3
2
  @use 'fonts';
4
3
  @use 'forms';
5
4
  @use 'layouts';
5
+
6
+ button:focus,
7
+ a:focus,
8
+ input:focus {
9
+ outline-color: var(--color-primary);
10
+ outline-style: auto;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iroco/ui",
3
- "version": "1.4.2",
3
+ "version": "1.6.0",
4
4
  "description": "Iroco design system based on Svelte",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,39 +0,0 @@
1
- .ui-fields-checkbox {
2
- > .container {
3
- display: flex;
4
- align-items: center;
5
- justify-content: flex-start;
6
-
7
- > label {
8
- @include Arial(0.9em, #00b9ff /*$blue*/, bold);
9
- letter-spacing: 0.05em;
10
- text-transform: uppercase;
11
- display: inline-block;
12
- margin-left: 20px;
13
-
14
- @include small-screen() {
15
- font-size: 0.8em;
16
- margin-left: 15px;
17
- }
18
- }
19
- }
20
-
21
- > .error,
22
- > .warning {
23
- display: flex;
24
- align-items: center;
25
- justify-content: flex-start;
26
- margin-top: 15px;
27
-
28
- > span {
29
- @include Arial(0.9em, var(--color-danger) /* red */);
30
- margin-left: 10px;
31
- }
32
- }
33
-
34
- > .warning {
35
- > span {
36
- color: #00b9ff /*$blue*/;
37
- }
38
- }
39
- }
@@ -1,158 +0,0 @@
1
- //@use './../colors';
2
- .ui-fields-input {
3
- width: 100%;
4
- transition: width linear 100ms;
5
-
6
- > label {
7
- @include Arial(1em, white, bold);
8
- letter-spacing: 0.05em;
9
- text-transform: uppercase;
10
- padding-bottom: 10px;
11
- display: inline-block;
12
- }
13
-
14
- input,
15
- input:active,
16
- input:focus {
17
- border: none;
18
- outline: none;
19
- text-decoration: none;
20
- background: transparent;
21
- }
22
-
23
- > .container {
24
- transition: background linear 100ms;
25
- background: white;
26
- width: 100%;
27
- display: flex;
28
- align-items: center;
29
- justify-content: space-between;
30
- position: relative;
31
-
32
- &:after {
33
- content: '';
34
- display: block;
35
- position: absolute;
36
- bottom: 0;
37
- left: 0;
38
- width: 0;
39
- height: 3px;
40
- background: var(--color-primary);
41
- transition: all 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
42
- }
43
-
44
- > .left-icon {
45
- padding-left: 15px;
46
- }
47
-
48
- > input {
49
- @include Arial(1em, #211d28); /* $darkBlue */
50
- flex: 1;
51
- padding: 10px 15px;
52
- text-overflow: ellipsis;
53
- white-space: nowrap;
54
- overflow: hidden;
55
-
56
- &::placeholder {
57
- color: var(--color-dark-blue-op-30);
58
- font-style: italic;
59
- }
60
- }
61
-
62
- > .suggestions {
63
- overflow: hidden;
64
- visibility: hidden;
65
- opacity: 0;
66
- position: absolute;
67
- background: white;
68
- width: 100%;
69
- top: 100%;
70
- transition: opacity linear 100ms;
71
- @include modal-layout();
72
-
73
- > .suggestion {
74
- display: block;
75
- text-align: left;
76
- width: 100%;
77
- border: none;
78
- cursor: pointer;
79
- -webkit-touch-callout: none;
80
- -webkit-user-select: none;
81
- -moz-user-select: none;
82
- -ms-user-select: none;
83
- user-select: none;
84
- flex-shrink: 0;
85
- border-top: solid var(--color-beige) 1px;
86
- background: white;
87
- transition: background linear 100ms;
88
-
89
- &:first-child {
90
- border: none;
91
- }
92
-
93
- &:hover,
94
- &.selected {
95
- background: #f5f5f5 /*lighGrey*/;
96
- }
97
- }
98
- }
99
- }
100
-
101
- > .instructions {
102
- @include Arial(1em, var(--color-secondary-dark) /*$darkBeige*/);
103
- margin-top: 10px;
104
- }
105
-
106
- > .error,
107
- > .warning {
108
- display: flex;
109
- align-items: center;
110
- justify-content: flex-start;
111
- margin-top: 15px;
112
-
113
- > span {
114
- @include Arial(0.9em, var(--color-danger) /*$red*/);
115
- margin-left: 10px;
116
- }
117
- }
118
-
119
- > .warning {
120
- > span {
121
- color: #00b9ff /*$blue*/;
122
- }
123
- }
124
-
125
- &.active {
126
- > .container {
127
- &:after {
128
- width: 100%;
129
- }
130
-
131
- > .suggestions.active {
132
- visibility: visible;
133
- opacity: 1;
134
- }
135
- }
136
- }
137
-
138
- &.dark {
139
- > .container {
140
- background: var(--color-body);
141
-
142
- > input {
143
- padding: 15px 20px;
144
-
145
- &::placeholder {
146
- color: var(--color-white-op-30);
147
- }
148
- }
149
- }
150
-
151
- &.active,
152
- &.touched {
153
- > .container {
154
- background: white;
155
- }
156
- }
157
- }
158
- }
@@ -1,2 +0,0 @@
1
- @use 'input';
2
- @use 'checkbox';