@ds-gn/ui 0.5.3 → 0.6.1
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 +8 -3
- package/custom-elements.json +250 -0
- package/dist/components/Callout/src/Callout.d.ts +28 -0
- package/dist/components/Callout/src/Callout.js +376 -0
- package/dist/components/Callout/src/Callout.props.d.ts +8 -0
- package/dist/components/Callout/src/Callout.props.js +35 -0
- package/dist/components/Callout/src/Callout.styles.d.ts +5 -0
- package/dist/components/CodeSnippet/src/CodeSnippet.d.ts +44 -0
- package/dist/components/CodeSnippet/src/CodeSnippet.js +452 -0
- package/dist/components/CodeSnippet/src/CodeSnippet.props.d.ts +2 -0
- package/dist/components/CodeSnippet/src/CodeSnippet.props.js +5 -0
- package/dist/components/CodeSnippet/src/CodeSnippet.styles.d.ts +13 -0
- package/dist/react/Callout.d.ts +6 -0
- package/dist/react/Callout.js +13 -0
- package/dist/react/CodeSnippet.d.ts +8 -0
- package/dist/react/CodeSnippet.js +13 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +2 -0
- package/package.json +17 -2
package/README.md
CHANGED
|
@@ -13,7 +13,12 @@ System.
|
|
|
13
13
|
[Website](https://ds-gn.com/?utm_source=npm&utm_medium=readme&utm_campaign=ui&utm_content=website_link)
|
|
14
14
|
· [Documentation](https://docs.ds-gn.com/) ·
|
|
15
15
|
[Component reference](https://docs.ds-gn.com/components/button/) ·
|
|
16
|
-
[Changelog](https://docs.ds-gn.com/changelog/ui/)
|
|
16
|
+
[Changelog](https://docs.ds-gn.com/changelog/ui/) ·
|
|
17
|
+
[Public repository](https://github.com/LightLeapLabs/design-system)
|
|
18
|
+
|
|
19
|
+
npm's Repository link points to our private build repository, which is required
|
|
20
|
+
for Trusted Publishing. For examples and issue reporting, visit our
|
|
21
|
+
[public design-system repository](https://github.com/LightLeapLabs/design-system).
|
|
17
22
|
|
|
18
23
|
## Install
|
|
19
24
|
|
|
@@ -112,13 +117,13 @@ The string helpers inherit `currentColor` for theme-aware lettering and keep the
|
|
|
112
117
|
<details>
|
|
113
118
|
<summary><strong>Public Beta components and compatibility policy</strong></summary>
|
|
114
119
|
|
|
115
|
-
The
|
|
120
|
+
The Public Beta includes 26 custom elements:
|
|
116
121
|
|
|
117
122
|
| Group | Included components |
|
|
118
123
|
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
119
124
|
| App-capable | `Button` (`dsgn-button`), `Input` (`dsgn-input`), `Modal` (`dsgn-modal`) |
|
|
120
125
|
| Display and layout | `Background` (`dsgn-background`), `Badge` (`dsgn-badge`), `Card` (`dsgn-card`), `CodeBlock` (`dsgn-code-block`), `Container` (`dsgn-container`), `Divider` (`dsgn-divider`), `Grid` (`dsgn-grid`), `Stack` (`dsgn-stack`) |
|
|
121
|
-
| Content | `Heading` (`dsgn-heading`), `Text` (`dsgn-text`), `Icon` (`dsgn-icon`), `Image` (`dsgn-image`)
|
|
126
|
+
| Content | `Heading` (`dsgn-heading`), `Text` (`dsgn-text`), `Icon` (`dsgn-icon`), `Image` (`dsgn-image`), `Callout` (`dsgn-callout`), `CodeSnippet` (`dsgn-code-snippet`) |
|
|
122
127
|
| Marketing and composition | `Hero` (`dsgn-hero`), `HeadingBlock` (`dsgn-heading-block`), `FeatureItem` (`dsgn-feature-item`), `FeatureTabs` (`dsgn-feature-tabs`), `FormBlock` (`dsgn-form-block`) |
|
|
123
128
|
| Navigation | `Nav` (`dsgn-nav`), `NavLink` (`dsgn-nav-link`), `NavDropdownColumn` (`dsgn-nav-dropdown-column`), `Footer` (`dsgn-footer`) |
|
|
124
129
|
|
package/custom-elements.json
CHANGED
|
@@ -651,6 +651,91 @@
|
|
|
651
651
|
}
|
|
652
652
|
]
|
|
653
653
|
},
|
|
654
|
+
{
|
|
655
|
+
"kind": "javascript-module",
|
|
656
|
+
"path": "components/Callout/src/Callout.ts",
|
|
657
|
+
"declarations": [
|
|
658
|
+
{
|
|
659
|
+
"kind": "class",
|
|
660
|
+
"description": "",
|
|
661
|
+
"name": "Callout",
|
|
662
|
+
"slots": [
|
|
663
|
+
{
|
|
664
|
+
"description": "Optional heading, rendered in bold above the content.",
|
|
665
|
+
"name": "title"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"description": "Callout content.",
|
|
669
|
+
"name": ""
|
|
670
|
+
}
|
|
671
|
+
],
|
|
672
|
+
"members": [
|
|
673
|
+
{
|
|
674
|
+
"kind": "field",
|
|
675
|
+
"name": "surface",
|
|
676
|
+
"type": {
|
|
677
|
+
"text": "SurfaceType"
|
|
678
|
+
},
|
|
679
|
+
"description": "Surface theme variant (light or dark)",
|
|
680
|
+
"attribute": "surface",
|
|
681
|
+
"reflects": true
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"kind": "field",
|
|
685
|
+
"name": "tone",
|
|
686
|
+
"type": {
|
|
687
|
+
"text": "CalloutToneType"
|
|
688
|
+
},
|
|
689
|
+
"description": "Semantic tone, which sets the colour and the icon",
|
|
690
|
+
"attribute": "tone",
|
|
691
|
+
"reflects": true
|
|
692
|
+
}
|
|
693
|
+
],
|
|
694
|
+
"superclass": {
|
|
695
|
+
"name": "Base",
|
|
696
|
+
"package": "@common/Base/Base.ts"
|
|
697
|
+
},
|
|
698
|
+
"tagName": "dsgn-callout",
|
|
699
|
+
"customElement": true,
|
|
700
|
+
"attributes": [
|
|
701
|
+
{
|
|
702
|
+
"name": "surface",
|
|
703
|
+
"fieldName": "surface",
|
|
704
|
+
"type": {
|
|
705
|
+
"text": "SurfaceType"
|
|
706
|
+
},
|
|
707
|
+
"description": "Surface theme variant (light or dark)"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
"name": "tone",
|
|
711
|
+
"fieldName": "tone",
|
|
712
|
+
"type": {
|
|
713
|
+
"text": "CalloutToneType"
|
|
714
|
+
},
|
|
715
|
+
"description": "Semantic tone, which sets the colour and the icon"
|
|
716
|
+
}
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
],
|
|
720
|
+
"exports": [
|
|
721
|
+
{
|
|
722
|
+
"kind": "js",
|
|
723
|
+
"name": "Callout",
|
|
724
|
+
"declaration": {
|
|
725
|
+
"name": "Callout",
|
|
726
|
+
"module": "components/Callout/src/Callout.ts"
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"kind": "custom-element-definition",
|
|
731
|
+
"name": "dsgn-callout",
|
|
732
|
+
"declaration": {
|
|
733
|
+
"name": "Callout",
|
|
734
|
+
"module": "components/Callout/src/Callout.ts"
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
]
|
|
738
|
+
},
|
|
654
739
|
{
|
|
655
740
|
"kind": "javascript-module",
|
|
656
741
|
"path": "components/Card/src/Card.ts",
|
|
@@ -904,6 +989,171 @@
|
|
|
904
989
|
}
|
|
905
990
|
]
|
|
906
991
|
},
|
|
992
|
+
{
|
|
993
|
+
"kind": "javascript-module",
|
|
994
|
+
"path": "components/CodeSnippet/src/CodeSnippet.ts",
|
|
995
|
+
"declarations": [
|
|
996
|
+
{
|
|
997
|
+
"kind": "class",
|
|
998
|
+
"description": "A framed code sample with an optional filename, language label, and a copy\nbutton. Slot in a `<pre>` — plain or pre-highlighted (for example, Shiki\noutput). The copy button copies the slotted text exactly as displayed.",
|
|
999
|
+
"name": "CodeSnippet",
|
|
1000
|
+
"slots": [
|
|
1001
|
+
{
|
|
1002
|
+
"description": "The code, typically a `<pre>` element.",
|
|
1003
|
+
"name": ""
|
|
1004
|
+
}
|
|
1005
|
+
],
|
|
1006
|
+
"members": [
|
|
1007
|
+
{
|
|
1008
|
+
"kind": "field",
|
|
1009
|
+
"name": "filename",
|
|
1010
|
+
"type": {
|
|
1011
|
+
"text": "string"
|
|
1012
|
+
},
|
|
1013
|
+
"default": "''",
|
|
1014
|
+
"description": "File name shown in the header",
|
|
1015
|
+
"attribute": "filename"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"kind": "field",
|
|
1019
|
+
"name": "language",
|
|
1020
|
+
"type": {
|
|
1021
|
+
"text": "string"
|
|
1022
|
+
},
|
|
1023
|
+
"default": "''",
|
|
1024
|
+
"description": "Language label shown in the header",
|
|
1025
|
+
"attribute": "language"
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"kind": "field",
|
|
1029
|
+
"name": "copyLabel",
|
|
1030
|
+
"type": {
|
|
1031
|
+
"text": "string"
|
|
1032
|
+
},
|
|
1033
|
+
"default": "''",
|
|
1034
|
+
"description": "Copy button label. The button is only rendered when a label is supplied.",
|
|
1035
|
+
"attribute": "copy-label"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"kind": "field",
|
|
1039
|
+
"name": "copiedLabel",
|
|
1040
|
+
"type": {
|
|
1041
|
+
"text": "string"
|
|
1042
|
+
},
|
|
1043
|
+
"default": "''",
|
|
1044
|
+
"description": "Label shown and announced after a successful copy",
|
|
1045
|
+
"attribute": "copied-label"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
"kind": "field",
|
|
1049
|
+
"name": "_copied",
|
|
1050
|
+
"type": {
|
|
1051
|
+
"text": "boolean"
|
|
1052
|
+
},
|
|
1053
|
+
"privacy": "private",
|
|
1054
|
+
"default": "false"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
"kind": "field",
|
|
1058
|
+
"name": "_resetTimer",
|
|
1059
|
+
"type": {
|
|
1060
|
+
"text": "ReturnType<typeof setTimeout> | undefined"
|
|
1061
|
+
},
|
|
1062
|
+
"privacy": "private"
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
"kind": "method",
|
|
1066
|
+
"name": "_codeText",
|
|
1067
|
+
"privacy": "private",
|
|
1068
|
+
"return": {
|
|
1069
|
+
"type": {
|
|
1070
|
+
"text": "string"
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
"description": "The text of the slotted code, as displayed."
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
"kind": "method",
|
|
1077
|
+
"name": "_handleCopy",
|
|
1078
|
+
"privacy": "private"
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
"kind": "method",
|
|
1082
|
+
"name": "_renderButton",
|
|
1083
|
+
"privacy": "private"
|
|
1084
|
+
}
|
|
1085
|
+
],
|
|
1086
|
+
"events": [
|
|
1087
|
+
{
|
|
1088
|
+
"description": "Fired after the code is copied; `detail` is `{ text }`.",
|
|
1089
|
+
"name": "dsgn-copy"
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
"superclass": {
|
|
1093
|
+
"name": "Base",
|
|
1094
|
+
"package": "@common/Base/Base.ts"
|
|
1095
|
+
},
|
|
1096
|
+
"tagName": "dsgn-code-snippet",
|
|
1097
|
+
"customElement": true,
|
|
1098
|
+
"attributes": [
|
|
1099
|
+
{
|
|
1100
|
+
"name": "filename",
|
|
1101
|
+
"fieldName": "filename",
|
|
1102
|
+
"type": {
|
|
1103
|
+
"text": "string"
|
|
1104
|
+
},
|
|
1105
|
+
"default": "''",
|
|
1106
|
+
"description": "File name shown in the header"
|
|
1107
|
+
},
|
|
1108
|
+
{
|
|
1109
|
+
"name": "language",
|
|
1110
|
+
"fieldName": "language",
|
|
1111
|
+
"type": {
|
|
1112
|
+
"text": "string"
|
|
1113
|
+
},
|
|
1114
|
+
"default": "''",
|
|
1115
|
+
"description": "Language label shown in the header"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
"name": "copy-label",
|
|
1119
|
+
"fieldName": "copyLabel",
|
|
1120
|
+
"type": {
|
|
1121
|
+
"text": "string"
|
|
1122
|
+
},
|
|
1123
|
+
"default": "''",
|
|
1124
|
+
"description": "Copy button label. The button is only rendered when a label is supplied."
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
"name": "copied-label",
|
|
1128
|
+
"fieldName": "copiedLabel",
|
|
1129
|
+
"type": {
|
|
1130
|
+
"text": "string"
|
|
1131
|
+
},
|
|
1132
|
+
"default": "''",
|
|
1133
|
+
"description": "Label shown and announced after a successful copy"
|
|
1134
|
+
}
|
|
1135
|
+
]
|
|
1136
|
+
}
|
|
1137
|
+
],
|
|
1138
|
+
"exports": [
|
|
1139
|
+
{
|
|
1140
|
+
"kind": "js",
|
|
1141
|
+
"name": "CodeSnippet",
|
|
1142
|
+
"declaration": {
|
|
1143
|
+
"name": "CodeSnippet",
|
|
1144
|
+
"module": "components/CodeSnippet/src/CodeSnippet.ts"
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
"kind": "custom-element-definition",
|
|
1149
|
+
"name": "dsgn-code-snippet",
|
|
1150
|
+
"declaration": {
|
|
1151
|
+
"name": "CodeSnippet",
|
|
1152
|
+
"module": "components/CodeSnippet/src/CodeSnippet.ts"
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
]
|
|
1156
|
+
},
|
|
907
1157
|
{
|
|
908
1158
|
"kind": "javascript-module",
|
|
909
1159
|
"path": "components/Container/src/Container.ts",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../../../types/global.d.ts';
|
|
2
|
+
import '../../Icon/src/Icon.js';
|
|
3
|
+
import { Base } from '../../../common/Base/Base.js';
|
|
4
|
+
import { type SurfaceType } from '../../../common/props/surface/surface.props.js';
|
|
5
|
+
import { type CSSResultGroup } from 'lit';
|
|
6
|
+
import { type CalloutToneType } from './Callout.props.js';
|
|
7
|
+
/**
|
|
8
|
+
* @slot title - Optional heading, rendered in bold above the content.
|
|
9
|
+
* @slot - Callout content.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Callout extends Base {
|
|
12
|
+
static styles: CSSResultGroup;
|
|
13
|
+
/**
|
|
14
|
+
* Surface theme variant (light or dark)
|
|
15
|
+
*/
|
|
16
|
+
surface: SurfaceType;
|
|
17
|
+
/**
|
|
18
|
+
* Semantic tone, which sets the colour and the icon
|
|
19
|
+
*/
|
|
20
|
+
tone: CalloutToneType;
|
|
21
|
+
render(): import("lit").TemplateResult<1>;
|
|
22
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
'dsgn-callout': Callout;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// components/Callout/src/Callout.ts
|
|
13
|
+
import"../../Icon/src/Icon.js";
|
|
14
|
+
|
|
15
|
+
// common/Base/Base.ts
|
|
16
|
+
import { html, LitElement } from "lit";
|
|
17
|
+
|
|
18
|
+
// common/helpers/define-element.ts
|
|
19
|
+
var defineElement = (tag, ctor) => {
|
|
20
|
+
if (typeof customElements === "undefined")
|
|
21
|
+
return;
|
|
22
|
+
if (!customElements.get(tag))
|
|
23
|
+
customElements.define(tag, ctor);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// common/Base/Base.css
|
|
27
|
+
import { css } from "lit";
|
|
28
|
+
var styles = css`/* Base reset in @layer base ensures it comes before utilities in Tailwind v4 cascade
|
|
29
|
+
This prevents the reset from overriding component utility classes */
|
|
30
|
+
@layer base {
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
line-height: 1.5;
|
|
35
|
+
-webkit-text-size-adjust: 100%;
|
|
36
|
+
tab-size: 4;
|
|
37
|
+
font-family: var(
|
|
38
|
+
--default-font-family,
|
|
39
|
+
var(--font-sans, ui-sans-serif, system-ui, sans-serif)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
*,
|
|
44
|
+
*::before,
|
|
45
|
+
*::after {
|
|
46
|
+
box-sizing: inherit;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
border: 0 solid;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host h1,
|
|
53
|
+
:host h2,
|
|
54
|
+
:host h3,
|
|
55
|
+
:host h4,
|
|
56
|
+
:host h5,
|
|
57
|
+
:host h6 {
|
|
58
|
+
font-size: inherit;
|
|
59
|
+
font-weight: inherit;
|
|
60
|
+
margin: 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
var Base_default = styles;
|
|
66
|
+
|
|
67
|
+
// common/Base/Base.ts
|
|
68
|
+
class Base extends LitElement {
|
|
69
|
+
static styles = Base_default;
|
|
70
|
+
updateTheme(changedProperties, surface) {
|
|
71
|
+
if (changedProperties.has("surface")) {
|
|
72
|
+
if (surface) {
|
|
73
|
+
this.setAttribute("data-theme", surface);
|
|
74
|
+
} else {
|
|
75
|
+
this.removeAttribute("data-theme");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
emit(name, detail, options = {}) {
|
|
80
|
+
return this.dispatchEvent(new CustomEvent(name, {
|
|
81
|
+
detail,
|
|
82
|
+
bubbles: true,
|
|
83
|
+
composed: true,
|
|
84
|
+
cancelable: options.cancelable ?? false
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
return html`<slot></slot>`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
defineElement("dsgn-base", Base);
|
|
92
|
+
|
|
93
|
+
// common/helpers/enum-validator.ts
|
|
94
|
+
var enumValidator = (propName, enumSet, candidateValue) => {
|
|
95
|
+
if (!enumSet.has(candidateValue)) {
|
|
96
|
+
throw new Error(`Invalid prop ${propName} of value ${candidateValue}. Expected one of: ${Array.from(enumSet).join(", ")}`);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// common/helpers/enum-creator.ts
|
|
101
|
+
var enumCreator = (acceptableValues, propName, type, other = {}) => {
|
|
102
|
+
const acceptableValuesSet = new Set(acceptableValues);
|
|
103
|
+
return {
|
|
104
|
+
type,
|
|
105
|
+
hasChanged(newValue, oldValue) {
|
|
106
|
+
if (newValue !== oldValue) {
|
|
107
|
+
enumValidator(propName, acceptableValuesSet, newValue);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
},
|
|
112
|
+
...other
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// common/props/surface/surface.props.ts
|
|
117
|
+
var surfaceValues = {
|
|
118
|
+
LIGHT: "light",
|
|
119
|
+
DARK: "dark"
|
|
120
|
+
};
|
|
121
|
+
var surfaceProps = enumCreator(Object.values(surfaceValues), "surface", String, { reflect: true });
|
|
122
|
+
|
|
123
|
+
// components/Callout/src/Callout.ts
|
|
124
|
+
import { html as html2 } from "lit";
|
|
125
|
+
import { property } from "lit/decorators.js";
|
|
126
|
+
// components/Icon/src/icons/circle-alert.ts
|
|
127
|
+
import { svg } from "lit";
|
|
128
|
+
var circleAlert = svg`<circle cx="12" cy="12" r="10" /><line x1="12" x2="12" y1="8" y2="12" /><line x1="12" x2="12.01" y1="16" y2="16" />`;
|
|
129
|
+
// components/Icon/src/icons/circle-check.ts
|
|
130
|
+
import { svg as svg2 } from "lit";
|
|
131
|
+
var circleCheck = svg2`<circle cx="12" cy="12" r="10" /><path d="m9 12 2 2 4-4" />`;
|
|
132
|
+
// components/Icon/src/icons/info.ts
|
|
133
|
+
import { svg as svg3 } from "lit";
|
|
134
|
+
var info = svg3`<circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" />`;
|
|
135
|
+
// components/Icon/src/icons/triangle-alert.ts
|
|
136
|
+
import { svg as svg4 } from "lit";
|
|
137
|
+
var triangleAlert = svg4`<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path d="M12 9v4" /><path d="M12 17h.01" />`;
|
|
138
|
+
// components/Callout/src/Callout.css
|
|
139
|
+
import { css as css2 } from "lit";
|
|
140
|
+
var styles2 = css2`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
141
|
+
@layer properties;
|
|
142
|
+
@layer theme {
|
|
143
|
+
:root, :host {
|
|
144
|
+
--spacing: 0.25rem;
|
|
145
|
+
--text-sm: 0.875rem;
|
|
146
|
+
--text-sm--line-height: calc(1.25 / 0.875);
|
|
147
|
+
--font-weight-semibold: 600;
|
|
148
|
+
--leading-relaxed: 1.625;
|
|
149
|
+
--radius-lg: 0.5rem;
|
|
150
|
+
--color-error: inherit;
|
|
151
|
+
--color-error-subtle: inherit;
|
|
152
|
+
--color-info: inherit;
|
|
153
|
+
--color-info-subtle: inherit;
|
|
154
|
+
--color-success: inherit;
|
|
155
|
+
--color-success-subtle: inherit;
|
|
156
|
+
--color-text-primary: inherit;
|
|
157
|
+
--color-warning: inherit;
|
|
158
|
+
--color-warning-subtle: inherit;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
@layer utilities {
|
|
162
|
+
.static {
|
|
163
|
+
position: static;
|
|
164
|
+
}
|
|
165
|
+
.flex {
|
|
166
|
+
display: flex;
|
|
167
|
+
}
|
|
168
|
+
.min-w-0 {
|
|
169
|
+
min-width: calc(var(--spacing) * 0);
|
|
170
|
+
}
|
|
171
|
+
.shrink-0 {
|
|
172
|
+
flex-shrink: 0;
|
|
173
|
+
}
|
|
174
|
+
.flex-col {
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
}
|
|
177
|
+
.gap-1 {
|
|
178
|
+
gap: calc(var(--spacing) * 1);
|
|
179
|
+
}
|
|
180
|
+
.gap-3 {
|
|
181
|
+
gap: calc(var(--spacing) * 3);
|
|
182
|
+
}
|
|
183
|
+
.rounded-lg {
|
|
184
|
+
border-radius: var(--radius-lg);
|
|
185
|
+
}
|
|
186
|
+
.border {
|
|
187
|
+
border-style: var(--tw-border-style);
|
|
188
|
+
border-width: 1px;
|
|
189
|
+
}
|
|
190
|
+
.border-l-4 {
|
|
191
|
+
border-left-style: var(--tw-border-style);
|
|
192
|
+
border-left-width: 4px;
|
|
193
|
+
}
|
|
194
|
+
.border-error {
|
|
195
|
+
border-color: var(--color-error);
|
|
196
|
+
}
|
|
197
|
+
.border-info {
|
|
198
|
+
border-color: var(--color-info);
|
|
199
|
+
}
|
|
200
|
+
.border-success {
|
|
201
|
+
border-color: var(--color-success);
|
|
202
|
+
}
|
|
203
|
+
.border-warning {
|
|
204
|
+
border-color: var(--color-warning);
|
|
205
|
+
}
|
|
206
|
+
.bg-error-subtle {
|
|
207
|
+
background-color: var(--color-error-subtle);
|
|
208
|
+
}
|
|
209
|
+
.bg-info-subtle {
|
|
210
|
+
background-color: var(--color-info-subtle);
|
|
211
|
+
}
|
|
212
|
+
.bg-success-subtle {
|
|
213
|
+
background-color: var(--color-success-subtle);
|
|
214
|
+
}
|
|
215
|
+
.bg-warning-subtle {
|
|
216
|
+
background-color: var(--color-warning-subtle);
|
|
217
|
+
}
|
|
218
|
+
.px-4 {
|
|
219
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
220
|
+
}
|
|
221
|
+
.py-3 {
|
|
222
|
+
padding-block: calc(var(--spacing) * 3);
|
|
223
|
+
}
|
|
224
|
+
.pt-0\\.5 {
|
|
225
|
+
padding-top: calc(var(--spacing) * 0.5);
|
|
226
|
+
}
|
|
227
|
+
.text-sm {
|
|
228
|
+
font-size: var(--text-sm);
|
|
229
|
+
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
230
|
+
}
|
|
231
|
+
.leading-relaxed {
|
|
232
|
+
--tw-leading: var(--leading-relaxed);
|
|
233
|
+
line-height: var(--leading-relaxed);
|
|
234
|
+
}
|
|
235
|
+
.font-semibold {
|
|
236
|
+
--tw-font-weight: var(--font-weight-semibold);
|
|
237
|
+
font-weight: var(--font-weight-semibold);
|
|
238
|
+
}
|
|
239
|
+
.text-error {
|
|
240
|
+
color: var(--color-error);
|
|
241
|
+
}
|
|
242
|
+
.text-info {
|
|
243
|
+
color: var(--color-info);
|
|
244
|
+
}
|
|
245
|
+
.text-success {
|
|
246
|
+
color: var(--color-success);
|
|
247
|
+
}
|
|
248
|
+
.text-text-primary {
|
|
249
|
+
color: var(--color-text-primary);
|
|
250
|
+
}
|
|
251
|
+
.text-warning {
|
|
252
|
+
color: var(--color-warning);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
@property --dsgn-border-sweep-angle {
|
|
256
|
+
syntax: '<angle>';
|
|
257
|
+
inherits: false;
|
|
258
|
+
initial-value: 0deg;
|
|
259
|
+
}
|
|
260
|
+
@property --tw-border-style {
|
|
261
|
+
syntax: "*";
|
|
262
|
+
inherits: false;
|
|
263
|
+
initial-value: solid;
|
|
264
|
+
}
|
|
265
|
+
@property --tw-leading {
|
|
266
|
+
syntax: "*";
|
|
267
|
+
inherits: false;
|
|
268
|
+
}
|
|
269
|
+
@property --tw-font-weight {
|
|
270
|
+
syntax: "*";
|
|
271
|
+
inherits: false;
|
|
272
|
+
}
|
|
273
|
+
@layer properties {
|
|
274
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
275
|
+
*, ::before, ::after, ::backdrop {
|
|
276
|
+
--tw-border-style: solid;
|
|
277
|
+
--tw-leading: initial;
|
|
278
|
+
--tw-font-weight: initial;
|
|
279
|
+
--dsgn-border-sweep-angle: 0deg;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
`;
|
|
284
|
+
var Callout_default = styles2;
|
|
285
|
+
|
|
286
|
+
// components/Callout/src/Callout.props.ts
|
|
287
|
+
var calloutToneValues = {
|
|
288
|
+
NOTE: "note",
|
|
289
|
+
TIP: "tip",
|
|
290
|
+
WARNING: "warning",
|
|
291
|
+
DANGER: "danger"
|
|
292
|
+
};
|
|
293
|
+
var calloutToneProps = enumCreator(Object.values(calloutToneValues), "tone", String, { reflect: true });
|
|
294
|
+
|
|
295
|
+
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
296
|
+
function r(e) {
|
|
297
|
+
var t, f, n = "";
|
|
298
|
+
if (typeof e == "string" || typeof e == "number")
|
|
299
|
+
n += e;
|
|
300
|
+
else if (typeof e == "object")
|
|
301
|
+
if (Array.isArray(e)) {
|
|
302
|
+
var o = e.length;
|
|
303
|
+
for (t = 0;t < o; t++)
|
|
304
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
305
|
+
} else
|
|
306
|
+
for (f in e)
|
|
307
|
+
e[f] && (n && (n += " "), n += f);
|
|
308
|
+
return n;
|
|
309
|
+
}
|
|
310
|
+
function clsx() {
|
|
311
|
+
for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
|
|
312
|
+
(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
313
|
+
return n;
|
|
314
|
+
}
|
|
315
|
+
var clsx_default = clsx;
|
|
316
|
+
|
|
317
|
+
// components/Callout/src/Callout.styles.ts
|
|
318
|
+
var toneClasses = {
|
|
319
|
+
[calloutToneValues.NOTE]: ["bg-info-subtle", "border-info"],
|
|
320
|
+
[calloutToneValues.TIP]: ["bg-success-subtle", "border-success"],
|
|
321
|
+
[calloutToneValues.WARNING]: ["bg-warning-subtle", "border-warning"],
|
|
322
|
+
[calloutToneValues.DANGER]: ["bg-error-subtle", "border-error"]
|
|
323
|
+
};
|
|
324
|
+
var iconToneClasses = {
|
|
325
|
+
[calloutToneValues.NOTE]: "text-info",
|
|
326
|
+
[calloutToneValues.TIP]: "text-success",
|
|
327
|
+
[calloutToneValues.WARNING]: "text-warning",
|
|
328
|
+
[calloutToneValues.DANGER]: "text-error"
|
|
329
|
+
};
|
|
330
|
+
var classNames = (tone) => clsx_default("flex", "gap-3", "rounded-lg", "border", "border-l-4", "px-4", "py-3", "text-text-primary", toneClasses[tone]);
|
|
331
|
+
var iconClassNames = (tone) => clsx_default("flex", "shrink-0", "pt-0.5", iconToneClasses[tone]);
|
|
332
|
+
var contentClassNames = () => clsx_default("flex", "min-w-0", "flex-col", "gap-1", "text-sm", "leading-relaxed");
|
|
333
|
+
var titleClassNames = () => clsx_default("font-semibold", "text-text-primary");
|
|
334
|
+
|
|
335
|
+
// components/Callout/src/Callout.ts
|
|
336
|
+
var toneIcons = {
|
|
337
|
+
[calloutToneValues.NOTE]: info,
|
|
338
|
+
[calloutToneValues.TIP]: circleCheck,
|
|
339
|
+
[calloutToneValues.WARNING]: triangleAlert,
|
|
340
|
+
[calloutToneValues.DANGER]: circleAlert
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
class Callout extends Base {
|
|
344
|
+
constructor() {
|
|
345
|
+
super(...arguments);
|
|
346
|
+
this.surface = surfaceValues.LIGHT;
|
|
347
|
+
this.tone = calloutToneValues.NOTE;
|
|
348
|
+
}
|
|
349
|
+
static styles = [Base.styles, Callout_default];
|
|
350
|
+
render() {
|
|
351
|
+
const { tone } = this;
|
|
352
|
+
return html2`<aside class="${classNames(tone)}" role="note">
|
|
353
|
+
<span class="${iconClassNames(tone)}" aria-hidden="true"
|
|
354
|
+
><dsgn-icon .icon=${toneIcons[tone]} size="sm"></dsgn-icon
|
|
355
|
+
></span>
|
|
356
|
+
<div class="${contentClassNames()}">
|
|
357
|
+
<div class="${titleClassNames()}"><slot name="title"></slot></div>
|
|
358
|
+
<div><slot></slot></div>
|
|
359
|
+
</div>
|
|
360
|
+
</aside>`;
|
|
361
|
+
}
|
|
362
|
+
updated(changedProperties) {
|
|
363
|
+
super.updated(changedProperties);
|
|
364
|
+
this.updateTheme(changedProperties, this.surface);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
__legacyDecorateClassTS([
|
|
368
|
+
property({ ...surfaceProps })
|
|
369
|
+
], Callout.prototype, "surface", undefined);
|
|
370
|
+
__legacyDecorateClassTS([
|
|
371
|
+
property({ ...calloutToneProps })
|
|
372
|
+
], Callout.prototype, "tone", undefined);
|
|
373
|
+
defineElement("dsgn-callout", Callout);
|
|
374
|
+
export {
|
|
375
|
+
Callout
|
|
376
|
+
};
|