Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dial pad): new composed component (VIV-1512) #1629

Merged
merged 71 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
2fd54c9
add dial-pad component
rinaok Mar 3, 2024
ed3460d
lint
rinaok Mar 3, 2024
eab4f71
add attributes
rinaok Mar 4, 2024
65adc46
Merge branch 'main' of github.com:Vonage/vivid-3 into VIV-1512-dialpad
rinaok Mar 4, 2024
c00d517
disabled
rinaok Mar 5, 2024
3a15c36
Merge branch 'main' of github.com:Vonage/vivid-3 into VIV-1512-dialpad
rinaok Mar 5, 2024
e1a1846
buttons clicked
rinaok Mar 5, 2024
bb37be5
no-call
rinaok Mar 5, 2024
0d5af1a
pattern
rinaok Mar 5, 2024
ecfdbea
clear button
rinaok Mar 5, 2024
7aae614
value
rinaok Mar 5, 2024
005cd91
events
rinaok Mar 5, 2024
c70c8b8
locales
rinaok Mar 6, 2024
802bc21
add snapshots
rinaok Mar 6, 2024
c0a98ec
remove focus definition
rinaok Mar 7, 2024
283a1ae
add unit tests
rinaok Mar 8, 2024
2e6b038
.
rinaok Mar 8, 2024
03423a1
Merge branch 'main' into VIV-1512-dialpad
rinaok Mar 7, 2024
604f810
lint
rinaok Mar 10, 2024
7e7dd26
fix tests
rinaok Mar 10, 2024
0c31bb5
add tests
rinaok Mar 10, 2024
372f9c4
fix
rinaok Mar 10, 2024
a5f5cd9
.
rinaok Mar 10, 2024
e92197f
delete button
rinaok Mar 10, 2024
64220f1
new value
rinaok Mar 10, 2024
def0e3b
update snapshots
rinaok Mar 10, 2024
1ea94fa
code coverage
rinaok Mar 10, 2024
01108cd
alpha
rinaok Mar 10, 2024
283a621
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 13, 2024
89603fa
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 13, 2024
2abe117
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 13, 2024
86d71a5
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 13, 2024
a589501
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 13, 2024
7435439
Merge branch 'main' into VIV-1512-dialpad
rinaok Mar 13, 2024
a7db895
add sass variables
rinaok Mar 13, 2024
a93fb5f
lint
rinaok Mar 13, 2024
a893bba
lint
rinaok Mar 13, 2024
e6d619f
lint
rinaok Mar 13, 2024
599e8a2
Update libs/components/src/lib/dial-pad/dial-pad.ts
rinaok Mar 20, 2024
93fe892
Update libs/components/src/lib/dial-pad/README.md
rinaok Mar 20, 2024
b287f6d
Merge branch 'main' into VIV-1512-dialpad
rinaok Mar 20, 2024
092506a
Update libs/components/src/lib/dial-pad/dial-pad.ts
rinaok Mar 20, 2024
6ed2081
fixes
rinaok Mar 20, 2024
41b385b
lint
rinaok Mar 20, 2024
454cd92
document clicked button
rinaok Mar 20, 2024
1021696
Merge branch 'main' into VIV-1512-dialpad
rinaok Mar 20, 2024
e0a798d
internal-part
rinaok Mar 20, 2024
a64fac2
ui changes
rinaok Mar 20, 2024
4612b78
remove ghost
rinaok Mar 20, 2024
074b115
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
748b672
Update libs/components/src/lib/dial-pad/dial-pad.template.ts
rinaok Mar 21, 2024
64c227c
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
f833c66
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
cd41950
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
4a3f211
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
82779b8
Update libs/components/src/lib/dial-pad/dial-pad.scss
rinaok Mar 21, 2024
e732007
css
rinaok Mar 21, 2024
9875652
Merge branch 'VIV-1512-dialpad' of https://github.com/Vonage/vivid-3 …
rinaok Mar 21, 2024
8710754
css changes
rinaok Mar 21, 2024
367f525
update style
rinaok Mar 21, 2024
3877f75
lint
rinaok Mar 21, 2024
94d1dd8
Merge branch 'main' into VIV-1512-dialpad
rinaok Mar 21, 2024
8361cc3
active btn while typing in text field
rinaok Mar 24, 2024
93f2055
remove attributes
rinaok Mar 24, 2024
973e936
test coverage
rinaok Mar 24, 2024
c9b288e
lint
rinaok Mar 24, 2024
63f326d
code coverage
rinaok Mar 24, 2024
31ffe46
add vue component
rinaok Mar 24, 2024
28ba489
fix vue
rinaok Mar 24, 2024
7330961
vueModel
rinaok Mar 24, 2024
2db8f7f
fix click on icon
rinaok Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/docs/_data/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@
"title": "Audio Player",
"markdown": "./libs/components/src/lib/audio-player/README.md"
},
{
rinaok marked this conversation as resolved.
Show resolved Hide resolved
"title": "Dial Pad",
"status": "alpha",
"markdown": "./libs/components/src/lib/dial-pad/README.md"
},
{
"title": "Video Player",
"status": "alpha",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<VDialPad />
</template>

<script setup lang="ts">
import { VDialPad } from '@vonage/vivid-vue';
</script>
22 changes: 22 additions & 0 deletions apps/vue-docs/docs/examples/dial-pad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Dial Pad Examples

## Basic

<code-tab>
<template #example>
<BasicExample/>
</template>
<template #code>

```vue
<!--@include: ./components/dial-pad/BasicExample.vue-->
```

</template>
</code-tab>

<script setup lang="ts">
import codeTab from '../custom/CodeTab.vue';
import { defineClientComponent } from "vitepress";
const BasicExample = defineClientComponent(() => import("./components/dial-pad/BasicExample.vue"));
</script>
1 change: 1 addition & 0 deletions libs/components/src/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from './combobox/definition';
export * from './data-grid/definition';
export * from './date-picker/definition';
export * from './date-range-picker/definition';
export * from './dial-pad/definition';
export * from './dialog/definition';
export * from './divider/definition';
export * from './empty-state/definition';
Expand Down
112 changes: 112 additions & 0 deletions libs/components/src/lib/dial-pad/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Dial Pad

This is a composed component that allows users to enter / dial telephone numbers.

```js
<script type="module">import '@vonage/vivid/dial-pad';</script>
```

```html preview
<vwc-dial-pad></vwc-dial-pad>
```

## Members

### Value

To set the value of the input, use the `value` attribute to set the text displayed in the input.

- Type: `string`
- Default: `undefined`

```html preview
<vwc-dial-pad value="1234567890"></vwc-dial-pad>
```

### Helper Text

To give extra context to the number that is being displayed, use the `helper-text` attribute to set the text displayed under the input.

- Type: `string`
- Default: `undefined`

```html preview
<vwc-dial-pad helper-text="58 Meeting Room - Extension"></vwc-dial-pad>
```

### Placeholder

To give a hint to the user of what to enter in the input, use the `placeholder` attribute to set the text displayed in the input.

- Type: `string`
- Default: `undefined`

```html preview
<vwc-dial-pad placeholder="Enter a phone number"></vwc-dial-pad>
```

### Disabled

Use the `disabled` attribute to disable the keypad, input and Call/End call buttons.

- Type: `boolean`
- Default: `false`

```html preview
<vwc-dial-pad disabled></vwc-dial-pad>
```

### Call Active

Use the `call-active` attribute (or `callActive` property) to enable the `end call button` and disable the `dial button`.

- Type: `boolean`
- Default: `false`

```html preview
<vwc-dial-pad call-active></vwc-dial-pad>
```

### No Call

Use the `no-call` attribute (or `noCall` property) to disable call/end call functionality and hide the call/end call button.

- Type: `boolean`
- Default: `false`

```html preview
<vwc-dial-pad no-call></vwc-dial-pad>
```

### Pattern

Use the `pattern` attribute to set the regex string of allowed characters in the input.
Read more about [vwc-text-field validation](/components/text-field/#validation).
You can change the error text with the `error-text` attribute.

- Type: `string`
- Default: `^[0-9#*]*$` (key pad buttons)

```html preview
<vwc-dial-pad
placeholder="Only digits"
pattern="^[0-9]*$"
error-text="The input is invalid"
></vwc-dial-pad>
```

## Events

<div class="table-wrapper">

| Name | Description |
| -------------- | ------------------------------------------------------------------------------------------------------- |
| `dial` | Emitted (with the value of the input) when the dial pad is submitted and there is a value in the input. |
| `end-call` | Emitted when the end call button is clicked. |
| `keypad-click` | Emitted when a keypad button is clicked. The `detail` object holds the clicked button. |
| `input` | Emitted from the input element. |
| `change` | Emitted from the input element. |
| `blur` | Emitted from the input element. |
| `focus` | Emitted from the input element. |

</div>
30 changes: 30 additions & 0 deletions libs/components/src/lib/dial-pad/definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { FoundationElementDefinition } from '@microsoft/fast-foundation';
import { registerFactory } from '../../shared/design-system';
import { buttonRegistries } from '../button/definition';
import { textFieldRegistries } from '../text-field/definition';
import styles from './dial-pad.scss?inline';

import { DialPad } from './dial-pad';
import { DialPadTemplate as template } from './dial-pad.template';

export const dialPadDefinition = DialPad.compose<FoundationElementDefinition>({
baseName: 'dial-pad',
template: template as any,
styles,
});

/**
* @internal
*/
export const dialPadRegistries = [
dialPadDefinition(),
...buttonRegistries,
...textFieldRegistries,
];

/**
* Registers the dial-pad element with the design system.
*
* @param prefix - the prefix to use for the component name
*/
export const registerDialPad = registerFactory(dialPadRegistries);
68 changes: 68 additions & 0 deletions libs/components/src/lib/dial-pad/dial-pad.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@use '../../../../../dist/libs/tokens/scss/tokens.constants' as constants;
@use '../../../../shared/src/lib/sass/mixins/border-radius' as
border-radius-variables;
@use '../../../../shared/src/lib/sass/mixins/connotation/config' with (
$connotations: accent,
$shades: contrast soft pale fierce firm-all faint dim,
$default: accent
);
@use '../../../../shared/src/lib/sass/mixins/connotation' as connotation;
@use '../../../../shared/src/lib/sass/mixins/appearance/config' as
appearance-config with (
$appearances: duotone,
$states: idle hover disabled,
$default: duotone
);
@use '../../../../shared/src/lib/sass/mixins/appearance' as appearance;

$gap: 16px;

:host {
display: inline-block;
margin: 16px;
inline-size: 230px;
}

.base {
rinaok marked this conversation as resolved.
Show resolved Hide resolved
display: grid;
box-sizing: border-box;
grid-template-rows: 80px 1fr auto;
}

.digits {
display: grid;
gap: $gap;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(4, 1fr);
inline-size: 100%;
}

.phone-field {
align-self: flex-start;
grid-column: 1 / -1;
}

.digit-btn {
@include appearance.appearance;
@include connotation.connotation(dial-pad);

--vvd-button-accent-primary: var(#{appearance.get-appearance-token(text)});

display: flex;
rinaok marked this conversation as resolved.
Show resolved Hide resolved
overflow: hidden;
flex-direction: column;
border-radius: #{border-radius-variables.$border-radius-expanded};
box-shadow: 0 0 0 1px var(#{appearance.get-appearance-token(outline)});
inline-size: 100%;

&-num {
.digit-btn:not(.disabled) & {
color: var(#{constants.$vvd-color-canvas-text});
}
}
}

.call-btn {
margin-top: 32px;
grid-column: 1/-1;
}
Loading
Loading