@iyulab/components 2.39.0 → 3.0.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/README.md +11 -0
  3. package/dist/components/UElement.d.ts +18 -0
  4. package/dist/components/UElement.js +18 -0
  5. package/dist/components/UFloatingElement.styles.js +1 -0
  6. package/dist/components/UFormControlElement.d.ts +1 -2
  7. package/dist/components/UFormControlElement.js +2 -24
  8. package/dist/components/alert/UAlert.d.ts +3 -3
  9. package/dist/components/alert/UAlert.js +2 -2
  10. package/dist/components/alert/UAlert.styles.js +20 -18
  11. package/dist/components/badge/UBadge.styles.js +4 -3
  12. package/dist/components/breadcrumb/UBreadcrumb.js +1 -0
  13. package/dist/components/breadcrumb/UBreadcrumb.styles.js +6 -0
  14. package/dist/components/breadcrumb-item/UBreadcrumbItem.d.ts +2 -0
  15. package/dist/components/breadcrumb-item/UBreadcrumbItem.js +8 -1
  16. package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +2 -2
  17. package/dist/components/button/UButton.d.ts +8 -1
  18. package/dist/components/button/UButton.js +15 -15
  19. package/dist/components/button/UButton.styles.js +6 -8
  20. package/dist/components/calendar/UCalendar.js +3 -2
  21. package/dist/components/calendar/UCalendar.styles.js +4 -0
  22. package/dist/components/calendar/picker.styles.js +3 -16
  23. package/dist/components/card/UCard.d.ts +1 -0
  24. package/dist/components/card/UCard.js +3 -0
  25. package/dist/components/carousel/UCarousel.js +2 -4
  26. package/dist/components/carousel/UCarousel.styles.js +8 -5
  27. package/dist/components/command-palette/UCommandPalette.styles.js +2 -6
  28. package/dist/components/divider/UDivider.styles.js +3 -3
  29. package/dist/components/drawer/UDrawer.styles.js +2 -0
  30. package/dist/components/expander/UExpander.styles.js +6 -0
  31. package/dist/components/field/UField.styles.js +1 -1
  32. package/dist/components/file-input/UFileInput.styles.js +3 -4
  33. package/dist/components/icon-button/UIconButton.d.ts +1 -2
  34. package/dist/components/icon-button/UIconButton.js +2 -13
  35. package/dist/components/input/UInput.styles.js +9 -8
  36. package/dist/components/menu/UMenu.js +2 -2
  37. package/dist/components/menu-item/UMenuItem.js +1 -1
  38. package/dist/components/menu-item/UMenuItem.styles.js +19 -9
  39. package/dist/components/option/UOption.styles.js +10 -8
  40. package/dist/components/pagination/UPagination.styles.js +6 -0
  41. package/dist/components/popover/UPopover.d.ts +7 -0
  42. package/dist/components/popover/UPopover.js +25 -0
  43. package/dist/components/progress-bar/UProgressBar.styles.js +15 -8
  44. package/dist/components/radio/URadio.js +2 -2
  45. package/dist/components/radio/URadio.styles.js +11 -4
  46. package/dist/components/rating/URating.js +7 -2
  47. package/dist/components/rating/URating.styles.js +1 -1
  48. package/dist/components/select/USelect.d.ts +15 -15
  49. package/dist/components/select/USelect.js +7 -9
  50. package/dist/components/select/USelect.styles.js +17 -8
  51. package/dist/components/skeleton/USkeleton.styles.js +1 -2
  52. package/dist/components/slider/USlider.js +11 -6
  53. package/dist/components/slider/USlider.styles.js +7 -5
  54. package/dist/components/split-panel/USplitPanel.d.ts +2 -0
  55. package/dist/components/split-panel/USplitPanel.js +13 -5
  56. package/dist/components/split-panel/USplitPanel.styles.js +4 -1
  57. package/dist/components/steps/USteps.styles.js +3 -4
  58. package/dist/components/switch/USwitch.styles.js +7 -4
  59. package/dist/components/tab/UTab.styles.js +5 -5
  60. package/dist/components/tab-nav/UTabNav.styles.js +1 -2
  61. package/dist/components/tab-panel/UTabPanel.js +2 -2
  62. package/dist/components/tab-panel/UTabPanel.styles.js +4 -4
  63. package/dist/components/tag/UTag.styles.js +4 -4
  64. package/dist/components/textarea/UTextarea.styles.js +3 -3
  65. package/dist/components/tree/UTree.js +2 -2
  66. package/dist/components/tree-item/UTreeItem.js +1 -1
  67. package/dist/components/tree-item/UTreeItem.styles.js +20 -13
  68. package/dist/react/USelect.d.ts +3 -3
  69. package/dist/react/USelect.js +1 -1
  70. package/dist/utilities/Toast.js +1 -0
  71. package/package.json +4 -3
  72. package/skills/iyulab-components/SKILL.md +2 -0
  73. package/skills/iyulab-components/references/components/alert.md +8 -7
  74. package/skills/iyulab-components/references/components/breadcrumb.md +1 -1
  75. package/skills/iyulab-components/references/components/input.md +7 -2
  76. package/skills/iyulab-components/references/components/popover.md +3 -0
  77. package/skills/iyulab-components/references/components/select.md +3 -3
  78. package/skills/iyulab-components/references/components/split-panel.md +1 -1
  79. package/skills/iyulab-components/references/usage.md +16 -0
@@ -23,7 +23,7 @@ var styles = css`
23
23
  flex-direction: row;
24
24
  align-items: center;
25
25
  padding: 4px 8px;
26
- padding-left: calc(
26
+ padding-inline-start: calc(
27
27
  var(--tree-indent-size) * var(--tree-item-depth)
28
28
  + var(--tree-indent-guide-offset)
29
29
  );
@@ -54,10 +54,10 @@ var styles = css`
54
54
  display: none;
55
55
  }
56
56
  .affix-prefix {
57
- margin-right: 0.2em;
57
+ margin-inline-end: 0.2em;
58
58
  }
59
59
  .affix-suffix {
60
- margin-left: 0.2em;
60
+ margin-inline-start: 0.2em;
61
61
  }
62
62
 
63
63
 
@@ -65,9 +65,7 @@ var styles = css`
65
65
  flex: 1;
66
66
  min-width: 0;
67
67
  line-height: 1.5;
68
- overflow: hidden;
69
- text-overflow: ellipsis;
70
- white-space: nowrap;
68
+ overflow-wrap: anywhere;
71
69
  }
72
70
 
73
71
 
@@ -80,7 +78,8 @@ var styles = css`
80
78
  position: relative;
81
79
  box-sizing: border-box;
82
80
  flex-shrink: 0;
83
- margin: -3px 1px -3px -3px;
81
+ margin-block: -3px;
82
+ margin-inline: -3px 1px;
84
83
  display: inline-flex;
85
84
  align-items: center;
86
85
  justify-content: center;
@@ -102,6 +101,11 @@ var styles = css`
102
101
  font-size: 12px;
103
102
  pointer-events: none;
104
103
  }
104
+
105
+
106
+ :host(:dir(rtl)) .toggle-glyph {
107
+ transform: scaleX(-1);
108
+ }
105
109
  :host(:not([disabled])[trigger="icon"]) .prefix-toggler:hover::before,
106
110
  :host(:not([disabled])[trigger="icon"]:focus-visible) .prefix-toggler::before {
107
111
  background-color: var(--u-bg-color-hover, #F5F5F5);
@@ -110,11 +114,13 @@ var styles = css`
110
114
 
111
115
 
112
116
  :host([checkable]) .prefix-toggler {
113
- margin: -3px 4px -3px -6px;
114
- padding-left: 6px;
117
+ margin-block: -3px;
118
+ margin-inline: -6px 4px;
119
+ padding-inline-start: 6px;
115
120
  }
116
121
  :host([checkable]) .prefix-toggler::before {
117
- inset: 3px 0 3px 6px;
122
+ inset-block: 3px;
123
+ inset-inline: 6px 0;
118
124
  }
119
125
 
120
126
 
@@ -124,7 +130,8 @@ var styles = css`
124
130
  position: relative;
125
131
  box-sizing: border-box;
126
132
  flex-shrink: 0;
127
- margin: -4px 0 -4px -4px;
133
+ margin-block: -4px;
134
+ margin-inline: -4px 0;
128
135
  display: inline-flex;
129
136
  align-items: center;
130
137
  justify-content: center;
@@ -171,10 +178,10 @@ var styles = css`
171
178
  position: absolute;
172
179
  top: 0;
173
180
  bottom: 0;
174
- left: calc(
181
+ inset-inline-start: calc(
175
182
  var(--tree-indent-size) * (var(--tree-item-depth) + 1)
176
183
  );
177
- border-left: var(--tree-indent-guide-width)
184
+ border-inline-start: var(--tree-indent-guide-width)
178
185
  var(--tree-indent-guide-style)
179
186
  var(--tree-indent-guide-color);
180
187
  pointer-events: none;
@@ -1,17 +1,17 @@
1
1
  import React from 'react';
2
2
  import { USelect as USelectElement } from '@iyulab/components/dist/components/select/USelect.js';
3
- import { type USelectSearchDetail } from '@iyulab/components/dist/components/select/USelect.js';
3
+ import { type USelectQueryChangeDetail } from '@iyulab/components/dist/components/select/USelect.js';
4
4
 
5
5
  type EventOf<K extends string> = K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : CustomEvent;
6
6
  type USelectOwnProps = Omit<USelectElement, keyof HTMLElement>;
7
7
 
8
8
  export declare const USelect: React.ForwardRefExoticComponent<
9
9
  Partial<Omit<USelectElement, Exclude<keyof React.HTMLAttributes<USelectElement>, keyof USelectOwnProps>>>
10
- & Omit<React.HTMLAttributes<USelectElement>, keyof USelectOwnProps | 'onChange' | 'onSearch'>
10
+ & Omit<React.HTMLAttributes<USelectElement>, keyof USelectOwnProps | 'onChange' | 'onQueryChange'>
11
11
  & React.RefAttributes<USelectElement>
12
12
  & {
13
13
  onChange?: (event: EventOf<'change'>) => void;
14
- onSearch?: (event: CustomEvent<USelectSearchDetail>) => void;
14
+ onQueryChange?: (event: CustomEvent<USelectQueryChangeDetail>) => void;
15
15
  }
16
16
  >;
17
17
 
@@ -8,6 +8,6 @@ export const USelect = createComponent({
8
8
  elementClass: USelectElement,
9
9
  events: {
10
10
  onChange: 'change',
11
- onSearch: 'search',
11
+ onQueryChange: 'query-change',
12
12
  },
13
13
  });
@@ -44,6 +44,7 @@ var Toast = class {
44
44
  ...options
45
45
  };
46
46
  const el = new UAlert();
47
+ el.floating = true;
47
48
  el.status = status;
48
49
  el.textContent = content || "";
49
50
  el.appearance = merged.appearance || "soft";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
- "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.39.0",
3
+ "description": "Lit-based UI elements for business web apps: buttons, inputs, selects, date pickers, dialogs, design tokens, theming and a locale registry",
4
+ "version": "3.0.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -49,8 +49,9 @@
49
49
  "scripts": {
50
50
  "preversion": "node -e \"if(require('fs').existsSync('../../scripts/preversion-check.mjs'))require('child_process').execFileSync('node',['../../scripts/preversion-check.mjs'],{stdio:'inherit'})\"",
51
51
  "start": "vite --force",
52
- "test": "vitest run",
52
+ "test": "vitest run --project=unit --project=browser",
53
53
  "test:browser": "vitest run --project=browser",
54
+ "test:webkit": "vitest run --project=webkit",
54
55
  "lint": "eslint src/",
55
56
  "lint:fix": "eslint src/ --fix",
56
57
  "build": "npm run typecheck && eslint && npm run typecheck:plugins && vite build && npm run build:plugins && npm run test:react-types",
@@ -43,6 +43,8 @@ import { UButton, UInput } from '@iyulab/components/react';
43
43
 
44
44
  > For detailed guidance on theming, icon setup, and advanced usage, see [./references/usage.md](./references/usage.md).
45
45
 
46
+ > **Direction:** layout follows the document direction — under `dir="rtl"` the prefix/suffix slots, inner padding and borders mirror (logical CSS properties). Placement values that name a physical side (`u-drawer placement="left"`, `u-tab-panel placement`) stay physical. The chevrons a component draws itself mirror too (breadcrumb separator, previous/next in pagination and calendar, the closed marker of expander and tree item, the submenu marker) — a chevron you pass through a `separator` or `expand-icon` slot stays as you drew it. Script-positioned parts follow the pointer and the arrow keys in a right-to-left page (`u-split-panel`, `u-slider`, `u-rating`, `u-carousel`). The badge corner placements stay physical on purpose; the virtualized grid and spreadsheet are mirrored in `@iyulab/flex-table` and `@iyulab/data-components`, and the timeline keeps time left to right.
47
+
46
48
  ---
47
49
 
48
50
  ## Components
@@ -18,21 +18,22 @@ Closable message banner with status icons, auto-dismiss timer, and open/hide tra
18
18
  <u-button slot="footer" appearance="solid">Retry</u-button>
19
19
  </u-alert>
20
20
 
21
- <!-- In the page flow (a callout, an error summary): fills its place, no floating shadow -->
22
- <u-alert inline open status="info" title="Totals follow the filters above">
21
+ <!-- The default is the page flow (a callout, an error summary): fills its place, no floating shadow -->
22
+ <u-alert open status="info" title="Totals follow the filters above">
23
23
  Clear a filter chip to widen them.
24
24
  </u-alert>
25
25
 
26
26
  <!-- A static note is not a live region: set the role, and swap the icon -->
27
- <u-alert inline open status="notice" role="note" title="Note">
27
+ <u-alert open status="notice" role="note" title="Note">
28
28
  <u-icon slot="icon" lib="bootstrap" name="pencil"></u-icon>
29
29
  Customer asked for the same cover as last year.
30
30
  </u-alert>
31
31
  ```
32
32
 
33
- Without `inline` the alert has the floating look a toast uses (content width, large shadow, scale transition) and
34
- keeps its place while closed. `inline` is for an alert that sits in the page: it fills its container, drops the
35
- shadow and the transition, and takes no space while closed. The role follows `status` (`error`/`warning` →
33
+ By default the alert sits in the page flow: it fills its container, has no shadow or transition, and takes no space
34
+ while closed. Add `floating` for the look a toast uses (content width, large shadow, scale transition; it keeps its
35
+ place while closed) — `Toast` does this for you. (Before 3.0 the default was the floating look and the page-flow
36
+ form was `inline`; `inline` no longer exists — delete it.) The role follows `status` (`error`/`warning` →
36
37
  `alert`, otherwise `status`) unless you set one — a role you set is kept.
37
38
 
38
39
  ---
@@ -55,7 +56,7 @@ shadow and the transition, and takes no space while closed. The role follows `st
55
56
  | `status` | `'error'\|'warning'\|'success'\|'info'\|'notice'` | — | ✓ | Status type; controls icon, color and role (`error`/`warning` are `role="alert"`). An outcome word, not a palette word — buttons and badges say `color="danger"`, an alert says `status="error"`; an unknown value renders as a neutral notice and warns in development, naming the likely word |
56
57
  | `title` | `string` | `''` | — | Title label. Left empty, the status name in the current locale is shown (`Locale.set('ko')` → 「오류」), not the raw status value |
57
58
  | `duration` | `number` | `0` | — | Auto-dismiss delay in ms; `0` disables |
58
- | `inline` | `boolean` | `false` | ✓ | In the page flow: fills its container, no floating shadow or scale transition, no space while closed |
59
+ | `floating` | `boolean` | `false` | ✓ | The floating (toast) look: content width, large shadow, scale transition, keeps its place while closed. Default (absent): in the page flow |
59
60
 
60
61
  ## Events
61
62
 
@@ -59,7 +59,7 @@ Hierarchical location indicator. Compose `u-breadcrumb-item` elements inside `u-
59
59
  | Property | Type | Default | Reflect | Description |
60
60
  |----------|------|---------|---------|-------------|
61
61
  | `disabled` | `boolean` | `false` | ✓ | Disable the item |
62
- | `href` | `string` | — | — | Link URL; renders as `<a>` when set |
62
+ | `href` | `string` | — | — | Link URL; renders as `<a>` when set (a host `aria-label` moves onto the link) |
63
63
  | `target` | `string` | — | — | Link `target` attribute |
64
64
  | `rel` | `string` | — | — | Link `rel` attribute |
65
65
 
@@ -105,12 +105,17 @@ Call `preventDefault()` on the `keydown` to cancel it. Do not also submit on Ent
105
105
 
106
106
  ```html
107
107
  <form @submit=${onSubmit}>
108
- <u-input name="user" required></u-input>
109
- <u-input name="password" type="password" required></u-input>
108
+ <u-input name="user" autocomplete="username" required></u-input>
109
+ <u-input name="password" type="password" autocomplete="current-password" required></u-input>
110
110
  <u-button type="submit">Sign in</u-button>
111
111
  </form>
112
112
  ```
113
113
 
114
+ The browser's password manager sees these fields like native ones: inside a `<form>`, with a
115
+ `name` and `autocomplete="username"` / `"current-password"` (`"new-password"` on a sign-up or
116
+ change-password form), it offers to save the credentials on submit and fills both fields on the
117
+ next visit (verified in Chrome).
118
+
114
119
  ## Methods
115
120
 
116
121
  | Method | Description |
@@ -74,6 +74,9 @@ document.addEventListener('keydown', (e) => {
74
74
  });
75
75
  ```
76
76
 
77
+ `trigger="contextmenu"` also opens from the keyboard: the menu key or Shift+F10 on the anchor opens it at the focused
78
+ element, in every browser (Safari fires no `contextmenu` for those keys, so the popover takes them).
79
+
77
80
  `scroll` and `resize` are viewport-geometry changes and **only close the popover when it is
78
81
  anchored to a coordinate** — i.e. the virtual anchor created by `trigger="contextmenu"`, whose
79
82
  `clientX`/`clientY` stop matching whatever they pointed at once the page reflows.
@@ -41,10 +41,10 @@ Options of different kinds can be grouped under headings with [`u-option-group`]
41
41
  | `value` | `string \| string[]` | — | — | Selected value(s) |
42
42
  | `appearance` | `'outlined'\|'soft'\|'underlined'\|'plain'` | `'outlined'` | ✓ | How much chrome: `outlined` · `soft` tinted face · `underlined` bottom line only · `plain` no chrome |
43
43
  | `size` | `'sm'\|'md'\|'lg'` | `'md'` | ✓ | Field size, like a button's: `--u-density` (14px) for md, 6/7 of it for sm (12px) and 8/7 for lg (16px) — change the density and all three follow. A field and a button of the same size share a height |
44
- | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its clear button and arrow + padding, so it no longer widens and narrows with the chosen option (a longer one ends in an ellipsis); a sized one (`--u-select-width`, `block`) uses it as the text floor, so a narrower box overflows. Same axis as `u-input`'s `chars`. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
44
+ | `chars` | `number` | — | ✓ | Characters the field holds. An unsized field draws at N characters + its clear button and arrow + padding, so it no longer widens and narrows with the chosen option (a longer one ends in an ellipsis; the open list shows it in full); a sized one (`--u-select-width`, `block`) uses it as the text floor, so a narrower box overflows. Same axis as `u-input`'s `chars`. N characters are measured as drawn — tabular figures and letter spacing count, which CSS `ch` leaves out |
45
45
  | `multiple` | `boolean` | `false` | ✓ | Allow multiple selections |
46
46
  | `searchable` | `boolean` | `false` | ✓ | Filter options by text |
47
- | `filter` | `'local'\|'none'` | `'local'` | ✓ | Who filters by the search text. `local` shows options whose text or value contains it; `none` hides nothing — for remote search, where the `search` event drives a server query and you replace the options with its results. When the text matches nothing (and not `loading`), the popup says *No matches* |
47
+ | `filter` | `'local'\|'none'` | `'local'` | ✓ | Who filters by the search text. `local` shows options whose text or value contains it; `none` hides nothing — for remote search, where the `query-change` event drives a server query and you replace the options with its results. When the text matches nothing (and not `loading`), the popup says *No matches* |
48
48
  | `clearable` | `boolean` | `false` | ✓ | Show clear button |
49
49
  | `loading` | `boolean` | `false` | ✓ | Loading state |
50
50
  | `placeholder` | `string` | — | — | Placeholder text |
@@ -65,7 +65,7 @@ Options of different kinds can be grouped under headings with [`u-option-group`]
65
65
  | Event | Description |
66
66
  |-------|-------------|
67
67
  | `change` | Fires when selection changes |
68
- | `search` | Fires when the search text changes, when `searchable` (`detail: { query: string; composing: boolean }`). While an IME composition is in progress (Korean, Japanese, Chinese) `composing` is `true` and `query` ends in a partial syllable; when it ends the event fires again with `false` — a server search can skip composing queries. While composing, the built-in filter uses only the committed part, so it never hides an option the finished text would match. With `filter="none"` the select hides nothing, so the options you set from the server are shown as they are — otherwise the built-in local filter runs too |
68
+ | `query-change` | Fires when the text that filters the options changes, when `searchable` (`detail: { query: string }`). While an IME composition is in progress (Korean, Japanese, Chinese) it does not fire; when the composition ends it fires once with the finished text — a server search never sees a half-composed syllable. (Before 3.0 this was `search` with `detail.composing`; `search` now means only «a search was committed», on `u-input type="search"`.) While composing, the built-in filter uses only the committed part, so it never hides an option the finished text would match. With `filter="none"` the select hides nothing, so the options you set from the server are shown as they are — otherwise the built-in local filter runs too |
69
69
 
70
70
  ## Methods
71
71
 
@@ -89,7 +89,7 @@ share of the two panels it sits between — `100` with two panels), and it is na
89
89
  | `Home` / `End` | Give the panel before the handle its smallest / largest size |
90
90
  | `Enter` | Collapse the panel before the handle; press again to restore its previous size |
91
91
 
92
- In a right-to-left layout `←` still moves the handle left. A keyboard change fires `shift-start`,
92
+ In a right-to-left layout the first pane is on the right: `←` still moves the handle left (so it grows that pane) and a pointer drag follows the pointer. A keyboard change fires `shift-start`,
93
93
  `shift` and `shift-end` in turn, so listening to `shift-end` alone covers both pointer and keyboard.
94
94
 
95
95
  ## CSS Custom Properties
@@ -156,6 +156,22 @@ To rebrand typography, override the tokens rather than the screens:
156
156
  :root { --u-text-title-size: 22px; --u-text-title-weight: 800; }
157
157
  ```
158
158
 
159
+ ### Touch targets — `--u-target-size`
160
+
161
+ By default controls keep their normal size (24×24 CSS px or larger, WCAG 2.2 SC 2.5.8) — 36px high for a
162
+ button. For touch, set a floor for everything that is pressed once, instead of writing `::part()` rules per component:
163
+
164
+ ```css
165
+ @media (pointer: coarse) {
166
+ :root { --u-target-size: 44px; }
167
+ }
168
+ ```
169
+
170
+ Buttons, text fields, selects, date pickers, tabs and menu rows grow to it; small controls (checkbox, switch,
171
+ rating stars, slider thumb, a field's clear/reveal icons) keep their look and grow only the area that takes the
172
+ press. It is a floor — anything already larger stays. Unset (the default) changes nothing. Details:
173
+ `docs/theming.md` «Target size».
174
+
159
175
  ---
160
176
 
161
177
  ## Icon Setup