-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Keyboard): add KeyboardSearch component variant
- Loading branch information
Showing
4 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/@lightningjs/ui-components/src/components/Keyboard/KeyboardSearch.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import Keyboard from './Keyboard'; | ||
|
||
export default class KeyboardSearch extends Keyboard {} |
62 changes: 62 additions & 0 deletions
62
packages/@lightningjs/ui-components/src/components/Keyboard/KeyboardSearch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import Keyboard from './Keyboard'; | ||
import * as styles from './Keyboard.styles.js'; | ||
|
||
export default class KeyboardSearch extends Keyboard { | ||
static get __componentName() { | ||
return 'KeyboardSearch'; | ||
} | ||
|
||
static get __themeStyle() { | ||
return styles; | ||
} | ||
|
||
_construct() { | ||
super._construct(); | ||
this.formats = this.searchFormat; | ||
} | ||
|
||
get searchFormat() { | ||
return { | ||
uppercase: [ | ||
['A', 'B', 'C', 'D', 'E', 'F'], | ||
['G', 'H', 'I', 'J', 'K', 'L'], | ||
['M', 'N', 'O', 'P', 'Q', 'R'], | ||
['S', 'T', 'U', 'V', 'W', 'X'], | ||
['Y', 'Z', '1', '2', '3', '4'], | ||
['5', '6', '7', '8', '9', '0'], | ||
[ | ||
{ | ||
title: 'Space', | ||
size: 'lg', | ||
keyId: 'space', | ||
announce: 'space, button' | ||
}, | ||
{ | ||
title: 'Delete', | ||
size: 'md', | ||
keyId: 'delete', | ||
announce: 'delete, button' | ||
} | ||
] | ||
] | ||
}; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
packages/@lightningjs/ui-components/src/components/Keyboard/KeyboardSearch.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import lng from '@lightningjs/core'; | ||
import mdx from './Keyboard.mdx'; | ||
import { CATEGORIES } from '../../docs/constants'; | ||
import { context } from '../../globals'; | ||
import utils from '../../utils'; | ||
import { default as KeyboardSearchComponent } from './KeyboardSearch'; | ||
import { Keyboard } from './Keyboard.stories'; | ||
|
||
export default { | ||
title: `${CATEGORIES[8]}/KeyboardSearch`, | ||
parameters: { | ||
docs: { | ||
page: mdx | ||
} | ||
} | ||
}; | ||
|
||
export const KeyboardSearch = () => | ||
class KeyboardSearch extends lng.Component { | ||
static _template() { | ||
return { | ||
Keyboard: { | ||
type: KeyboardSearchComponent, | ||
defaultFormat: 'uppercase' | ||
}, | ||
w: utils.getWidthByUpCount(context.theme, 1) | ||
}; | ||
} | ||
}; | ||
|
||
KeyboardSearch.storyName = 'KeyboardSearch'; | ||
KeyboardSearch.args = { | ||
centerKeyboard: false, | ||
mode: 'focused' | ||
}; | ||
KeyboardSearch.argTypes = Keyboard.sharedArgTypes; | ||
KeyboardSearch.parameters = {}; |