aural-ui 4.2.4 → 4.2.5
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/components/index.ts +1 -1
- package/dist/components/offer-label/OfferLabel.stories.tsx +267 -0
- package/dist/components/offer-label/index.tsx +32 -0
- package/dist/components/offer-label/meta.ts +6 -0
- package/dist/icons/chain-link-icon/ChainLinkIcon.stories.tsx +167 -0
- package/dist/icons/chain-link-icon/index.tsx +30 -0
- package/dist/icons/chain-link-icon/meta.ts +8 -0
- package/dist/icons/clock-icon/ClockIcon.stories.tsx +210 -0
- package/dist/icons/clock-icon/index.tsx +28 -0
- package/dist/icons/clock-icon/meta.ts +8 -0
- package/dist/icons/headphone-icon/HeadphoneIcon.stories.tsx +186 -0
- package/dist/icons/headphone-icon/index.tsx +49 -0
- package/dist/icons/headphone-icon/meta.ts +8 -0
- package/dist/icons/index.ts +5 -1
- package/dist/icons/underline-icon/UnderlineIcon.stories.tsx +238 -0
- package/dist/icons/underline-icon/index.tsx +58 -0
- package/dist/icons/underline-icon/meta.ts +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
3
|
+
|
|
4
|
+
import { CapitalALetterIcon } from "src/ui/icons/capital-a-letter-icon"
|
|
5
|
+
import { FileTextIcon } from "src/ui/icons/file-text-icon"
|
|
6
|
+
import { TextColorIcon } from "src/ui/icons/text-color-icon"
|
|
7
|
+
import { TextIndicatorIcon } from "src/ui/icons/text-indicator-icon"
|
|
8
|
+
import {
|
|
9
|
+
IconDefaultCanvas,
|
|
10
|
+
IconPlaygroundCanvas,
|
|
11
|
+
IconUsageCanvas,
|
|
12
|
+
IconUsageSection,
|
|
13
|
+
} from "src/ui/story-spec/icons/icon-story-canvas"
|
|
14
|
+
import { AuralIconDocsPage } from "src/ui/story-spec/icons/icon-story-docs-page"
|
|
15
|
+
|
|
16
|
+
import { UnderlineIcon } from "."
|
|
17
|
+
|
|
18
|
+
const meta: Meta<typeof UnderlineIcon> = {
|
|
19
|
+
title: "Icons/UnderlineIcon",
|
|
20
|
+
component: UnderlineIcon,
|
|
21
|
+
parameters: {
|
|
22
|
+
layout: "fullscreen",
|
|
23
|
+
backgrounds: {
|
|
24
|
+
default: "dark",
|
|
25
|
+
values: [
|
|
26
|
+
{ name: "dark", value: "var(--color-fm-surface-primary)" },
|
|
27
|
+
{ name: "darker", value: "var(--color-fm-neutral-0)" },
|
|
28
|
+
{ name: "light", value: "var(--color-fm-neutral-1100)" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
docs: {
|
|
32
|
+
page: () => (
|
|
33
|
+
<AuralIconDocsPage
|
|
34
|
+
accentToken="warning"
|
|
35
|
+
features={[
|
|
36
|
+
{ title: "Gradient Stroke", description: "Custom gradient colors" },
|
|
37
|
+
{ title: "Decorative Mark", description: "Accent underline style" },
|
|
38
|
+
{ title: "Accessible", description: "ARIA-ready by default" },
|
|
39
|
+
]}
|
|
40
|
+
quickStart={{
|
|
41
|
+
codeExample: `import { UnderlineIcon } from "src/ui/icons/underline-icon"
|
|
42
|
+
|
|
43
|
+
function HighlightedHeading() {
|
|
44
|
+
return (
|
|
45
|
+
<span className="relative inline-block pb-1">
|
|
46
|
+
<span className="text-fm-primary font-fm-brand text-2xl font-bold">
|
|
47
|
+
Featured
|
|
48
|
+
</span>
|
|
49
|
+
<UnderlineIcon
|
|
50
|
+
className="absolute left-0 h-1 w-7.5"
|
|
51
|
+
withAccessibility={false}
|
|
52
|
+
/>
|
|
53
|
+
</span>
|
|
54
|
+
)
|
|
55
|
+
}`,
|
|
56
|
+
livePreview: (
|
|
57
|
+
<span className="relative inline-block pb-1">
|
|
58
|
+
<span className="text-fm-primary font-fm-brand text-2xl font-bold">
|
|
59
|
+
Featured
|
|
60
|
+
</span>
|
|
61
|
+
<UnderlineIcon
|
|
62
|
+
className="absolute left-0 h-1 w-7.5"
|
|
63
|
+
withAccessibility={false}
|
|
64
|
+
/>
|
|
65
|
+
</span>
|
|
66
|
+
),
|
|
67
|
+
}}
|
|
68
|
+
relatedIcons={[
|
|
69
|
+
{
|
|
70
|
+
name: "TextColorIcon",
|
|
71
|
+
description: "Text formatting accent",
|
|
72
|
+
icon: TextColorIcon,
|
|
73
|
+
accentToken: "info",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "CapitalALetterIcon",
|
|
77
|
+
description: "Typography size marker",
|
|
78
|
+
icon: CapitalALetterIcon,
|
|
79
|
+
accentToken: "positive",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "TextIndicatorIcon",
|
|
83
|
+
description: "Inline text indicator",
|
|
84
|
+
icon: TextIndicatorIcon,
|
|
85
|
+
accentToken: "warning",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "FileTextIcon",
|
|
89
|
+
description: "Document with text",
|
|
90
|
+
icon: FileTextIcon,
|
|
91
|
+
accentToken: "negative",
|
|
92
|
+
},
|
|
93
|
+
]}
|
|
94
|
+
/>
|
|
95
|
+
),
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
tags: ["autodocs"],
|
|
99
|
+
argTypes: {
|
|
100
|
+
fromColor: {
|
|
101
|
+
control: "color",
|
|
102
|
+
description: "Gradient start color",
|
|
103
|
+
},
|
|
104
|
+
toColor: {
|
|
105
|
+
control: "color",
|
|
106
|
+
description: "Gradient end color",
|
|
107
|
+
},
|
|
108
|
+
width: {
|
|
109
|
+
control: { type: "range", min: 30, max: 400, step: 10 },
|
|
110
|
+
description: "Width in pixels — keep ~7:1 ratio with height",
|
|
111
|
+
},
|
|
112
|
+
height: {
|
|
113
|
+
control: { type: "range", min: 4, max: 60, step: 1 },
|
|
114
|
+
description: "Height in pixels — keep ~7:1 ratio with width",
|
|
115
|
+
},
|
|
116
|
+
withAccessibility: {
|
|
117
|
+
control: "boolean",
|
|
118
|
+
description: "Wrap with accessibility label",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default meta
|
|
124
|
+
type Story = StoryObj<typeof UnderlineIcon>
|
|
125
|
+
|
|
126
|
+
// Natural viewBox is 32 × 5 (6.4:1). Default uses 3× scale (96 × 15).
|
|
127
|
+
export const Default: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
width: 96,
|
|
130
|
+
height: 15,
|
|
131
|
+
fromColor: "#F9FFB8",
|
|
132
|
+
toColor: "#CFFF3F",
|
|
133
|
+
withAccessibility: true,
|
|
134
|
+
},
|
|
135
|
+
render: (args) => (
|
|
136
|
+
<IconDefaultCanvas>
|
|
137
|
+
<UnderlineIcon {...args} />
|
|
138
|
+
</IconDefaultCanvas>
|
|
139
|
+
),
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const UsageExamples: Story = {
|
|
143
|
+
render: () => (
|
|
144
|
+
<IconUsageCanvas>
|
|
145
|
+
<IconUsageSection title="Decorated Heading">
|
|
146
|
+
<div className="space-y-2">
|
|
147
|
+
<span className="relative inline-block pb-1">
|
|
148
|
+
<h2 className="text-fm-primary font-fm-brand text-2xl font-bold">
|
|
149
|
+
Our Story
|
|
150
|
+
</h2>
|
|
151
|
+
<UnderlineIcon
|
|
152
|
+
className="absolute left-0 h-1 w-7.5"
|
|
153
|
+
withAccessibility={false}
|
|
154
|
+
/>
|
|
155
|
+
</span>
|
|
156
|
+
<p className="text-fm-secondary font-fm-text text-sm">
|
|
157
|
+
Building the future of audio entertainment.
|
|
158
|
+
</p>
|
|
159
|
+
</div>
|
|
160
|
+
</IconUsageSection>
|
|
161
|
+
|
|
162
|
+
<IconUsageSection title="Feature Card Accent">
|
|
163
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary w-full max-w-sm rounded-xl border p-5">
|
|
164
|
+
<div className="mb-3">
|
|
165
|
+
<span className="relative inline-block pb-1">
|
|
166
|
+
<span className="text-fm-primary font-fm-brand text-base font-semibold">
|
|
167
|
+
Premium Audio
|
|
168
|
+
</span>
|
|
169
|
+
<UnderlineIcon
|
|
170
|
+
className="absolute left-0 h-1 w-7.5"
|
|
171
|
+
fromColor="#F9FFB8"
|
|
172
|
+
toColor="#CFFF3F"
|
|
173
|
+
withAccessibility={false}
|
|
174
|
+
/>
|
|
175
|
+
</span>
|
|
176
|
+
</div>
|
|
177
|
+
<p className="text-fm-secondary font-fm-text text-sm leading-relaxed">
|
|
178
|
+
Immersive listening experience crafted for creators.
|
|
179
|
+
</p>
|
|
180
|
+
</div>
|
|
181
|
+
</IconUsageSection>
|
|
182
|
+
|
|
183
|
+
<IconUsageSection title="Highlighted Quote">
|
|
184
|
+
<div className="border-fm-divider-secondary bg-fm-surface-secondary w-full max-w-sm rounded-xl border p-5">
|
|
185
|
+
<div className="flex flex-col gap-3">
|
|
186
|
+
<span className="relative inline-block self-start pb-1">
|
|
187
|
+
<blockquote className="text-fm-primary font-fm-text text-sm italic">
|
|
188
|
+
“Audio is the future.”
|
|
189
|
+
</blockquote>
|
|
190
|
+
<UnderlineIcon
|
|
191
|
+
className="absolute left-0 h-1 w-7.5"
|
|
192
|
+
fromColor="#F9FFB8"
|
|
193
|
+
toColor="#CFFF3F"
|
|
194
|
+
withAccessibility={false}
|
|
195
|
+
/>
|
|
196
|
+
</span>
|
|
197
|
+
<span className="text-fm-secondary font-fm-text text-xs">
|
|
198
|
+
— Product Team
|
|
199
|
+
</span>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</IconUsageSection>
|
|
203
|
+
|
|
204
|
+
<IconUsageSection title="Section Label Accent">
|
|
205
|
+
<div className="flex flex-wrap gap-6">
|
|
206
|
+
{["Discover", "Trending", "For You"].map((label) => (
|
|
207
|
+
<span key={label} className="relative inline-block pb-1">
|
|
208
|
+
<span className="text-fm-primary font-fm-brand text-lg font-semibold">
|
|
209
|
+
{label}
|
|
210
|
+
</span>
|
|
211
|
+
<UnderlineIcon
|
|
212
|
+
className="absolute left-0 h-1 w-7.5"
|
|
213
|
+
fromColor="#F9FFB8"
|
|
214
|
+
toColor="#CFFF3F"
|
|
215
|
+
withAccessibility={false}
|
|
216
|
+
/>
|
|
217
|
+
</span>
|
|
218
|
+
))}
|
|
219
|
+
</div>
|
|
220
|
+
</IconUsageSection>
|
|
221
|
+
</IconUsageCanvas>
|
|
222
|
+
),
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export const Playground: Story = {
|
|
226
|
+
args: {
|
|
227
|
+
width: 192,
|
|
228
|
+
height: 30,
|
|
229
|
+
fromColor: "#F9FFB8",
|
|
230
|
+
toColor: "#CFFF3F",
|
|
231
|
+
withAccessibility: true,
|
|
232
|
+
},
|
|
233
|
+
render: (args) => (
|
|
234
|
+
<IconPlaygroundCanvas>
|
|
235
|
+
<UnderlineIcon {...args} />
|
|
236
|
+
</IconPlaygroundCanvas>
|
|
237
|
+
),
|
|
238
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useId } from "react"
|
|
2
|
+
import { AccessibleIcon } from "@radix-ui/react-accessible-icon"
|
|
3
|
+
|
|
4
|
+
export interface IUnderlineIconProps extends React.SVGProps<SVGSVGElement> {
|
|
5
|
+
fromColor?: string
|
|
6
|
+
toColor?: string
|
|
7
|
+
withAccessibility?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const UnderlineIcon = (props: IUnderlineIconProps) => {
|
|
11
|
+
const {
|
|
12
|
+
fromColor = "#F9FFB8",
|
|
13
|
+
toColor = "#CFFF3F",
|
|
14
|
+
withAccessibility = true,
|
|
15
|
+
id: idProp,
|
|
16
|
+
...svgProps
|
|
17
|
+
} = props
|
|
18
|
+
|
|
19
|
+
const autoId = useId()
|
|
20
|
+
const gradientId = `underline-gradient-${idProp ?? autoId}`
|
|
21
|
+
|
|
22
|
+
const svg = (
|
|
23
|
+
<svg
|
|
24
|
+
viewBox="0 0 32 5"
|
|
25
|
+
fill="none"
|
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
{...svgProps}
|
|
29
|
+
>
|
|
30
|
+
<path
|
|
31
|
+
d="M0.499845 2.55202C0.499845 2.55202 13.9101 0.777228 21.7693 0.643631C29.6284 0.510034 31.7935 0.279256 30.6512 1.00823C29.509 1.73721 24.0827 4.08102 24.6916 4.06392C25.3005 4.04681 30.6783 4.04011 30.6783 4.04011"
|
|
32
|
+
stroke={`url(#${gradientId})`}
|
|
33
|
+
strokeWidth={1}
|
|
34
|
+
strokeLinecap="round"
|
|
35
|
+
strokeLinejoin="round"
|
|
36
|
+
/>
|
|
37
|
+
<defs>
|
|
38
|
+
<linearGradient
|
|
39
|
+
id={gradientId}
|
|
40
|
+
x1="1.76936"
|
|
41
|
+
y1="3.77954"
|
|
42
|
+
x2="6.01158"
|
|
43
|
+
y2="-7.79593"
|
|
44
|
+
gradientUnits="userSpaceOnUse"
|
|
45
|
+
>
|
|
46
|
+
<stop style={{ stopColor: fromColor }} />
|
|
47
|
+
<stop offset="1" style={{ stopColor: toColor }} />
|
|
48
|
+
</linearGradient>
|
|
49
|
+
</defs>
|
|
50
|
+
</svg>
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if (withAccessibility) {
|
|
54
|
+
return <AccessibleIcon label="Underline icon">{svg}</AccessibleIcon>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return svg
|
|
58
|
+
}
|