Skip to content

Commit

Permalink
convert to gts
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed Mar 11, 2024
1 parent 60bd9a3 commit ce20204
Show file tree
Hide file tree
Showing 118 changed files with 3,594 additions and 3,395 deletions.
11 changes: 4 additions & 7 deletions carbon-components-ember/src/components/accordion/index.gts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface AccordionSignature {
Args: {
disabled?: boolean;
open?: boolean;
align?: 'start'|'end';
align?: 'start' | 'end';
};
Element: null;
Blocks: {
Expand All @@ -33,9 +33,8 @@ interface ItemSignature {
}

class Item extends Component<ItemSignature> {

get itemId() {
return guidFor(this)
return guidFor(this);
}

get isActive() {
Expand All @@ -45,7 +44,6 @@ class Item extends Component<ItemSignature> {
return this.args.isOpen ?? this.args.accordion.isActive(this);
}


<template>
<li
class='cds--accordion__item
Expand Down Expand Up @@ -84,7 +82,6 @@ class Item extends Component<ItemSignature> {
</template>
}


export default class Accordion extends Component<AccordionSignature> {
@tracked currentItem?: Item;

Expand All @@ -96,9 +93,9 @@ export default class Accordion extends Component<AccordionSignature> {
setActiveItem(item: Item) {
if (this.currentItem === item) {
this.currentItem = undefined;
return
return;
}
this.currentItem = item
this.currentItem = item;
}

<template>
Expand Down
32 changes: 15 additions & 17 deletions carbon-components-ember/src/components/breadcrumbs/index.gts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import { on } from '@ember/modifier';
/** @documenter yuidoc */

type Args = {
/**
@argument crumbs
@type String[]
/**
@argument crumbs
@type String[]
*/
crumbs: string[];

current?: string;

onSelect?(crumb: string): void;
}

};

export interface BreadcrumbSignature {
// We have a `<table>` as our root element
Expand All @@ -33,21 +32,20 @@ export interface BreadcrumbSignature {
};
}

/**
The Carbon Breadcrumb
```handlebars
{{import Breadcrumbs from 'carbon-components-ember/components/breadcrumbs'}}
<Button @onClick={{fn this.onclick}} @danger={{false}} > Button Text </Button>
```
@class CarbonBreadcrumb
@public
/**
The Carbon Breadcrumb
```handlebars
{{import Breadcrumbs from 'carbon-components-ember/components/breadcrumbs'}}
<Button @onClick={{fn this.onclick}} @danger={{false}} > Button Text </Button>
```
@class CarbonBreadcrumb
@public
**/
class CarbonBreadcrumb extends Component<BreadcrumbSignature> {

args: Args = defaultArgs(this, {
crumbs: []
crumbs: [],
});

@action
Expand Down
120 changes: 67 additions & 53 deletions carbon-components-ember/src/components/button/index.gts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Component from '@glimmer/component';
import { bxClassNames, classPrefix, defaultArgs } from 'carbon-components-ember/decorators';
import {
bxClassNames,
classPrefix,
defaultArgs,
} from 'carbon-components-ember/decorators';
import DialogManagerService from 'carbon-components-ember/services/dialog-manager';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
Expand All @@ -13,63 +17,63 @@ import Loading from 'carbon-components-ember/components/loading';
/** @documenter yuidoc */

type Args = {
/**
* Will display a spinning Wheel inside the button
@argument loading
@type boolean
/**
* Will display a spinning Wheel inside the button
@argument loading
@type boolean
*/
loading?: boolean;
/**
@argument disabled
@type boolean
/**
@argument disabled
@type boolean
*/
disabled?: boolean;
/**
@argument bubbles
@type boolean
/**
@argument bubbles
@type boolean
*/
bubbles?: boolean;
/**
@argument onClick
@type function
/**
@argument onClick
@type function
*/
onClick?: Function|null;
onClick?: Function | null;

/**
* Indicates the type of the button
@argument type
@type string
/**
* Indicates the type of the button
@argument type
@type string
*/
type?: 'primary'|'secondary'|'danger';
type?: 'primary' | 'secondary' | 'danger';

/**
* If the action is dangerous, this text message will be shown in the dialog
@argument confirmText
@type String
/**
* If the action is dangerous, this text message will be shown in the dialog
@argument confirmText
@type String
*/
confirmText?: string;
/**
* Use this component as dialog
@argument confirmDialog
@type ConfirmDialogComponent
/**
* Use this component as dialog
@argument confirmDialog
@type ConfirmDialogComponent
*/
confirmDialog?: typeof ConfirmDialogComponent;
/**
* If the button is tertiary
@argument tertiary
@type boolean
/**
* If the button is tertiary
@argument tertiary
@type boolean
*/
tertiary?: boolean;
/**
* the button size
@argument small
@type 'sm' | 'md' | 'lg' | 'xl'
/**
* the button size
@argument small
@type 'sm' | 'md' | 'lg' | 'xl'
*/
size?: 'sm' | 'md' | 'lg' | 'xl';
/**
* If the button is a ghost button
@argument ghost
@type boolean
/**
* If the button is a ghost button
@argument ghost
@type boolean
*/
ghost?: boolean;

Expand All @@ -91,16 +95,16 @@ export interface ButtonSignature {
};
}

/**
The Carbon Button
```handlebars
{{import Button from 'carbon-components-ember/components/button'}}
<Button @onClick={{fn this.onclick}} @danger={{false}} > Button Text </Button>
```
@class CarbonButton
@public
/**
The Carbon Button
```handlebars
{{import Button from 'carbon-components-ember/components/button'}}
<Button @onClick={{fn this.onclick}} @danger={{false}} > Button Text </Button>
```
@class CarbonButton
@public
**/
@classPrefix('cds--btn--')
class CarbonButton extends Component<ButtonSignature> {
Expand All @@ -120,7 +124,7 @@ class CarbonButton extends Component<ButtonSignature> {
confirmDialog: undefined,
tertiary: false,
size: 'md',
ghost: false
ghost: false,
};

<template>
Expand Down Expand Up @@ -177,7 +181,17 @@ class CarbonButton extends Component<ButtonSignature> {
return `cds--layout--size-${this.args.size}`;
}

@bxClassNames('primary', 'secondary', 'danger', 'tertiary', 'ghost', 'size', 'disabled', 'iconOnly:icon-only') bxClassNames;
@bxClassNames(
'primary',
'secondary',
'danger',
'tertiary',
'ghost',
'size',
'disabled',
'iconOnly:icon-only',
)
bxClassNames;

@action
runButtonClick() {
Expand All @@ -191,7 +205,7 @@ class CarbonButton extends Component<ButtonSignature> {
this.disabled = false;
this.loading = false;
this.showDialog = false;
} ;
};
ret.then(end, end);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { default as onUpdate } from '../../-helpers/on-update';
import { default as toBool } from '../../-helpers/to-bool';
import { default as newObj } from 'carbon-components-ember/helpers/new-obj';
import Component from '@glimmer/component';
import CarbonChart from '../../../charts/-components/chart';
import { ScaleTypes } from '@carbon/charts';
Expand Down Expand Up @@ -36,14 +39,29 @@ type Args = {
};

/** @documenter yuidoc */
/**
The ChartAxis
```handlebars
```
@class ChartAxis
@public
/**
The ChartAxis
```handlebars
```
@class ChartAxis
@public
**/
class ChartAxis extends Component<Args> {}
class ChartAxis extends Component<Args> {
<template>
{{#if @chart.setAxis}}
{{onUpdate
(fn
@chart.setAxis
@axis
(newObj title=@title stacked=(toBool @stacked) scaleType=@scaleType)
)
@axis
@title
@stacked
}}
{{/if}}
</template>
}

export default ChartAxis;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import Component from '@glimmer/component';
import { default as TabularData } from '../tabular-data';
import { default as Axis } from '../axis';
import { default as ColorPairing } from '../color/pairing';
import { default as ColorScale } from '../color/scale';
import { default as set } from 'carbon-components-ember/helpers/set';
import { default as didInsert } from '@ember/render-modifiers/modifiers/did-insert';
import { default as didUpdate } from '@ember/render-modifiers/modifiers/did-update';
import { default as willDestroy } from '@ember/render-modifiers/modifiers/will-destroy';import Component from '@glimmer/component';
import { action } from '@ember/object';
import { throttle } from '@ember/runloop';
import { defaultArgs } from 'carbon-components-ember/decorators';
Expand Down Expand Up @@ -188,6 +195,34 @@ class CarbonChart extends Component<CarbonChartSignature> {

this.updateChart();
}

<template>









<div
...attributes
{{didInsert this.loadChart}}
{{didUpdate this.updateChart @legendClickable @resizable}}
{{willDestroy this.destroyChart}}
>
</div>

{{yield
(hash
TabularData=(component TabularData chart=this)
Axis=(component Axis chart=this)
ColorPairing=(component ColorPairing chart=this)
ColorScale=(component ColorScale chart=this)
)
}}
</template>
}

export default CarbonChart;
Loading

0 comments on commit ce20204

Please sign in to comment.