Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3ca0ba5
feat: add calendar
paulodetarsofm Jun 5, 2023
f8e27de
feat: use first day of the week according to the locale
paulodetarsofm Jun 13, 2023
304e0c9
feat: add "disabled" property
paulodetarsofm Jun 13, 2023
fdd0660
feat: handle "Previous" and "Next" month buttons
paulodetarsofm Jun 14, 2023
07fdf78
feat: add locale for all stories
paulodetarsofm Jun 14, 2023
b61eea7
feat: add "min" and "max" date
paulodetarsofm Jun 14, 2023
619be78
refactor: add new render methods
paulodetarsofm Jun 14, 2023
6336db2
feat: format day using Intl.NumberFormat
paulodetarsofm Jun 15, 2023
2ac6dd3
fix: lit-plugin "no-incompatible-property-type"
paulodetarsofm Jun 19, 2023
d218c5e
fix: packages version + property type error
paulodetarsofm Jun 20, 2023
db4d3fb
refactor: add to-do list to README
paulodetarsofm Jun 21, 2023
bbe6171
feat: add event handlers and slots for icons
paulodetarsofm Jun 23, 2023
c18991c
refactor(calendar): update dependencies
paulodetarsofm Jul 18, 2023
f9f05ca
refactor(calendar): changing Lit resource import source
paulodetarsofm Jul 19, 2023
a4e15e4
refactor: add comments and use correct formatters
paulodetarsofm Jul 19, 2023
1e8b319
refactor: convert property `_locale` to a getter
paulodetarsofm Jul 19, 2023
004029d
refactor: remove `_` from private properties and methods
paulodetarsofm Jul 19, 2023
3208d99
refactor: remove unnecessary method
paulodetarsofm Jul 19, 2023
19d288c
refactor: remove unnecessary template checking
paulodetarsofm Jul 19, 2023
fbd2d29
refactor: add new private properties
paulodetarsofm Jul 19, 2023
b18c3f1
refactor: code improvements, new comments
paulodetarsofm Jul 19, 2023
185f79f
refactor: remove reflect from properties they don't need
paulodetarsofm Jul 19, 2023
dec3be5
fix: add new package to tsconfig.json
paulodetarsofm Jul 24, 2023
d4f08ef
refactor: use same version of `@internationalized/number` used by oth…
paulodetarsofm Jul 31, 2023
c235d4f
refactor(calendar): improvements and new TODOs
paulodetarsofm Jul 31, 2023
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
2 changes: 2 additions & 0 deletions packages/calendar/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
stories
test
40 changes: 40 additions & 0 deletions packages/calendar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Description
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add more robust docs later...but know it'll be required at some point before a full release.


### Usage

[![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/calendar?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/calendar)
[![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/calendar?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/calendar)

```
yarn add @spectrum-web-components/calendar
```

Import the side effectful registration of `<sp-calendar>` via:

```
import '@spectrum-web-components/calendar/sp-calendar.js';
```

When looking to leverage the `Calendar` base class as a type and/or for extension purposes, do so via:

```
import { Calendar } from '@spectrum-web-components/calendar';
```

## Example

```html
<sp-calendar></sp-calendar>
```

## To-do list

- Implement a cache mechanism to store the value of `today` and use this value to initialise `currentDate`
- Include a condition to run the `setWeekdays()` method only when really needed
- Attribute 'role="heading"' removed, due to error 'The "heading" role requires the attribute "aria-level"'
- Translate the "Previous" text used in the "title" and "aria-label" of the button displayed in the header of the calendar
- Translate the "Next" text used in the "title" and "aria-label" of the button displayed in the header of the calendar
- The title must include "Today," and " selected" translated to the current language
- Implement keyboard navigation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just walked through the Focus Group and Roving Tab Index Reactive Controllers as a team today. This might be a good place to prove out the knowledge of those APIs @jnjosh.

- Add support for other types of calendars - [React Calendar: International Calendars](https://react-spectrum.adobe.com/react-spectrum/Calendar.html#international-calendars)
- Include `aria-label` in calendar for accessibility - [React Calendar: Labeling](https://react-spectrum.adobe.com/react-spectrum/Calendar.html#labeling)
4 changes: 4 additions & 0 deletions packages/calendar/exports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"./src/*": "./src/*.js",
"./sp-calendar.js": "./sp-calendar.js"
}
80 changes: 80 additions & 0 deletions packages/calendar/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "@spectrum-web-components/calendar",
"version": "0.0.1",
"publishConfig": {
"access": "public"
},
"description": "Web component implementation of a Spectrum Calendar",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/adobe/spectrum-web-components.git",
"directory": "packages/calendar"
},
"author": "",
"homepage": "https://adobe.github.io/spectrum-web-components/components/calendar",
"bugs": {
"url": "https://github.com/adobe/spectrum-web-components/issues"
},
"main": "./src/index.js",
"module": "./src/index.js",
"type": "module",
"exports": {
".": {
"development": "./src/index.dev.js",
"default": "./src/index.js"
},
"./package.json": "./package.json",
"./src/Calendar.js": {
"development": "./src/Calendar.dev.js",
"default": "./src/Calendar.js"
},
"./src/calendar.css.js": "./src/calendar.css.js",
"./src/index.js": {
"development": "./src/index.dev.js",
"default": "./src/index.js"
},
"./src/types.js": {
"development": "./src/types.dev.js",
"default": "./src/types.js"
},
"./sp-calendar.js": {
"development": "./sp-calendar.dev.js",
"default": "./sp-calendar.js"
}
},
"scripts": {
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
},
"files": [
"**/*.d.ts",
"**/*.js",
"**/*.js.map",
"custom-elements.json",
"!stories/",
"!test/"
],
"keywords": [
"spectrum css",
"web components",
"lit-element",
"lit-html"
],
"dependencies": {
"@internationalized/date": "^3.2.0",
"@internationalized/number": "^3.1.0",
"@spectrum-web-components/action-button": "^0.34.0",
"@spectrum-web-components/base": "^0.34.0",
"@spectrum-web-components/icons-workflow": "^0.34.0",
"@spectrum-web-components/reactive-controllers": "^0.34.0"
},
"devDependencies": {
"@spectrum-css/calendar": "^3.2.6"
},
"types": "./src/index.d.ts",
"customElements": "custom-elements.json",
"sideEffects": [
"./sp-*.js",
"./**/*.dev.js"
]
}
20 changes: 20 additions & 0 deletions packages/calendar/sp-calendar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Copyright 2023 Adobe. All rights reserved.
This file is licensed to you 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 REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import { Calendar } from './src/Calendar.js';

customElements.define('sp-calendar', Calendar);

declare global {
interface HTMLElementTagNameMap {
'sp-calendar': Calendar;
}
}
Loading