@iyulab/components 1.23.0 โ 1.24.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/CHANGELOG.md +62 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/components/field/UField.styles.js +15 -0
- package/dist/components/icon/UIcon.d.ts +17 -4
- package/dist/components/icon/UIcon.js +9 -6
- package/dist/components/text/UText.d.ts +38 -0
- package/dist/components/text/UText.js +45 -0
- package/dist/components/text/UText.styles.d.ts +1 -0
- package/dist/components/text/UText.styles.js +91 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/react/UText.d.ts +12 -0
- package/dist/react/UText.js +10 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utilities/Theme.d.ts +13 -0
- package/dist/utilities/Theme.js +13 -0
- package/package.json +4 -3
- package/skills/iyulab-components/SKILL.md +2 -0
- package/skills/iyulab-components/references/components/copy-button.md +80 -0
- package/skills/iyulab-components/references/components/icon.md +12 -0
- package/skills/iyulab-components/references/components/text.md +79 -0
- package/skills/iyulab-components/references/usage.md +51 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.24.0] - 2026-08-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- ๐ด**`u-text` โ ์๋ฏธ ํ์ดํฌ๊ทธ๋ํผ ์ค์ผ์ผ(7๋จ)์ ๋งํฌ์
์์ ์ฐ๋ ์๋ฆฌ.**
|
|
8
|
+
์ํธ๋ `1.21.0` ๋ถํฐ ๋จ๋ง๋ค **ํฌ๊ธฐยท๊ตต๊ธฐยทํ๊ฐยท์๊ฐ** ๋ค ๊ฐ์ ๊ฐ๊ณ ์์์ง๋ง **๊ทธ ๋จ์
|
|
9
|
+
์ ์ฉํ๋ ์ปดํฌ๋ํธ๊ฐ ์์๋ค** โ ์๋น์๊ฐ ์ค์ผ์ผ์ ์ฐ๋ ค๋ฉด ์๊ธฐ CSS ์์ ํ ํฐ์ ์ง์
|
|
10
|
+
์ฐธ์กฐํด์ผ ํ๊ณ , ๊ทธ๋ฌ๋ฉด ยซ์ปดํฌ๋ํธ๋ง์ผ๋ก ํ๋ฉด์ ์ง๋๋คยป๊ฐ ๊ทธ ์๋ฆฌ์์ ๊นจ์ก๋ค.
|
|
11
|
+
โ ์ฐ๋ฆฌ๊ฐ ์ค ๊ฒ์ **๊ฐ**์ด๊ณ ํ์ํ๋ ๊ฒ์ **์๋ฆฌ**๋ค.
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<u-text level="1" variant="display">๋ฌธ์ ์ ๋ชฉ</u-text>
|
|
15
|
+
<u-text variant="subtitle" tone="weak">ํ ์ค ์ค๋ช
</u-text>
|
|
16
|
+
<u-text>๋ณธ๋ฌธ</u-text>
|
|
17
|
+
<u-text variant="caption" tone="weak">๋ณด์กฐ ๋ฌธ๊ตฌ</u-text>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
โ
**์๊ฐ ์ถ(`variant`)๊ณผ ์๋ฏธ ์ถ(`level`)์ด ๋
๋ฆฝ**์ด๋ค โ `level` ์ ์ฃผ๋ฉด ์๋ ๋ฃจํธ์ ์ค์
|
|
21
|
+
`<h1>`~`<h6>` ์ ๋ ๋ํด heading ์ผ๋ก ์ฝํ๊ณ (์ฌ๋กฏ ํ
์คํธ๊ฐ ์ ๊ทผ๊ฐ๋ฅ ์ด๋ฆ), ์ฃผ์ง ์์ผ๋ฉด
|
|
22
|
+
`<p>` ๋ค. ๊ทธ๋์ *"ํ์ด์ง์ ๋ ๋ฒ์งธ ์ ๋ชฉ์ด ์๊ฐ์ ์ผ๋ก ๊ฐ์ฅ ํฐ"* ๋ฐฐ์น๊ฐ ๋งํฌ์
์
|
|
23
|
+
๊ฑฐ์ง๋ง์ํค์ง ์๊ณ ํํ๋๋ค.
|
|
24
|
+
|
|
25
|
+
โ **`tone` ์ ์ค๋ฆฝ ๊ฐ์กฐ ์ถ์ด๋ค**(`default`ยท`weak`ยท`strong`ยท`inverse`) โ ์ญํ ์์ด
|
|
26
|
+
์๋๋ค. ์๋น ํ๋ฉด ์ค์ธก์์ ๋์จ ์ ๋ค์ฏ ์ค ์
์ด ์ด ์ถ์ด์๊ณ ๋๋จธ์ง ๋์ **๋งํฌ**์
|
|
27
|
+
**์ฝ์์ ๋ฐ์ค**๋ผ ์ด ์ปดํฌ๋ํธ์ ์ถ์ด ์๋์๋ค.
|
|
28
|
+
|
|
29
|
+
โ **๊ฐ์ ์๋ก ์ ์ํ์ง ์๋๋ค** โ 7๋จ ร 4์์ฑ์ ์ํธ์์ ์ฝ๊ธฐ๋ง ํ๋ค. ํ๊ท 12๊ฑด์ด
|
|
30
|
+
*"์ด๋ค ํฌ๊ธฐ์ธ๊ฐ"* ๊ฐ ์๋๋ผ ***"์ํธ๊ฐ ๋งํ ๊ทธ ๊ฐ์ ์ฐ๋๊ฐ"*** ๋ฅผ ์ฐ๋ค.
|
|
31
|
+
๊ฐ์ ์ด์ ๋ก `overline` ์ `text-transform: uppercase` ๋ฅผ **๋ถ์ด์ง ์์๋ค** โ ๊ด์ต์ด๊ธด ํ๋
|
|
32
|
+
์๋น์๊ฐ ์ด ๊ธ์๋ฅผ ๋ฐ๊พธ๊ณ , CJK ์๋ ํจ๊ณผ๊ฐ ์์ด **๊ฐ์ ๋จ์ด ์ธ์ด์ ๋ฐ๋ผ ๋ค๋ฅด๊ฒ ๋ณด์ธ๋ค.**
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- ๐ด**`u-field` ์์ ์ปจํธ๋กค์ด ํ๋ ํญ์ ์ฑ์ฐ์ง ์์ ํผ ๊ฒฉ์๊ฐ ์ด๊ธ๋ฌ๋ค.** ์ค์ธก: ๊ฐ์ 231px
|
|
37
|
+
์นธ ์์์ `u-input` 202 ยท `u-select` 71/92/108 ยท `u-textarea` 168 โ **์ค๋ฅธ์ชฝ ๋์ด ๋ค์ฏ
|
|
38
|
+
๊ตฐ๋ฐ์์ ๋ค ๋ฌ๋๋ค.** ์ปจํธ๋กค ์์ ์ ๊ธฐ๋ณธ๊ฐ(`inline-block`)์ ์ณ์ง๋ง, `u-field` ๋ก ๊ฐ์ผ
|
|
39
|
+
์๊ฐ ๊ทธ๊ฒ์ **ํผ์ ํ ์นธ**์ด๋ค โ ๋ผ๋ฒจยท์ค๋ช
ยท๊ฒ์ฆ ๋ฌธ๊ตฌ์ ๋ฐฐ์น๋ฅผ ์ฑ
์์ง๋ ์ด ์ปดํฌ๋ํธ๊ฐ
|
|
40
|
+
ํญ๋ ํจ๊ป ์ ํ๋ค(`::slotted(*) { width: 100% }`).
|
|
41
|
+
โ ์๋น์๊ฐ ์ธ๋ผ์ธ `style` ๋ก ํญ์ ์ฃผ๋ฉด ๊ทธ์ชฝ์ด ์ด๊ธด๋ค.
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- **`u-icon[fallback]`** โ ์ด๋ฆยทURL ์ด ํด์๋์ง ์์ ๋ ๋์ ๊ทธ๋ฆด SVG ์๋ฌธ.
|
|
46
|
+
ยซ์์ด์ฝ์ด ์ ๋ณด์ธ๋คยป๊ฐ **ยซ๋๋ฅผ ๊ฒ์ด ์๋คยป** ๊ฐ ๋๋ ์๋ฆฌ๊ฐ ์๋ค(์ ํ ์ฌ์ด๋๋ฐ์ ๋ฉ๋ด ํญ๋ชฉ).
|
|
47
|
+
ํด์ ์คํจ๋ ์ด๋ฆ ๋ฏธ์ง์ ยท 404 ยท SVG ํ์ฑ ์คํจ๋ฅผ **๋ชจ๋** ํฌํจํ๋ค.
|
|
48
|
+
|
|
49
|
+
### Documentation
|
|
50
|
+
|
|
51
|
+
- ๐ด**`Theme.accent(seed)` ๊ฐ `primary` ์ญํ ํ ํฐ **7์ข
์ค 6์ข
**๋ง ์ธํ
ํ๋ค๋ ๊ฒ์ ๋ช
์ํ๋ค.**
|
|
52
|
+
`--u-primary-bg-color`(`u-tag` ์ `--tag-hue-surface` ๊ฐ ์ฝ๋ ยซ๊ธ์๋ฅผ ์น๋ ์
์ ๋ฉดยป)๋
|
|
53
|
+
์ํธ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ๋จ์ผ๋ฏ๋ก, **์๋๋ง ๋ฃ์ผ๋ฉด ํ๊ทธยท์ ํ๋ ํ ๊ฐ์ ์
์ ๋ฉด์ด ํ๋์ผ๋ก ๋จ๋๋ค.**
|
|
54
|
+
์ค์ธก๋ ์ฆ์์ด *"๋ฒํผ์ ๋ธ๋๋์ธ๋ฐ ์ ํ๋ ํ ํ์ ํ๋"* ์ด๋ค.
|
|
55
|
+
โ `usage.md` ๋ธ๋๋ ์ ์ **7์ข
ํ**์ ํ ์ค ํด๋ฒ์, `Theme.accent` JSDoc ์ ๊ฐ์ ๋ด์ฉ์ ์ ์๋ค.
|
|
56
|
+
|
|
57
|
+
โ **ํ์์ ๋ถ์ด์ง ์์ ์ด์ **: ์ด ํ ํฐ์ `info`ยท`success`ยท`danger`ยท`warning` ๊ณผ ํ ์ธํธ๋ก
|
|
58
|
+
**5๊ณ์ด ร 2ํ
๋ง = 10๊ฐ ๊ฐ์ด ์์ผ๋ก ์ง์ง์ด์ ธ** ์๊ณ , ๋ ํ
๋ง๊ฐ ๊ฐ์ ๊ณ์ฝ์ ์ฐ์ง ์๋๋ค
|
|
59
|
+
(๋ฐํ ๋๋น๋น ์ค์ธก โ ๋ผ์ดํธ **1.142** ยท ๋คํฌ **1.030**). ๋์ถ์์ผ๋ก ๋ฐ๊พธ๋ ๊ฒ์ ํ๋ ํธ
|
|
60
|
+
๊ฐ ๊ฒฐ์ ์ด๋ผ ๋ณ๋ ํ๋จ์ด ํ์ํ๋ค.
|
|
61
|
+
|
|
62
|
+
๋ธ๋ผ์ฐ์ ํ๊ท 2๊ฑด์ด ์ด ๋ฌธ์๊ฐ ์ฐธ์ธ์ง ์ฐ๋ค โ **๊ฒฐ์์ ๊ณ ์ ํ๋ ๊ฒ์ด ์๋๋ผ**, ๋์ค์ ํ์์ด
|
|
63
|
+
๋ถ์ผ๋ฉด ๊ทธ ํ
์คํธ๊ฐ ๋ค์งํ๋ฉด์ ๋ฌธ์๋ ๊ณ ์น๋ผ๊ณ ์๋ฆฐ๋ค.
|
|
64
|
+
|
|
3
65
|
## [1.23.0] - 2026-08-04
|
|
4
66
|
|
|
5
67
|
### Added
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ npx skills add ./node_modules/@iyulab/components
|
|
|
76
76
|
|
|
77
77
|
**Navigation** โ `u-menu`, `u-menu-item`, `u-tab-panel`, `u-breadcrumb`, `u-breadcrumb-item`, `u-tree`, `u-tree-item`
|
|
78
78
|
|
|
79
|
-
**Layout & Display** โ `u-avatar`, `u-card`, `u-carousel`, `u-divider`, `u-icon`, `u-panel`, `u-split-panel`, `u-tag`
|
|
79
|
+
**Layout & Display** โ `u-avatar`, `u-card`, `u-carousel`, `u-divider`, `u-icon`, `u-panel`, `u-split-panel`, `u-tag`, `u-text`
|
|
80
80
|
|
|
81
81
|
## Theming
|
|
82
82
|
|
|
@@ -15,6 +15,21 @@ var styles = css`
|
|
|
15
15
|
color: var(--u-danger-color-strong, #C62828);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/* ๐ด**๋ผ๋ฒจ์ ๋จ ์ปจํธ๋กค์ ํ๋ ํญ์ ์ฑ์ด๋ค.**
|
|
19
|
+
์ปจํธ๋กค ์์ ์ ๊ธฐ๋ณธ๊ฐ์ inline-block(์๊ธฐ ๋ด์ฉ๋งํผ)์ด ์ณ๋ค โ ๋ฌธ์ฅ ์์ ๋์ด๋ ๊ฒฝ์ฐ๊ฐ
|
|
20
|
+
์๊ธฐ ๋๋ฌธ์ด๋ค. ๊ทธ๋ฌ๋ u-field ๋ก ๊ฐ์ผ ์๊ฐ ๊ทธ๊ฒ์ **ํผ์ ํ ์นธ**์ด๊ณ , ์นธ๋ง๋ค ์ปจํธ๋กค์ด
|
|
21
|
+
์ ๊ฐ๊ฐ์ ํญ์ ๊ฐ์ง๋ฉด ๊ฒฉ์๊ฐ ๋๋๋๋ํด์ง๋ค. ์ค์ธก: ๊ฐ์ 231px ์นธ ์์์ input 202 ยท
|
|
22
|
+
select 71/92/108 ยท textarea 168 โ **์ค๋ฅธ์ชฝ ๋์ด ๋ค์ฏ ๊ตฐ๋ฐ์์ ๋ค ๋ฌ๋๋ค.**
|
|
23
|
+
โ ๋ผ๋ฒจยท์ค๋ช
ยท๊ฒ์ฆ ๋ฌธ๊ตฌ์ ๋ฐฐ์น๋ฅผ ์ฑ
์์ง๋ ์ด ์ปดํฌ๋ํธ๊ฐ ํญ๋ ํจ๊ป ์ ํ๋ค.
|
|
24
|
+
|
|
25
|
+
โ ์๋น์๊ฐ ์ธ๋ผ์ธ style ๋ก ํญ์ ์ฃผ๋ฉด ๊ทธ์ชฝ์ด ์ด๊ธด๋ค(์ธ๋ผ์ธ > ::slotted).
|
|
26
|
+
โ ์ด ์ฃผ์์ ๋ฐฑํฑ์ ์ฐ์ง ๋ง ๊ฒ โ css ํ๊ทธ๋ ํ
ํ๋ฆฟ์ ๊ทธ ์๋ฆฌ์์ ๋๋ธ๋ค(์ด ํ์ผ์ด ์ค์ ๋ก
|
|
27
|
+
๊ทธ๋ ๊ฒ ๊นจ์ก๊ณ , cycle-217 ์ด ๋ง๋ ํ์
๊ฒ์ดํธ๊ฐ ์ก์๋ค). */
|
|
28
|
+
::slotted(*) {
|
|
29
|
+
width: 100%;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
.header {
|
|
19
34
|
display: flex;
|
|
20
35
|
flex-direction: row;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { nothing } from 'lit';
|
|
2
1
|
import { UElement } from '../UElement.js';
|
|
3
2
|
export type IconLibrary = (string & {}) | "internal" | "tabler" | "heroicons" | "lucide" | "bootstrap";
|
|
4
3
|
/**
|
|
@@ -14,9 +13,23 @@ export declare class UIcon extends UElement {
|
|
|
14
13
|
lib?: IconLibrary;
|
|
15
14
|
/** ์ฌ์ฉํ ์์ด์ฝ ์ด๋ฆ์ ์ง์ ํฉ๋๋ค. */
|
|
16
15
|
name?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* ์ด๋ฆยทURL ์ด **ํด์๋์ง ์์ ๋** ๋์ ๊ทธ๋ฆด SVG ์๋ฌธ.
|
|
18
|
+
*
|
|
19
|
+
* โ
**ยซ์์ด์ฝ์ด ์ ๋ณด์ธ๋คยป๊ฐ ยซ์๋ฆฌ ์์ฒด๊ฐ ์ฌ๋ผ์ง๋คยป๊ฐ ๋๋ ๊ณณ์ด ์๋ค.** ์ฌ์ด๋๋ฐ๊ฐ ์ ํ๋ฉด
|
|
20
|
+
* ๋ผ๋ฒจ์ด ์จ๊ณ ์์ด์ฝ๋ง ๋จ๋๋ฐ, ๊ทธ ์์ด์ฝ์ด ํด์์ ์คํจํ๋ฉด ๊ทธ ๋ฉ๋ด๋ **๋๋ฅผ ๊ฒ์ด ์๋
|
|
21
|
+
* ๋น ์ค**์ด ๋๋ค โ ์ด๋ฆ์ด ์๋ชป๋๋์ง, ํ์ผ์ด ์๋์ง, ์์ด์ฝ์ ์ ์ค ๊ฒ์ธ์ง ํ๋ฉด์์
|
|
22
|
+
* ๊ตฌ๋ถ๋์ง ์๊ณ **ํ์ ์๋จ์ด ํต์งธ๋ก ์ฌ๋ผ์ง๋ค.**
|
|
23
|
+
*
|
|
24
|
+
* โ ๊ทธ๋ฐ ์๋ฆฌ๋ ยซ์์ผ๋ฉด ์ ๊ทธ๋ฆฐ๋คยป๊ฐ ์๋๋ผ **ยซ์์ผ๋ฉด ๋์ ๊ทธ๋ฆฐ๋คยป** ์ฌ์ผ ํ๋ค.
|
|
25
|
+
* ํด์ ์คํจ๋ `name` ๋ฏธ์ง์ ยท ํ์ผ ์์(404) ยท SVG ํ์ฑ ์คํจ๋ฅผ **๋ชจ๋** ํฌํจํ๋ค.
|
|
26
|
+
*
|
|
27
|
+
* โ ์๋น์๊ฐ ์ฃผ๋ ๊ฐ์ `sanitize()` ๋ฅผ ๊ฑฐ์น๋ค(`name` ๊ฒฝ๋ก์ ๊ฐ์ ์ฒ๋ฆฌ).
|
|
28
|
+
*/
|
|
29
|
+
fallback?: string;
|
|
30
|
+
render(): import('lit-html/directive.js').DirectiveResult<typeof import('lit-html/directives/unsafe-html.js').UnsafeHTMLDirective>;
|
|
31
|
+
/** ํด์ ๊ฒฐ๊ณผ๊ฐ ์์ผ๋ฉด `fallback` ์ผ๋ก ๋์ ํ๋ค. ๋ ๋ค ์์ ๋๋ง ์๋ฌด๊ฒ๋ ๊ทธ๋ฆฌ์ง ์๋๋ค. */
|
|
32
|
+
private paint;
|
|
20
33
|
private resolve;
|
|
21
34
|
private sanitize;
|
|
22
35
|
}
|
|
@@ -14,13 +14,15 @@ var UIcon = class UIcon extends UElement {
|
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
16
|
if (this.src) return until(IconRegistry.resolveUrl(this.src).then((html) => {
|
|
17
|
-
|
|
18
|
-
return sanitized ? unsafeHTML(sanitized) : nothing;
|
|
17
|
+
return this.paint(this.sanitize(html));
|
|
19
18
|
}), nothing);
|
|
20
|
-
if (this.name) return until(this.resolve(this.name).then((html) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
if (this.name) return until(this.resolve(this.name).then((html) => this.paint(html)), nothing);
|
|
20
|
+
return this.paint(void 0);
|
|
21
|
+
}
|
|
22
|
+
/** ํด์ ๊ฒฐ๊ณผ๊ฐ ์์ผ๋ฉด `fallback` ์ผ๋ก ๋์ ํ๋ค. ๋ ๋ค ์์ ๋๋ง ์๋ฌด๊ฒ๋ ๊ทธ๋ฆฌ์ง ์๋๋ค. */
|
|
23
|
+
paint(html) {
|
|
24
|
+
const resolved = html ?? this.sanitize(this.fallback);
|
|
25
|
+
return resolved ? unsafeHTML(resolved) : nothing;
|
|
24
26
|
}
|
|
25
27
|
async resolve(name) {
|
|
26
28
|
let html = void 0;
|
|
@@ -50,6 +52,7 @@ var UIcon = class UIcon extends UElement {
|
|
|
50
52
|
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UIcon.prototype, "src", void 0);
|
|
51
53
|
__decorate([property({ type: String }), __decorateMetadata("design:type", Object)], UIcon.prototype, "lib", void 0);
|
|
52
54
|
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UIcon.prototype, "name", void 0);
|
|
55
|
+
__decorate([property({ type: String }), __decorateMetadata("design:type", String)], UIcon.prototype, "fallback", void 0);
|
|
53
56
|
UIcon = __decorate([customElement("u-icon")], UIcon);
|
|
54
57
|
//#endregion
|
|
55
58
|
export { UIcon };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UElement } from '../UElement.js';
|
|
2
|
+
export type TextVariant = "display" | "title" | "subtitle" | "body" | "label" | "caption" | "overline";
|
|
3
|
+
/** ์ค๋ฆฝ ๊ฐ์กฐ ์ถ. **์ญํ ์์ด ์๋๋ค** โ ์ญํ ์์ด ํ์ํ๋ฉด ๊ทธ๊ฒ์ ๋ณ๋ ์ถ์ด๋ค. */
|
|
4
|
+
export type TextTone = "default" | "weak" | "strong" | "inverse";
|
|
5
|
+
/** ์ ๋ชฉ ๋จ๊ณ. ๊ฐ์ด ์์ผ๋ฉด heading ์ผ๋ก ์ฝํ๋ค. */
|
|
6
|
+
export type TextLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
/**
|
|
8
|
+
* ์๋ฏธ ํ์ดํฌ๊ทธ๋ํผ ์ค์ผ์ผ(7๋จ)์ ๋งํฌ์
์์ ์ฐ๋ ์๋ฆฌ์
๋๋ค.
|
|
9
|
+
*
|
|
10
|
+
* ์ํธ๋ ๋จ๋ง๋ค **ํฌ๊ธฐยท๊ตต๊ธฐยทํ๊ฐยท์๊ฐ** ๋ค ๊ฐ์ ๊ฐ๊ณ ์์ผ๋, ๊ทธ ๋จ์ *์ ์ฉํ๋* ๊ฒ์ด
|
|
11
|
+
* ์์ด ์๋น์๋ ์๊ธฐ CSS ์์ ํ์ดํฌ ํ ํฐ์ ์ง์ ์ฐธ์กฐํด์ผ ํ์ต๋๋ค.
|
|
12
|
+
* ์ด ์ปดํฌ๋ํธ๋ ๊ทธ ์๋ฆฌ๋ฅผ ๋์ ํ๋ฉฐ, **๊ฐ์ ์๋ก ์ ์ํ์ง ์๊ณ ํ ํฐ๋ง ์ฝ์ต๋๋ค.**
|
|
13
|
+
*
|
|
14
|
+
* `level` ์ ์ฃผ๋ฉด ์๋ ๋ฃจํธ์ ์ค์ `<h1>`~`<h6>` ์ ๋ ๋ํ๋ฏ๋ก heading ์ผ๋ก ์ฝํ๋๋ค
|
|
15
|
+
* (์ฌ๋กฏ ํ
์คํธ๊ฐ ์ ๊ทผ๊ฐ๋ฅ ์ด๋ฆ์ด ๋ฉ๋๋ค). ์ฃผ์ง ์์ผ๋ฉด `<p>` ์
๋๋ค.
|
|
16
|
+
*
|
|
17
|
+
* โ ์๊ฐ ์ถ(`variant`)๊ณผ ์๋ฏธ ์ถ(`level`)์ **๋
๋ฆฝ**์
๋๋ค โ ํ์ด์ง์ ๋ ๋ฒ์งธ ์ ๋ชฉ์ด
|
|
18
|
+
* ์๊ฐ์ ์ผ๋ก ๊ฐ์ฅ ํด ์ ์์ต๋๋ค(`level="2" variant="display"`).
|
|
19
|
+
*
|
|
20
|
+
* @slot - ํ
์คํธ ๋ด์ฉ
|
|
21
|
+
*
|
|
22
|
+
* @csspart base - ๋ ๋๋ `<p>` ๋๋ `<h1>`~`<h6>` ์์
|
|
23
|
+
*/
|
|
24
|
+
export declare class UText extends UElement {
|
|
25
|
+
static styles: import('lit').CSSResultGroup[];
|
|
26
|
+
/** ์๋ฏธ ํ์ดํฌ๊ทธ๋ํผ ๋จ๊ณ */
|
|
27
|
+
variant: TextVariant;
|
|
28
|
+
/** ์ค๋ฆฝ ๊ฐ์กฐ ์ถ (์ญํ ์์ด ์๋๋ค) */
|
|
29
|
+
tone: TextTone;
|
|
30
|
+
/** ์ ๋ชฉ ๋จ๊ณ. ์ง์ ํ๋ฉด heading ์์๋ก ๋ ๋๋๋ค */
|
|
31
|
+
level?: TextLevel;
|
|
32
|
+
protected render(): import('lit-html').TemplateResult;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'u-text': UText;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UElement } from "../UElement.js";
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/decorate.js";
|
|
4
|
+
import { styles } from "./UText.styles.js";
|
|
5
|
+
import { customElement, property } from "lit/decorators.js";
|
|
6
|
+
import { html, literal } from "lit/static-html.js";
|
|
7
|
+
//#region src/components/text/UText.ts
|
|
8
|
+
var PARAGRAPH = literal`p`;
|
|
9
|
+
var HEADINGS = {
|
|
10
|
+
1: literal`h1`,
|
|
11
|
+
2: literal`h2`,
|
|
12
|
+
3: literal`h3`,
|
|
13
|
+
4: literal`h4`,
|
|
14
|
+
5: literal`h5`,
|
|
15
|
+
6: literal`h6`
|
|
16
|
+
};
|
|
17
|
+
var UText = class UText extends UElement {
|
|
18
|
+
constructor(..._args) {
|
|
19
|
+
super(..._args);
|
|
20
|
+
this.variant = "body";
|
|
21
|
+
this.tone = "default";
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = [super.styles, styles];
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const tag = this.level && HEADINGS[this.level] ? HEADINGS[this.level] : PARAGRAPH;
|
|
28
|
+
return html`<${tag} class="text" part="base"><slot></slot></${tag}>`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
__decorate([property({
|
|
32
|
+
type: String,
|
|
33
|
+
reflect: true
|
|
34
|
+
}), __decorateMetadata("design:type", Object)], UText.prototype, "variant", void 0);
|
|
35
|
+
__decorate([property({
|
|
36
|
+
type: String,
|
|
37
|
+
reflect: true
|
|
38
|
+
}), __decorateMetadata("design:type", Object)], UText.prototype, "tone", void 0);
|
|
39
|
+
__decorate([property({
|
|
40
|
+
type: Number,
|
|
41
|
+
reflect: true
|
|
42
|
+
}), __decorateMetadata("design:type", Object)], UText.prototype, "level", void 0);
|
|
43
|
+
UText = __decorate([customElement("u-text")], UText);
|
|
44
|
+
//#endregion
|
|
45
|
+
export { UText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import('lit').CSSResult;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/components/text/UText.styles.ts
|
|
3
|
+
var styles = css`
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
color: var(--u-txt-color, #212121);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* ๊ธฐ๋ณธ์ body ๋ค. :host([variant="body"]) ๊ท์น์ ๋ฐ๋ก ๋์ง ์๋ ์ด์ ๋
|
|
11
|
+
* ๊ฐ์ด ๊ฐ๊ธฐ ๋๋ฌธ์ด๋ฉฐ, ๋ถ์ ํจ๊ณผ๋ก **์ ์ ์๋ variant ๊ฐ body ๋ก ํ๋ฅธ๋ค**
|
|
12
|
+
* (์กฐ์ฉํ ํฐํธ๊ฐ ์ฌ๋ผ์ง๋ ๊ฒ๋ณด๋ค ๋ซ๋ค).
|
|
13
|
+
*/
|
|
14
|
+
.text {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-family: inherit;
|
|
17
|
+
font-size: var(--u-text-body-size, 14px);
|
|
18
|
+
font-weight: var(--u-text-body-weight, 400);
|
|
19
|
+
line-height: var(--u-text-body-leading, 1.6);
|
|
20
|
+
letter-spacing: var(--u-text-body-tracking, 0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([variant="display"]) .text {
|
|
24
|
+
font-size: var(--u-text-display-size, 26px);
|
|
25
|
+
font-weight: var(--u-text-display-weight, 700);
|
|
26
|
+
line-height: var(--u-text-display-leading, 1.4);
|
|
27
|
+
letter-spacing: var(--u-text-display-tracking, -0.02em);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([variant="title"]) .text {
|
|
31
|
+
font-size: var(--u-text-title-size, 20px);
|
|
32
|
+
font-weight: var(--u-text-title-weight, 700);
|
|
33
|
+
line-height: var(--u-text-title-leading, 1.45);
|
|
34
|
+
letter-spacing: var(--u-text-title-tracking, -0.01em);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([variant="subtitle"]) .text {
|
|
38
|
+
font-size: var(--u-text-subtitle-size, 16px);
|
|
39
|
+
font-weight: var(--u-text-subtitle-weight, 600);
|
|
40
|
+
line-height: var(--u-text-subtitle-leading, 1.5);
|
|
41
|
+
letter-spacing: var(--u-text-subtitle-tracking, 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([variant="label"]) .text {
|
|
45
|
+
font-size: var(--u-text-label-size, 13px);
|
|
46
|
+
font-weight: var(--u-text-label-weight, 600);
|
|
47
|
+
line-height: var(--u-text-label-leading, 1.5);
|
|
48
|
+
letter-spacing: var(--u-text-label-tracking, 0);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([variant="caption"]) .text {
|
|
52
|
+
font-size: var(--u-text-caption-size, 12px);
|
|
53
|
+
font-weight: var(--u-text-caption-weight, 400);
|
|
54
|
+
line-height: var(--u-text-caption-leading, 1.5);
|
|
55
|
+
letter-spacing: var(--u-text-caption-tracking, 0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* โ overline ์ text-transform: uppercase ๋ฅผ ๋ถ์ด์ง ์๋๋ค.
|
|
60
|
+
*
|
|
61
|
+
* ๋์น ํ
์คํธ์ ๊ด์ต์ด๊ธด ํ๋ โด์ํธ๊ฐ ์ ์ํ๋ ๊ฒ์ ๋ค ์์ฑ๋ฟ์ด๋ผ ๋ค์ฏ ๋ฒ์งธ๋ฅผ ์ฌ๊ธฐ์
|
|
62
|
+
* ์ ํ๋ฉด ์ด ์ปดํฌ๋ํธ๊ฐ ยซ๋ ๋ฒ์งธ ์ ์์ฒยป๊ฐ ๋๊ณ โต์๋น์๊ฐ ์ด ๊ธ์๋ฅผ ์กฐ์ฉํ ๋ฐ๊พธ๋ฉฐ
|
|
63
|
+
* โถCJK ์๋ ์๋ฌด ํจ๊ณผ๊ฐ ์์ด **๊ฐ์ ๋จ์ด ์ธ์ด์ ๋ฐ๋ผ ๋ค๋ฅด๊ฒ ๋ณด์ธ๋ค.**
|
|
64
|
+
* ๋๋ฌธ์๊ฐ ํ์ํ ์๋ฆฌ๋ ๊ทธ ์๋ฆฌ๊ฐ ์ ํ๋ค.
|
|
65
|
+
*/
|
|
66
|
+
:host([variant="overline"]) .text {
|
|
67
|
+
font-size: var(--u-text-overline-size, 11px);
|
|
68
|
+
font-weight: var(--u-text-overline-weight, 700);
|
|
69
|
+
line-height: var(--u-text-overline-leading, 1.45);
|
|
70
|
+
letter-spacing: var(--u-text-overline-tracking, 0.06em);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
* tone ์ **์ค๋ฆฝ ๊ฐ์กฐ ์ถ**์ด๋ค โ ์ญํ ์(info/success/dangerโฆ)์ด ์๋๋ค.
|
|
75
|
+
* ์๋น์ฑ ์ค์ธก์์ ๋์จ ์ ๋ค์ฏ ์ค ์
์ด ์ด ์ถ์ด์๊ณ , ๋๋จธ์ง ๋์ ๋งํฌ์
|
|
76
|
+
* ์ฝ์์ ๋ฐ์ค๋ผ u-text ์ ๋ฌธ์ ๊ฐ ์๋์๋ค.
|
|
77
|
+
*/
|
|
78
|
+
:host([tone="weak"]) {
|
|
79
|
+
color: var(--u-txt-color-weak, #757575);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([tone="strong"]) {
|
|
83
|
+
color: var(--u-txt-color-strong, #000000);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
:host([tone="inverse"]) {
|
|
87
|
+
color: var(--u-txt-color-inverse, #FFFFFF);
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { styles };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export * from './components/switch/USwitch.js';
|
|
|
41
41
|
export * from './components/tab/UTab.js';
|
|
42
42
|
export * from './components/tab-panel/UTabPanel.js';
|
|
43
43
|
export * from './components/tag/UTag.js';
|
|
44
|
+
export * from './components/text/UText.js';
|
|
44
45
|
export * from './components/textarea/UTextarea.js';
|
|
45
46
|
export * from './components/tooltip/UTooltip.js';
|
|
46
47
|
export * from './components/tree/UTree.js';
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import { USplitPanel } from "./components/split-panel/USplitPanel.js";
|
|
|
47
47
|
import { USwitch } from "./components/switch/USwitch.js";
|
|
48
48
|
import { UTab } from "./components/tab/UTab.js";
|
|
49
49
|
import { UTabPanel } from "./components/tab-panel/UTabPanel.js";
|
|
50
|
+
import { UText } from "./components/text/UText.js";
|
|
50
51
|
import { UTextarea } from "./components/textarea/UTextarea.js";
|
|
51
52
|
import { UTreeItem } from "./components/tree-item/UTreeItem.js";
|
|
52
53
|
import { UTree } from "./components/tree/UTree.js";
|
|
@@ -54,4 +55,4 @@ import { BrowserStorage } from "./utilities/BrowserStorage.js";
|
|
|
54
55
|
import { Dialog } from "./utilities/Dialog.js";
|
|
55
56
|
import { Theme } from "./utilities/Theme.js";
|
|
56
57
|
import { Toast } from "./utilities/Toast.js";
|
|
57
|
-
export { BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, dateAttrConverter, getDefaultBaseUrl, getParentElement, jsonAttrConverter, querySelectorAllWithin, querySelectorWithin, setDefaultBaseUrl, urlAttrConverter };
|
|
58
|
+
export { BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, dateAttrConverter, getDefaultBaseUrl, getParentElement, jsonAttrConverter, querySelectorAllWithin, querySelectorWithin, setDefaultBaseUrl, urlAttrConverter };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UText as UTextElement } from '../components/text/UText';
|
|
3
|
+
|
|
4
|
+
export declare const UText: React.ForwardRefExoticComponent<
|
|
5
|
+
Omit<Partial<UTextElement>, keyof React.HTMLAttributes<UTextElement>>
|
|
6
|
+
& Omit<React.HTMLAttributes<UTextElement>, never>
|
|
7
|
+
& React.RefAttributes<UTextElement>
|
|
8
|
+
& {
|
|
9
|
+
}
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
export type UTextProps = React.ComponentProps<typeof UText>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UText as UTextElement } from '../components/text/UText.js';
|
|
4
|
+
|
|
5
|
+
export const UText = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-text',
|
|
8
|
+
elementClass: UTextElement,
|
|
9
|
+
events: {},
|
|
10
|
+
});
|
package/dist/react/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { UTreeItem, UTreeItemProps } from './UTreeItem';
|
|
|
2
2
|
export { UTree, UTreeProps } from './UTree';
|
|
3
3
|
export { UTooltip, UTooltipProps } from './UTooltip';
|
|
4
4
|
export { UTextarea, UTextareaProps } from './UTextarea';
|
|
5
|
+
export { UText, UTextProps } from './UText';
|
|
5
6
|
export { UTag, UTagProps } from './UTag';
|
|
6
7
|
export { UTabPanel, UTabPanelProps } from './UTabPanel';
|
|
7
8
|
export { UTab, UTabProps } from './UTab';
|
package/dist/react/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { UTreeItem } from './UTreeItem.js';
|
|
|
2
2
|
export { UTree } from './UTree.js';
|
|
3
3
|
export { UTooltip } from './UTooltip.js';
|
|
4
4
|
export { UTextarea } from './UTextarea.js';
|
|
5
|
+
export { UText } from './UText.js';
|
|
5
6
|
export { UTag } from './UTag.js';
|
|
6
7
|
export { UTabPanel } from './UTabPanel.js';
|
|
7
8
|
export { UTab } from './UTab.js';
|
|
@@ -85,6 +85,19 @@ export declare class Theme {
|
|
|
85
85
|
*
|
|
86
86
|
* โ **๋ณ์๋ `documentElement` ์ ์ธ๋ผ์ธ ์คํ์ผ๋ก ๋ค์ด๊ฐ๋ค** โ ์ํธ๋ณด๋ค ์ฐ์ ํ๋ฏ๋ก
|
|
87
87
|
* ๋ก๋ ์์์ ๊ธฐ๋์ง ์๋๋ค.
|
|
88
|
+
*
|
|
89
|
+
* ๐ด**`--u-primary-bg-color` ๋ ์ธํ
ํ์ง ์๋๋ค โ ์ด ์๊ฐ ๋ฎ๋ ๊ฒ์ 7์ข
์ค 6์ข
์ด๋ค.**
|
|
90
|
+
* ๊ทธ ํ ํฐ์ ยซ๊ธ์๋ฅผ ์น๋ ์
์ ๋ฉดยป(`u-tag` ์ `--tag-hue-surface`)์ด๋ผ ๋จํ์ ์ด๋ ๋จ๊ณผ๋
|
|
91
|
+
* ์ฑ์ง์ด ๋ค๋ฅด๊ณ , ์ํธ๋ ๊ทธ ์๋ฆฌ๋ฅผ **5๊ณ์ด ร 2ํ
๋ง = 10๊ฐ ๊ฐ์ผ๋ก ์์ ์ง์ง์ด** ๋์๋ค
|
|
92
|
+
* (๋ผ์ดํธ/๋คํฌ๊ฐ ๊ฐ์ ๋๋น๋น๋ฅผ ์ฐ์ง ์๋๋ค โ ์ค์ธก 1.14 ๋ 1.03). ๋์ถ์์ผ๋ก ๋ฐ๊พธ๋ ๊ฒ์
|
|
93
|
+
* ํ๋ ํธ ๊ฐ ๊ฒฐ์ ์ด๋ผ ์ฌ๋ ํ๋จ์ด ํ์ํ๋ค.
|
|
94
|
+
*
|
|
95
|
+
* โ **์๋๋ง ๋ฃ์ผ๋ฉด ํ๊ทธยท์ ํ๋ ํ ๊ฐ์ ์
์ ๋ฉด์ด ํ๋์ผ๋ก ๋จ๋๋ค.** ํจ๊ป ์ธํ
ํ ๊ฒ:
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* Theme.accent('#7c3aed');
|
|
99
|
+
* document.documentElement.style.setProperty('--u-primary-bg-color', '#f3e8ff');
|
|
100
|
+
* ```
|
|
88
101
|
*/
|
|
89
102
|
static accent(seed: string | null): void;
|
|
90
103
|
/** ํ์ฌ ์๋๋ฅผ ํ์ฌ ํ
๋ง์ ๋ฐํ์ ๋ง์ถฐ ๋ค์ ๊ณ์ฐํด ์ ์ฉํ๋ค. */
|
package/dist/utilities/Theme.js
CHANGED
|
@@ -186,6 +186,19 @@ var Theme = class {
|
|
|
186
186
|
*
|
|
187
187
|
* โ **๋ณ์๋ `documentElement` ์ ์ธ๋ผ์ธ ์คํ์ผ๋ก ๋ค์ด๊ฐ๋ค** โ ์ํธ๋ณด๋ค ์ฐ์ ํ๋ฏ๋ก
|
|
188
188
|
* ๋ก๋ ์์์ ๊ธฐ๋์ง ์๋๋ค.
|
|
189
|
+
*
|
|
190
|
+
* ๐ด**`--u-primary-bg-color` ๋ ์ธํ
ํ์ง ์๋๋ค โ ์ด ์๊ฐ ๋ฎ๋ ๊ฒ์ 7์ข
์ค 6์ข
์ด๋ค.**
|
|
191
|
+
* ๊ทธ ํ ํฐ์ ยซ๊ธ์๋ฅผ ์น๋ ์
์ ๋ฉดยป(`u-tag` ์ `--tag-hue-surface`)์ด๋ผ ๋จํ์ ์ด๋ ๋จ๊ณผ๋
|
|
192
|
+
* ์ฑ์ง์ด ๋ค๋ฅด๊ณ , ์ํธ๋ ๊ทธ ์๋ฆฌ๋ฅผ **5๊ณ์ด ร 2ํ
๋ง = 10๊ฐ ๊ฐ์ผ๋ก ์์ ์ง์ง์ด** ๋์๋ค
|
|
193
|
+
* (๋ผ์ดํธ/๋คํฌ๊ฐ ๊ฐ์ ๋๋น๋น๋ฅผ ์ฐ์ง ์๋๋ค โ ์ค์ธก 1.14 ๋ 1.03). ๋์ถ์์ผ๋ก ๋ฐ๊พธ๋ ๊ฒ์
|
|
194
|
+
* ํ๋ ํธ ๊ฐ ๊ฒฐ์ ์ด๋ผ ์ฌ๋ ํ๋จ์ด ํ์ํ๋ค.
|
|
195
|
+
*
|
|
196
|
+
* โ **์๋๋ง ๋ฃ์ผ๋ฉด ํ๊ทธยท์ ํ๋ ํ ๊ฐ์ ์
์ ๋ฉด์ด ํ๋์ผ๋ก ๋จ๋๋ค.** ํจ๊ป ์ธํ
ํ ๊ฒ:
|
|
197
|
+
*
|
|
198
|
+
* ```ts
|
|
199
|
+
* Theme.accent('#7c3aed');
|
|
200
|
+
* document.documentElement.style.setProperty('--u-primary-bg-color', '#f3e8ff');
|
|
201
|
+
* ```
|
|
189
202
|
*/
|
|
190
203
|
static accent(seed) {
|
|
191
204
|
this.accentSeed = seed;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/components",
|
|
3
3
|
"description": "web-components library based on lit-element made by iyulab",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.24.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"components",
|
|
@@ -42,14 +42,15 @@
|
|
|
42
42
|
"test:browser": "vitest run --project=browser",
|
|
43
43
|
"lint": "eslint src/",
|
|
44
44
|
"lint:fix": "eslint src/ --fix",
|
|
45
|
-
"build": "eslint && npm run typecheck:plugins && vite build && npm run build:plugins && npm run test:react-types",
|
|
45
|
+
"build": "npm run typecheck && eslint && npm run typecheck:plugins && vite build && npm run build:plugins && npm run test:react-types",
|
|
46
46
|
"test:react-types": "tsc -p tsconfig.react-smoke.json",
|
|
47
47
|
"typecheck:plugins": "tsc -p plugins/tsconfig.json",
|
|
48
48
|
"docs:cssprops": "node scripts/cssprops-doc.mjs --write",
|
|
49
49
|
"docs:react-events": "node scripts/react-events-doc.mjs --write",
|
|
50
50
|
"docs:tokens": "node scripts/design-tokens-doc.mjs --write",
|
|
51
51
|
"build:plugins": "tsc -p plugins/tsconfig.build.json",
|
|
52
|
-
"probe:seed-ramp": "node scripts/seed-ramp.mjs"
|
|
52
|
+
"probe:seed-ramp": "node scripts/seed-ramp.mjs",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@floating-ui/dom": "^1.8.0",
|
|
@@ -59,6 +59,7 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
59
59
|
|
|
60
60
|
- [`u-button`](./references/components/button.md) โ Versatile button with multiple variants; renders as `<a>` when `href` is set
|
|
61
61
|
- [`u-icon-button`](./references/components/icon-button.md) โ Square icon-only button with built-in tooltip
|
|
62
|
+
- [`u-copy-button`](./references/components/copy-button.md) โ Copies text to the clipboard with a transient confirmation
|
|
62
63
|
- [`u-button-group`](./references/components/button-group.md) โ Groups buttons with shared variant and disabled state
|
|
63
64
|
|
|
64
65
|
### Form Controls
|
|
@@ -109,6 +110,7 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
109
110
|
- [`u-chip`](./references/components/chip.md) โ Selectable/removable chip tag
|
|
110
111
|
- [`u-tag`](./references/components/tag.md) โ Non-interactive label tag
|
|
111
112
|
- [`u-icon`](./references/components/icon.md) โ SVG icon from built-in or external icon library
|
|
113
|
+
- [`u-text`](./references/components/text.md) โ Semantic typography step; optional heading level
|
|
112
114
|
|
|
113
115
|
---
|
|
114
116
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# u-copy-button
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/copy-button/UCopyButton.js';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Tag:** `u-copy-button`
|
|
8
|
+
|
|
9
|
+
Copies text to the clipboard and shows a transient confirmation by swapping its icon.
|
|
10
|
+
|
|
11
|
+
Two shapes:
|
|
12
|
+
|
|
13
|
+
- **Icon only** (default) โ the default slot becomes the tooltip.
|
|
14
|
+
- **Icon + label** โ set `label` to render visible text beside the icon.
|
|
15
|
+
|
|
16
|
+
The clipboard logic is identical in both.
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<!-- Icon only; slot content is the tooltip -->
|
|
20
|
+
<u-copy-button value="npm i @iyulab/components">Copy install command</u-copy-button>
|
|
21
|
+
|
|
22
|
+
<!-- Icon + label -->
|
|
23
|
+
<u-copy-button value="RESULT-1024" label="Copy result"></u-copy-button>
|
|
24
|
+
|
|
25
|
+
<!-- Stays in the copied state until reset explicitly -->
|
|
26
|
+
<u-copy-button value="token" .delay=${0}></u-copy-button>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Changing or cancelling what gets copied
|
|
30
|
+
|
|
31
|
+
The `copy` event fires **before** the write, so a handler can rewrite the payload or cancel:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
button.addEventListener('copy', (e: ClipboardEvent) => {
|
|
35
|
+
e.clipboardData?.setData('text/plain', transform(button.value));
|
|
36
|
+
e.preventDefault(); // cancel the built-in write
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Slots
|
|
43
|
+
|
|
44
|
+
| Name | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| *(default)* | Tooltip content, icon-only shape. Unused when `label` is set |
|
|
47
|
+
|
|
48
|
+
## Properties
|
|
49
|
+
|
|
50
|
+
| Property | Type | Default | Reflect | Description |
|
|
51
|
+
|----------|------|---------|---------|-------------|
|
|
52
|
+
| `variant` | `'solid'\|'outline'\|'ghost'\|'link'` | `'ghost'` | โ | Button style |
|
|
53
|
+
| `rounded` | `boolean` | `false` | โ | Circular shape |
|
|
54
|
+
| `disabled` | `boolean` | `false` | โ | Disabled state |
|
|
55
|
+
| `copied` | `boolean` | `false` | โ | Currently showing the copied state |
|
|
56
|
+
| `tooltipPlacement` | `Placement` | `"top"` | | Tooltip placement (`tooltip-placement`) |
|
|
57
|
+
| `tooltipOffset` | `OffsetOptions` | `4` | | Tooltip distance (`tooltip-offset`) |
|
|
58
|
+
| `delay` | `number` | `1_000` | | Milliseconds before leaving the copied state; `0` or less keeps it |
|
|
59
|
+
| `value` | `string` | โ | | Text to copy |
|
|
60
|
+
| `label` | `string` | โ | | Inline label; switches to the icon + label shape |
|
|
61
|
+
|
|
62
|
+
## Events
|
|
63
|
+
|
|
64
|
+
| Event | Detail | Description |
|
|
65
|
+
|-------|--------|-------------|
|
|
66
|
+
| `copy` | native `ClipboardEvent` | Fires before the write. `preventDefault()` cancels it; `clipboardData.setData` replaces the payload |
|
|
67
|
+
|
|
68
|
+
## CSS Parts
|
|
69
|
+
|
|
70
|
+
| Part | Description |
|
|
71
|
+
|------|-------------|
|
|
72
|
+
| `button` | Inner button element |
|
|
73
|
+
| `icon` | Icon element |
|
|
74
|
+
| `tooltip` | Tooltip element (icon-only shape) |
|
|
75
|
+
|
|
76
|
+
## Sizing
|
|
77
|
+
|
|
78
|
+
This component keeps a **fixed** font size (18px) rather than inheriting the surrounding
|
|
79
|
+
typography โ it reads as an affordance next to text of any size. See
|
|
80
|
+
[design-tokens.md](../../../../docs/design-tokens.md) for the four components that do this.
|
|
@@ -30,8 +30,19 @@ Renders an SVG icon by name from a registered icon library. Inline `src` also ac
|
|
|
30
30
|
<u-icon src='<svg ...>...</svg>'></u-icon>
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
```html
|
|
34
|
+
<!-- Fallback: drawn when the name does not resolve -->
|
|
35
|
+
<u-icon name="might-not-exist" fallback='<svg viewBox="0 0 16 16">...</svg>'></u-icon>
|
|
36
|
+
```
|
|
37
|
+
|
|
33
38
|
For registering custom libraries, see [icons.md](../utilities/icons.md).
|
|
34
39
|
|
|
40
|
+
> **When you need `fallback`.** An icon that fails to resolve renders nothing. That is usually
|
|
41
|
+
> harmless โ but not where the icon is the only hit target. A collapsed sidebar hides labels, so
|
|
42
|
+
> a nav item with no visible icon becomes an **empty row the user cannot click**: the screen
|
|
43
|
+
> becomes unreachable. `fallback` covers all three failure modes (no `name`, 404, unparseable SVG).
|
|
44
|
+
> Keep the fallback **inline**; a fallback that fetches reproduces the very failure it covers.
|
|
45
|
+
|
|
35
46
|
---
|
|
36
47
|
|
|
37
48
|
## Properties
|
|
@@ -41,6 +52,7 @@ For registering custom libraries, see [icons.md](../utilities/icons.md).
|
|
|
41
52
|
| `lib` | `'internal'\|'tabler'\|'heroicons'\|'lucide'\|'bootstrap'\|string` | โ | Icon library identifier |
|
|
42
53
|
| `name` | `string` | โ | Icon name (library-specific; append `:filled` / `:solid` for filled variants) |
|
|
43
54
|
| `src` | `string` | โ | Raw SVG string (overrides `lib`/`name`) |
|
|
55
|
+
| `fallback` | `string` | โ | Raw SVG drawn when `name`/`src` cannot be resolved (missing, 404, or unparseable) |
|
|
44
56
|
|
|
45
57
|
## CSS Parts
|
|
46
58
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# u-text
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/text/UText.js';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Tag:** `u-text`
|
|
8
|
+
|
|
9
|
+
Semantic typography. Applies one of the seven design-token type steps
|
|
10
|
+
(`display` โ `overline`) so markup can use the scale without any consumer CSS.
|
|
11
|
+
The component reads the token sheet โ it never defines its own type values.
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<u-text level="1" variant="display">Document title</u-text>
|
|
15
|
+
<u-text variant="subtitle" tone="weak">One-line description</u-text>
|
|
16
|
+
|
|
17
|
+
<u-text>Body copy is the default step.</u-text>
|
|
18
|
+
<u-text variant="caption" tone="weak">Helper text</u-text>
|
|
19
|
+
|
|
20
|
+
<u-text variant="overline">Section</u-text>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Visual step and heading level are independent
|
|
24
|
+
|
|
25
|
+
`variant` chooses how the text *looks*; `level` chooses what it *is*. When
|
|
26
|
+
`level` is set the component renders a real `<h1>`โ`<h6>` in its shadow root, so
|
|
27
|
+
assistive technology reads it as a heading whose accessible name is the slotted
|
|
28
|
+
text. Without `level` it renders a `<p>`.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<!-- Second-level heading that is visually the largest thing on the page -->
|
|
32
|
+
<u-text level="2" variant="display">Overview</u-text>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This keeps the document outline honest while leaving the visual hierarchy free.
|
|
36
|
+
|
|
37
|
+
> **Do not nest a heading inside the slot** โ `<u-text><h2>โฆ</h2></u-text>` makes
|
|
38
|
+
> the UA rule `h2 { font-size: 1.5em }` multiply the step's font size. Use
|
|
39
|
+
> `level` instead. Wrapping the other way (`<h2><u-text>โฆ</u-text></h2>`) is safe
|
|
40
|
+
> because the steps are absolute sizes, but the outer heading keeps its UA
|
|
41
|
+
> margin, so `level` is still the simpler choice.
|
|
42
|
+
|
|
43
|
+
## Colour
|
|
44
|
+
|
|
45
|
+
`tone` is a **neutral emphasis axis**, not a role-colour axis. Semantic status
|
|
46
|
+
colour belongs to the component that owns the status (`u-alert`, `u-tag`,
|
|
47
|
+
`u-badge`), and link colour belongs to the link.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Slots
|
|
52
|
+
|
|
53
|
+
| Name | Description |
|
|
54
|
+
|------|-------------|
|
|
55
|
+
| *(default)* | Text content |
|
|
56
|
+
|
|
57
|
+
## Properties
|
|
58
|
+
|
|
59
|
+
| Property | Type | Default | Reflect | Description |
|
|
60
|
+
|----------|------|---------|---------|-------------|
|
|
61
|
+
| `variant` | `'display'\|'title'\|'subtitle'\|'body'\|'label'\|'caption'\|'overline'` | `'body'` | โ | Semantic type step |
|
|
62
|
+
| `tone` | `'default'\|'weak'\|'strong'\|'inverse'` | `'default'` | โ | Neutral emphasis axis |
|
|
63
|
+
| `level` | `1\|2\|3\|4\|5\|6` | โ | โ | Heading level; renders `<h1>`โ`<h6>` |
|
|
64
|
+
|
|
65
|
+
## CSS Parts
|
|
66
|
+
|
|
67
|
+
| Part | Description |
|
|
68
|
+
|------|-------------|
|
|
69
|
+
| `base` | The rendered `<p>` or `<h1>`โ`<h6>` element |
|
|
70
|
+
|
|
71
|
+
## Design tokens read
|
|
72
|
+
|
|
73
|
+
| Step | Tokens |
|
|
74
|
+
|------|--------|
|
|
75
|
+
| `display` ยท `title` ยท `subtitle` ยท `body` ยท `label` ยท `caption` ยท `overline` | `--u-text-{step}-size`, `--u-text-{step}-weight`, `--u-text-{step}-leading`, `--u-text-{step}-tracking` |
|
|
76
|
+
| `tone` | `--u-txt-color`, `--u-txt-color-weak`, `--u-txt-color-strong`, `--u-txt-color-inverse` |
|
|
77
|
+
|
|
78
|
+
Spacing between blocks is **not** this component's concern โ it has no margin.
|
|
79
|
+
The surrounding layout decides rhythm (`u-group-box`, `u-card`, a flex column).
|
|
@@ -78,6 +78,32 @@ accent surface โฅ 4.5:1, accent text on the page background โฅ 4.5:1, `-strong
|
|
|
78
78
|
from `-color`, and `-weak` usable as a non-text graphic (โฅ 3:1). It is **recalculated when the
|
|
79
79
|
theme changes**, because those targets are relative to the page background.
|
|
80
80
|
|
|
81
|
+
#### How many tokens does the `primary` role have? **Seven.**
|
|
82
|
+
|
|
83
|
+
`Theme.accent()` sets **six** of them:
|
|
84
|
+
|
|
85
|
+
| Token | `Theme.accent()` | What reads it |
|
|
86
|
+
|---|---|---|
|
|
87
|
+
| `--u-primary-color` | โ
| accent surface โ 21 source files |
|
|
88
|
+
| `--u-primary-color-strong` | โ
| text/icons on the page background; hover ยท active ยท link ยท focus ring โ 14 files |
|
|
89
|
+
| `--u-primary-color-weak` | โ
| non-text graphics |
|
|
90
|
+
| `--u-primary-color-weaker` | โ
| decorative |
|
|
91
|
+
| `--u-primary-color-weakest` | โ
| decorative |
|
|
92
|
+
| `--u-primary-txt-color` | โ
| text on the accent surface |
|
|
93
|
+
| **`--u-primary-bg-color`** | ๐ด**no** | tinted **surface behind text** โ `u-tag`'s `--tag-hue-surface` |
|
|
94
|
+
|
|
95
|
+
๐ด **`Theme.accent()` does not touch `--u-primary-bg-color`.** It stays on the sheet default
|
|
96
|
+
(a blue tint), so a seeded brand leaves tinted surfaces blue. Set it yourself alongside the seed:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
Theme.accent('#7c3aed');
|
|
100
|
+
document.documentElement.style.setProperty('--u-primary-bg-color', '#f3e8ff');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Pick a tint that keeps your body text readable on it โ the built-in sheet values sit at roughly
|
|
104
|
+
1.14:1 (light) and 1.03:1 (dark) against the page background. Deriving this step automatically is
|
|
105
|
+
tracked as open work, because the sheet pairs it by hand across five colour roles and two themes.
|
|
106
|
+
|
|
81
107
|
**Manual override** โ you must set the steps you use, not just one:
|
|
82
108
|
|
|
83
109
|
```css
|
|
@@ -86,11 +112,36 @@ theme changes**, because those targets are relative to the page background.
|
|
|
86
112
|
--u-primary-color: #7c3aed; /* accent surface */
|
|
87
113
|
--u-primary-color-strong: #5b21b6; /* text/icons on the page background */
|
|
88
114
|
--u-primary-txt-color: #ffffff; /* text on the accent surface */
|
|
115
|
+
--u-primary-bg-color: #f3e8ff; /* tinted surface behind text */
|
|
89
116
|
}
|
|
90
117
|
```
|
|
91
118
|
|
|
92
119
|
โ Setting `--u-primary-color` alone is **not enough**: hover/focus/link colors resolve from
|
|
93
120
|
`--u-primary-color-strong`, so they stay on the default ramp and your brand looks half-applied.
|
|
121
|
+
The measured symptom is a *selected table row* or *tag* that stays blue while buttons turn brand โ
|
|
122
|
+
that one is `--u-primary-bg-color`.
|
|
123
|
+
|
|
124
|
+
### Typography
|
|
125
|
+
|
|
126
|
+
The sheet defines seven semantic steps โ `display`, `title`, `subtitle`, `body`, `label`,
|
|
127
|
+
`caption`, `overline` โ each with `-size`, `-weight`, `-leading`, `-tracking`. Use them from
|
|
128
|
+
markup with [`u-text`](./components/text.md) instead of writing your own CSS:
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<u-text level="1" variant="display">Document title</u-text>
|
|
132
|
+
<u-text variant="subtitle" tone="weak">One-line description</u-text>
|
|
133
|
+
<u-text>Body copy</u-text>
|
|
134
|
+
<u-text variant="caption" tone="weak">Helper text</u-text>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`variant` is the visual step and `level` is the document level โ they are independent, and
|
|
138
|
+
`level` renders a real `<h1>`โ`<h6>` so the heading is read as one.
|
|
139
|
+
|
|
140
|
+
To rebrand typography, override the tokens rather than the screens:
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
:root { --u-text-title-size: 22px; --u-text-title-weight: 800; }
|
|
144
|
+
```
|
|
94
145
|
|
|
95
146
|
---
|
|
96
147
|
|