Skip to content

Commit de23e12

Browse files
hynes-dialpadclaudeiropolofrancisrupert
authored
feat(tokens): DLT-2937 introduce spacing and layout token systems (#1045)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: iropolo <ignacio.ropolo@dialpad.com> Co-authored-by: Francis Rupert <francis.rupert@dialpad.com> Co-authored-by: Francis Rupert <francisrupert@gmail.com>
1 parent 6ea7eb9 commit de23e12

22 files changed

Lines changed: 1507 additions & 416 deletions

File tree

.github/actions/setup-environment/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ runs:
1212
with:
1313
node-version-file: ".nvmrc"
1414
cache: "pnpm"
15+
registry-url: "https://npm.pkg.github.com"
16+
scope: "dialpad"
17+
env:
18+
NODE_AUTH_TOKEN: ${{ github.token }}
1519

1620
- name: Install dependencies
1721
shell: bash

apps/dialtone-documentation/docs/.vuepress/baseComponents/tokens/constants.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export const THEMES = [
2727
export const CATEGORY_MAP = {
2828
color: ['color', 'opacity', 'shell'],
2929
typography: ['typography', 'font', 'text'],
30+
spacing: ['spacing'],
31+
layout: ['layout'],
3032
size: ['size'],
3133
shadow: ['shadow'],
3234
component: ['topbar', 'sidebar', 'presence', 'mention', 'avatar', 'badge', 'checkbox', 'icon', 'inputs', 'action'],
@@ -105,16 +107,20 @@ export const getTokensStructure = () => ({
105107
shadow: {
106108
_children: [],
107109
},
108-
size: {
110+
spacing: {
109111
base: {
110112
_children: [],
111113
},
112114
negative: {
113115
_children: [],
114116
},
115-
percentage: {
117+
},
118+
layout: {
119+
base: {
116120
_children: [],
117121
},
122+
},
123+
size: {
118124
radius: {
119125
_children: [],
120126
},

apps/dialtone-documentation/docs/.vuepress/baseComponents/tokens/utilities.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,34 @@ const addTokensToCategories = (token, format, structure) => {
159159
return;
160160
}
161161

162-
// SIZE
163-
if (key.startsWith('size') && key.endsWith('negative')) {
164-
structure.size.negative._children.push(displayToken);
162+
// SPACING (0-64px)
163+
if (key.startsWith('spacing') && key.endsWith('negative')) {
164+
structure.spacing.negative._children.push(displayToken);
165165
return;
166166
}
167167

168-
if (key.startsWith('size') && key.endsWith('percent')) {
169-
structure.size.percentage._children.push(displayToken);
168+
if (key.startsWith('spacing')) {
169+
structure.spacing.base._children.push(displayToken);
170170
return;
171171
}
172172

173-
if (key.startsWith('size') && SUBCATEGORY_MAP.size.includes(splitKeys[1])) {
174-
addTokenToSubcategory(displayToken, 'size', SUBCATEGORY_MAP.size.find(sub => sub === splitKeys[1]), structure);
173+
// LAYOUT (64px+)
174+
if (key.startsWith('layout') && key.endsWith('negative')) {
175+
structure.layout.negative._children.push(displayToken);
175176
return;
176177
}
177178

179+
if (key.startsWith('layout') && key.endsWith('percent')) {
180+
structure.layout.percentage._children.push(displayToken);
181+
return;
182+
}
183+
184+
if (key.startsWith('layout')) {
185+
structure.layout.base._children.push(displayToken);
186+
return;
187+
}
188+
189+
// SIZE (radius, border, and component-specific only)
178190
if (key.startsWith('size/radius')) {
179191
structure.size.radius._children.push(displayToken);
180192
return;
@@ -185,11 +197,6 @@ const addTokensToCategories = (token, format, structure) => {
185197
return;
186198
}
187199

188-
if (key.startsWith('size')) {
189-
structure.size.base._children.push(displayToken);
190-
return;
191-
}
192-
193200
if (CATEGORY_MAP.component.includes(splitKeys[0]) && splitKeys[1] === 'size') {
194201
if (splitKeys[2] === 'border') {
195202
structure.size.components._children.push({ ...displayToken, hidden: true });
@@ -199,8 +206,8 @@ const addTokensToCategories = (token, format, structure) => {
199206
return;
200207
}
201208

202-
// SPACE tokens are deprecated - they now alias to SIZE tokens
203-
// Suppress them from the tokens page display
209+
// Old size base/negative tokens are deprecated - suppress from display
210+
// They are replaced by spacing (0-64px) and layout (64px+) tokens
204211
};
205212

206213
const addTokenToSubcategory = (token, category, subcategory, structure) => {

apps/dialtone-documentation/docs/.vuepress/theme/components/Home.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,4 @@
1212
</template>
1313

1414
<script setup>
15-
function sendAnalyticsEvent () {
16-
if (!window.gtag) return;
17-
window.gtag('event', 'click', { event_name: 'get_started_button_clicked' });
18-
}
1915
</script>

0 commit comments

Comments
 (0)