@cdx-ui/components 0.1.4 → 0.1.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/README.md +1 -1
- package/lib/commonjs/figma/Calendar.figma.js +28 -0
- package/lib/commonjs/figma/Calendar.figma.js.map +1 -0
- package/lib/commonjs/figma/Carousel.NextButton.figma.js +27 -0
- package/lib/commonjs/figma/Carousel.NextButton.figma.js.map +1 -0
- package/lib/commonjs/figma/Carousel.Pagination.figma.js +22 -0
- package/lib/commonjs/figma/Carousel.Pagination.figma.js.map +1 -0
- package/lib/commonjs/figma/Carousel.PrevButton.figma.js +27 -0
- package/lib/commonjs/figma/Carousel.PrevButton.figma.js.map +1 -0
- package/lib/commonjs/figma/Carousel.figma.js +37 -0
- package/lib/commonjs/figma/Carousel.figma.js.map +1 -0
- package/lib/commonjs/figma/Checkbox.Group.figma.js +24 -0
- package/lib/commonjs/figma/Checkbox.Group.figma.js.map +1 -0
- package/lib/commonjs/figma/CurrencyInput.figma.js +54 -0
- package/lib/commonjs/figma/CurrencyInput.figma.js.map +1 -0
- package/lib/commonjs/figma/DateField.figma.js +58 -0
- package/lib/commonjs/figma/DateField.figma.js.map +1 -0
- package/lib/commonjs/figma/DatePicker.figma.js +88 -0
- package/lib/commonjs/figma/DatePicker.figma.js.map +1 -0
- package/lib/commonjs/figma/DateRangePicker.figma.js +85 -0
- package/lib/commonjs/figma/DateRangePicker.figma.js.map +1 -0
- package/lib/commonjs/figma/DateTimeField.figma.js +69 -0
- package/lib/commonjs/figma/DateTimeField.figma.js.map +1 -0
- package/lib/commonjs/figma/Field.Checkbox.figma.js +52 -0
- package/lib/commonjs/figma/Field.Checkbox.figma.js.map +1 -0
- package/lib/commonjs/figma/Field.DateField.figma.js +57 -0
- package/lib/commonjs/figma/Field.DateField.figma.js.map +1 -0
- package/lib/commonjs/figma/Field.DateTimeField.figma.js +57 -0
- package/lib/commonjs/figma/Field.DateTimeField.figma.js.map +1 -0
- package/lib/commonjs/figma/Image.figma.js +22 -0
- package/lib/commonjs/figma/Image.figma.js.map +1 -0
- package/lib/commonjs/figma/MonthCalendar.figma.js +18 -0
- package/lib/commonjs/figma/MonthCalendar.figma.js.map +1 -0
- package/lib/commonjs/figma/ProgressBar.figma.js +54 -0
- package/lib/commonjs/figma/ProgressBar.figma.js.map +1 -0
- package/lib/commonjs/figma/ProgressCircle.figma.js +73 -0
- package/lib/commonjs/figma/ProgressCircle.figma.js.map +1 -0
- package/lib/commonjs/figma/RangeCalendar.figma.js +36 -0
- package/lib/commonjs/figma/RangeCalendar.figma.js.map +1 -0
- package/lib/commonjs/figma/Skeleton.figma.js +31 -0
- package/lib/commonjs/figma/Skeleton.figma.js.map +1 -0
- package/lib/commonjs/figma/Slider.Marker.figma.js +21 -0
- package/lib/commonjs/figma/Slider.Marker.figma.js.map +1 -0
- package/lib/commonjs/figma/Slider.MarkerGroup.figma.js +22 -0
- package/lib/commonjs/figma/Slider.MarkerGroup.figma.js.map +1 -0
- package/lib/commonjs/figma/Slider.Thumb.figma.js +22 -0
- package/lib/commonjs/figma/Slider.Thumb.figma.js.map +1 -0
- package/lib/commonjs/figma/Slider.figma.js +69 -0
- package/lib/commonjs/figma/Slider.figma.js.map +1 -0
- package/lib/commonjs/figma/Switch.figma.js +36 -0
- package/lib/commonjs/figma/Switch.figma.js.map +1 -0
- package/lib/commonjs/figma/Tabs.SegmentedControl.Segment.figma.js +34 -0
- package/lib/commonjs/figma/Tabs.SegmentedControl.Segment.figma.js.map +1 -0
- package/lib/commonjs/figma/Tabs.SegmentedControl.figma.js +43 -0
- package/lib/commonjs/figma/Tabs.SegmentedControl.figma.js.map +1 -0
- package/lib/commonjs/figma/Tabs.Tab.figma.js +34 -0
- package/lib/commonjs/figma/Tabs.Tab.figma.js.map +1 -0
- package/lib/commonjs/figma/Tabs.figma.js +39 -0
- package/lib/commonjs/figma/Tabs.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.Description.figma.js +23 -0
- package/lib/commonjs/figma/Tile.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.Group.figma.js +45 -0
- package/lib/commonjs/figma/Tile.Group.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.LeadingSlot.figma.js +23 -0
- package/lib/commonjs/figma/Tile.LeadingSlot.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.Title.figma.js +23 -0
- package/lib/commonjs/figma/Tile.Title.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.TrailingSlot.figma.js +23 -0
- package/lib/commonjs/figma/Tile.TrailingSlot.figma.js.map +1 -0
- package/lib/commonjs/figma/Tile.figma.js +57 -0
- package/lib/commonjs/figma/Tile.figma.js.map +1 -0
- package/lib/commonjs/figma/Toast.Button.figma.js +32 -0
- package/lib/commonjs/figma/Toast.Button.figma.js.map +1 -0
- package/lib/commonjs/figma/Toast.Close.figma.js +20 -0
- package/lib/commonjs/figma/Toast.Close.figma.js.map +1 -0
- package/lib/commonjs/figma/Toast.figma.js +81 -0
- package/lib/commonjs/figma/Toast.figma.js.map +1 -0
- package/lib/commonjs/figma/Tooltip.Content.figma.js +30 -0
- package/lib/commonjs/figma/Tooltip.Content.figma.js.map +1 -0
- package/lib/commonjs/figma/Tooltip.figma.js +46 -0
- package/lib/commonjs/figma/Tooltip.figma.js.map +1 -0
- package/lib/commonjs/figma/VirtualizedList.figma.js +31 -0
- package/lib/commonjs/figma/VirtualizedList.figma.js.map +1 -0
- package/lib/module/figma/Calendar.figma.js +22 -0
- package/lib/module/figma/Calendar.figma.js.map +1 -0
- package/lib/module/figma/Carousel.NextButton.figma.js +21 -0
- package/lib/module/figma/Carousel.NextButton.figma.js.map +1 -0
- package/lib/module/figma/Carousel.Pagination.figma.js +18 -0
- package/lib/module/figma/Carousel.Pagination.figma.js.map +1 -0
- package/lib/module/figma/Carousel.PrevButton.figma.js +21 -0
- package/lib/module/figma/Carousel.PrevButton.figma.js.map +1 -0
- package/lib/module/figma/Carousel.figma.js +31 -0
- package/lib/module/figma/Carousel.figma.js.map +1 -0
- package/lib/module/figma/Checkbox.Group.figma.js +18 -0
- package/lib/module/figma/Checkbox.Group.figma.js.map +1 -0
- package/lib/module/figma/CurrencyInput.figma.js +48 -0
- package/lib/module/figma/CurrencyInput.figma.js.map +1 -0
- package/lib/module/figma/DateField.figma.js +52 -0
- package/lib/module/figma/DateField.figma.js.map +1 -0
- package/lib/module/figma/DatePicker.figma.js +82 -0
- package/lib/module/figma/DatePicker.figma.js.map +1 -0
- package/lib/module/figma/DateRangePicker.figma.js +79 -0
- package/lib/module/figma/DateRangePicker.figma.js.map +1 -0
- package/lib/module/figma/DateTimeField.figma.js +63 -0
- package/lib/module/figma/DateTimeField.figma.js.map +1 -0
- package/lib/module/figma/Field.Checkbox.figma.js +46 -0
- package/lib/module/figma/Field.Checkbox.figma.js.map +1 -0
- package/lib/module/figma/Field.DateField.figma.js +51 -0
- package/lib/module/figma/Field.DateField.figma.js.map +1 -0
- package/lib/module/figma/Field.DateTimeField.figma.js +51 -0
- package/lib/module/figma/Field.DateTimeField.figma.js.map +1 -0
- package/lib/module/figma/Image.figma.js +18 -0
- package/lib/module/figma/Image.figma.js.map +1 -0
- package/lib/module/figma/MonthCalendar.figma.js +14 -0
- package/lib/module/figma/MonthCalendar.figma.js.map +1 -0
- package/lib/module/figma/ProgressBar.figma.js +48 -0
- package/lib/module/figma/ProgressBar.figma.js.map +1 -0
- package/lib/module/figma/ProgressCircle.figma.js +67 -0
- package/lib/module/figma/ProgressCircle.figma.js.map +1 -0
- package/lib/module/figma/RangeCalendar.figma.js +30 -0
- package/lib/module/figma/RangeCalendar.figma.js.map +1 -0
- package/lib/module/figma/Skeleton.figma.js +25 -0
- package/lib/module/figma/Skeleton.figma.js.map +1 -0
- package/lib/module/figma/Slider.Marker.figma.js +17 -0
- package/lib/module/figma/Slider.Marker.figma.js.map +1 -0
- package/lib/module/figma/Slider.MarkerGroup.figma.js +18 -0
- package/lib/module/figma/Slider.MarkerGroup.figma.js.map +1 -0
- package/lib/module/figma/Slider.Thumb.figma.js +18 -0
- package/lib/module/figma/Slider.Thumb.figma.js.map +1 -0
- package/lib/module/figma/Slider.figma.js +63 -0
- package/lib/module/figma/Slider.figma.js.map +1 -0
- package/lib/module/figma/Switch.figma.js +30 -0
- package/lib/module/figma/Switch.figma.js.map +1 -0
- package/lib/module/figma/Tabs.SegmentedControl.Segment.figma.js +28 -0
- package/lib/module/figma/Tabs.SegmentedControl.Segment.figma.js.map +1 -0
- package/lib/module/figma/Tabs.SegmentedControl.figma.js +37 -0
- package/lib/module/figma/Tabs.SegmentedControl.figma.js.map +1 -0
- package/lib/module/figma/Tabs.Tab.figma.js +28 -0
- package/lib/module/figma/Tabs.Tab.figma.js.map +1 -0
- package/lib/module/figma/Tabs.figma.js +33 -0
- package/lib/module/figma/Tabs.figma.js.map +1 -0
- package/lib/module/figma/Tile.Description.figma.js +17 -0
- package/lib/module/figma/Tile.Description.figma.js.map +1 -0
- package/lib/module/figma/Tile.Group.figma.js +39 -0
- package/lib/module/figma/Tile.Group.figma.js.map +1 -0
- package/lib/module/figma/Tile.LeadingSlot.figma.js +17 -0
- package/lib/module/figma/Tile.LeadingSlot.figma.js.map +1 -0
- package/lib/module/figma/Tile.Title.figma.js +17 -0
- package/lib/module/figma/Tile.Title.figma.js.map +1 -0
- package/lib/module/figma/Tile.TrailingSlot.figma.js +17 -0
- package/lib/module/figma/Tile.TrailingSlot.figma.js.map +1 -0
- package/lib/module/figma/Tile.figma.js +51 -0
- package/lib/module/figma/Tile.figma.js.map +1 -0
- package/lib/module/figma/Toast.Button.figma.js +26 -0
- package/lib/module/figma/Toast.Button.figma.js.map +1 -0
- package/lib/module/figma/Toast.Close.figma.js +15 -0
- package/lib/module/figma/Toast.Close.figma.js.map +1 -0
- package/lib/module/figma/Toast.figma.js +75 -0
- package/lib/module/figma/Toast.figma.js.map +1 -0
- package/lib/module/figma/Tooltip.Content.figma.js +24 -0
- package/lib/module/figma/Tooltip.Content.figma.js.map +1 -0
- package/lib/module/figma/Tooltip.figma.js +40 -0
- package/lib/module/figma/Tooltip.figma.js.map +1 -0
- package/lib/module/figma/VirtualizedList.figma.js +25 -0
- package/lib/module/figma/VirtualizedList.figma.js.map +1 -0
- package/lib/typescript/figma/Calendar.figma.d.ts +8 -0
- package/lib/typescript/figma/Calendar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Carousel.NextButton.figma.d.ts +11 -0
- package/lib/typescript/figma/Carousel.NextButton.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Carousel.Pagination.figma.d.ts +11 -0
- package/lib/typescript/figma/Carousel.Pagination.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Carousel.PrevButton.figma.d.ts +11 -0
- package/lib/typescript/figma/Carousel.PrevButton.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Carousel.figma.d.ts +8 -0
- package/lib/typescript/figma/Carousel.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Checkbox.Group.figma.d.ts +8 -0
- package/lib/typescript/figma/Checkbox.Group.figma.d.ts.map +1 -0
- package/lib/typescript/figma/CurrencyInput.figma.d.ts +8 -0
- package/lib/typescript/figma/CurrencyInput.figma.d.ts.map +1 -0
- package/lib/typescript/figma/DateField.figma.d.ts +8 -0
- package/lib/typescript/figma/DateField.figma.d.ts.map +1 -0
- package/lib/typescript/figma/DatePicker.figma.d.ts +8 -0
- package/lib/typescript/figma/DatePicker.figma.d.ts.map +1 -0
- package/lib/typescript/figma/DateRangePicker.figma.d.ts +8 -0
- package/lib/typescript/figma/DateRangePicker.figma.d.ts.map +1 -0
- package/lib/typescript/figma/DateTimeField.figma.d.ts +8 -0
- package/lib/typescript/figma/DateTimeField.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Field.Checkbox.figma.d.ts +8 -0
- package/lib/typescript/figma/Field.Checkbox.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Field.DateField.figma.d.ts +8 -0
- package/lib/typescript/figma/Field.DateField.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Field.DateTimeField.figma.d.ts +8 -0
- package/lib/typescript/figma/Field.DateTimeField.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Image.figma.d.ts +11 -0
- package/lib/typescript/figma/Image.figma.d.ts.map +1 -0
- package/lib/typescript/figma/MonthCalendar.figma.d.ts +8 -0
- package/lib/typescript/figma/MonthCalendar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ProgressBar.figma.d.ts +8 -0
- package/lib/typescript/figma/ProgressBar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/ProgressCircle.figma.d.ts +11 -0
- package/lib/typescript/figma/ProgressCircle.figma.d.ts.map +1 -0
- package/lib/typescript/figma/RangeCalendar.figma.d.ts +8 -0
- package/lib/typescript/figma/RangeCalendar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Skeleton.figma.d.ts +11 -0
- package/lib/typescript/figma/Skeleton.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Slider.Marker.figma.d.ts +11 -0
- package/lib/typescript/figma/Slider.Marker.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Slider.MarkerGroup.figma.d.ts +8 -0
- package/lib/typescript/figma/Slider.MarkerGroup.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Slider.Thumb.figma.d.ts +11 -0
- package/lib/typescript/figma/Slider.Thumb.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Slider.figma.d.ts +8 -0
- package/lib/typescript/figma/Slider.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Switch.figma.d.ts +8 -0
- package/lib/typescript/figma/Switch.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tabs.SegmentedControl.Segment.figma.d.ts +8 -0
- package/lib/typescript/figma/Tabs.SegmentedControl.Segment.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tabs.SegmentedControl.figma.d.ts +8 -0
- package/lib/typescript/figma/Tabs.SegmentedControl.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tabs.Tab.figma.d.ts +8 -0
- package/lib/typescript/figma/Tabs.Tab.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tabs.figma.d.ts +8 -0
- package/lib/typescript/figma/Tabs.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.Description.figma.d.ts +11 -0
- package/lib/typescript/figma/Tile.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.Group.figma.d.ts +8 -0
- package/lib/typescript/figma/Tile.Group.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.LeadingSlot.figma.d.ts +8 -0
- package/lib/typescript/figma/Tile.LeadingSlot.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.Title.figma.d.ts +11 -0
- package/lib/typescript/figma/Tile.Title.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.TrailingSlot.figma.d.ts +8 -0
- package/lib/typescript/figma/Tile.TrailingSlot.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tile.figma.d.ts +8 -0
- package/lib/typescript/figma/Tile.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Toast.Button.figma.d.ts +14 -0
- package/lib/typescript/figma/Toast.Button.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Toast.Close.figma.d.ts +11 -0
- package/lib/typescript/figma/Toast.Close.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Toast.figma.d.ts +8 -0
- package/lib/typescript/figma/Toast.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tooltip.Content.figma.d.ts +8 -0
- package/lib/typescript/figma/Tooltip.Content.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Tooltip.figma.d.ts +8 -0
- package/lib/typescript/figma/Tooltip.figma.d.ts.map +1 -0
- package/lib/typescript/figma/VirtualizedList.figma.d.ts +8 -0
- package/lib/typescript/figma/VirtualizedList.figma.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=308-19827
|
|
4
|
+
// source=packages/components/src/components/Switch/index.tsx
|
|
5
|
+
// component=Switch
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `Platform` is a Figma-only preview axis; the code picks the native or web switch automatically.
|
|
10
|
+
const isChecked = instance.getEnum('isChecked', {
|
|
11
|
+
true: true,
|
|
12
|
+
false: undefined
|
|
13
|
+
});
|
|
14
|
+
const isInvalid = instance.getEnum('isInvalid', {
|
|
15
|
+
true: true,
|
|
16
|
+
false: undefined
|
|
17
|
+
});
|
|
18
|
+
const isDisabled = instance.getEnum('isDisabled', {
|
|
19
|
+
true: true,
|
|
20
|
+
false: undefined
|
|
21
|
+
});
|
|
22
|
+
const isCheckedProp = figma.helpers.react.renderProp('isChecked', isChecked);
|
|
23
|
+
const isInvalidProp = figma.helpers.react.renderProp('isInvalid', isInvalid);
|
|
24
|
+
const isDisabledProp = figma.helpers.react.renderProp('isDisabled', isDisabled);
|
|
25
|
+
export default {
|
|
26
|
+
id: 'switch',
|
|
27
|
+
imports: ["import { Switch } from '@cdx-ui/components'"],
|
|
28
|
+
example: figma.code`<Switch accessibilityLabel="Switch"${isCheckedProp}${isInvalidProp}${isDisabledProp} />`
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Switch.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","isChecked","getEnum","true","false","undefined","isInvalid","isDisabled","isCheckedProp","helpers","react","renderProp","isInvalidProp","isDisabledProp","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Switch.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,SAAS,GAAGF,QAAQ,CAACG,OAAO,CAAC,WAAW,EAAE;EAC9CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEC;AACT,CAAC,CAAC;AACF,MAAMC,SAAS,GAAGP,QAAQ,CAACG,OAAO,CAAC,WAAW,EAAE;EAC9CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEC;AACT,CAAC,CAAC;AACF,MAAME,UAAU,GAAGR,QAAQ,CAACG,OAAO,CAAC,YAAY,EAAE;EAChDC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEC;AACT,CAAC,CAAC;AAEF,MAAMG,aAAa,GAAGV,KAAK,CAACW,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,WAAW,EAAEV,SAAS,CAAC;AAC5E,MAAMW,aAAa,GAAGd,KAAK,CAACW,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,WAAW,EAAEL,SAAS,CAAC;AAC5E,MAAMO,cAAc,GAAGf,KAAK,CAACW,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,YAAY,EAAEJ,UAAU,CAAC;AAE/E,eAAe;EACbO,EAAE,EAAE,QAAQ;EACZC,OAAO,EAAE,CAAC,6CAA6C,CAAC;EACxDC,OAAO,EAAElB,KAAK,CAACmB,IAAI,sCAAsCT,aAAa,GAAGI,aAAa,GAAGC,cAAc;AACzG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8708-771
|
|
4
|
+
// source=packages/components/src/components/Tabs/index.tsx
|
|
5
|
+
// component=Tabs.Tab
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `active` is owned by the parent SegmentedControl (`defaultValue` on `Tabs`).
|
|
10
|
+
const label = instance.findText('{label}').textContent;
|
|
11
|
+
// Must match the value derivation in Tabs.SegmentedControl.figma.ts.
|
|
12
|
+
const value = label.trim().toLowerCase().replace(/\s+/g, '-');
|
|
13
|
+
const showIcon = instance.getEnum('Show Icon?', {
|
|
14
|
+
True: true,
|
|
15
|
+
False: false
|
|
16
|
+
});
|
|
17
|
+
const icon = instance.getInstanceSwap('icon');
|
|
18
|
+
const iconSnippet = showIcon && icon?.type === 'INSTANCE' ? icon.executeTemplate().example : null;
|
|
19
|
+
export default {
|
|
20
|
+
id: 'tabs-segmented-control-segment',
|
|
21
|
+
imports: ["import { Tabs } from '@cdx-ui/components'"],
|
|
22
|
+
example: figma.code`
|
|
23
|
+
<Tabs.Tab value="${value}">
|
|
24
|
+
${iconSnippet}
|
|
25
|
+
<Tabs.TabLabel>${label}</Tabs.TabLabel>
|
|
26
|
+
</Tabs.Tab>`
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=Tabs.SegmentedControl.Segment.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","label","findText","textContent","value","trim","toLowerCase","replace","showIcon","getEnum","True","False","icon","getInstanceSwap","iconSnippet","type","executeTemplate","example","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Tabs.SegmentedControl.Segment.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,KAAK,GAAIF,QAAQ,CAACG,QAAQ,CAAC,SAAS,CAAC,CAAgCC,WAAW;AACtF;AACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;AAE7D,MAAMC,QAAQ,GAAGT,QAAQ,CAACU,OAAO,CAAC,YAAY,EAAE;EAC9CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACT,CAAC,CAAC;AACF,MAAMC,IAAI,GAAGb,QAAQ,CAACc,eAAe,CAAC,MAAM,CAAC;AAC7C,MAAMC,WAAW,GAAGN,QAAQ,IAAII,IAAI,EAAEG,IAAI,KAAK,UAAU,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC,CAACC,OAAO,GAAG,IAAI;AAEjG,eAAe;EACbC,EAAE,EAAE,gCAAgC;EACpCC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDF,OAAO,EAAEnB,KAAK,CAACsB,IAAI;AACrB,mBAAmBhB,KAAK;AACxB,IAAIU,WAAW;AACf,mBAAmBb,KAAK;AACxB;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8708-795
|
|
4
|
+
// source=packages/components/src/components/Tabs/index.tsx
|
|
5
|
+
// component=Tabs
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
const segmentCount = instance.getEnum('segments', {
|
|
9
|
+
'2': 2,
|
|
10
|
+
'3': 3,
|
|
11
|
+
'4': 4,
|
|
12
|
+
'5': 5
|
|
13
|
+
});
|
|
14
|
+
const selected = instance.getEnum('selected', {
|
|
15
|
+
'1': 1,
|
|
16
|
+
'2': 2,
|
|
17
|
+
'3': 3,
|
|
18
|
+
'4': 4,
|
|
19
|
+
'5': 5
|
|
20
|
+
});
|
|
21
|
+
const segmentLayerNames = ['Segment 1', 'Segment 2', 'Segment 3', 'Segment 4', 'Segment 5'].slice(0, segmentCount ?? 2);
|
|
22
|
+
const segments = figma.properties.children(segmentLayerNames);
|
|
23
|
+
const selectedSegment = instance.findInstance(`Segment ${String(selected ?? 1)}`);
|
|
24
|
+
const selectedLabel = selectedSegment.type === 'INSTANCE' ? selectedSegment.findText('{label}').textContent : undefined;
|
|
25
|
+
const defaultValue = selectedLabel?.trim().toLowerCase().replace(/\s+/g, '-');
|
|
26
|
+
const defaultValueProp = figma.helpers.react.renderProp('defaultValue', defaultValue);
|
|
27
|
+
export default {
|
|
28
|
+
id: 'tabs-segmented-control',
|
|
29
|
+
imports: ["import { Tabs } from '@cdx-ui/components'"],
|
|
30
|
+
example: figma.code`
|
|
31
|
+
<Tabs variant="solid"${defaultValueProp}>
|
|
32
|
+
<Tabs.List accessibilityLabel="Segmented control">
|
|
33
|
+
${segments}
|
|
34
|
+
</Tabs.List>
|
|
35
|
+
</Tabs>`
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=Tabs.SegmentedControl.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","segmentCount","getEnum","selected","segmentLayerNames","slice","segments","properties","children","selectedSegment","findInstance","String","selectedLabel","type","findText","textContent","undefined","defaultValue","trim","toLowerCase","replace","defaultValueProp","helpers","react","renderProp","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tabs.SegmentedControl.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;AAEvC,MAAMC,YAAY,GAAGF,QAAQ,CAACG,OAAO,CAAC,UAAU,EAAE;EAChD,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE;AACP,CAAC,CAAC;AACF,MAAMC,QAAQ,GAAGJ,QAAQ,CAACG,OAAO,CAAC,UAAU,EAAE;EAC5C,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE;AACP,CAAC,CAAC;AAEF,MAAME,iBAAiB,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAACC,KAAK,CAC/F,CAAC,EACDJ,YAAY,IAAI,CAClB,CAAC;AACD,MAAMK,QAAQ,GAAGR,KAAK,CAACS,UAAU,CAACC,QAAQ,CAACJ,iBAAiB,CAAC;AAE7D,MAAMK,eAAe,GAAGV,QAAQ,CAACW,YAAY,CAAC,WAAWC,MAAM,CAACR,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC;AACjF,MAAMS,aAAa,GACjBH,eAAe,CAACI,IAAI,KAAK,UAAU,GAC9BJ,eAAe,CAACK,QAAQ,CAAC,SAAS,CAAC,CAAgCC,WAAW,GAC/EC,SAAS;AACf,MAAMC,YAAY,GAAGL,aAAa,EAAEM,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;AAC7E,MAAMC,gBAAgB,GAAGvB,KAAK,CAACwB,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,cAAc,EAAEP,YAAY,CAAC;AAErF,eAAe;EACbQ,EAAE,EAAE,wBAAwB;EAC5BC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAE7B,KAAK,CAAC8B,IAAI;AACrB,uBAAuBP,gBAAgB;AACvC;AACA,MAAMf,QAAQ;AACd;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=10146-4255
|
|
4
|
+
// source=packages/components/src/components/Tabs/index.tsx
|
|
5
|
+
// component=Tabs.Tab
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `active` is owned by the parent `Tabs` (`defaultValue`); `orientation` is inherited from it.
|
|
10
|
+
const label = instance.findText('Tabs.TabLabel').textContent;
|
|
11
|
+
// Must match the value derivation in Tabs.figma.ts so the parent's defaultValue selects this tab.
|
|
12
|
+
const value = label.trim().toLowerCase().replace(/\s+/g, '-');
|
|
13
|
+
const showIcon = instance.getEnum('Show Icon?', {
|
|
14
|
+
True: true,
|
|
15
|
+
False: false
|
|
16
|
+
});
|
|
17
|
+
const icon = instance.getInstanceSwap('icon');
|
|
18
|
+
const iconSnippet = showIcon && icon?.type === 'INSTANCE' ? icon.executeTemplate().example : null;
|
|
19
|
+
export default {
|
|
20
|
+
id: 'tabs-tab',
|
|
21
|
+
imports: ["import { Tabs } from '@cdx-ui/components'"],
|
|
22
|
+
example: figma.code`
|
|
23
|
+
<Tabs.Tab value="${value}">
|
|
24
|
+
${iconSnippet}
|
|
25
|
+
<Tabs.TabLabel>${label}</Tabs.TabLabel>
|
|
26
|
+
</Tabs.Tab>`
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=Tabs.Tab.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","label","findText","textContent","value","trim","toLowerCase","replace","showIcon","getEnum","True","False","icon","getInstanceSwap","iconSnippet","type","executeTemplate","example","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Tabs.Tab.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,KAAK,GAAIF,QAAQ,CAACG,QAAQ,CAAC,eAAe,CAAC,CAAgCC,WAAW;AAC5F;AACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;AAE7D,MAAMC,QAAQ,GAAGT,QAAQ,CAACU,OAAO,CAAC,YAAY,EAAE;EAC9CC,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE;AACT,CAAC,CAAC;AACF,MAAMC,IAAI,GAAGb,QAAQ,CAACc,eAAe,CAAC,MAAM,CAAC;AAC7C,MAAMC,WAAW,GAAGN,QAAQ,IAAII,IAAI,EAAEG,IAAI,KAAK,UAAU,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC,CAACC,OAAO,GAAG,IAAI;AAEjG,eAAe;EACbC,EAAE,EAAE,UAAU;EACdC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDF,OAAO,EAAEnB,KAAK,CAACsB,IAAI;AACrB,mBAAmBhB,KAAK;AACxB,IAAIU,WAAW;AACf,mBAAmBb,KAAK;AACxB;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=10266-3192
|
|
4
|
+
// source=packages/components/src/components/Tabs/index.tsx
|
|
5
|
+
// component=Tabs
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// The Figma Tabs component is the line-indicator style (`variant="outline"`); the filled style is
|
|
10
|
+
// the separate SegmentedControl component (see Tabs.SegmentedControl.figma.ts).
|
|
11
|
+
// Figma `width=fixed` (equal-width tabs) has no code prop, so `width` is not mapped.
|
|
12
|
+
const orientation = instance.getEnum('orientation', {
|
|
13
|
+
horizontal: undefined,
|
|
14
|
+
vertical: 'vertical'
|
|
15
|
+
});
|
|
16
|
+
const orientationProp = figma.helpers.react.renderProp('orientation', orientation);
|
|
17
|
+
const activeTab = instance.findConnectedInstances(node => node.getPropertyValue('active') === 'true').find(node => node.type === 'INSTANCE');
|
|
18
|
+
const activeLabel = activeTab?.type === 'INSTANCE' ? activeTab.findText('Tabs.TabLabel').textContent : undefined;
|
|
19
|
+
const defaultValue = activeLabel?.trim().toLowerCase().replace(/\s+/g, '-');
|
|
20
|
+
const defaultValueProp = figma.helpers.react.renderProp('defaultValue', defaultValue);
|
|
21
|
+
const listSlot = instance.getSlot('Tabs.List');
|
|
22
|
+
const listChildren = listSlot ? figma.helpers.react.renderChildren(listSlot) : null;
|
|
23
|
+
export default {
|
|
24
|
+
id: 'tabs',
|
|
25
|
+
imports: ["import { Tabs } from '@cdx-ui/components'"],
|
|
26
|
+
example: figma.code`
|
|
27
|
+
<Tabs variant="outline"${defaultValueProp}${orientationProp}>
|
|
28
|
+
<Tabs.List accessibilityLabel="Tabs">
|
|
29
|
+
${listChildren}
|
|
30
|
+
</Tabs.List>
|
|
31
|
+
</Tabs>`
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=Tabs.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","orientation","getEnum","horizontal","undefined","vertical","orientationProp","helpers","react","renderProp","activeTab","findConnectedInstances","node","getPropertyValue","find","type","activeLabel","findText","textContent","defaultValue","trim","toLowerCase","replace","defaultValueProp","listSlot","getSlot","listChildren","renderChildren","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tabs.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA;AACA;AACA,MAAMC,WAAW,GAAGF,QAAQ,CAACG,OAAO,CAAC,aAAa,EAAE;EAClDC,UAAU,EAAEC,SAAS;EACrBC,QAAQ,EAAE;AACZ,CAAC,CAAC;AACF,MAAMC,eAAe,GAAGR,KAAK,CAACS,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,aAAa,EAAER,WAAW,CAAC;AAElF,MAAMS,SAAS,GAAGX,QAAQ,CACvBY,sBAAsB,CAAEC,IAAI,IAAKA,IAAI,CAACC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,CAC5EC,IAAI,CAAEF,IAAI,IAAKA,IAAI,CAACG,IAAI,KAAK,UAAU,CAAC;AAC3C,MAAMC,WAAW,GACfN,SAAS,EAAEK,IAAI,KAAK,UAAU,GACzBL,SAAS,CAACO,QAAQ,CAAC,eAAe,CAAC,CAAgCC,WAAW,GAC/Ed,SAAS;AACf,MAAMe,YAAY,GAAGH,WAAW,EAAEI,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;AAC3E,MAAMC,gBAAgB,GAAGzB,KAAK,CAACS,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,cAAc,EAAEU,YAAY,CAAC;AAErF,MAAMK,QAAQ,GAAGzB,QAAQ,CAAC0B,OAAO,CAAC,WAAW,CAAC;AAC9C,MAAMC,YAAY,GAAGF,QAAQ,GAAG1B,KAAK,CAACS,OAAO,CAACC,KAAK,CAACmB,cAAc,CAACH,QAAQ,CAAC,GAAG,IAAI;AAEnF,eAAe;EACbI,EAAE,EAAE,MAAM;EACVC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAEhC,KAAK,CAACiC,IAAI;AACrB,yBAAyBR,gBAAgB,GAAGjB,eAAe;AAC3D;AACA,MAAMoB,YAAY;AAClB;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8820-6260
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile.Description
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
const description = instance.findText('{description}').textContent;
|
|
9
|
+
export default {
|
|
10
|
+
id: 'tile-description',
|
|
11
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
12
|
+
example: figma.code`<Tile.Description>${description}</Tile.Description>`,
|
|
13
|
+
metadata: {
|
|
14
|
+
nestable: true
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Tile.Description.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","description","findText","textContent","id","imports","example","code","metadata","nestable"],"sourceRoot":"../../../src","sources":["figma/Tile.Description.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;AAEvC,MAAMC,WAAW,GAAIF,QAAQ,CAACG,QAAQ,CAAC,eAAe,CAAC,CAAgCC,WAAW;AAElG,eAAe;EACbC,EAAE,EAAE,kBAAkB;EACtBC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAER,KAAK,CAACS,IAAI,qBAAqBN,WAAW,qBAAqB;EACxEO,QAAQ,EAAE;IAAEC,QAAQ,EAAE;EAAK;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8856-11176
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile.Group
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
const direction = instance.getEnum('direction', {
|
|
9
|
+
column: undefined,
|
|
10
|
+
row: 'row'
|
|
11
|
+
});
|
|
12
|
+
const spacing = instance.getEnum('spacing', {
|
|
13
|
+
default: undefined,
|
|
14
|
+
none: 'none'
|
|
15
|
+
});
|
|
16
|
+
const directionProp = figma.helpers.react.renderProp('direction', direction);
|
|
17
|
+
const spacingProp = figma.helpers.react.renderProp('spacing', spacing);
|
|
18
|
+
|
|
19
|
+
// Figma Tile.Group has no selection-mode property; the required `type` comes from the child tiles.
|
|
20
|
+
const tiles = instance.findConnectedInstances(node => {
|
|
21
|
+
const tileType = node.getPropertyValue('type');
|
|
22
|
+
return tileType === 'single' || tileType === 'multiple';
|
|
23
|
+
}).filter(node => node.type === 'INSTANCE');
|
|
24
|
+
const type = tiles[0]?.getPropertyValue('type') === 'multiple' ? 'multiple' : 'single';
|
|
25
|
+
const selectedValues = tiles.filter(tile => tile.getPropertyValue('isSelected') === 'true').map(tile => tile.findText('{title}', {
|
|
26
|
+
traverseInstances: true
|
|
27
|
+
}).textContent.trim().toLowerCase().replace(/\s+/g, '-'));
|
|
28
|
+
const defaultValueProp = type === 'multiple' ? figma.helpers.react.renderProp('defaultValue', selectedValues.length > 0 ? figma.helpers.react.array(selectedValues) : undefined) : figma.helpers.react.renderProp('defaultValue', selectedValues[0]);
|
|
29
|
+
const itemsSlot = instance.getSlot('items');
|
|
30
|
+
const itemsChildren = itemsSlot ? figma.helpers.react.renderChildren(itemsSlot) : null;
|
|
31
|
+
export default {
|
|
32
|
+
id: 'tile-group',
|
|
33
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
34
|
+
example: figma.code`
|
|
35
|
+
<Tile.Group type="${type}" aria-label="Options"${defaultValueProp}${directionProp}${spacingProp}>
|
|
36
|
+
${itemsChildren}
|
|
37
|
+
</Tile.Group>`
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=Tile.Group.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","direction","getEnum","column","undefined","row","spacing","default","none","directionProp","helpers","react","renderProp","spacingProp","tiles","findConnectedInstances","node","tileType","getPropertyValue","filter","type","selectedValues","tile","map","findText","traverseInstances","textContent","trim","toLowerCase","replace","defaultValueProp","length","array","itemsSlot","getSlot","itemsChildren","renderChildren","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tile.Group.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;AAEvC,MAAMC,SAAS,GAAGF,QAAQ,CAACG,OAAO,CAAC,WAAW,EAA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CAACC,UAAU,CAC5B,cAAc,EACdS,cAAc,CAACU,MAAM,GAAG,CAAC,GAAGjC,KAAK,CAACY,OAAO,CAACC,KAAK,CAACqB,KAAK,CAACX,cAAc,CAAC,GAAGjB,SAC1E,CAAC,GACDN,KAAK,CAACY,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,cAAc,EAAES,cAAc,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAMY,SAAS,GAAGlC,QAAQ,CAACmC,OAAO,CAAC,OAAO,CAAC;AAC3C,MAAMC,aAAa,GAAGF,SAAS,GAAGnC,KAAK,CAACY,OAAO,CAACC,KAAK,CAACyB,cAAc,CAACH,SAAS,CAAC,GAAG,IAAI;AAEtF,eAAe;EACbI,EAAE,EAAE,YAAY;EAChBC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAEzC,KAAK,CAAC0C,IAAI;AACrB,oBAAoBpB,IAAI,yBAAyBU,gBAAgB,GAAGrB,aAAa,GAAGI,WAAW;AAC/F,IAAIsB,aAAa;AACjB;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8820-6202
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile.LeadingSlot
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// Figma `direction` only arranges placeholder content; Tile.LeadingSlot has no direction prop.
|
|
10
|
+
const childrenSlot = instance.getSlot('children');
|
|
11
|
+
const children = childrenSlot ? figma.helpers.react.renderChildren(childrenSlot) : null;
|
|
12
|
+
export default {
|
|
13
|
+
id: 'tile-leading-slot',
|
|
14
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
15
|
+
example: figma.code`<Tile.LeadingSlot>${children}</Tile.LeadingSlot>`
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Tile.LeadingSlot.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","childrenSlot","getSlot","children","helpers","react","renderChildren","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tile.LeadingSlot.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,YAAY,GAAGF,QAAQ,CAACG,OAAO,CAAC,UAAU,CAAC;AACjD,MAAMC,QAAQ,GAAGF,YAAY,GAAGH,KAAK,CAACM,OAAO,CAACC,KAAK,CAACC,cAAc,CAACL,YAAY,CAAC,GAAG,IAAI;AAEvF,eAAe;EACbM,EAAE,EAAE,mBAAmB;EACvBC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAEX,KAAK,CAACY,IAAI,qBAAqBP,QAAQ;AAClD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8820-6257
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile.Title
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
const title = instance.findText('{title}').textContent;
|
|
9
|
+
export default {
|
|
10
|
+
id: 'tile-title',
|
|
11
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
12
|
+
example: figma.code`<Tile.Title>${title}</Tile.Title>`,
|
|
13
|
+
metadata: {
|
|
14
|
+
nestable: true
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Tile.Title.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","title","findText","textContent","id","imports","example","code","metadata","nestable"],"sourceRoot":"../../../src","sources":["figma/Tile.Title.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;AAEvC,MAAMC,KAAK,GAAIF,QAAQ,CAACG,QAAQ,CAAC,SAAS,CAAC,CAAgCC,WAAW;AAEtF,eAAe;EACbC,EAAE,EAAE,YAAY;EAChBC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAER,KAAK,CAACS,IAAI,eAAeN,KAAK,eAAe;EACtDO,QAAQ,EAAE;IAAEC,QAAQ,EAAE;EAAK;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8820-6209
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile.TrailingSlot
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// Figma `direction` only arranges placeholder content; Tile.TrailingSlot has no direction prop.
|
|
10
|
+
const childrenSlot = instance.getSlot('children');
|
|
11
|
+
const children = childrenSlot ? figma.helpers.react.renderChildren(childrenSlot) : null;
|
|
12
|
+
export default {
|
|
13
|
+
id: 'tile-trailing-slot',
|
|
14
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
15
|
+
example: figma.code`<Tile.TrailingSlot>${children}</Tile.TrailingSlot>`
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Tile.TrailingSlot.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","childrenSlot","getSlot","children","helpers","react","renderChildren","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tile.TrailingSlot.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,YAAY,GAAGF,QAAQ,CAACG,OAAO,CAAC,UAAU,CAAC;AACjD,MAAMC,QAAQ,GAAGF,YAAY,GAAGH,KAAK,CAACM,OAAO,CAACC,KAAK,CAACC,cAAc,CAACL,YAAY,CAAC,GAAG,IAAI;AAEvF,eAAe;EACbM,EAAE,EAAE,oBAAoB;EACxBC,OAAO,EAAE,CAAC,2CAA2C,CAAC;EACtDC,OAAO,EAAEX,KAAK,CAACY,IAAI,sBAAsBP,QAAQ;AACnD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=8843-7101
|
|
4
|
+
// source=packages/components/src/components/Tile/index.tsx
|
|
5
|
+
// component=Tile
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// Inside a Tile.Group the indicator style is inferred from the group's `type`; standalone tiles
|
|
10
|
+
// default to a checkbox indicator, so only the radio (`single`) style needs to be explicit.
|
|
11
|
+
const indicatorType = instance.getEnum('type', {
|
|
12
|
+
single: 'radio',
|
|
13
|
+
multiple: undefined
|
|
14
|
+
});
|
|
15
|
+
const isSelected = instance.getEnum('isSelected', {
|
|
16
|
+
true: true,
|
|
17
|
+
false: undefined
|
|
18
|
+
});
|
|
19
|
+
const isDisabled = instance.getEnum('isDisabled', {
|
|
20
|
+
true: true,
|
|
21
|
+
false: undefined
|
|
22
|
+
});
|
|
23
|
+
const isSelectedProp = figma.helpers.react.renderProp('isSelected', isSelected);
|
|
24
|
+
const disabledProp = figma.helpers.react.renderProp('disabled', isDisabled);
|
|
25
|
+
const indicatorTypeProp = figma.helpers.react.renderProp('indicatorType', indicatorType);
|
|
26
|
+
const showLeadingSlot = instance.getBoolean('Show LeadingSlot?');
|
|
27
|
+
const showTrailingSlot = instance.getBoolean('Show TrailingSlot?');
|
|
28
|
+
const showIndicator = instance.getBoolean('Show Indicator?');
|
|
29
|
+
const title = instance.findText('{title}', {
|
|
30
|
+
traverseInstances: true
|
|
31
|
+
}).textContent;
|
|
32
|
+
// Must match the value derivation in Tile.Group.figma.ts so the group's defaultValue selects this tile.
|
|
33
|
+
const value = title.trim().toLowerCase().replace(/\s+/g, '-');
|
|
34
|
+
const leadingInstance = instance.findInstance('Tile.LeadingSlot');
|
|
35
|
+
const leadingSnippet = showLeadingSlot && leadingInstance.type === 'INSTANCE' ? leadingInstance.executeTemplate().example : null;
|
|
36
|
+
const trailingInstance = instance.findInstance('Tile.TrailingSlot');
|
|
37
|
+
const trailingSnippet = showTrailingSlot && trailingInstance.type === 'INSTANCE' ? trailingInstance.executeTemplate().example : null;
|
|
38
|
+
const contentSlot = instance.getSlot('Tile.Content');
|
|
39
|
+
const contentChildren = contentSlot ? figma.helpers.react.renderChildren(contentSlot) : null;
|
|
40
|
+
export default {
|
|
41
|
+
id: 'tile',
|
|
42
|
+
imports: ["import { Tile } from '@cdx-ui/components'"],
|
|
43
|
+
example: figma.code`
|
|
44
|
+
<Tile value="${value}"${isSelectedProp}${disabledProp}>
|
|
45
|
+
${leadingSnippet}
|
|
46
|
+
<Tile.Content>${contentChildren}</Tile.Content>
|
|
47
|
+
${trailingSnippet}
|
|
48
|
+
${showIndicator ? figma.code`<Tile.Indicator${indicatorTypeProp} />` : null}
|
|
49
|
+
</Tile>`
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=Tile.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","indicatorType","getEnum","single","multiple","undefined","isSelected","true","false","isDisabled","isSelectedProp","helpers","react","renderProp","disabledProp","indicatorTypeProp","showLeadingSlot","getBoolean","showTrailingSlot","showIndicator","title","findText","traverseInstances","textContent","value","trim","toLowerCase","replace","leadingInstance","findInstance","leadingSnippet","type","executeTemplate","example","trailingInstance","trailingSnippet","contentSlot","getSlot","contentChildren","renderChildren","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Tile.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA;AACA,MAAMC,aAAa,GAAGF,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE;EAC7CC,MAAM,EAAE,OAAO;EACfC,QAAQ,EAAEC;AACZ,CAAC,CAAC;AACF,MAAMC,UAAU,GAAGP,QAAQ,CAACG,OAAO,CAAC,YAAY,EAAE;EAChDK,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEH;AACT,CAAC,CAAC;AACF,MAAMI,UAAU,GAAGV,QAAQ,CAACG,OAAO,CAAC,YAAY,EAAE;EAChDK,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEH;AACT,CAAC,CAAC;AAEF,MAAMK,cAAc,GAAGZ,KAAK,CAACa,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,YAAY,EAAEP,UAAU,CAAC;AAC/E,MAAMQ,YAAY,GAAGhB,KAAK,CAACa,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,UAAU,EAAEJ,UAAU,CAAC;AAC3E,MAAMM,iBAAiB,GAAGjB,KAAK,CAACa,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,eAAe,EAAEZ,aAAa,CAAC;AAExF,MAAMe,eAAe,GAAGjB,QAAQ,CAACkB,UAAU,CAAC,mBAAmB,CAAC;AAChE,MAAMC,gBAAgB,GAAGnB,QAAQ,CAACkB,UAAU,CAAC,oBAAoB,CAAC;AAClE,MAAME,a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oreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=12772-30603
|
|
4
|
+
// source=packages/components/src/components/Toast/index.tsx
|
|
5
|
+
// component=Toast.Action
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// Toast.Action wraps its string children in Button.Label and derives the button color from the
|
|
10
|
+
// toast, so only the label carries over from the nested Figma Button.
|
|
11
|
+
const label = instance.findText('Button.Label', {
|
|
12
|
+
traverseInstances: true
|
|
13
|
+
}).textContent;
|
|
14
|
+
export default {
|
|
15
|
+
id: 'toast-button',
|
|
16
|
+
imports: ["import { Toast } from '@cdx-ui/components'"],
|
|
17
|
+
example: figma.code`<Toast.Action onPress={() => {}}>${label}</Toast.Action>`,
|
|
18
|
+
// `label` lets the parent Toast template emit `actionLabel` in the `toast.show()` config form.
|
|
19
|
+
metadata: {
|
|
20
|
+
nestable: true,
|
|
21
|
+
props: {
|
|
22
|
+
label
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=Toast.Button.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","label","findText","traverseInstances","textContent","id","imports","example","code","metadata","nestable","props"],"sourceRoot":"../../../src","sources":["figma/Toast.Button.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA;AACA,MAAMC,KAAK,GACTF,QAAQ,CAACG,QAAQ,CAAC,cAAc,EAAE;EAAEC,iBAAiB,EAAE;AAAK,CAAC,CAAC,CAC9DC,WAAW;AAEb,eAAe;EACbC,EAAE,EAAE,cAAc;EAClBC,OAAO,EAAE,CAAC,4CAA4C,CAAC;EACvDC,OAAO,EAAET,KAAK,CAACU,IAAI,oCAAoCP,KAAK,iBAAiB;EAC7E;EACAQ,QAAQ,EAAE;IAAEC,QAAQ,EAAE,IAAI;IAAEC,KAAK,EAAE;MAAEV;IAAM;EAAE;AAC/C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=5437-4322
|
|
4
|
+
// source=packages/components/src/components/Toast/index.tsx
|
|
5
|
+
// component=Toast.Close
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
export default {
|
|
8
|
+
id: 'toast-close',
|
|
9
|
+
imports: ["import { Toast } from '@cdx-ui/components'"],
|
|
10
|
+
example: figma.code`<Toast.Close />`,
|
|
11
|
+
metadata: {
|
|
12
|
+
nestable: true
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=Toast.Close.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","id","imports","example","code","metadata","nestable"],"sourceRoot":"../../../src","sources":["figma/Toast.Close.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,eAAe;EACbC,EAAE,EAAE,aAAa;EACjBC,OAAO,EAAE,CAAC,4CAA4C,CAAC;EACvDC,OAAO,EAAEH,KAAK,CAACI,IAAI,iBAAiB;EACpCC,QAAQ,EAAE;IAAEC,QAAQ,EAAE;EAAK;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=5170-8043
|
|
4
|
+
// source=packages/components/src/components/Toast/index.tsx
|
|
5
|
+
// component=Toast
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `Viewport` previews the responsive width only; the toast provider handles layout per platform.
|
|
10
|
+
const color = instance.getEnum('severity', {
|
|
11
|
+
neutral: undefined,
|
|
12
|
+
danger: 'danger',
|
|
13
|
+
warning: 'warning',
|
|
14
|
+
success: 'success',
|
|
15
|
+
info: 'info'
|
|
16
|
+
});
|
|
17
|
+
const showIcon = instance.getBoolean('Show Icon?');
|
|
18
|
+
const showTitle = instance.getBoolean('Show Title?');
|
|
19
|
+
const showTrailingSlot = instance.getBoolean('Show TrailingSlot?');
|
|
20
|
+
const icon = instance.getInstanceSwap('icon');
|
|
21
|
+
const iconResult = showIcon && icon?.type === 'INSTANCE' ? icon.executeTemplate() : undefined;
|
|
22
|
+
const iconName = iconResult?.metadata?.props?.componentName;
|
|
23
|
+
const iconSnippet = iconName ?? iconResult?.example;
|
|
24
|
+
const title = instance.findText('Toast.Title').textContent;
|
|
25
|
+
const description = instance.findText('Toast.Description').textContent;
|
|
26
|
+
const trailingSlot = instance.getSlot('Toast.TrailingSlot');
|
|
27
|
+
const trailingChildren = showTrailingSlot && trailingSlot ? figma.helpers.react.renderChildren(trailingSlot) : null;
|
|
28
|
+
const iconSymbolId = icon?.type === 'INSTANCE' ? icon.symbolId : undefined;
|
|
29
|
+
const trailingInstances = showTrailingSlot ? instance.findConnectedInstances(node => node.hasCodeConnect() && node.symbolId !== iconSymbolId).filter(node => node.type === 'INSTANCE') : [];
|
|
30
|
+
const actionButtons = trailingInstances.filter(node => node.codeConnectId() === 'toast-button');
|
|
31
|
+
const actionLabel = actionButtons.length === 1 ? actionButtons[0].executeTemplate().metadata?.props?.label : undefined;
|
|
32
|
+
|
|
33
|
+
// The `toast.show()` config form renders at most one action and no close button, and its `icon`
|
|
34
|
+
// option takes a component reference, so anything else in the design needs the `component` form.
|
|
35
|
+
// Unconnected layers in the trailing slot are invisible to `findConnectedInstances`.
|
|
36
|
+
const isIconExpressible = !showIcon || !iconResult || iconName !== undefined;
|
|
37
|
+
const isTrailingExpressible = !showTrailingSlot || trailingInstances.length === 0 || trailingInstances.length === 1 && actionLabel !== undefined;
|
|
38
|
+
const useConfigForm = isIconExpressible && isTrailingExpressible;
|
|
39
|
+
const quote = text => {
|
|
40
|
+
const escaped = text.replace(/\\/g, '\\\\');
|
|
41
|
+
if (!escaped.includes("'")) return `'${escaped}'`;
|
|
42
|
+
if (!escaped.includes('"')) return `"${escaped}"`;
|
|
43
|
+
return `'${escaped.replace(/'/g, "\\'")}'`;
|
|
44
|
+
};
|
|
45
|
+
const iconImports = iconName ? [`import { ${iconName} } from '@cdx-ui/icons'`] : [];
|
|
46
|
+
const colorOption = color ? figma.code`\n color: '${color}',` : null;
|
|
47
|
+
const iconOption = iconName ? figma.code`\n icon: ${iconName},` : null;
|
|
48
|
+
const labelOption = showTitle ? figma.code`\n label: ${quote(title)},` : null;
|
|
49
|
+
const actionOptions = showTrailingSlot && actionLabel !== undefined ? figma.code`\n actionLabel: ${quote(actionLabel)},\n onActionPress: ({ hide }) => hide(),` : null;
|
|
50
|
+
const configExample = figma.code`
|
|
51
|
+
const { toast } = useToast();
|
|
52
|
+
|
|
53
|
+
toast.show({${colorOption}${iconOption}${labelOption}
|
|
54
|
+
description: ${quote(description)},${actionOptions}
|
|
55
|
+
});`;
|
|
56
|
+
const colorProp = figma.helpers.react.renderProp('color', color);
|
|
57
|
+
const componentExample = figma.code`
|
|
58
|
+
const { toast } = useToast();
|
|
59
|
+
|
|
60
|
+
toast.show({
|
|
61
|
+
component: (props) => (
|
|
62
|
+
<Toast {...props}${colorProp}>
|
|
63
|
+
${iconSnippet ? figma.code`<Toast.Icon as={${iconSnippet}} />` : null}
|
|
64
|
+
${showTitle ? figma.code`<Toast.Title>${title}</Toast.Title>` : null}
|
|
65
|
+
<Toast.Description>${description}</Toast.Description>
|
|
66
|
+
${trailingChildren}
|
|
67
|
+
</Toast>
|
|
68
|
+
),
|
|
69
|
+
});`;
|
|
70
|
+
export default {
|
|
71
|
+
id: 'toast',
|
|
72
|
+
imports: useConfigForm ? ["import { useToast } from '@cdx-ui/components'", ...iconImports] : ["import { Toast, useToast } from '@cdx-ui/components'", ...iconImports],
|
|
73
|
+
example: useConfigForm ? configExample : componentExample
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=Toast.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","color","getEnum","neutral","undefined","danger","warning","success","info","showIcon","getBoolean","showTitle","showTrailingSlot","icon","getInstanceSwap","iconResult","type","executeTemplate","iconName","metadata","props","componentName","iconSnippet","example","title","findText","textContent","description","trailingSlot","getSlot","trailingChildren","helpers","react","renderChildren","iconSymbolId","symbolId","trailingInstances","findConnectedInstances","node","hasCodeConnect","filter","actionButtons","codeConnectId","actionLabel","length","label","isIconExpressible","isTrailingExpressible","useConfigForm","quote","text","escaped","replace","includes","iconImports","colorOption","code","iconOption","labelOption","actionOptions","configExample","colorProp","renderProp","componentExample","id","imports"],"sourceRoot":"../../../src","sources":["figma/Toast.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,KAAK,GAAGF,QAAQ,CAACG,OAAO,CAAC,UAAU,EAAE;EACzCC,OAAO,EAAEC,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE;AACR,CAAC,CAAC;AAEF,MAAMC,QAAQ,GAAGV,QAAQ,CAACW,UAAU,CAAC,YAAY,CAAC;AAClD,MAAMC,SAAS,GAAGZ,QAAQ,CAACW,UAAU,CAAC,aAAa,CAAC;AACpD,MAAME,gBAAgB,GAAGb,QAAQ,CAACW,UAAU,CAAC,oBAAoB,CAAC;AAElE,MA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AKvC,SAAS,GACzCN,KAAK,CAAC0D,IAAI,oBAAoBP,KAAK,CAACN,WAAW,CAAC,2CAA2C,GAC3F,IAAI;AAEV,MAAMiB,aAAa,GAAG9D,KAAK,CAAC0D,IAAI;AAChC;AACA;AACA,cAAcD,WAAW,GAAGE,UAAU,GAAGC,WAAW;AACpD,iBAAiBT,KAAK,CAACtB,WAAW,CAAC,IAAIgC,aAAa;AACpD,IAAI;AAEJ,MAAME,SAAS,GAAG/D,KAAK,CAACiC,OAAO,CAACC,KAAK,CAAC8B,UAAU,CAAC,OAAO,EAAE7D,KAAK,CAAC;AAEhE,MAAM8D,gBAAgB,GAAGjE,KAAK,CAAC0D,IAAI;AACnC;AACA;AACA;AACA;AACA,uBAAuBK,SAAS;AAChC,QAAQvC,WAAW,GAAGxB,KAAK,CAAC0D,IAAI,mBAAmBlC,WAAW,MAAM,GAAG,IAAI;AAC3E,QAAQX,SAAS,GAAGb,KAAK,CAAC0D,IAAI,gBAAgBhC,KAAK,gBAAgB,GAAG,IAAI;AAC1E,2BAA2BG,WAAW;AACtC,QAAQG,gBAAgB;AACxB;AACA;AACA,IAAI;AAEJ,eAAe;EACbkC,EAAE,EAAE,OAAO;EACXC,OAAO,EAAEjB,aAAa,GAClB,CAAC,+CAA+C,EAAE,GAAGM,WAAW,CAAC,GACjE,CAAC,sDAAsD,EAAE,GAAGA,WAAW,CAAC;EAC5E/B,OAAO,EAAEyB,aAAa,GAAGY,aAAa,GAAGG;AAC3C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=12980-8437
|
|
4
|
+
// source=packages/components/src/components/Tooltip/index.tsx
|
|
5
|
+
// component=Tooltip.Content
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `placement` is set on the parent Tooltip in code (see Tooltip.figma.ts); the content only
|
|
10
|
+
// mirrors it in Figma so the arrow points the right way.
|
|
11
|
+
const showArrow = instance.getBoolean('Show Arrow?');
|
|
12
|
+
const textLayer = instance.findText('{text}');
|
|
13
|
+
const contentSlot = instance.getSlot('content');
|
|
14
|
+
const children = textLayer.type === 'TEXT' ? textLayer.textContent : contentSlot ? figma.helpers.react.renderChildren(contentSlot) : null;
|
|
15
|
+
export default {
|
|
16
|
+
id: 'tooltip-content',
|
|
17
|
+
imports: ["import { Tooltip } from '@cdx-ui/components'"],
|
|
18
|
+
example: figma.code`
|
|
19
|
+
<Tooltip.Content>
|
|
20
|
+
${showArrow ? figma.code`<Tooltip.Arrow />` : null}
|
|
21
|
+
${children}
|
|
22
|
+
</Tooltip.Content>`
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Tooltip.Content.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","showArrow","getBoolean","textLayer","findText","contentSlot","getSlot","children","type","textContent","helpers","react","renderChildren","id","imports","example","code"],"sourceRoot":"../../../src","sources":["figma/Tooltip.Content.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA;AACA,MAAMC,SAAS,GAAGF,QAAQ,CAACG,UAAU,CAAC,aAAa,CAAC;AAEpD,MAAMC,SAAS,GAAGJ,QAAQ,CAACK,QAAQ,CAAC,QAAQ,CAAC;AAC7C,MAAMC,WAAW,GAAGN,QAAQ,CAACO,OAAO,CAAC,SAAS,CAAC;AAC/C,MAAMC,QAAQ,GACZJ,SAAS,CAACK,IAAI,KAAK,MAAM,GACrBL,SAAS,CAACM,WAAW,GACrBJ,WAAW,GACTP,KAAK,CAACY,OAAO,CAACC,KAAK,CAACC,cAAc,CAACP,WAAW,CAAC,GAC/C,IAAI;AAEZ,eAAe;EACbQ,EAAE,EAAE,iBAAiB;EACrBC,OAAO,EAAE,CAAC,8CAA8C,CAAC;EACzDC,OAAO,EAAEjB,KAAK,CAACkB,IAAI;AACrB;AACA,IAAIf,SAAS,GAAGH,KAAK,CAACkB,IAAI,mBAAmB,GAAG,IAAI;AACpD,IAAIT,QAAQ;AACZ;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=12996-1099
|
|
4
|
+
// source=packages/components/src/components/Tooltip/index.tsx
|
|
5
|
+
// component=Tooltip
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
|
|
9
|
+
// `isOpen` only previews the open state in Figma; the tooltip opens from its trigger at runtime.
|
|
10
|
+
const placement = instance.getEnum('placement', {
|
|
11
|
+
top: undefined,
|
|
12
|
+
'top-start': 'top-start',
|
|
13
|
+
'top-end': 'top-end',
|
|
14
|
+
bottom: 'bottom',
|
|
15
|
+
'bottom-start': 'bottom-start',
|
|
16
|
+
'bottom-end': 'bottom-end',
|
|
17
|
+
left: 'left',
|
|
18
|
+
'left-start': 'left-start',
|
|
19
|
+
'left-end': 'left-end',
|
|
20
|
+
right: 'right',
|
|
21
|
+
'right-start': 'right-start',
|
|
22
|
+
'right-end': 'right-end'
|
|
23
|
+
});
|
|
24
|
+
const placementProp = figma.helpers.react.renderProp('placement', placement);
|
|
25
|
+
const trigger = instance.getInstanceSwap('Instance');
|
|
26
|
+
const triggerSnippet = trigger?.type === 'INSTANCE' ? trigger.executeTemplate().example : null;
|
|
27
|
+
const content = instance.findInstance('Tooltip.Content');
|
|
28
|
+
const contentSnippet = content.type === 'INSTANCE' ? content.executeTemplate().example : null;
|
|
29
|
+
export default {
|
|
30
|
+
id: 'tooltip',
|
|
31
|
+
imports: ["import { Tooltip } from '@cdx-ui/components'"],
|
|
32
|
+
example: figma.code`
|
|
33
|
+
<Tooltip${placementProp}>
|
|
34
|
+
<Tooltip.Trigger asChild>
|
|
35
|
+
${triggerSnippet}
|
|
36
|
+
</Tooltip.Trigger>
|
|
37
|
+
${contentSnippet}
|
|
38
|
+
</Tooltip>`
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=Tooltip.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","placement","getEnum","top","undefined","bottom","left","right","placementProp","helpers","react","renderProp","trigger","getInstanceSwap","triggerSnippet","type","executeTemplate","example","content","findInstance","contentSnippet","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Tooltip.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,SAAS,GAAGF,QAAQ,CAACG,OAAO,CAAC,WAAW,EAAE;EAC9CC,GAAG,EAAEC,SAAS;EACd,WAAW,EAAE,WAAW;EACxB,SAAS,EAAE,SAAS;EACpBC,MAAM,EAAE,QAAQ;EAChB,cAAc,EAAE,cAAc;EAC9B,YAAY,EAAE,YAAY;EAC1BC,IAAI,EAAE,MAAM;EACZ,YAAY,EAAE,YAAY;EAC1B,UAAU,EAAE,UAAU;EACtBC,KAAK,EAAE,OAAO;EACd,aAAa,EAAE,aAAa;EAC5B,WAAW,EAAE;AACf,CAAC,CAAC;AACF,MAAMC,aAAa,GAAGV,KAAK,CAACW,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,WAAW,EAAEV,SAAS,CAAC;AAE5E,MAAMW,OAAO,GAAGb,QAAQ,CAACc,eAAe,CAAC,UAAU,CAAC;AACpD,MAAMC,cAAc,GAAGF,OAAO,EAAEG,IAAI,KAAK,UAAU,GAAGH,OAAO,CAACI,eAAe,CAAC,CAAC,CAACC,OAAO,GAAG,IAAI;AAE9F,MAAMC,OAAO,GAAGnB,QAAQ,CAACoB,YAAY,CAAC,iBAAiB,CAAC;AACxD,MAAMC,cAAc,GAAGF,OAAO,CAACH,IAAI,KAAK,UAAU,GAAGG,OAAO,CAACF,eAAe,CAAC,CAAC,CAACC,OAAO,GAAG,IAAI;AAE7F,eAAe;EACbI,EAAE,EAAE,SAAS;EACbC,OAAO,EAAE,CAAC,8CAA8C,CAAC;EACzDL,OAAO,EAAEnB,KAAK,CAACyB,IAAI;AACrB,UAAUf,aAAa;AACvB;AACA,MAAMM,cAAc;AACpB;AACA,IAAIM,cAAc;AAClB;AACA,CAAC","ignoreList":[]}
|