Skip to content

Commit ba6b599

Browse files
docs(playground): DLT-3119 refine playground UI and integrate across doc site (#1127)
1 parent 23c5689 commit ba6b599

178 files changed

Lines changed: 5044 additions & 1441 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/dialtone-documentation/docs/.vuepress/baseComponents/ComponentCombinator.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
:component="component"
44
:library="library"
55
:documentation="componentDocumentation"
6+
:variants="componentVariants"
7+
:dev-mode="isDev"
68
/>
79
</template>
810

911
<script>
12+
import { variantBank } from '@dialpad/dialtone-combinator';
13+
1014
export default {
1115
name: 'ComponentCombinator',
1216
@@ -40,13 +44,22 @@ export default {
4044
);
4145
},
4246
47+
componentVariants () {
48+
return variantBank()[this.componentName] ?? {};
49+
},
50+
4351
library () {
4452
return {
4553
...this.dialtoneComponents,
4654
...this.dialtoneIcons,
4755
...this.dialtoneIllustrations,
4856
};
4957
},
58+
59+
isDev () {
60+
return typeof __VUEPRESS_DEV__ !== 'undefined'
61+
&& (__VUEPRESS_DEV__ || __DIALTONE_DEPLOY_PREVIEW__);
62+
},
5063
},
5164
};
5265
</script>

apps/dialtone-documentation/docs/.vuepress/baseComponents/ComponentVueApi.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ const resolveConstantRef = (rawDefault, values) => {
113113
return rawDefault;
114114
};
115115
116+
const extractRawDefault = (defaultValue) => {
117+
// vue-docgen-api produces { func, value } objects, but Vite's JSON import
118+
// may evaluate them to direct JS values at runtime. Handle both formats.
119+
if (defaultValue != null && typeof defaultValue === 'object' && 'value' in defaultValue) {
120+
return defaultValue.value;
121+
}
122+
if (defaultValue === undefined) return undefined;
123+
return String(defaultValue);
124+
};
125+
116126
const resolveDefaultValue = (rawDefault, values) => {
117127
if (!rawDefault) return rawDefault;
118128
if (rawDefault === 'undefined') return null;
@@ -127,7 +137,7 @@ const docProps = componentDocs.find(f => isSameComponentName(f.displayName))
127137
name: item.name,
128138
description: item.description,
129139
type: item.type?.name,
130-
defaultValue: resolveDefaultValue(item.defaultValue?.value, item.values),
140+
defaultValue: resolveDefaultValue(extractRawDefault(item.defaultValue), item.values),
131141
values: item.values,
132142
required: item.required,
133143
deprecated: isDeprecated(item),

apps/dialtone-documentation/docs/.vuepress/baseComponents/CopyButton.vue

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
<template>
2-
<dt-tooltip
3-
:message="message"
4-
:sticky="true"
2+
<dt-button
3+
:aria-label="ariaLabel"
4+
size="xs"
5+
importance="clear"
6+
kind="muted"
7+
@click="copyToClipboard"
58
>
6-
<template #anchor>
7-
<dt-button
8-
:aria-label="ariaLabel"
9-
size="xs"
10-
importance="clear"
11-
kind="muted"
12-
@click="copyToClipboard"
13-
>
14-
<template #startIcon="{ iconSize }">
15-
<dt-icon
16-
name="copy"
17-
:size="iconSize"
18-
/>
19-
</template>
20-
<slot />
21-
</dt-button>
9+
<template #startIcon="{ iconSize }">
10+
<dt-icon
11+
:name="copied ? 'check' : 'copy'"
12+
:size="iconSize"
13+
:class="{ 'd-fc-success': copied }"
14+
/>
2215
</template>
23-
</dt-tooltip>
16+
<template v-if="copied">
17+
Copied!
18+
</template>
19+
<slot v-else />
20+
</dt-button>
2421
</template>
2522

2623
<script setup>
@@ -30,13 +27,13 @@ const props = defineProps({
3027
text: { type: String, required: true },
3128
ariaLabel: { type: String, required: true },
3229
});
33-
const message = ref(props.ariaLabel);
30+
const copied = ref(false);
3431
const copyToClipboard = async () => {
3532
try {
3633
await navigator.clipboard.writeText(props.text);
37-
message.value = 'Copied';
38-
await new Promise(resolve => setTimeout(resolve, 750));
39-
message.value = props.ariaLabel;
34+
copied.value = true;
35+
await new Promise(resolve => setTimeout(resolve, 2000));
36+
copied.value = false;
4037
} catch {
4138
console.error('Error copying to clipboard', props.text);
4239
}

apps/dialtone-documentation/docs/.vuepress/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ export default defineUserConfig({
4949
css: {
5050
devSourcemap: true,
5151
},
52+
resolve: {
53+
alias: [
54+
// The combinator's DtcNode uses runtime template compilation (h({ template: '...' })),
55+
// which requires the full Vue build including the compiler.
56+
// Exact match only — must not rewrite vue/server-renderer etc. during SSR build.
57+
{ find: /^vue$/, replacement: 'vue/dist/vue.esm-bundler.js' },
58+
],
59+
},
5260
server: {
5361
// hmr: {
5462
// overlay: false,

apps/dialtone-documentation/docs/.vuepress/exampleComponents/ExampleTabs.vue

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,20 @@
1717
panel-id="2"
1818
selected
1919
>
20-
<p>
21-
First tab
22-
</p>
20+
First tab
2321
</dt-tab>
2422
<dt-tab
2523
id="3"
2624
panel-id="4"
2725
>
28-
<p>
29-
Second tab
30-
</p>
26+
Second tab
3127
</dt-tab>
3228
<dt-tab
3329
id="5"
3430
panel-id="6"
3531
label="Third Label"
3632
>
37-
<p>
38-
Third tab
39-
</p>
33+
Third tab
4034
</dt-tab>
4135
</template>
4236
<div

apps/dialtone-documentation/docs/components/avatar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ figma_url: https://www.figma.com/design/W58r5BkO8qTw3vem9YieJd/DT9-Component-Lib
99
keywords: ["profile picture", "user image", "profile image", "d-avatar", "DtAvatar", "dt-avatar", "initials", "user icon", "persona"]
1010
---
1111

12-
<code-well-header>
12+
<!-- <code-well-header>
1313
<dt-stack direction="row" align="center" gap="500">
1414
<dt-avatar size="lg">
1515
<template #icon>
@@ -19,9 +19,9 @@ keywords: ["profile picture", "user image", "profile image", "d-avatar", "DtAvat
1919
<dt-avatar size="lg" full-name="dp" seed="user-123" presence="busy" />
2020
<dt-avatar size="lg" image-src="/assets/images/person.png" image-alt="avatar user" presence="active" />
2121
</dt-stack>
22-
</code-well-header>
22+
</code-well-header> -->
2323

24-
<!-- <component-combinator component-name="DtAvatar" /> -->
24+
<component-combinator component-name="DtAvatar" />
2525

2626
## Usage
2727

apps/dialtone-documentation/docs/components/badge.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@ figma_url: https://www.figma.com/design/W58r5BkO8qTw3vem9YieJd/DT9-Component-Lib
99
keywords: ["label","tag","indicator","count","d-badge","DtBadge","dt-badge"]
1010
---
1111

12-
<code-well-header>
13-
<dt-stack direction="row" gap="400" align="center">
14-
<dt-badge text="Label"></dt-badge>
15-
<dt-badge kind="count" text="1"></dt-badge>
16-
</dt-stack>
17-
</code-well-header>
18-
19-
<!-- <component-combinator component-name="DtBadge" /> -->
12+
<component-combinator component-name="DtBadge" />
2013

2114
## Usage
2215

apps/dialtone-documentation/docs/components/banner.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ keywords: ["alert","notification","message","d-banner","DtBanner","dt-banner"]
2323
</dt-stack>
2424
</code-well-header>
2525

26+
<!-- <component-combinator component-name="DtBanner" /> -->
27+
2628
## Usage
2729

2830
System banners are used for **system** messaging. They are full-width notices placed in one of two locations:

apps/dialtone-documentation/docs/components/breadcrumbs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ figma_url: https://www.figma.com/design/W58r5BkO8qTw3vem9YieJd/DT9-Component-Lib
99
keywords: ["navigation", "path", "d-breadcrumbs", "DtBreadcrumbs", "dt-breadcrumbs", "trail", "path navigation"]
1010
---
1111

12-
<code-well-header>
12+
<!-- <code-well-header>
1313
<dt-breadcrumbs
1414
:breadcrumbs="[
1515
{ href: '#', label: 'Root' },
@@ -19,9 +19,9 @@ keywords: ["navigation", "path", "d-breadcrumbs", "DtBreadcrumbs", "dt-breadcrum
1919
{ href: '#', label: 'Current Page', selected: true },
2020
]"
2121
/>
22-
</code-well-header>
22+
</code-well-header> -->
2323

24-
<!-- <component-combinator component-name="DtBreadcrumbs" /> -->
24+
<component-combinator component-name="DtBreadcrumbs" />
2525

2626
## Usage
2727

apps/dialtone-documentation/docs/components/button-group.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,14 @@ storybook: https://dialtone.dialpad.com/vue/?path=/story/components-button-group
77
keywords: ["button set", "btn group", "action group", "d-btn-group", "DtButtonGroup", "dt-button-group", "toolbar", "segmented button"]
88
---
99

10-
<code-well-header class="d-d-block">
11-
<dt-button-group alignment="start" class="d-g8">
10+
<!-- <code-well-header class="d-d-block">
11+
<dt-button-group alignment="start">
1212
<dt-button importance="primary">Confirm</dt-button>
1313
<dt-button importance="outlined">Cancel</dt-button>
1414
</dt-button-group>
15-
</code-well-header>
15+
</code-well-header> -->
1616

17-
<code-example-tabs
18-
htmlCode='
19-
<div role="group" class="d-btn-group d-btn-group--start" alignment="start">
20-
<button type="button" class="base-button__button d-btn d-btn--primary">
21-
<span class="d-btn__label base-button__label"> Confirm </span>
22-
</button>
23-
<button data-qa="dt-button" type="button" class="base-button__button d-btn d-btn--outlined">
24-
<span class="d-btn__label base-button__label"> Cancel </span>
25-
</button>
26-
</div>
27-
'
28-
vueCode='
29-
<dt-button-group>
30-
<dt-button importance="primary">Confirm</dt-button>
31-
<dt-button importance="outlined">Cancel</dt-button>
32-
</dt-button-group>
33-
'
34-
showHtmlWarning />
17+
<component-combinator component-name="DtButtonGroup" />
3518

3619
## Variants
3720

@@ -41,7 +24,7 @@ The alignment and the order of buttons within it can be customized to suit the s
4124

4225
When aligned to `start`, the `primary` button is on the **left** side of the group.
4326
<code-well-header class="d-d-block">
44-
<dt-button-group alignment="start" class="d-g8">
27+
<dt-button-group alignment="start">
4528
<dt-button importance="primary">Confirm</dt-button>
4629
<dt-button importance="outlined">Cancel</dt-button>
4730
</dt-button-group>
@@ -70,7 +53,7 @@ showHtmlWarning />
7053

7154
When aligned to `end`, the `primary` button is on the **right** side of the group.
7255
<code-well-header class="d-d-block">
73-
<dt-button-group alignment="end" class="d-g8">
56+
<dt-button-group alignment="end">
7457
<dt-button importance="outlined">Cancel</dt-button>
7558
<dt-button importance="primary">Confirm</dt-button>
7659
</dt-button-group>
@@ -99,7 +82,7 @@ showHtmlWarning />
9982

10083
When set to `space-between`, the elements are evenly distributed within the row, creating a directional flow where the `primary` button is either on the **left** (regressive) or on the **right** (progressive).
10184
<code-well-header class="d-d-block">
102-
<dt-button-group alignment="space-between" class="d-g8">
85+
<dt-button-group alignment="space-between">
10386
<dt-button importance="outlined">Previous</dt-button>
10487
<dt-button importance="primary">Next</dt-button>
10588
</dt-button-group>

0 commit comments

Comments
 (0)