-
Notifications
You must be signed in to change notification settings - Fork 42
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: Add timepicker component #299
Open
maxxyouu
wants to merge
65
commits into
IBM:main
Choose a base branch
from
maxxyouu:timepicker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 45 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
7c87efd
custom components
maxxyouu 61655a6
Restore export modal tab order between opens
zvonimirfras 180fa74
Centralize linting rules in root (#291)
Akshat55 11e53cd
Support {{children}} in custom components
zvonimirfras 9c2984b
Fix export template not working when items empty
zvonimirfras debbadf
fix: add workflow to release package (#292)
Akshat55 e080e1d
fix: remove nx set sha action (#293)
Akshat55 ea419ca
fix: add release config (#294)
Akshat55 6eeac0a
fix: add permission for id-token (#295)
Akshat55 8728221
fix: add repository url to packages (#296)
Akshat55 4a72a08
Add instructions to set up a new project w/ player
zvonimirfras d7523d3
Fix export error when custom collections undefined
zvonimirfras 6fc2a14
Fix export error when custom collections undefined
zvonimirfras 5200b0c
draft
maxxyouu 300f3bd
draft
maxxyouu 5ff39dd
svg timepicker
maxxyouu 69a994f
timpicker
maxxyouu 9d30222
conflict
maxxyouu 83e7732
progress
maxxyouu 1860d51
double quote to singlel quote
maxxyouu 68087b2
double quote to singlel quote
maxxyouu f915cd8
slots
maxxyouu f32c890
build error
maxxyouu 314db02
delete custom compo
maxxyouu d738613
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu ad8bd29
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu c8a653e
fix
maxxyouu 4b67bee
Merge branch 'timepicker' of https://github.com/maxxyouu/carbon-ui-bu…
maxxyouu 99e7581
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 22df52c
fix
maxxyouu 94aaf53
Merge branch 'timepicker' of https://github.com/maxxyouu/carbon-ui-bu…
maxxyouu 056f1ad
label
maxxyouu ba39e73
s[ace
maxxyouu dd82d28
Merge branch 'main' into timepicker
Akshat55 04b0170
export fix
b7c03c5
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 0e744d1
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 7196d40
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 593bf51
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 0d8150d
pr revision
52be878
make am/pm and timezone optional
bb9d0df
make am/pm and timezone optional
3010c06
done
446c530
fix export
26dc9c2
fix action
c2d1736
Merge branch 'main' of https://github.com/IBM/carbon-ui-builder into …
86864e5
lint
666b1bb
chore: lint fix
Akshat55 54bcf0a
chore: lint exports
Akshat55 56c4a16
fix: remove redundant attribute from interface
Akshat55 286b536
fix: correct export conditions
Akshat55 3000eb1
fix: add missing events in export
Akshat55 da19cbd
fixed angular export
528347f
angular export
8793f16
resolve conflict
9bf08e3
angular export fix
cb7d011
fix react export import section
d906675
Merge branch 'main' into timepicker
Akshat55 b0608e3
Update player/react/src/lib/components/ui-time-picker.tsx
maxxyouu 3378c01
Update player/react/src/lib/components/ui-time-picker.tsx
maxxyouu 6bf50b8
Update sdk/react/src/lib/fragment-components/a-time-picker.tsx
maxxyouu 50e59e1
revision
fe4c0fe
revision
d605326
revision
0d89669
style
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,107 @@ | ||
import { TimePickerSelect } from '@carbon/react'; | ||
import { SelectItem } from '@carbon/react'; | ||
import { TimePicker } from '@carbon/react'; | ||
import React from 'react'; | ||
import { commonSlots, slotsDisabled } from '../common-slots'; | ||
import { SendSignal } from '../types'; | ||
|
||
export interface TimePickerState { | ||
id: string | number; | ||
codeContext?: { | ||
name: string; | ||
}; | ||
type: string; | ||
placeholder: string; | ||
disabled?: boolean; | ||
invalid?: boolean; | ||
invalidText?: string; | ||
light?: boolean; | ||
size?: string; | ||
value?: string; | ||
label?: string; | ||
items: []; | ||
} | ||
|
||
export const type = 'time-picker'; | ||
|
||
export const signals = ['valueChange', 'click']; | ||
|
||
export const slots = { | ||
...commonSlots, | ||
...slotsDisabled, | ||
invalid: 'boolean', | ||
isInvalid: (state: TimePickerState) => ({ | ||
...state, | ||
invalid: true | ||
}), | ||
isValid: (state: TimePickerState) => ({ | ||
...state, | ||
invalid: false | ||
}), | ||
toggleIsInvalid: (state: TimePickerState) => ({ | ||
...state, | ||
invalid: !state.invalid | ||
}), | ||
light: 'boolean', | ||
isLight: (state: TimePickerState) => ({ | ||
...state, | ||
light: true | ||
}), | ||
isDark: (state: TimePickerState) => ({ | ||
...state, | ||
light: false | ||
}), | ||
toggleIsLight: (state: TimePickerState) => ({ | ||
...state, | ||
light: !state.light | ||
}), | ||
placeholder: 'string', | ||
type: 'string', | ||
invalidText: 'string', | ||
label: 'string', | ||
size: 'string', | ||
value: 'string', | ||
}; | ||
|
||
|
||
export const UITimePicker = ({ state, sendSignal }: { | ||
state: TimePickerState; | ||
setState: (state: any) => void; | ||
setGlobalState: (state: any) => void; | ||
sendSignal: SendSignal; | ||
}) => { | ||
if (state.type !== 'time-picker') { | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <></>; | ||
} | ||
|
||
return <TimePicker | ||
id={state.codeContext?.name} | ||
light={state.light} | ||
disabled={state.disabled} | ||
invalid={state.invalid} | ||
invalidText={state.invalidText} | ||
placeholder={state.placeholder} | ||
size={state.size} | ||
labelText={state.label} | ||
onClick={() => { | ||
sendSignal(state.id, 'click'); | ||
}} | ||
onChange={(event: any) => { | ||
sendSignal(state.id, 'valueChange', [event.value], { ...state, value: event.value }); | ||
}}> | ||
<TimePickerSelect id={state.codeContext?.name + '-select-1'}> | ||
<SelectItem value='AM' text='AM' /> | ||
<SelectItem value='PM' text='PM' /> | ||
</TimePickerSelect> | ||
<TimePickerSelect id={state.codeContext?.name + '-select-2'}> | ||
{ | ||
state.items.map((step: any, index: number) => <SelectItem | ||
value={step.value} | ||
text={step.text} | ||
key={index} | ||
/>) | ||
} | ||
</TimePickerSelect> | ||
</TimePicker>; | ||
}; |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should be setters and follow function naming e.g.
setInvalid
Plus,
setInvalid
seems like it would do the same thing asinvalid
property, so it's not necessary?note: date picker seems to be doing the naming right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the naming of the setter is fine, i don't think other component (i,e. combobox) use this naming.
setInvalid
is fine but no need for unnecessary changes.In terms of the need of
setInvalid
, please check combobox as well because the setter is similar.